File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DK_WinterWheat_CC Class Reference

#include <DK_WinterWheat_CC.h>

Inheritance diagram for DK_WinterWheat_CC:
Crop

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 DK_WinterWheat_CC (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
void SetUpFarmCategoryInformation ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
int GetFirstDate (void)
 
void ChooseNextCrop (int a_no_dates)
 Chooses the next crop to grow in a field. More...
 
int GetCropClassification ()
 
void SetCropClassification (int a_classification)
 
void GetCropType (TTypesOfCrops a_toc)
 
TTypesOfCrops GetCropType ()
 
FarmManagementCategory LookUpManagementCategory (int a_todo)
 
bool GetForceSpringOK ()
 

Additional Inherited Members

- Public Attributes inherited from Crop
TTypesOfVegetation m_tov
 
- Protected Member Functions inherited from Crop
void SimpleEvent (long a_date, int a_todo, bool a_lock)
 Adds an event to this crop management. More...
 
void SimpleEvent_ (long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
 Adds an event to this crop management without relying on member variables. More...
 
bool StartUpCrop (int a_spring, std::vector< std::vector< int >> a_flexdates, int a_todo)
 
Holds the translation between the farm operation enum for each cropand the farm management category associated with it More...
 
bool AphidDamage (LE *a_field)
 Compares aphid numbers per m2 with a threshold to return true if threshold is exceeded. More...
 
- Protected Attributes inherited from Crop
Farmm_farm
 
LEm_field
 
FarmEventm_ev
 
int m_first_date
 
int m_count
 
int m_last_date
 
int m_ddegstoharvest
 
int m_base_elements_no
 
Landscapem_OurLandscape
 
bool m_forcespringpossible = false
 Used to signal that the crop can be forced to start in spring. More...
 
TTypesOfCrops m_toc
 The Crop type in terms of the TTypesOfCrops list (smaller list than tov, no country designation) More...
 
int m_CropClassification
 Contains information on whether this is a winter crop, spring crop, or catch crop that straddles the year boundary (0,1,2) More...
 
vector< FarmManagementCategorym_ManagementCategories
 Holds the translation between the farm operation enum for each crop and the farm management category associated with it. More...
 
- Static Protected Attributes inherited from Crop
static int m_date_modifier = 0
 Holds a value that shifts test pesticide use by this many days in crops modified to use it. More...
 

Constructor & Destructor Documentation

◆ DK_WinterWheat_CC()

DK_WinterWheat_CC::DK_WinterWheat_CC ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
83  : Crop(a_tov, a_toc, a_L)
84  {
85  m_first_date = g_date->DayInYear(17, 9);
87  }

References Calendar::DayInYear(), g_date, Crop::m_first_date, and SetUpFarmCategoryInformation().

Member Function Documentation

◆ Do()

bool DK_WinterWheat_CC::Do ( Farm a_farm,
LE a_field,
FarmEvent a_ev 
)
virtual

Reimplemented from Crop.

42 {
43  m_farm = a_farm;
44  m_field = a_field;
45  m_ev = a_ev;
46  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true, m_farm, m_field).
47  bool flag = false;
48  int d1 = 0;
49  int noDates = 1;
51  int l_nextcropstartdate;
52 
53  switch (m_ev->m_todo)
54  {
55  case dk_wwcc_start:
56  {
57  a_field->ClearManagementActionSum();
58 
59  DK_WWCC_MN_S = false;
60  DK_WWCC_MN_P = false;
61 
62  m_last_date = g_date->DayInYear(31, 8); // Should match the last flexdate below
63  //Create a 2d array of 1 plus the number of operations you use. Change only 4+1 to what you need in the line below
64  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
65  // Set up the date management stuff
66  // Start and stop dates for all events after harvest
67  flexdates[0][1] = g_date->DayInYear(31, 8); // last possible day of harvest
68  // Now these are done in pairs, start & end for each operation. If its not used then -1
69  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
70  flexdates[1][1] = g_date->DayInYear(31, 8); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) // harvest
71 
72  // Below if this is a spring crop use 365, otherwise first parameter is always 0, second parameter is fixed, and the third is the start up operation in the first year
73  if (StartUpCrop(0, flexdates, int(dk_wwcc_wait))) break;
74 
75  // End single block date checking code. Please see next line comment as well.
76  // Reinit d1 to first possible starting date.
77  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
78  // OK, let's go.
80  }
81  break;
82 
84  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
85  if (!m_farm->AutumnHarrow(m_field, 0.0,
86  g_date->DayInYear(16, 9) - g_date->DayInYear())) { // changed from 31/8 to fit rotation with CloverGrassGrazed2 (as preceding crop)
88  break;
89  }
90  DK_WWCC_TILL_1 = true; // we need to remember farmers doing stubble harrow
92  break;
93  }
94  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.40)) {
96  break;
97  }// 15% no cultivation
98  else SimpleEvent(g_date->Date() + 1, dk_wwcc_autumn_harrow_nt, false);
99  break; // no till 15%
100 
101 
102  case dk_wwcc_autumn_plough: // 85% doing this
103  if (!m_farm->AutumnPlough(m_field, 0.0,
104  g_date->DayInYear(17, 9) - g_date->DayInYear())) {// changed from 15/9 to fit rotation
106  break;
107  }
109  break;
110 
111  case dk_wwcc_autumn_roll:
112  if (!m_farm->AutumnRoll(m_field, 0.0,
113  g_date->DayInYear(17, 9) - g_date->DayInYear())) {// changed from 15/9 to fit rotation
115  break;
116  }
118  break;
119 
121  if (m_ev->m_lock || m_farm->DoIt_prob(0.80)) { // 80% of the 15% not doing the first harrow or plough
122  if (!m_farm->AutumnHarrow(m_field, 0.0,
123  g_date->DayInYear(17, 9) - g_date->DayInYear())) {
125  break;
126  }
127  }
129  break;
130 
132  if (m_field->GetSoilType() != 2 && m_field->GetSoilType() != 6) // on clay soils (NL KLEI & VEEN)
133  {
134  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) {
135  if (!m_farm->Molluscicide(m_field, 0.0,
136  g_date->DayInYear(18, 9) - g_date->DayInYear())) { // changed from 16/9 to fit rotation
138  break;
139  }
140  }
141  }
143  break;
144 
145  case dk_wwcc_autumn_sow:
146  if (!m_farm->AutumnSow(m_field, 0.0,
147  g_date->DayInYear(25, 9) - g_date->DayInYear())) {
148  SimpleEvent(g_date->Date() + 1, dk_wwcc_autumn_sow, true);
149  break;
150  }
151  if (a_farm->IsStockFarmer()) //Stock Farmer
152  {
154  break;
155  }
156  else SimpleEvent(g_date->Date(), dk_wwcc_ferti_p1, false);
157  break;
158 
159  case dk_wwcc_ferti_s1: // preventing Mn depletion
160  if (m_ev->m_lock || m_farm->DoIt_prob(0.03)) {
162  g_date->DayInYear(25, 9) - g_date->DayInYear())) {
163  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s1, true);
164  break;
165  }
166  }
167  SimpleEvent(g_date->Date() + 7, dk_wwcc_ferti_s2, false);
168  break;
169 
170  case dk_wwcc_ferti_p1:// preventing Mn depletion
171  if (m_ev->m_lock || m_farm->DoIt_prob(0.03)) {
173  g_date->DayInYear(25, 9) - g_date->DayInYear())) {
174  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p1, true);
175  break;
176  }
177  }
178  SimpleEvent(g_date->Date() + 7, dk_wwcc_ferti_p2, false);
179  break;
180 
181  case dk_wwcc_ferti_s2:
182  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
183  {
185  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
186  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s2, true);
187  break;
188  }
189  }
190  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
192  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
193  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s2, true);
194  break;
195  }
196  DK_WWCC_MN_S = true; // we need to remember who sprays Mn
197  }
198  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide1, false);
199  break;
200 
201  case dk_wwcc_ferti_p2:
202  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
203  {
205  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
206  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p2, true);
207  break;
208  }
209  }
210  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
212  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
213  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p2, true);
214  break;
215  }
216  DK_WWCC_MN_P = true; // we need to remember who sprays Mn
217  }
218  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide1, false);
219  break;
220 
221  case dk_wwcc_herbicide1:
222  if (m_ev->m_lock || m_farm->DoIt_prob(0.75)) {
223  if (!m_farm->HerbicideTreat(m_field, 0.0,
224  g_date->DayInYear(4, 10) - g_date->DayInYear())) {
225  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide1, true);
226  break;
227  }
228  }
229  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide2, false);
230  break;
231 
232  case dk_wwcc_herbicide2:
233  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
234  if (!m_farm->HerbicideTreat(m_field, 0.0,
235  g_date->DayInYear(5, 10) - g_date->DayInYear())) {
236  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide2, true);
237  break;
238  }
239  }
240  SimpleEvent(g_date->Date() + 7, dk_wwcc_herbicide3, false);
241  break;
242 
243  case dk_wwcc_herbicide3:
244  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
245  if (!m_farm->HerbicideTreat(m_field, 0.0,
246  g_date->DayInYear(13, 10) - g_date->DayInYear())) {
247  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide3, true);
248  break;
249  }
250  }
251  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide4, false);
252  break;
253 
254  case dk_wwcc_herbicide4:
255  if (m_ev->m_lock || m_farm->DoIt_prob(0.30)) {
256  if (!m_farm->HerbicideTreat(m_field, 0.0,
257  g_date->DayInYear(14, 10) - g_date->DayInYear())) {
258  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide4, true);
259  break;
260  }
261  }
262  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + 365, dk_wwcc_wait, false);
263  break;
264 
265  case dk_wwcc_wait:
266  if (!m_farm->SleepAllDay(m_field, 0.0,
267  g_date->DayInYear(28, 2) - g_date->DayInYear())) {
268  SimpleEvent(g_date->Date() + 1, dk_wwcc_wait, true);
269  break;
270  }
271  if (a_farm->IsStockFarmer()) //Stock Farmer
272  {
276  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_wwcc_gr, false);
279  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5) + m_date_modifier, dk_wwcc_insecticide1, false); // main thread
280  break;
281  }
282  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3), dk_wwcc_ferti_p3, false);
285  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_wwcc_gr, false);
288  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5) + m_date_modifier, dk_wwcc_insecticide1, false); // main thread
289  break;
290 
291  case dk_wwcc_ferti_s3:
292  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
293  {
295  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
296  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s3, true);
297  break;
298  }
299  }
300  else if (DK_WWCC_MN_S == true) {
301  if (m_ev->m_lock || m_farm->DoIt_prob(0.20 / 0.25)) {
303  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
304  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s3, true);
305  break;
306  }
307  }
308  }
309  break; // end of thread
310 
311  case dk_wwcc_ferti_p3:
312  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
313  {
315  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
316  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p3, true);
317  break;
318  }
319  }
320  else if (DK_WWCC_MN_P == true) {
321  if (m_ev->m_lock || m_farm->DoIt_prob(0.20 / 0.25)) {
323  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
324  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p3, true);
325  break;
326  }
327  }
328  }
329  break;
330 
331  case dk_wwcc_ferti_s4:
332  if (!m_farm->FA_Slurry(m_field, 0.0,
333  g_date->DayInYear(15, 4) - g_date->DayInYear())) {
334  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s4, true);
335  break;
336  }
337  break; // end of thread
338 
339  case dk_wwcc_ferti_p4:
340  if (!m_farm->FP_Slurry(m_field, 0.0,
341  g_date->DayInYear(15, 4) - g_date->DayInYear())) {
342  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p4, true);
343  break;
344  }
345  break; // end of thread
346 
347  case dk_wwcc_ferti_s5:
348  if (!m_farm->FA_NPK(m_field, 0.0,
349  g_date->DayInYear(20, 3) - g_date->DayInYear())) {
350  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s5, true);
351  break;
352  }
354  break;
355 
356  case dk_wwcc_ferti_p5:
357  if (!m_farm->FP_NPK(m_field, 0.0,
358  g_date->DayInYear(20, 3) - g_date->DayInYear())) {
359  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p5, true);
360  break;
361  }
363  break;
364 
365  case dk_wwcc_ferti_s6:
366  if (!m_farm->FA_NPK(m_field, 0.0,
367  g_date->DayInYear(20, 4) - g_date->DayInYear())) {
368  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s6, true);
369  break;
370  }
371  break; // end of thread
372 
373  case dk_wwcc_ferti_p6:
374  if (!m_farm->FP_NPK(m_field, 0.0,
375  g_date->DayInYear(20, 4) - g_date->DayInYear())) {
376  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p6, true);
377  break;
378  }
379  break; // end of thread
380 
381  case dk_wwcc_gr:
382  if (m_ev->m_lock || m_farm->DoIt_prob(0.80)) {
383  if (!m_farm->GrowthRegulator(m_field, 0.0,
384  g_date->DayInYear(31, 5) - g_date->DayInYear())) {
385  SimpleEvent(g_date->Date() + 1, dk_wwcc_gr, true);
386  break;
387  }
388  }
389  break; // end of thread
390 
391  case dk_wwcc_herbicide5:
392  if (m_ev->m_lock || m_farm->DoIt_prob(0.90)) {
393  if (!m_farm->HerbicideTreat(m_field, 0.0,
394  g_date->DayInYear(15, 4) - g_date->DayInYear())) {
395  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide5, true);
396  break;
397  }
398  }
399  SimpleEvent(g_date->Date() + 14, dk_wwcc_herbicide6, false);
400  break;
401 
402  case dk_wwcc_herbicide6:
403  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
404  if (!m_farm->HerbicideTreat(m_field, 0.0,
405  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
406  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide6, true);
407  break;
408  }
409  }
410  break; // end of thread
411 
412  case dk_wwcc_fungicide1:
413  if (m_ev->m_lock || m_farm->DoIt_prob(0.98)) {
414  if (!m_farm->FungicideTreat(m_field, 0.0,
415  g_date->DayInYear(15, 5) - g_date->DayInYear())) {
416  SimpleEvent(g_date->Date() + 1, dk_wwcc_fungicide1, true);
417  break;
418  }
419  SimpleEvent(g_date->Date() + 14, dk_wwcc_fungicide2, false);
420  break;
421  }
422  break; // end of thread
423 
424  case dk_wwcc_fungicide2:
425  if (m_ev->m_lock || m_farm->DoIt_prob(0.98)) {
426  if (!m_farm->FungicideTreat(m_field, 0.0,
427  g_date->DayInYear(31, 5) - g_date->DayInYear())) {
428  SimpleEvent(g_date->Date() + 1, dk_wwcc_fungicide2, true);
429  break;
430  }
431  }
432  break; // end of thread
433 
435 #ifdef ECOSTACK_BIOPESTICIDE
436  if (m_ev->m_lock || m_farm->DoIt_prob(0.60) || AphidDamage(m_field)) {
437 #else
438  if (m_ev->m_lock || m_farm->DoIt_prob(0.30) || AphidDamage(m_field)) {
439 #endif
440  // here we check whether we are using ERA pesticide or not
441  d1 = g_date->DayInYear(31, 5) - g_date->DayInYear();
442  if (!cfg_pest_winterwheat_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
443  {
444 #ifdef ECOSTACK_BIOPESTICIDE
445  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
446 #else
447  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
448 #endif
449  }
450  else {
452  }
453  if (!flag) {
455  break;
456  }
457  }
459  break;
460 
462 #ifdef ECOSTACK_BIOPESTICIDE
463  if (m_ev->m_lock || m_farm->DoIt_prob(0.10) || AphidDamage(m_field)) {
464 #else
465  if (m_ev->m_lock || m_farm->DoIt_prob(0.05) || AphidDamage(m_field)) {
466 #endif
467  // here we check whether we are using ERA pesticide or not
468  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
469  if (!cfg_pest_winterwheat_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
470  {
471 #ifdef ECOSTACK_BIOPESTICIDE
472  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
473 #else
474  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
475 #endif
476  }
477  else {
479  }
480  if (!flag) {
482  break;
483  }
484  }
486  break;
487 
488  case dk_wwcc_herbicide7: // only if for fodder- not allowed for consume
489  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
490  if (!m_farm->HerbicideTreat(m_field, 0.0,
491  g_date->DayInYear(14, 8) - g_date->DayInYear())) {
492  SimpleEvent(g_date->Date() + 1, dk_wwcc_herbicide7, true);
493  break;
494  }
495  }
496  if (a_farm->IsStockFarmer()) //Stock Farmer
497  {
498  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s7, false);
499  SimpleEvent(g_date->Date() + 14, dk_wwcc_harvest, false); // main thread
500  break;
501  }
502  else SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p7, false);
503  SimpleEvent(g_date->Date() + 14, dk_wwcc_harvest, false); // main thread
504  break;
505 
506  case dk_wwcc_ferti_s7:
507  if (m_ev->m_lock || m_farm->DoIt_prob(0.02)) {
508  if (!m_farm->FA_Calcium(m_field, 0.0,
509  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
510  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_s7, true);
511  break;
512  }
513  }
514  break; // end of thread
515 
516  case dk_wwcc_ferti_p7:
517  if (m_ev->m_lock || m_farm->DoIt_prob(0.02)) {
518  if (!m_farm->FP_Calcium(m_field, 0.0,
519  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
520  SimpleEvent(g_date->Date() + 1, dk_wwcc_ferti_p7, true);
521  break;
522  }
523  }
524  break; // end of thread
525 
526  case dk_wwcc_harvest:
527  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 1) - g_date->DayInYear())) {
528  SimpleEvent(g_date->Date() + 1, dk_wwcc_harvest, true);
529  break;
530  }
531  if (m_ev->m_lock || m_farm->DoIt_prob(cfg_DKCatchCropPct.value())) { //set to 100% from this code - in reality ~ 42% of all winter wheat
532  // So we are done,but this crop uses a catch crop
533  l_nextcropstartdate = m_farm->GetNextCropStartDate(m_ev->m_field, l_tov);
534  m_field->BumpRunNum();
535  m_field->SetVegPatchy(false); // reverse the patchy before the next crop
536  m_farm->AddNewEvent(tov_DKCatchCrop, g_date->Date(), m_ev->m_field, PROG_START, m_ev->m_field->GetRunNum(), false, l_nextcropstartdate, false, l_tov, fmc_Others, false, false);
537  m_field->SetVegType(tov_DKCatchCrop, tov_Undefined); // Two vegetation curves are specified
538  if (m_field->GetUnsprayedMarginPolyRef() != -1)
539  {
542  }
543  // NB no "done = true" because this crop effectively continues into the catch crop.
544  break;
545  }
546  else done = true;
547  break;
548 
549  default:
550  g_msg->Warn(WARN_BUG, "DK_WinterWheat_CC::Do(): "
551  "Unknown event type! ", "");
552  exit(1);
553  }
554  return done;
555 }

