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_WinterRape Class Reference

#include <DK_WinterRape.h>

Inheritance diagram for DK_WinterRape:
Crop

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 DK_WinterRape (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_WinterRape()

DK_WinterRape::DK_WinterRape ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
91  : Crop(a_tov, a_toc, a_L)
92  {
93  m_first_date = g_date->DayInYear(26, 8);
95  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

41 {
42  m_farm = a_farm;
43  m_field = a_field;
44  m_ev = a_ev;
45  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).
46  bool flag = false;
47  int d1 = 0;
48  int noDates = 1;
50 
51  switch (m_ev->m_todo)
52  {
53  case dk_wosr_start:
54  {
55  a_field->ClearManagementActionSum();
56 
57  DK_WOSR_FERTI_S = false;
58  DK_WOSR_FERTI_P = false;
59  DK_WOSR_ROW_CULT = false;
60  DK_WOSR_HERBI = false;
61 
62  m_last_date = g_date->DayInYear(19, 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(5, 8); // last possible day of swathing - this is in effect day before the earliest date that a following crop can use
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(19, 8); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
71 
72 
73  // 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
74  if (StartUpCrop(0, flexdates, int(dk_wosr_wait))) break;
75 
76  // End single block date checking code. Please see next line comment as well.
77  // Reinit d1 to first possible starting date.
78  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
79  // OK, let's go.
81  break;
82  }
83  break;
84 
86  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
87  if (!m_farm->AutumnPlough(m_field, 0.0,
88  g_date->DayInYear(20, 8) - g_date->DayInYear())) {
90  break;
91  }
92  d1 = g_date->Date();
93  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 8)) {
95  break;
96  }
97  else
98  SimpleEvent(g_date->Date() + 1, dk_wosr_autumn_sow, false);
99  break;
100  }
101  else if (m_ev->m_lock || m_farm->DoIt_prob(0.20 / 0.50)) {
103  break;
104  }
106  break;
107 
109  if (!m_farm->AutumnHarrow(m_field, 0.0,
110  g_date->DayInYear(20, 8) - g_date->DayInYear())) {
112  break;
113  }
114  d1 = g_date->Date();
115  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 8)) {
117  break;
118  }
119  else
120  SimpleEvent(g_date->Date() + 1, dk_wosr_autumn_sow, false);
121  break;
122 
125  g_date->DayInYear(25, 8) - g_date->DayInYear())) {
127  break;
128  }
129  if (a_farm->IsStockFarmer()) //Stock Farmer
130  {
132  SimpleEvent(g_date->Date() + 2, dk_wosr_herbicide1, false); // main thread
134  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 9), dk_wosr_gr, false);
136  break;
137  }
138  else SimpleEvent(g_date->Date(), dk_wosr_ferti_p1, false);
139  SimpleEvent(g_date->Date() + 2, dk_wosr_herbicide1, false); // main thread
141  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 9), dk_wosr_gr, false);
143  break;
144 
145  case dk_wosr_autumn_sow:
146  if (!m_farm->AutumnSow(m_field, 0.0,
147  g_date->DayInYear(25, 8) - g_date->DayInYear())) {
148  SimpleEvent(g_date->Date() + 1, dk_wosr_autumn_sow, true);
149  break;
150  }
151  if (a_farm->IsStockFarmer()) //Stock Farmer
152  {
154  SimpleEvent(g_date->Date() + 2, dk_wosr_herbicide1, false); // main thread
156  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 9), dk_wosr_gr, false);
158  break;
159  }
160  else SimpleEvent(g_date->Date(), dk_wosr_ferti_p1, false);
161  SimpleEvent(g_date->Date() + 2, dk_wosr_herbicide1, false); // main thread
163  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 9), dk_wosr_gr, false);
165  break;
166 
167  case dk_wosr_ferti_s1:
168  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
169  if (!m_farm->FA_Slurry(m_field, 0.0,
170  g_date->DayInYear(25, 9) - g_date->DayInYear())) {
171  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s1, true);
172  break;
173  }
174  }
175  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.75)) {
177  break;
178  }
179  else SimpleEvent(g_date->Date(), dk_wosr_ferti_s3, false);
180  break;
181 
182  case dk_wosr_ferti_p1:
183  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
184  if (!m_farm->FP_Slurry(m_field, 0.0,
185  g_date->DayInYear(25, 9) - g_date->DayInYear())) {
186  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p1, true);
187  break;
188  }
189  }
190  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.75)) {
192  break;
193  }
194  else SimpleEvent(g_date->Date(), dk_wosr_ferti_p3, false);
195  break;
196 
197  case dk_wosr_ferti_s2:
198  if (!m_farm->FA_Slurry(m_field, 0.0,
199  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
200  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s2, true);
201  break;
202  }
203  break; // end of thread
204 
205  case dk_wosr_ferti_p2:
206  if (!m_farm->FP_Slurry(m_field, 0.0,
207  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
208  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p2, true);
209  break;
210  }
211  break; // end of thread
212 
213  case dk_wosr_ferti_s3:
215  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
216  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s3, true);
217  break;
218  }
219  DK_WOSR_FERTI_S = true; // we need to remember who did NPK instead of slurry
220  break; // end of thread
221 
222  case dk_wosr_ferti_p3:
224  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
225  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p3, true);
226  break;
227  }
228  DK_WOSR_FERTI_P = true; // we need to remember who did NPK instead of slurry
229  break; // end of thread
230 
232  if (m_ev->m_lock || m_farm->DoIt_prob(0.01)) {
233  if (!m_farm->RowCultivation(m_field, 0.0,
234  g_date->DayInYear(15, 9) - g_date->DayInYear())) {
236  break;
237  }
239  break;
240  }
241  break; // end of thread
242 
244  if (!m_farm->RowCultivation(m_field, 0.0,
245  g_date->DayInYear(5, 10) - g_date->DayInYear())) {
247  break;
248  }
249  DK_WOSR_ROW_CULT = true; // we need to remember who did row cultivation
250  break; // end of thread
251 
252  case dk_wosr_gr:
253  if (m_ev->m_lock || m_farm->DoIt_prob(0.20)) {
254  if (!m_farm->GrowthRegulator(m_field, 0.0,
255  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
256  SimpleEvent(g_date->Date() + 1, dk_wosr_gr, true);
257  break;
258  }
259  }
260  break; // end of thread
261 
263 #ifdef ECOSTACK_BIOPESTICIDE
264  if (m_ev->m_lock || m_farm->DoIt_prob(0.8) || AphidDamage(m_field)) {
265 #else
266  if (m_ev->m_lock || m_farm->DoIt_prob(0.80) || AphidDamage(m_field)) {
267 #endif
268  // here we check whether we are using ERA pesticide or not
269  d1 = g_date->DayInYear(15, 10) - g_date->DayInYear();
270  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
271  {
272 #ifdef ECOSTACK_BIOPESTICIDE
273  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
274 #else
275  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
276 #endif
277  }
278  else {
280  }
281  if (!flag) {
283  break;
284  }
285 #ifdef ECOSTACK_BIOPESTICIDE
287  break; // end of threads
288 #endif
289  }
290  break;
291 
292 #ifdef ECOSTACK_BIOPESTICIDE
294  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
295  // here we check whether we are using ERA pesticide or not
296  d1 = g_date->DayInYear(22, 10) - g_date->DayInYear();
297  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
298  if (!flag) {
300  break;
301  }
302  }
303  break; // end of thread
304 #endif
305 
306  case dk_wosr_herbicide1:
307  if (m_ev->m_lock || m_farm->DoIt_prob(0.35)) {
308  if (!m_farm->HerbicideTreat(m_field, 0.0,
309  g_date->DayInYear(28, 8) - g_date->DayInYear())) {
310  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide1, true);
311  break;
312  }
313  }
314  SimpleEvent(g_date->Date() + 7, dk_wosr_herbicide2, false);
315  break;
316 
317  case dk_wosr_herbicide2: // 1st split treatment
318  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
319  if (!m_farm->HerbicideTreat(m_field, 0.0,
320  g_date->DayInYear(5, 9) - g_date->DayInYear())) {
321  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide2, true);
322  break;
323  }
324  DK_WOSR_HERBI = true;
325  }
326  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide3, false);
327  break;
328 
329  case dk_wosr_herbicide3:
330  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
331  if (!m_farm->HerbicideTreat(m_field, 0.0,
332  g_date->DayInYear(13, 9) - g_date->DayInYear())) {
333  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide3, true);
334  break;
335  }
336  }
337  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide4, false);
338  break;
339 
340  case dk_wosr_herbicide4: // 2nd of split treatment
341  if (DK_WOSR_HERBI == true) {
342  if (!m_farm->HerbicideTreat(m_field, 0.0,
343  g_date->DayInYear(14, 10) - g_date->DayInYear())) {
344  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide4, true);
345  break;
346  }
347  }
348  SimpleEvent(g_date->Date() + 7, dk_wosr_herbicide5, false);
349  break;
350 
351  case dk_wosr_herbicide5:
352  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
353  if (!m_farm->HerbicideTreat(m_field, 0.0,
354  g_date->DayInYear(31, 10) - g_date->DayInYear())) {
355  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide5, true);
356  break;
357  }
358  }
360  break;
361 
362  case dk_wosr_herbicide6:
363  if (m_ev->m_lock || m_farm->DoIt_prob(0.90)) {
364  if (!m_farm->HerbicideTreat(m_field, 0.0,
365  g_date->DayInYear(30, 11) - g_date->DayInYear())) {
366  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide6, true);
367  break;
368  }
369  }
370  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + 365, dk_wosr_wait, false);
371  break;
372 
373  case dk_wosr_wait:
374  if (!m_farm->SleepAllDay(m_field, 0.0,
375  g_date->DayInYear(28, 2) - g_date->DayInYear())) {
376  SimpleEvent(g_date->Date() + 1, dk_wosr_wait, true);
377  break;
378  }
379  if (a_farm->IsStockFarmer()) //Stock Farmer
380  {
388  break;
389  }
390  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3), dk_wosr_ferti_p4, false);
397  break;
398 
399  case dk_wosr_ferti_s4:
400  if (DK_WOSR_FERTI_S == false) {
401  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) { // 50% of farmers applying slurry in autumn
402  if (!m_farm->FA_Slurry(m_field, 0.0,
403  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
404  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s4, true);
405  break;
406  }
407  }
408  }
409  break; // end of thread
410 
411  case dk_wosr_ferti_p4:
412  if (DK_WOSR_FERTI_P == false) {
413  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) { // 50% of farmers applying slurry in autumn
414  if (!m_farm->FP_Slurry(m_field, 0.0,
415  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
416  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p4, true);
417  break;
418  }
419  }
420  }
421  break; // end of thread
422 
423  case dk_wosr_ferti_s5:
424  if (m_ev->m_lock || m_farm->DoIt_prob(0.90)) {
426  g_date->DayInYear(10, 3) - g_date->DayInYear())) {
427  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s5, true);
428  break;
429  }
431  break;
432  }
433  break; // end of thread
434 
435  case dk_wosr_ferti_p5:
436  if (m_ev->m_lock || m_farm->DoIt_prob(0.90)) {
438  g_date->DayInYear(10, 3) - g_date->DayInYear())) {
439  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p5, true);
440  break;
441  }
443  break;
444  }
445  break; // end of thread
446 
447  case dk_wosr_ferti_s6:
449  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
450  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s6, true);
451  break;
452  }
453  break; // end of thread
454 
455  case dk_wosr_ferti_p6:
457  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
458  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p6, true);
459  break;
460  }
461  break; // end of thread
462 
463  case dk_wosr_ferti_s7:
464  if (m_ev->m_lock || m_farm->DoIt_prob(0.15)) {
465  if (!m_farm->FA_Boron(m_field, 0.0,
466  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
467  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_s7, true);
468  break;
469  }
470  }
471  break; // end of thread
472 
473  case dk_wosr_ferti_p7:
474  if (m_ev->m_lock || m_farm->DoIt_prob(0.15)) {
475  if (!m_farm->FP_Boron(m_field, 0.0,
476  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
477  SimpleEvent(g_date->Date() + 1, dk_wosr_ferti_p7, true);
478  break;
479  }
480  }
481  break; // end of thread
482 
484  if (DK_WOSR_ROW_CULT) {
485  if (!m_farm->RowCultivation(m_field, 0.0,
486  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
488  break;
489  }
490  }
491  break; // end of thread
492 
493  case dk_wosr_herbicide7:
494  if (m_ev->m_lock || m_farm->DoIt_prob(0.05)) {
495  if (!m_farm->HerbicideTreat(m_field, 0.0,
496  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
497  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide7, true);
498  break;
499  }
500  }
501  break; // end of thread
502 
504 #ifdef ECOSTACK_BIOPESTICIDE
505  if (m_ev->m_lock || m_farm->DoIt_prob(1.00) || AphidDamage(m_field)) {
506 #else
507  if (m_ev->m_lock || m_farm->DoIt_prob(0.50) || AphidDamage(m_field)) {
508 #endif
509  // here we check whether we are using ERA pesticide or not
510  d1 = g_date->DayInYear(31, 5) - g_date->DayInYear();
511  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
512  {
513 #ifdef ECOSTACK_BIOPESTICIDE
514  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
515 #else
516  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
517 #endif
518  }
519  else {
521  }
522  if (!flag) {
524  break;
525  }
526  }
527  d1 = g_date->Date();
528  if (d1 < g_date->OldDays() + g_date->DayInYear(17, 4)) {
530  break;
531  }
532  else SimpleEvent(g_date->Date() + 14, dk_wosr_insecticide3, false);
533  break;
534 
536 #ifdef ECOSTACK_BIOPESTICIDE
537  if (m_ev->m_lock || m_farm->DoIt_prob(0.40) || AphidDamage(m_field)) {
538 #else
539  if (m_ev->m_lock || m_farm->DoIt_prob(0.20) || AphidDamage(m_field)) {
540 #endif
541  // here we check whether we are using ERA pesticide or not
542  d1 = g_date->DayInYear(30, 6) - g_date->DayInYear();
543  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
544  {
545 #ifdef ECOSTACK_BIOPESTICIDE
546  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
547 #else
548  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
549 #endif
550  }
551  else {
553  }
554  if (!flag) {
556  break;
557  }
558  }
559  break; // end of thread
560 
561  case dk_wosr_fungicide1:
562  if (m_ev->m_lock || m_farm->DoIt_prob(0.80)) {
563  if (!m_farm->FungicideTreat(m_field, 0.0,
564  g_date->DayInYear(31, 5) - g_date->DayInYear())) {
565  SimpleEvent(g_date->Date() + 1, dk_wosr_fungicide1, true);
566  break;
567  }
568  }
569  SimpleEvent(g_date->Date() + 14, dk_wosr_fungicide2, false);
570  break;
571 
572  case dk_wosr_fungicide2:
573  if (m_ev->m_lock || m_farm->DoIt_prob(0.30)) {
574  if (!m_farm->FungicideTreat(m_field, 0.0,
575  g_date->DayInYear(15, 6) - g_date->DayInYear())) {
576  SimpleEvent(g_date->Date() + 1, dk_wosr_fungicide2, true);
577  break;
578  }
579  }
581  break;
582 
583  case dk_wosr_herbicide8:
584  if (m_ev->m_lock || m_farm->DoIt_prob(0.20)) {
585  if (!m_farm->HerbicideTreat(m_field, 0.0,
586  g_date->DayInYear(4, 8) - g_date->DayInYear())) {
587  SimpleEvent(g_date->Date() + 1, dk_wosr_herbicide8, true);
588  break;
589  }
590  SimpleEvent(g_date->Date() + 1, dk_wosr_swathing, false);
591  break;
592  }
594  break;
595 
596  case dk_wosr_swathing:
597  if (!m_farm->Swathing(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
598  SimpleEvent(g_date->Date() + 1, dk_wosr_swathing, true);
599  break;
600  }
601  SimpleEvent(g_date->Date() + 7, dk_wosr_harvest, false);
602  break;
603 
604  case dk_wosr_harvest:
605  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 1) - g_date->DayInYear())) {
606  SimpleEvent(g_date->Date() + 1, dk_wosr_harvest, true);
607  break;
608  }
609  done = true;
610  break;
611 
612  default:
613  g_msg->Warn(WARN_BUG, "DK_WinterRape::Do(): "
614  "Unknown event type! ", "");
615  exit(1);
616  }
617  return done;
618 }

