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

DE_WinterRape class
. More...

#include <DE_WinterRape.h>

Inheritance diagram for DE_WinterRape:
Crop

Public Member Functions

virtual bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 The one and only method for a crop management plan. All farm actions go through here. More...
 
 DE_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...
 

Detailed Description

DE_WinterRape class
.

See DE_WinterRape.h::DE_WinterRapeToDo for a complete list of all possible events triggered codes by the WinterRape management plan. When triggered these events are handled by Farm and are available as information for other objects such as animal and bird models.

Constructor & Destructor Documentation

◆ DE_WinterRape()

DE_WinterRape::DE_WinterRape ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline

When we start it off, the first possible date for a farm operation is 15th September This information is used by other crops when they decide how much post processing of the management is allowed after harvest before the next crop starts.

115  : Crop(a_tov, a_toc, a_L)
116  {
122  m_first_date=g_date->DayInYear( 20,8 );
124  }

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

Member Function Documentation

◆ Do()

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

The one and only method for a crop management plan. All farm actions go through here.

Called every time something is done to the crop by the farmer in the first instance it is always called with m_ev->todo set to start, but susequently will be called whenever the farmer wants to carry out a new operation.
This method details all the management and relationships between operations necessary to grow and ALMaSS crop - in this case conventional winter wheat.

Reimplemented from Crop.