References Farm::AddNewEvent(), Crop::AphidDamage(), Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), Farm::BiocideTreat(), cfg_DKCatchCropPct, cfg_pest_product_amounts, cfg_pest_winterwheat_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), dk_wwcc_autumn_harrow, dk_wwcc_autumn_harrow_nt, dk_wwcc_autumn_plough, dk_wwcc_autumn_roll, dk_wwcc_autumn_sow, dk_wwcc_ferti_p1, dk_wwcc_ferti_p2, dk_wwcc_ferti_p3, dk_wwcc_ferti_p4, dk_wwcc_ferti_p5, dk_wwcc_ferti_p6, dk_wwcc_ferti_p7, dk_wwcc_ferti_s1, dk_wwcc_ferti_s2, dk_wwcc_ferti_s3, dk_wwcc_ferti_s4, dk_wwcc_ferti_s5, dk_wwcc_ferti_s6, dk_wwcc_ferti_s7, dk_wwcc_fungicide1, dk_wwcc_fungicide2, dk_wwcc_gr, dk_wwcc_harvest, dk_wwcc_herbicide1, dk_wwcc_herbicide2, dk_wwcc_herbicide3, dk_wwcc_herbicide4, dk_wwcc_herbicide5, dk_wwcc_herbicide6, dk_wwcc_herbicide7, dk_wwcc_insecticide1, dk_wwcc_insecticide2, DK_WWCC_MN_P, DK_WWCC_MN_S, dk_wwcc_molluscicide, dk_wwcc_start, DK_WWCC_TILL_1, dk_wwcc_wait, Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FA_Slurry(), fmc_Others, Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GetNextCropStartDate(), LE::GetSoilType(), LE::GetUnsprayedMarginPolyRef(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, FarmEvent::m_field, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, Crop::m_OurLandscape, FarmEvent::m_todo, Farm::Molluscicide(), Calendar::OldDays(), ppp_1, Farm::ProductApplication(), PROG_START, LE::SetVegPatchy(), LE::SetVegType(), Crop::SimpleEvent(), Farm::SleepAllDay(), Crop::StartUpCrop(), Landscape::SupplyLEPointer(), tos_LoamySand, tos_Sand, tos_SandyClayLoam, tos_SandyLoam, tov_DKCatchCrop, tov_DKOCatchCrop, tov_DKWinterWheat_CC, tov_Undefined, CfgFloat::value(), CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DK_WinterWheat_CC::SetUpFarmCategoryInformation ( )
inline
88  {
89  const int elements = 2 + (dk_wwcc_foobar - DK_WWCC_BASE);
91 
92  FarmManagementCategory catlist[elements] =
93  {
94  fmc_Others, // zero element unused but must be here
95  fmc_Others, // dk_wwcc_start = 1, // Compulsory, start event must always be 1 (one).
96  fmc_Harvest, // dk_wwcc_harvest = DK_wwcc_BASE,
97  fmc_Cultivation, // dk_wwcc_autumn_plough,
98  fmc_Cultivation, // dk_wwcc_autumn_harrow,
99  fmc_Cultivation, // dk_wwcc_autumn_harrow_nt,
100  fmc_Others, // dk_wwcc_autumn_roll,
101  fmc_Others, // dk_wwcc_molluscicide,
102  fmc_Fertilizer, // dk_wwcc_ferti_s1,
103  fmc_Fertilizer, // dk_wwcc_ferti_p1,
104  fmc_Fertilizer, // dk_wwcc_ferti_s2,
105  fmc_Fertilizer, // dk_wwcc_ferti_p2,
106  fmc_Cultivation, // dk_wwcc_autumn_sow,
107  fmc_Herbicide, // dk_wwcc_herbicide1,
108  fmc_Fertilizer, // dk_wwcc_ferti_s3,
109  fmc_Fertilizer, // dk_wwcc_ferti_p3,
110  fmc_Fertilizer, // dk_wwcc_ferti_s4,
111  fmc_Fertilizer, // dk_wwcc_ferti_p4,
112  fmc_Fertilizer, // dk_wwcc_ferti_s5,
113  fmc_Fertilizer, // dk_wwcc_ferti_p5,
114  fmc_Fertilizer, // dk_wwcc_ferti_s6,
115  fmc_Fertilizer, // dk_wwcc_ferti_p6,
116  fmc_Fertilizer, // dk_wwcc_ferti_s7,
117  fmc_Fertilizer, // dk_wwcc_ferti_p7,
118  fmc_Herbicide, // dk_wwcc_herbicide2,
119  fmc_Herbicide, // dk_wwcc_herbicide3,
120  fmc_Herbicide, // dk_wwcc_herbicide4,
121  fmc_Herbicide, // dk_wwcc_herbicide5,
122  fmc_Herbicide, // dk_wwcc_herbicide6,
123  fmc_Herbicide, // dk_wwcc_herbicide7,
124  fmc_Fungicide, // dk_wwcc_fungicide1,
125  fmc_Fungicide, // dk_wwcc_fungicide2,
126  fmc_Insecticide, // dk_wwcc_insecticide1,
127  fmc_Insecticide, // dk_wwcc_insecticide2,
128  fmc_Others, // dk_wwcc_gr,
129  fmc_Others, // dk_wwcc_wait,
130 
131  // no foobar entry
132 
133  };
134  // Iterate over the catlist elements and copy them to vector
135  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
136  }

References DK_WWCC_BASE, dk_wwcc_foobar, fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DK_WinterWheat_CC().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
dk_wwcc_herbicide1
Definition: DK_WinterWheat_CC.h:51
dk_wwcc_ferti_p4
Definition: DK_WinterWheat_CC.h:55
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Returns a pointer to the object referred to by the polygon number.
Definition: Landscape.h:1722
dk_wwcc_autumn_sow
Definition: DK_WinterWheat_CC.h:50
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1067
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
dk_wwcc_ferti_p5
Definition: DK_WinterWheat_CC.h:57
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
Farm::FP_NPK
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:645
DK_WWCC_MN_P
#define DK_WWCC_MN_P
Definition: DK_WinterWheat_CC.h:34
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
dk_wwcc_herbicide2
Definition: DK_WinterWheat_CC.h:62
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
dk_wwcc_ferti_s3
Definition: DK_WinterWheat_CC.h:52
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
dk_wwcc_ferti_p2
Definition: DK_WinterWheat_CC.h:49
Farm::GetNextCropStartDate
int GetNextCropStartDate(LE *a_field, TTypesOfVegetation &a_curr_veg)
Returns the start date of the next crop in the rotation.
Definition: Farm.cpp:920
Farm::AddNewEvent
void AddNewEvent(TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop, FarmManagementCategory a_fmc, bool a_forcespring, bool a_forcespringOK)
Adds an event to the event queue for a farm.
Definition: Farm.cpp:845
CfgFloat::value
double value() const
Definition: Configurator.h:142
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
dk_wwcc_ferti_s5
Definition: DK_WinterWheat_CC.h:56
cfg_pest_winterwheat_on
CfgBool cfg_pest_winterwheat_on
Turn on pesticides for winter wheat.
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
dk_wwcc_harvest
Definition: DK_WinterWheat_CC.h:40
dk_wwcc_ferti_s6
Definition: DK_WinterWheat_CC.h:58
CfgBool::value
bool value() const
Definition: Configurator.h:164
dk_wwcc_ferti_p7
Definition: DK_WinterWheat_CC.h:61
dk_wwcc_herbicide6
Definition: DK_WinterWheat_CC.h:66
dk_wwcc_herbicide5
Definition: DK_WinterWheat_CC.h:65
tov_DKOCatchCrop
Definition: LandscapeFarmingEnums.h:421
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
cfg_pest_product_amounts
CfgArray_Double cfg_pest_product_amounts
Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.
dk_wwcc_autumn_roll
Definition: DK_WinterWheat_CC.h:44
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_wwcc_ferti_p3
Definition: DK_WinterWheat_CC.h:53
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
dk_wwcc_ferti_s7
Definition: DK_WinterWheat_CC.h:60
dk_wwcc_ferti_p1
Definition: DK_WinterWheat_CC.h:47
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
cfg_DKCatchCropPct
CfgFloat cfg_DKCatchCropPct
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
dk_wwcc_herbicide4
Definition: DK_WinterWheat_CC.h:64
dk_wwcc_herbicide3
Definition: DK_WinterWheat_CC.h:63
Crop::StartUpCrop
bool StartUpCrop(int a_spring, std::vector< std::vector< int >> a_flexdates, int a_todo)
Holds the translation between the farm operation enum for each cropand the farm management category a...
Definition: Farm.cpp:652
DK_WWCC_TILL_1
#define DK_WWCC_TILL_1
Definition: DK_WinterWheat_CC.h:35
FarmEvent::m_field
LE * m_field
Definition: Farm.h:391
dk_wwcc_ferti_s1
Definition: DK_WinterWheat_CC.h:46
dk_wwcc_gr
Definition: DK_WinterWheat_CC.h:72
dk_wwcc_ferti_s4
Definition: DK_WinterWheat_CC.h:54
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
Crop::m_ManagementCategories
vector< FarmManagementCategory > m_ManagementCategories
Holds the translation between the farm operation enum for each crop and the farm management category ...
Definition: Farm.h:530
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
dk_wwcc_start
Definition: DK_WinterWheat_CC.h:39
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
tos_Sand
Definition: LandscapeFarmingEnums.h:719
tov_Undefined
Definition: LandscapeFarmingEnums.h:610
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: FarmFuncs.cpp:299
LE::SetVegType
virtual void SetVegType(TTypesOfVegetation)
Definition: Elements.h:175
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: FarmFuncs.cpp:272
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
dk_wwcc_autumn_harrow
Definition: DK_WinterWheat_CC.h:42
tov_DKWinterWheat_CC
Definition: LandscapeFarmingEnums.h:422
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
dk_wwcc_fungicide1
Definition: DK_WinterWheat_CC.h:68
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
DK_WWCC_MN_S
#define DK_WWCC_MN_S
Definition: DK_WinterWheat_CC.h:33
dk_wwcc_autumn_harrow_nt
Definition: DK_WinterWheat_CC.h:43
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
dk_wwcc_autumn_plough
Definition: DK_WinterWheat_CC.h:41
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the autumn on a_field.
Definition: FarmFuncs.cpp:360
dk_wwcc_wait
Definition: DK_WinterWheat_CC.h:73
dk_wwcc_molluscicide
Definition: DK_WinterWheat_CC.h:45
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
dk_wwcc_herbicide7
Definition: DK_WinterWheat_CC.h:67
DK_WinterWheat_CC::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_WinterWheat_CC.h:88
dk_wwcc_insecticide1
Definition: DK_WinterWheat_CC.h:70
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
LE::GetUnsprayedMarginPolyRef
int GetUnsprayedMarginPolyRef(void)
Definition: Elements.h:383
tov_DKCatchCrop
Definition: LandscapeFarmingEnums.h:420
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_wwcc_ferti_s2
Definition: DK_WinterWheat_CC.h:48
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
dk_wwcc_foobar
Definition: DK_WinterWheat_CC.h:74
PROG_START
#define PROG_START
Definition: Farm.h:69
Crop::AphidDamage
bool AphidDamage(LE *a_field)
Compares aphid numbers per m2 with a threshold to return true if threshold is exceeded.
Definition: Farm.cpp:726
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_wwcc_insecticide2
Definition: DK_WinterWheat_CC.h:71
Crop::m_OurLandscape
Landscape * m_OurLandscape
Definition: Farm.h:506
dk_wwcc_fungicide2
Definition: DK_WinterWheat_CC.h:69
WARN_BUG
Definition: MapErrorMsg.h:34
dk_wwcc_ferti_p6
Definition: DK_WinterWheat_CC.h:59
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
DK_WWCC_BASE
#define DK_WWCC_BASE
Definition: DK_WinterWheat_CC.h:31
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001