References Crop::AphidDamage(), Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnSow(), Farm::BiocideTreat(), cfg_pest_product_amounts, cfg_pest_winterrape_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), dk_wosr_autumn_harrow, dk_wosr_autumn_plough, dk_wosr_autumn_sow, dk_wosr_cultivator_sow, DK_WOSR_FERTI_P, dk_wosr_ferti_p1, dk_wosr_ferti_p2, dk_wosr_ferti_p3, dk_wosr_ferti_p4, dk_wosr_ferti_p5, dk_wosr_ferti_p6, dk_wosr_ferti_p7, DK_WOSR_FERTI_S, dk_wosr_ferti_s1, dk_wosr_ferti_s2, dk_wosr_ferti_s3, dk_wosr_ferti_s4, dk_wosr_ferti_s5, dk_wosr_ferti_s6, dk_wosr_ferti_s7, dk_wosr_fungicide1, dk_wosr_fungicide2, dk_wosr_gr, dk_wosr_harvest, DK_WOSR_HERBI, dk_wosr_herbicide1, dk_wosr_herbicide2, dk_wosr_herbicide3, dk_wosr_herbicide4, dk_wosr_herbicide5, dk_wosr_herbicide6, dk_wosr_herbicide7, dk_wosr_herbicide8, dk_wosr_insecticide1, dk_wosr_insecticide1b, dk_wosr_insecticide2, dk_wosr_insecticide3, DK_WOSR_ROW_CULT, dk_wosr_row_cultivation1, dk_wosr_row_cultivation2, dk_wosr_row_cultivation3, dk_wosr_start, dk_wosr_swathing, dk_wosr_wait, Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_Boron(), Farm::FA_Slurry(), Farm::FP_AmmoniumSulphate(), Farm::FP_Boron(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Calendar::OldDays(), ppp_1, Farm::PreseedingCultivatorSow(), Farm::ProductApplication(), Farm::RowCultivation(), Crop::SimpleEvent(), Farm::SleepAllDay(), Crop::StartUpCrop(), Farm::Swathing(), tov_DKWinterRape, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DK_WinterRape::SetUpFarmCategoryInformation ( )
inline
96  {
97  const int elements = 2 + (dk_wosr_foobar - DK_WOSR_BASE);
99 
100  FarmManagementCategory catlist[elements] =
101  {
102  fmc_Others, // zero element unused but must be here
103  fmc_Others, // dk_wosr_start = 1, // Compulsory, start event must always be 1 (one).
104  fmc_Harvest, // dk_wosr_harvest = DK_wosr_BASE,
105  fmc_Cultivation, // dk_wosr_autumn_plough,
106  fmc_Cultivation, // dk_wosr_autumn_harrow,
107  fmc_Others, // dk_wosr_autumn_roll,
108  fmc_Others, // dk_wosr_molluscicide,
109  fmc_Fertilizer, // dk_wosr_ferti_s1,
110  fmc_Fertilizer, // dk_wosr_ferti_p1,
111  fmc_Fertilizer, // dk_wosr_ferti_s2,
112  fmc_Fertilizer, // dk_wosr_ferti_p2,
113  fmc_Others, // dk_wosr_autumn_sow,
114  fmc_Others, // dk_wosr_cultivator_sow,
115  fmc_Herbicide, // dk_wosr_herbicide1,
116  fmc_Fertilizer, // dk_wosr_ferti_s3,
117  fmc_Fertilizer, // dk_wosr_ferti_p3,
118  fmc_Fertilizer, // dk_wosr_ferti_s4,
119  fmc_Fertilizer, // dk_wosr_ferti_p4,
120  fmc_Fertilizer, // dk_wosr_ferti_s5,
121  fmc_Fertilizer, // dk_wosr_ferti_p5,
122  fmc_Fertilizer, // dk_wosr_ferti_s6,
123  fmc_Fertilizer, // dk_wosr_ferti_p6,
124  fmc_Fertilizer, // dk_wosr_ferti_s7,
125  fmc_Fertilizer, // dk_wosr_ferti_p7,
126  fmc_Cultivation, // dk_wosr_row_cultivation1,
127  fmc_Cultivation, // dk_wosr_row_cultivation2,
128  fmc_Cultivation, // dk_wosr_row_cultivation3,
129  fmc_Herbicide, // dk_wosr_herbicide2,
130  fmc_Herbicide, // dk_wosr_herbicide3,
131  fmc_Herbicide, // dk_wosr_herbicide4,
132  fmc_Herbicide, // dk_wosr_herbicide5,
133  fmc_Herbicide, // dk_wosr_herbicide6,
134  fmc_Herbicide, // dk_wosr_herbicide7,
135  fmc_Herbicide, // dk_wosr_herbicide8,
136  fmc_Fungicide, // dk_wosr_fungicide1,
137  fmc_Fungicide, // dk_wosr_fungicide2,
138  fmc_Insecticide, // dk_wosr_insecticide1,
139  fmc_Insecticide, // dk_wosr_insecticide2,
140  fmc_Insecticide, // dk_wosr_insecticide3,
141  fmc_Others, // dk_wosr_gr,
142  fmc_Cutting, // dk_wosr_swathing
143  fmc_Others, // dk_wosr_wait,
144 
145  // no foobar entry
146 
147  };
148  // Iterate over the catlist elements and copy them to vector
149  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
150  }

References DK_WOSR_BASE, dk_wosr_foobar, fmc_Cultivation, fmc_Cutting, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DK_WinterRape().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
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
tov_DKWinterRape
Definition: LandscapeFarmingEnums.h:418
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
dk_wosr_ferti_p4
Definition: DK_WinterRape.h:56
dk_wosr_row_cultivation2
Definition: DK_WinterRape.h:64
dk_wosr_ferti_s4
Definition: DK_WinterRape.h:55
dk_wosr_harvest
Definition: DK_WinterRape.h:41
dk_wosr_fungicide1
Definition: DK_WinterRape.h:73
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
DK_WOSR_BASE
#define DK_WOSR_BASE
Definition: DK_WinterRape.h:31
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
dk_wosr_insecticide1
Definition: DK_WinterRape.h:75
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
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
dk_wosr_autumn_sow
Definition: DK_WinterRape.h:50
dk_wosr_wait
Definition: DK_WinterRape.h:81
dk_wosr_autumn_harrow
Definition: DK_WinterRape.h:43
dk_wosr_insecticide1b
Definition: DK_WinterRape.h:76
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_wosr_ferti_s5
Definition: DK_WinterRape.h:57
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
cfg_pest_winterrape_on
CfgBool cfg_pest_winterrape_on
Turn on pesticides for winter rape.
dk_wosr_autumn_plough
Definition: DK_WinterRape.h:42
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_WinterRape::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_WinterRape.h:96
CfgBool::value
bool value() const
Definition: Configurator.h:164
dk_wosr_row_cultivation1
Definition: DK_WinterRape.h:63
dk_wosr_herbicide5
Definition: DK_WinterRape.h:69
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_wosr_ferti_s7
Definition: DK_WinterRape.h:61
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_wosr_herbicide8
Definition: DK_WinterRape.h:72
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
dk_wosr_ferti_p7
Definition: DK_WinterRape.h:62
dk_wosr_ferti_p6
Definition: DK_WinterRape.h:60
dk_wosr_insecticide2
Definition: DK_WinterRape.h:77
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
dk_wosr_ferti_s1
Definition: DK_WinterRape.h:46
dk_wosr_herbicide4
Definition: DK_WinterRape.h:68
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FA_Boron
virtual bool FA_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:868
dk_wosr_foobar
Definition: DK_WinterRape.h:82
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
Farm::FP_Boron
virtual bool FP_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:854
DK_WOSR_FERTI_S
#define DK_WOSR_FERTI_S
Definition: DK_WinterRape.h:33
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
dk_wosr_swathing
Definition: DK_WinterRape.h:80
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_wosr_gr
Definition: DK_WinterRape.h:79
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: FarmFuncs.cpp:325
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
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
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
dk_wosr_ferti_p1
Definition: DK_WinterRape.h:47
DK_WOSR_HERBI
#define DK_WOSR_HERBI
Definition: DK_WinterRape.h:36
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
dk_wosr_ferti_p5
Definition: DK_WinterRape.h:58
dk_wosr_herbicide7
Definition: DK_WinterRape.h:71
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
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
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
dk_wosr_start
Definition: DK_WinterRape.h:40
dk_wosr_ferti_s2
Definition: DK_WinterRape.h:48
dk_wosr_ferti_p2
Definition: DK_WinterRape.h:49
dk_wosr_cultivator_sow
Definition: DK_WinterRape.h:51
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_wosr_fungicide2
Definition: DK_WinterRape.h:74
dk_wosr_herbicide2
Definition: DK_WinterRape.h:66
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
dk_wosr_insecticide3
Definition: DK_WinterRape.h:78
dk_wosr_ferti_p3
Definition: DK_WinterRape.h:54
dk_wosr_herbicide6
Definition: DK_WinterRape.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
DK_WOSR_FERTI_P
#define DK_WOSR_FERTI_P
Definition: DK_WinterRape.h:34
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_wosr_ferti_s3
Definition: DK_WinterRape.h:53
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
dk_wosr_herbicide1
Definition: DK_WinterRape.h:52
DK_WOSR_ROW_CULT
#define DK_WOSR_ROW_CULT
Definition: DK_WinterRape.h:35
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: FarmFuncs.cpp:1350
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
dk_wosr_ferti_s6
Definition: DK_WinterRape.h:59
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_wosr_row_cultivation3
Definition: DK_WinterRape.h:65
dk_wosr_herbicide3
Definition: DK_WinterRape.h:67
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001