88 {
89 /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
90  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
91  m_field = a_field;
92  m_ev = a_ev;
93  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
94  bool flag = false;
95  int d1 = 0;
96  int noDates = 1;
97  TTypesOfVegetation l_tov = tov_DEWinterRape; // The current type - change to match the crop you have
98 /**********************************************To Here *************************************************************************/
99 
100  // Depending what event has occured jump to the correct bit of code
101  switch (m_ev->m_todo)
102  {
103  case de_wr_start:
104  {
106 
107  m_last_date = g_date->DayInYear(15, 8); // Should match the last flexdate below
108  //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
109  std::vector<std::vector<int>> flexdates(2 + 1, std::vector<int>(2, 0));
110  // Set up the date management stuff
111  // Start and stop dates for all events after harvest
112  flexdates[0][1] = g_date->DayInYear(10, 8); // last possible day of harvest - this is in effect day before the earliest date that a following crop can use
113  // Now these are done in pairs, start & end for each operation. If its not used then -1
114  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
115  flexdates[1][1] = g_date->DayInYear(15, 8); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
116  flexdates[2][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
117  flexdates[2][1] = g_date->DayInYear(15, 8); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 2)
118 
119  // Below if this is a spring crop use 365, otherwise set this to 0, second parameter is fixed, and the third is the start up operation in the first year
120  int isSpring = 0;
121  if (StartUpCrop(isSpring, flexdates, int(de_wr_herbicide3))) break;
122 
123  // End single block date checking code. Please see next line comment as well.
124  // Reinit d1 to first possible starting date.
125  d1 = g_date->OldDays() + g_date->DayInYear(10, 7) + isSpring;
126  // OK, let's go.
128  break;
129  }
130  break;
131 
132  // This is the first real farm operation
134  if (!m_farm->StubbleHarrowing(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
136  break;
137  }
138  d1 = g_date->Date() + 1;
139  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
140  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
141  }
142  if (m_farm->IsStockFarmer()) //Stock Farmer
143  {
145  }
146  else SimpleEvent_(d1, de_wr_ferti_p1, false, m_farm, m_field);
147  break;
148  case de_wr_ferti_p1:
149  if (m_ev->m_lock || m_farm->DoIt(50))
150  {
151  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
153  break;
154  }
155  }
157  break;
158  case de_wr_ferti_s1:
159  if (m_ev->m_lock || m_farm->DoIt(50))
160  {
161  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
163  break;
164  }
165  }
167  break;
168  case de_wr_autumn_plough:
169  if (m_ev->m_lock || m_farm->DoIt(40))
170  {
171  if (!m_farm->AutumnPlough(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
173  break;
174  }
175  else
176  {
177  // Queue up the next event and if it's late (after 15/8) it has to be rolling, else next fertilizer
178  d1 = g_date->OldDays() + g_date->DayInYear(15, 8);
179  if (g_date->Date() > d1)
180  {
182  break;
183  }
184  else
185  {
186  if (m_farm->IsStockFarmer()) //Stock Farmer
187  {
189  }
191  break;
192  }
193  }
194  }
196  break;
197  case de_wr_autumn_roll:
198  if (!m_farm->AutumnRoll(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
200  break;
201  }
202  if (m_farm->IsStockFarmer()) //Stock Farmer
203  {
205  }
207  break;
209  // the rest 60% who did not plough do heavy stubble cultivation
212  break;
213  }
214  if (m_farm->IsStockFarmer()) //Stock Farmer
215  {
217  }
219  break;
220  case de_wr_ferti_p2:
221  if (m_ev->m_lock || m_farm->DoIt(20))
222  {
223  if (!m_farm->FP_K(m_field, 0.0, g_date->DayInYear(3, 9) - g_date->DayInYear())) {
225  break;
226  }
227  }
229  break;
230  case de_wr_ferti_s2:
231  if (m_ev->m_lock || m_farm->DoIt(20))
232  {
233  if (!m_farm->FA_K(m_field, 0.0, g_date->DayInYear(3, 9) - g_date->DayInYear())) {
235  break;
236  }
237  }
239  break;
241  // 90% will do preseeding cultivation, the rest will do only harrowing
242  if (m_ev->m_lock || m_farm->DoIt(90))
243  {
246  break;
247  }
248  d1 = g_date->Date() + 1;
249  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 8)) {
250  d1 = g_date->OldDays() + g_date->DayInYear(20, 8);
251  }
253  break;
254  }
256  break;
258  // 10% will do only harrowing
259  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->DayInYear(4, 9) - g_date->DayInYear())) {
261  break;
262  }
263  d1 = g_date->Date() + 1;
264  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 8)) {
265  d1 = g_date->OldDays() + g_date->DayInYear(20, 8);
266  }
268  break;
269  case de_wr_autumn_sow:
270  if (!m_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(5, 9) - g_date->DayInYear())) {
272  break;
273  }
274  // Here is a fork leading to four parallel events
275  SimpleEvent_(g_date->Date() + 1, de_wr_herbicide1, false, m_farm, m_field); // Herbidide thread = MAIN THREAD
276  d1 = g_date->Date() + 10;
277  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 9)) {
278  d1 = g_date->OldDays() + g_date->DayInYear(20, 9);
279  }
280  SimpleEvent_(d1, de_wr_fungicide1, false, m_farm, m_field); // Fungicide thread
281  SimpleEvent_(d1 + m_date_modifier, de_wr_insecticide1, false, m_farm, m_field); // Insecticide thread
282  SimpleEvent_(d1, de_wr_molluscicide, false, m_farm, m_field); // Snail thread; should be with biomass>0 condition
283  if (m_farm->IsStockFarmer()) // N thread
284  {
285  SimpleEvent_(d1 = g_date->Date() + 10, de_wr_ferti_s3, false, m_farm, m_field);
286  }
287  else SimpleEvent_(d1 = g_date->Date() + 10, de_wr_ferti_p3, false, m_farm, m_field);
288  if (m_farm->IsStockFarmer()) // Microelements thread
289  {
291  }
293  break;
294  case de_wr_ferti_p3:
295  if (m_ev->m_lock || m_farm->DoIt(50))
296  {
297  if (m_field->GetGreenBiomass() <= 0) {
299  }
300  else
301  {
302  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
304  break;
305  }
306  }
308  break;
309  }
311  break;
312  case de_wr_ferti_s3:
313  if (m_ev->m_lock || m_farm->DoIt(50))
314  {
315  if (m_field->GetGreenBiomass() <= 0) {
317  }
318  else
319  {
320  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
322  break;
323  }
324  }
326  break;
327  }
329  break;
330  case de_wr_ferti_p4:
331  if (m_ev->m_lock || m_farm->DoIt(90))
332  {
333  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
335  break;
336  }
337  }
338  // End of thread
339  break;
340  case de_wr_ferti_s4:
341  if (m_ev->m_lock || m_farm->DoIt(90))
342  {
343  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
345  break;
346  }
347  }
348  // End of thread
349  break;
350  case de_wr_ferti_p5:
351  // Here comes the microelements thread
352  if (m_ev->m_lock || m_farm->DoIt(70))
353  {
354  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear())) {
356  break;
357  }
358  }
359  // End of thread
360  break;
361  case de_wr_ferti_s5:
362  if (m_ev->m_lock || m_farm->DoIt(70))
363  {
364  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear())) {
366  break;
367  }
368  }
369  // End of thread
370  break;
371  case de_wr_herbicide1: // The first of the pesticide managements.
372  // Here comes the herbicide thread
373  if (m_ev->m_lock || m_farm->DoIt(95))
374  {
375  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(5, 10) - g_date->DayInYear())) {
377  break;
378  }
379  }
381  break;
382  case de_wr_herbicide2:
383  if (m_ev->m_lock || m_farm->DoIt(30))
384  {
385  if (m_field->GetGreenBiomass() <= 0) { // spraying should be after the rape emergence
387  break;
388  }
389  else
390  {
391  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
393  break;
394  }
395  }
396  }
398  break;
399  case de_wr_herbicide3:
400  if (m_ev->m_lock || m_farm->DoIt(99))
401  {
402  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
404  break;
405  }
406  }
408  break;
409  case de_wr_fungicide1:
410  // Here comes the fungicide thread
411  if (m_ev->m_lock || m_farm->DoIt(99))
412  {
413  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(5, 10) - g_date->DayInYear())) {
415  break;
416  }
417  }
419  break;
420  case de_wr_fungicide2:
421  if (m_ev->m_lock || m_farm->DoIt(99))
422  {
423  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
425  break;
426  }
427  }
429  break;
430  case de_wr_fungicide3:
431  if (m_ev->m_lock || m_farm->DoIt(50))
432  {
433  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
435  break;
436  }
437  }
438  // End of thread
439  break;
440  case de_wr_insecticide1:
441 #ifdef ECOSTACK_BIOPESTICIDE
442  // Here comes the insecticide thread
443  if (m_ev->m_lock || m_farm->DoIt(90))
444 #else
445  if (m_ev->m_lock || m_farm->DoIt(90))
446 #endif
447  {
448  if (m_field->GetGreenBiomass() <= 0) {
450  }
451  else
452  {
453  // here we check whether we are using ERA pesticide or not
454  d1 = g_date->DayInYear(5, 10) - g_date->DayInYear();
455  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
456  {
457 #ifdef ECOSTACK_BIOPESTICIDE
458  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
459 #else
460  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
461 #endif
462  }
463  else {
465  }
466  if (!flag) {
468  break;
469  }
470 #ifdef ECOSTACK_BIOPESTICIDE
471  SimpleEvent_(d1 = g_date->Date() + 7, de_wr_insecticide1b, false, m_farm, m_field);
472  SimpleEvent_(d1 = g_date->Date() + 14, de_wr_insecticide2, false, m_farm, m_field);
473  break;
474 #else
475  SimpleEvent_(d1 = g_date->Date() + 14, de_wr_insecticide2, false, m_farm, m_field);
476  break;
477 #endif
478  }
479  }
480  SimpleEvent_(d1 = g_date->Date() + 14, de_wr_insecticide2, false, m_farm, m_field);
481  break;
482 
483 
484 #ifdef ECOSTACK_BIOPESTICIDE
485  case de_wr_insecticide1b:
486  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
487  // here we check whether we are using ERA pesticide or not
488  d1 = g_date->DayInYear(12, 10) - g_date->DayInYear();
489  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
490  if (!flag) {
492  break;
493  }
494  }
495  break; // end of thread
496 #endif
497 
498  case de_wr_insecticide2:
499  // here we check whether we are using ERA pesticide or not
500  d1 = g_date->DayInYear(5, 10) - g_date->DayInYear(); // why is this outside the if statement here?
501 #ifdef ECOSTACK_BIOPESTICIDE
502  if (m_ev->m_lock || m_farm->DoIt(20))
503 #else
504  if (m_ev->m_lock || m_farm->DoIt(10))
505 #endif
506  {
507  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
508  {
509 #ifdef ECOSTACK_BIOPESTICIDE
510  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
511 #else
512  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
513 #endif
514  }
515  else {
517  }
518  if (!flag) {
520  break;
521  }
522  }
523 #ifdef ECOSTACK_BIOPESTICIDE
525  break;
526 #else
528  break;
529 #endif
530  case de_wr_insecticide3:
531  // here we check whether we are using ERA pesticide or not
532  d1 = g_date->DayInYear(5, 10) - g_date->DayInYear();
533 #ifdef ECOSTACK_BIOPESTICIDE
534  if (m_ev->m_lock || m_farm->DoIt(10))
535 #else
536  if (m_ev->m_lock || m_farm->DoIt(5))
537 #endif
538  {
539  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
540  {
541 #ifdef ECOSTACK_BIOPESTICIDE
542  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
543 #else
544  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
545 #endif
546  }
547  else {
549  }
550  if (!flag) {
552  break;
553  }
554  }
556  break;
557  case de_wr_insecticide4:
558  // here we check whether we are using ERA pesticide or not
559  d1 = g_date->DayInYear(30, 3) - g_date->DayInYear();
560 #ifdef ECOSTACK_BIOPESTICIDE
561  if (m_ev->m_lock || m_farm->DoIt(90))
562 #else
563  if (m_ev->m_lock || m_farm->DoIt(90))
564 #endif
565  {
566  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
567  {
568 #ifdef ECOSTACK_BIOPESTICIDE
569  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
570 #else
571  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
572 #endif
573  }
574  else {
576  }
577  if (!flag) {
579  break;
580  }
581 #ifdef ECOSTACK_BIOPESTICIDE
583  d1 = g_date->Date() + 14;
584  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 4) + m_date_modifier) {
585  d1 = g_date->OldDays() + g_date->DayInYear(1, 4) + m_date_modifier;
586  }
588  break;
589 #endif
590  }
591  d1 = g_date->Date() + 14;
592  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 4) + m_date_modifier) {
593  d1 = g_date->OldDays() + g_date->DayInYear(1, 4) + m_date_modifier;
594  }
596  break;
597 
598 
599 #ifdef ECOSTACK_BIOPESTICIDE
600  case de_wr_insecticide4b:
601  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
602  // here we check whether we are using ERA pesticide or not
603  d1 = g_date->DayInYear(37, 3) - g_date->DayInYear();
604  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
605  if (!flag) {
607  break;
608  }
609  }
610  break; // end of thread
611 #endif
612 
613  case de_wr_insecticide5:
614  // here we check whether we are using ERA pesticide or not
615  d1 = g_date->DayInYear(30, 4) - g_date->DayInYear();
616 #ifdef ECOSTACK_BIOPESTICIDE
617  if (m_ev->m_lock || m_farm->DoIt(80))
618 #else
619  if (m_ev->m_lock || m_farm->DoIt(80))
620 #endif
621  {
622  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
623  {
624 #ifdef ECOSTACK_BIOPESTICIDE
625  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
626 #else
627  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
628 #endif
629  }
630  else {
632  }
633  if (!flag) {
635  break;
636  }
637 #ifdef ECOSTACK_BIOPESTICIDE
638  SimpleEvent_(d1 = g_date->Date() + 7, de_wr_insecticide5b, false, m_farm, m_field);
639  break;
640 #endif
641  }
642  // End of thread
643  break;
644 
645 #ifdef ECOSTACK_BIOPESTICIDE
646  case de_wr_insecticide5b:
647  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
648  // here we check whether we are using ERA pesticide or not
649  d1 = g_date->DayInYear(37, 4) - g_date->DayInYear();
650  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
651  if (!flag) {
653  break;
654  }
655  }
656  break; // end of thread
657 #endif
658 
659  case de_wr_molluscicide:
660  if (m_ev->m_lock || m_farm->DoIt(30))
661  {
662  if (m_field->GetGreenBiomass() <= 0) { // spraying should be after the rape emergence
664  break;
665  }
666  else
667  {
668  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(5, 10) - g_date->DayInYear())) {
670  break;
671  }
672  }
673  }
674  // End of thread
675  break;
676  case de_wr_harvest:
677  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
679  break;
680  }
682  break;
683 
684  case de_wr_straw_chop:
685  if (m_ev->m_lock || m_farm->DoIt(90))
686  {
687  if (!m_farm->StrawChopping(m_field, 0.0, m_field->GetMDates(1, 1) - g_date->DayInYear())) {
689  break;
690  }
691  done = true;
692  break;
693  }
694  d1 = g_date->Date() + 1;
696  break;
697 
698  case de_wr_haybailing:
699  if (!m_farm->HayBailing(m_field, 0.0, m_field->GetMDates(1, 2) - g_date->DayInYear())) {
701  break;
702  }
703  done = true;
704  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
705  // END of MAIN THREAD
706  break;
707  default:
708  g_msg->Warn(WARN_BUG, "DE_WinterRape::Do(): "
709  "Unknown event type! ", "");
710  exit(1);
711  }
712  return done;
713 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), Farm::BiocideTreat(), cfg_pest_product_amounts, cfg_pest_winterrape_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), de_wr_autumn_harrow1, de_wr_autumn_harrow2, de_wr_autumn_plough, de_wr_autumn_roll, de_wr_autumn_sow, de_wr_ferti_p1, de_wr_ferti_p2, de_wr_ferti_p3, de_wr_ferti_p4, de_wr_ferti_p5, de_wr_ferti_s1, de_wr_ferti_s2, de_wr_ferti_s3, de_wr_ferti_s4, de_wr_ferti_s5, de_wr_fungicide1, de_wr_fungicide2, de_wr_fungicide3, de_wr_harvest, de_wr_haybailing, de_wr_herbicide1, de_wr_herbicide2, de_wr_herbicide3, de_wr_insecticide1, de_wr_insecticide1b, de_wr_insecticide2, de_wr_insecticide3, de_wr_insecticide4, de_wr_insecticide4b, de_wr_insecticide5, de_wr_insecticide5b, de_wr_molluscicide, de_wr_preseeding_cultivator, de_wr_start, de_wr_straw_chop, de_wr_stubble_cultivator_heavy, Farm::DoIt(), Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_K(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FP_AmmoniumSulphate(), Farm::FP_K(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetGreenBiomass(), LE::GetMDates(), Farm::Harvest(), Farm::HayBailing(), 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, Farm::Molluscicide(), Calendar::OldDays(), ppp_1, Farm::PreseedingCultivator(), Farm::ProductApplication(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Crop::StartUpCrop(), Farm::StrawChopping(), Farm::StubbleCultivatorHeavy(), Farm::StubbleHarrowing(), tov_DEWinterRape, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DE_WinterRape::SetUpFarmCategoryInformation ( )
inline
125  {
126  const int elements = 2 + (de_wr_foobar - DE_WINTERRAPE_BASE);
128 
129  FarmManagementCategory catlist[elements] =
130  {
131  fmc_Others, // zero element unused but must be here
132  // ALL THE NECESSARY ENTRIES HERE
133  fmc_Others, // de_wr_start = 1, // Compulsory, must always be 1 (one).
134  fmc_Others, // de_wr_sleep_all_day
135  fmc_Others, // de_wr_event1,
136  fmc_Cultivation, // de_wr_autumn_harrow1,
137  fmc_Fertilizer, // de_wr_ferti_p1,
138  fmc_Fertilizer, // de_wr_ferti_s1,
139  fmc_Cultivation, // de_wr_autumn_plough,
140  fmc_Cultivation, // de_wr_autumn_roll,
141  fmc_Cultivation, // de_wr_stubble_cultivator_heavy,
142  fmc_Fertilizer, // de_wr_ferti_p2,
143  fmc_Fertilizer, // de_wr_ferti_s2,
144  fmc_Cultivation, // de_wr_preseeding_cultivator,
145  fmc_Cultivation, // de_wr_autumn_harrow2,
146  fmc_Cultivation, // de_wr_autumn_sow,
147  fmc_Herbicide, // de_wr_herbicide1,
148  fmc_Herbicide, // de_wr_herbicide2,
149  fmc_Fungicide, // de_wr_fungicide1,
150  fmc_Insecticide, // de_wr_insecticide1,
151  fmc_Insecticide, // de_wr_insecticide2,
152  fmc_Insecticide, // de_wr_insecticide3,
153  fmc_Insecticide, // de_wr_molluscicide,
154  fmc_Fertilizer, // de_wr_ferti_p3,
155  fmc_Fertilizer, // de_wr_ferti_s3,
156  fmc_Fertilizer, // de_wr_ferti_p4,
157  fmc_Fertilizer, // de_wr_ferti_s4,
158  fmc_Fertilizer, // de_wr_ferti_p5,
159  fmc_Fertilizer, // de_wr_ferti_s5,
160  fmc_Herbicide, // de_wr_herbicide3,
161  fmc_Fungicide, // de_wr_fungicide2,
162  fmc_Fungicide, // de_wr_fungicide3,
163  fmc_Insecticide, // de_wr_insecticide4,
164  fmc_Insecticide, // de_wr_insecticide5,
165  fmc_Herbicide, // de_wr_herbicide4,
166  fmc_Harvest, // de_wr_harvest,
167  fmc_Cultivation, // de_wr_straw_chop,
168  fmc_Cultivation, // de_wr_haybailing,
169 
170  // no foobar entry
171 
172  };
173  // Iterate over the catlist elements and copy them to vector
174  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
175 
176  }

References DE_WINTERRAPE_BASE, de_wr_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 DE_WinterRape().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
de_wr_straw_chop
Definition: DE_WinterRape.h:97
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: FarmFuncs.cpp:312
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
de_wr_insecticide5
Definition: DE_WinterRape.h:93
de_wr_herbicide2
Definition: DE_WinterRape.h:75
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
de_wr_insecticide3
Definition: DE_WinterRape.h:80
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
Farm::StubbleCultivatorHeavy
virtual bool StubbleCultivatorHeavy(LE *a_field, double a_user, int a_days)
Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can...
Definition: FarmFuncs.cpp:245
cfg_pest_winterrape_on
CfgBool cfg_pest_winterrape_on
Turn on pesticides for winter rape.
de_wr_ferti_s5
Definition: DE_WinterRape.h:87
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.
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
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
de_wr_fungicide1
Definition: DE_WinterRape.h:76
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
de_wr_insecticide4
Definition: DE_WinterRape.h:91
de_wr_ferti_p3
Definition: DE_WinterRape.h:82
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
de_wr_preseeding_cultivator
Definition: DE_WinterRape.h:71
de_wr_insecticide1
Definition: DE_WinterRape.h:77
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
de_wr_molluscicide
Definition: DE_WinterRape.h:81
de_wr_ferti_s4
Definition: DE_WinterRape.h:85
de_wr_fungicide2
Definition: DE_WinterRape.h:89
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
de_wr_ferti_p5
Definition: DE_WinterRape.h:86
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
DE_WINTERRAPE_BASE
#define DE_WINTERRAPE_BASE
Definition: DE_WinterRape.h:51
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
de_wr_autumn_sow
Definition: DE_WinterRape.h:73
tov_DEWinterRape
Definition: LandscapeFarmingEnums.h:508
CfgBool::value
bool value() const
Definition: Configurator.h:164
de_wr_autumn_plough
Definition: DE_WinterRape.h:66
de_wr_insecticide4b
Definition: DE_WinterRape.h:92
de_wr_ferti_p1
Definition: DE_WinterRape.h:64
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
de_wr_haybailing
Definition: DE_WinterRape.h:98
de_wr_insecticide1b
Definition: DE_WinterRape.h:78
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: FarmFuncs.cpp:1507
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
de_wr_stubble_cultivator_heavy
Definition: DE_WinterRape.h:68
de_wr_harvest
Definition: DE_WinterRape.h:96
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
DE_WinterRape::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_WinterRape.h:125
de_wr_herbicide3
Definition: DE_WinterRape.h:88
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FA_K
virtual bool FA_K(LE *a_field, double a_user, int a_days)
Apply K fertilizer, on a_field owned by stock farmer.
Definition: FarmFuncs.cpp:1038
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
de_wr_herbicide1
Definition: DE_WinterRape.h:74
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
de_wr_autumn_roll
Definition: DE_WinterRape.h:67
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
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::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
Farm::FP_K
virtual bool FP_K(LE *a_field, double a_user, int a_days)
Apply K fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:726
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
de_wr_autumn_harrow1
Definition: DE_WinterRape.h:63
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
de_wr_ferti_s3
Definition: DE_WinterRape.h:83
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
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
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
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
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
de_wr_start
Definition: DE_WinterRape.h:59
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
de_wr_ferti_s2
Definition: DE_WinterRape.h:70
de_wr_autumn_harrow2
Definition: DE_WinterRape.h:72
de_wr_ferti_p2
Definition: DE_WinterRape.h:69
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
de_wr_insecticide5b
Definition: DE_WinterRape.h:94
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
de_wr_fungicide3
Definition: DE_WinterRape.h:90
de_wr_ferti_p4
Definition: DE_WinterRape.h:84
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
de_wr_foobar
Definition: DE_WinterRape.h:99
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
de_wr_ferti_s1
Definition: DE_WinterRape.h:65
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
Crop::SimpleEvent_
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.
Definition: Farm.cpp:751
de_wr_insecticide2
Definition: DE_WinterRape.h:79