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

PLWinterRape class
. More...

#include <PLWinterRape.h>

Inheritance diagram for PLWinterRape:
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...
 
 PLWinterRape (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

PLWinterRape class
.

See PLWinterRape.h::PLWinterRapeToDo for a complete list of all possible events triggered codes by the winter wheat 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

◆ PLWinterRape()

PLWinterRape::PLWinterRape ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
108  : Crop(a_tov, a_toc, a_L)
109  {
110  // When we start it off, the first possible date for a farm operation is 15th August
111  // This information is used by other crops when they decide how much post processing of
112  // the management is allowed after harvest before the next crop starts.
113  m_first_date=g_date->DayInYear( 20,8 );
115  }

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

Member Function Documentation

◆ Do()

bool PLWinterRape::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 rape.

Reimplemented from Crop.

66 {
67  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
68  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
69  m_field = a_field;
70  m_ev = a_ev;
71  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
72  bool flag = false;
73  int d1 = 0;
74  int noDates = 1;
75  TTypesOfVegetation l_tov = tov_PLWinterRape; // The current type - change to match the crop you have
76 /**********************************************To Here *************************************************************************/
77 
78  // Depending what event has occured jump to the correct bit of code
79  switch (m_ev->m_todo)
80  {
81  case pl_wr_start:
82  {
83  // pl_wr_start just sets up all the starting conditions and reference dates that are needed to start a pl_wr
84  PL_WR_FERTI_P1 = false;
85  PL_WR_FERTI_S1 = false;
86  PL_WR_STUBBLE_PLOUGH = false;
87  PL_WR_DECIDE_TO_GR = false;
88  a_field->ClearManagementActionSum();
89  // Set up the date management stuff
90  // The next bit of code just allows for altering dates after harvest if it is necessary
91  // to allow for a crop which starts its management early.
92 
93  // 5 start and stop dates for all 'movable' events for this crop
94  // The first non - moveable date is always 0, 0, then the crop operations are numbered x, 1, x, 2 etc for each subsequent operation. 0, y is the start date and 1, y is the end date.
95 
96  int noDates = 4;
97  m_field->SetMDates(0, 0, g_date->DayInYear(10, 8)); // last possible day of harvest
98  m_field->SetMDates(1, 0, g_date->DayInYear(15, 8)); // last possible day of straw chopping, equal to harvest in this case
99  m_field->SetMDates(0, 1, 0); // start day of hay bailing (not used as it depends on previous treatment)
100  m_field->SetMDates(1, 1, g_date->DayInYear(20, 8)); // end day of hay bailing
101  m_field->SetMDates(0, 2, 0); // start day of RSM
102  m_field->SetMDates(1, 2, g_date->DayInYear(25, 8)); // end day of RSM
103  m_field->SetMDates(0, 3, 0); // start day of calcium application
104  m_field->SetMDates(1, 3, g_date->DayInYear(25, 8)); // end day of calcium application
105  // Can be up to 10 of these. If the shortening code is triggered
106  // then these will be reduced in value to at lowest the value of the "0,0" entry
107 
108  m_field->SetMConstants(0, 1);
109 
110  // Check the next crop for early start, unless it is a spring crop
111  // in which case we ASSUME that no checking is necessary!!!!
112  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
113 
114  //new if: do the check only for non-optimising farms and if year>0. (030713 - m_rotation used only in the hidden year, so I modified the condition from >7 to >0)
115  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
116  if (!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
117 
118  if (m_ev->m_startday > g_date->DayInYear(1, 7)) {
119  if (m_field->GetMDates(0, 0) >= m_ev->m_startday)
120  {
121  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): ", "Harvest too late for the next crop to start!!!");
122  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
123  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
124  }
125  // Now fix any late finishing problems
126  for (int i = 0; i < noDates; i++) {
127  if (m_field->GetMDates(0, i) >= m_ev->m_startday) {
128  m_field->SetMDates(0, i, m_ev->m_startday - 1); //move the starting date
129  }
130  if (m_field->GetMDates(1, i) >= m_ev->m_startday) {
131  m_field->SetMConstants(i, 0); //change the default value of the MConst (=1) to 0 (necessary to correctly execute farm events in case the finishing date (MDate) was moved)
132  m_field->SetMDates(1, i, m_ev->m_startday - 1); //move the finishing date
133  }
134  }
135  }
136  // Now no operations can be timed after the start of the next crop.
137 
138  if (!m_ev->m_first_year) {
139  // Are we before July 1st?
140  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
141  if (g_date->Date() < d1) {
142  // Yes, too early. We assumme this is because the last crop was late
143  printf("Poly: %d\n", m_field->GetPoly());
144  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): ", "Crop start attempt between 1st Jan & 1st July");
145  int prev = m_field->GetLandscape()->BackTranslateVegTypes(m_field->GetOwner()->GetPreviousTov(m_field->GetRotIndex()));
146  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
147  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
148  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
149  }
150  else {
151  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
152  if (g_date->Date() > d1) {
153  // Yes too late - should not happen - raise an error
154  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): ", "Crop start attempt after last possible start date");
155  g_msg->Warn(WARN_BUG, "Previous Crop ", "");
157  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
158  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
159  }
160  }
161  }
162  else {
163  // Is the first year
164  // Some special code to cope with that first start-up year in ALMaSS - ignore for all practical purposes
165  // Code for first spring treatment used
166  if (m_farm->IsStockFarmer()) //Stock Farmer
167  {
169  }
171  break;
172  }
173  }//if
174 
175  // End single block date checking code. Please see next line comment as well.
176  // Reinit d1 to first possible starting date.
177  d1 = g_date->OldDays() + g_date->DayInYear(5, 7);
178  // OK, let's go.
179  // Here we queue up the first event - this differs depending on whether we have a
180  // stock or arable farmer
181  if (m_farm->IsStockFarmer()) { // StockFarmer
183  }
184  else SimpleEvent_(d1, pl_wr_ferti_p1, false, m_farm, m_field);
185  }
186  break;
187 
188  // This is the first real farm operation
189  case pl_wr_ferti_p1:
190  // In total 10% of arable farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
191  // We therefore assume that half of them (5%) do it now
192  if (m_ev->m_lock || m_farm->DoIt(5))
193  {
194  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear()))
195  {
197  break;
198  }
199  else
200  {
201  //Rest of farmers do slurry before autumn plough/stubble cultivation so we need to remeber who already did it
202  PL_WR_FERTI_P1 = true;
203  }
204  }
205  // Queue up the next event -in this case stubble ploughing
207  break;
208  case pl_wr_ferti_s1:
209  // In total 80% of stock farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
210  // We therefore assume that half of them (40%) do it now
211  if (m_ev->m_lock || m_farm->DoIt(40))
212  {
213  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
215  break;
216  }
217  else
218  {
219  //Rest of farmers do slurry before autumn plough/stubble cultivation so we need to remeber who already did it
220  PL_WR_FERTI_S1 = true;
221  }
222  }
223  // Queue up the next event -in this case stubble ploughing
225  break;
227  // 50% will do stubble plough, but rest will get away with non-inversion cultivation
228  if (m_ev->m_lock || m_farm->DoIt(50))
229  {
230  if (!m_farm->StubblePlough(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
232  break;
233  }
234  else
235  {
236  // 50% of farmers will do this, but the other 50% won't so we need to remember whether we are in one or the other group
237  PL_WR_STUBBLE_PLOUGH = true;
238  // Queue up the next event
240  break;
241  }
242  }
244  break;
246  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
248  break;
249  }
251  break;
253  if (m_ev->m_lock || m_farm->DoIt(40))
254  {
255  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->Date() + 7 - g_date->DayInYear())) {
257  break;
258  }
259  }
260  d1 = g_date->Date() + 1;
261  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 7)) {
262  d1 = g_date->OldDays() + g_date->DayInYear(10, 7);
263  }
264  if (m_farm->IsStockFarmer()) //Stock Farmer
265  {
267  }
268  else SimpleEvent_(d1, pl_wr_ferti_p2, false, m_farm, m_field);
269  break;
271  if (!m_farm->StubbleHarrowing(m_field, 0.0, g_date->DayInYear(25, 8) - g_date->DayInYear())) {
273  break;
274  }
275  d1 = g_date->Date() + 1;
276  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 7)) {
277  d1 = g_date->OldDays() + g_date->DayInYear(10, 7);
278  }
279  if (m_farm->IsStockFarmer()) //Stock Farmer
280  {
282  }
283  else SimpleEvent_(d1, pl_wr_ferti_p2, false, m_farm, m_field);
284  break;
285  case pl_wr_ferti_p2:
286  // In total 10% of arable farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
287  // We therefore assume that half of them (5%) do it now (if haven't done before)
288  if ((m_ev->m_lock || m_farm->DoIt(static_cast<int>((5.0/95.0)*100)))&&(PL_WR_FERTI_P1==false))
289  {
290  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
292  break;
293  }
294  }
296  break;
297  case pl_wr_ferti_s2:
298  // In total 80% of stock farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
299  // We therefore assume that half of them (40%) do it now (if haven't done before)
300  if ((m_ev->m_lock || m_farm->DoIt(static_cast<int>((40.0/60.0)*100))) && (PL_WR_FERTI_S1==false))
301  {
302  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
304  break;
305  }
306  }
308  break;
309  case pl_wr_autumn_plough:
310  if (m_ev->m_lock || m_farm->DoIt(80))
311  {
312  if (!m_farm->AutumnPlough(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
314  break;
315  }
316  else
317  {
318  // Queue up the next event and if it's late (after 15/8) it has to be rolling, else next fertilizer
319  d1 = g_date->OldDays() + g_date->DayInYear(15, 8);
320  if (g_date->Date() > d1)
321  {
323  break;
324  }
325  else
326  {
327  if (m_farm->IsStockFarmer()) //Stock Farmer
328  {
330  }
332  break;
333  }
334  }
335  }
337  break;
338  case pl_wr_autumn_roll:
339  if (!m_farm->AutumnRoll(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
341  break;
342  }
343  if (m_farm->IsStockFarmer()) //Stock Farmer
344  {
346  }
348  break;
350  // the rest 20% who did not plough do heavy stubble cultivation
353  break;
354  }
355  if (m_farm->IsStockFarmer()) //Stock Farmer
356  {
358  }
360  break;
361  case pl_wr_ferti_p3:
362  if (m_ev->m_lock || m_farm->DoIt(90))
363  {
364  if (!m_farm->FP_NPKS(m_field, 0.0, g_date->DayInYear(3, 9) - g_date->DayInYear())) {
366  break;
367  }
368  }
370  break;
371  case pl_wr_ferti_s3:
372  if (m_ev->m_lock || m_farm->DoIt(90))
373  {
374  if (!m_farm->FA_NPKS(m_field, 0.0, g_date->DayInYear(3, 9) - g_date->DayInYear())) {
376  break;
377  }
378  }
380  break;
382  // 89% will do preseeding cultivation, the rest will do only harrowing
383  if (m_ev->m_lock || m_farm->DoIt(89))
384  {
387  break;
388  }
390  break;
391  }
393  break;
395  // 11% will do only harrowing
396  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->DayInYear(4, 9) - g_date->DayInYear())) {
398  break;
399  }
401  break;
402  case pl_wr_autumn_sow:
403  if (g_date->DayInYear() < 239) {
405 
406  break;
407  }
408  if (cfg_seedcoating_winterrape_on.value() && a_field->GetLandscape()->SupplyShouldSpray()) {
409  if (!m_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(5, 9) - g_date->DayInYear(),
412  break;
413  }
414  }
415  else {
416  if (!m_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(5, 9) - g_date->DayInYear())) {
418  break;
419  }
420  }
421  // Here is a fork leading to four parallel events
422  SimpleEvent_(g_date->Date() + 1, pl_wr_herbicide1, false, m_farm, m_field); // Herbidide thread = MAIN THREAD
423  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 9), pl_wr_fungicide1, false, m_farm, m_field); // Fungicide thread
424  SimpleEvent_(g_date->Date() + 10 + m_date_modifier, pl_wr_insecticide1, false, m_farm, m_field); // Insecticide thread
425  SimpleEvent_(g_date->Date() + 10, pl_wr_molluscicide, false, m_farm, m_field); // Snail thread; should be with biomass>0 condition
426  if (m_farm->IsStockFarmer()) // N thread
427  {
429  }
430  else SimpleEvent_(g_date->Date() + 10, pl_wr_ferti_p4, false, m_farm, m_field);
431  if (m_farm->IsStockFarmer()) // Microelements thread
432  {
434  }
436  break;
437  case pl_wr_ferti_p4:
438  if (m_ev->m_lock || m_farm->DoIt(50))
439  {
440  if (m_field->GetGreenBiomass() <= 0) {
442  }
443  else
444  {
445  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
447  break;
448  }
449  }
451  break;
452  }
454  break;
455  case pl_wr_ferti_s4:
456  if (m_ev->m_lock || m_farm->DoIt(50))
457  {
458  if (m_field->GetGreenBiomass() <= 0) {
460  }
461  else
462  {
463  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
465  break;
466  }
467  }
469  break;
470  }
472  break;
473  case pl_wr_ferti_p5:
474  if (m_ev->m_lock || m_farm->DoIt(93))
475  {
476  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
478  break;
479  }
480  }
481  d1 = g_date->Date() + 10;
482  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 3)) {
483  d1 = g_date->OldDays() + g_date->DayInYear(20, 3);
484  }
486  break;
487  case pl_wr_ferti_s5:
488  if (m_ev->m_lock || m_farm->DoIt(93))
489  {
490  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
492  break;
493  }
494  }
495  d1 = g_date->Date() + 10;
496  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 3)) {
497  d1 = g_date->OldDays() + g_date->DayInYear(20, 3);
498  }
500  break;
501  case pl_wr_ferti_p6:
502  if (m_ev->m_lock || m_farm->DoIt(91))
503  {
504  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
506  break;
507  }
508  }
509  // End of thread
510  break;
511  case pl_wr_ferti_s6:
512  if (m_ev->m_lock || m_farm->DoIt(91))
513  {
514  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
516  break;
517  }
518  }
519  // End of thread
520  break;
521  case pl_wr_ferti_p7:
522  // Here comes the microelements thread
523  if (m_ev->m_lock || m_farm->DoIt(55))
524  {
525  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear())) {
527  break;
528  }
529  }
531  break;
532  case pl_wr_ferti_s7:
533  if (m_ev->m_lock || m_farm->DoIt(55))
534  {
535  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear())) {
537  break;
538  }
539  }
541  break;
542  case pl_wr_ferti_p8:
543  if (m_ev->m_lock || m_farm->DoIt(58))
544  {
545  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
547  break;
548  }
549  }
550  // End of thread
551  break;
552  case pl_wr_ferti_s8:
553  if (m_ev->m_lock || m_farm->DoIt(58))
554  {
555  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
557  break;
558  }
559  }
560  // End of thread
561  break;
562  case pl_wr_herbicide1: // The first of the pesticide managements.
563  // Here comes the herbicide thread
564  if (m_ev->m_lock || m_farm->DoIt(85))
565  {
566  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->Date() + 3 - g_date->DayInYear())) {
568  break;
569  }
570  }
572  break;
573  case pl_wr_herbicide2:
574  if (m_ev->m_lock || m_farm->DoIt(63))
575  {
576  if (m_field->GetGreenBiomass() <= 0) { // spraying should be after the rape emergence
578  break;
579  }
580  else
581  {
582  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(20, 9) - g_date->DayInYear())) {
584  break;
585  }
586  }
587  }
589  break;
590  case pl_wr_herbicide3:
591  if (m_ev->m_lock || m_farm->DoIt(36))
592  {
593  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
595  break;
596  }
597  }
598  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 7), pl_wr_herbicide4, false, m_farm, m_field); // The last herbicide thread which is desiccation just before the harvest
599  break;
600  case pl_wr_fungicide1:
601  // Here comes the fungicide thread
602  if (m_ev->m_lock || m_farm->DoIt(56))
603  {
604  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(10, 10) - g_date->DayInYear())) {
606  break;
607  }
608  }
610  break;
611  case pl_wr_fungicide2:
612  if (m_ev->m_lock || m_farm->DoIt(63))
613  {
614  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
616  break;
617  }
618  }
620  break;
621  case pl_wr_fungicide3:
622  if (m_ev->m_lock || m_farm->DoIt(64))
623  {
624  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
626  break;
627  }
628  }
629  d1 = g_date->Date() + 14;
630  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 6)) {
631  d1 = g_date->OldDays() + g_date->DayInYear(1, 6);
632  }
634  break;
635  case pl_wr_fungicide4:
636  if (m_ev->m_lock || m_farm->DoIt(15))
637  {
638  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear())) {
640  break;
641  }
642  }
643  // End of thread
644  break;
645  case pl_wr_insecticide1:
646 #ifdef ECOSTACK_BIOPESTICIDE
647  // Here comes the insecticide thread
648  if (m_ev->m_lock || m_farm->DoIt(76))
649 #else
650  if (m_ev->m_lock || m_farm->DoIt(38))
651 #endif
652  {
653  if (m_field->GetGreenBiomass() <= 0) {
655  }
656  else
657  {
658  // here we check whether we are using ERA pesticide or not
659  d1 = g_date->DayInYear(20, 9) - g_date->DayInYear();
660  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
661  {
662 #ifdef ECOSTACK_BIOPESTICIDE
663  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
664 #else
665  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
666 #endif
667  }
668  else {
670  }
671  if (!flag) {
673  break;
674  }
675 #ifdef ECOSTACK_BIOPESTICIDE
676  d1 = g_date->Date() + 7;
677 #else
678  d1 = g_date->Date() + 14;
679 #endif
680  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 9)) {
681  d1 = g_date->OldDays() + g_date->DayInYear(20, 9);
682  }
684  break;
685  }
686  }
687 #ifdef ECOSTACK_BIOPESTICIDE
688  d1 = g_date->Date() + 7;
689 #else
690  d1 = g_date->Date() + 14;
691 #endif
692  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 9)) {
693  d1 = g_date->OldDays() + g_date->DayInYear(20, 9);
694  }
696  break;
697 
698  case pl_wr_insecticide2:
699 #ifdef ECOSTACK_BIOPESTICIDE
700  if (m_ev->m_lock || m_farm->DoIt(56))
701 #else
702  if (m_ev->m_lock || m_farm->DoIt(28))
703 #endif
704  {
705  // here we check whether we are using ERA pesticide or not
706  d1 = g_date->DayInYear(10, 10) - g_date->DayInYear();
707  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
708  {
709 #ifdef ECOSTACK_BIOPESTICIDE
710  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
711 #else
712  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
713 #endif
714  }
715  else {
717  }
718  if (!flag) {
720  break;
721  }
722  }
723 #ifdef ECOSTACK_BIOPESTICIDE
724  d1 = g_date->Date() + 7;
725 #else
726  d1 = g_date->Date() + 14;
727 #endif
728  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 10)) {
729  d1 = g_date->OldDays() + g_date->DayInYear(10, 10);
730  }
732  break;
733 
734  case pl_wr_insecticide3:
735 #ifdef ECOSTACK_BIOPESTICIDE
736  if (m_ev->m_lock || m_farm->DoIt(40))
737 #else
738  if (m_ev->m_lock || m_farm->DoIt(20))
739 #endif
740  {
741  // here we check whether we are using ERA pesticide or not
742  d1 = g_date->DayInYear(15, 11) - g_date->DayInYear();
743  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
744  {
745 #ifdef ECOSTACK_BIOPESTICIDE
746  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
747 #else
748  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
749 #endif
750  }
751  else {
753  }
754  if (!flag) {
756  break;
757  }
758  }
759  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 3) + 365 + m_date_modifier, pl_wr_insecticide4, false, m_farm, m_field); //what to do here with ECOSTACK_BIOPESTICIDE?
760  break;
761 
762  case pl_wr_insecticide4:
763 #ifdef ECOSTACK_BIOPESTICIDE
764  if (m_ev->m_lock || m_farm->DoIt(80))
765 #else
766  if (m_ev->m_lock || m_farm->DoIt(80))
767 #endif
768  {
769  // here we check whether we are using ERA pesticide or not
770  d1 = g_date->DayInYear(30, 3) - g_date->DayInYear();
771  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
772  {
773 #ifdef ECOSTACK_BIOPESTICIDE
774  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
775 #else
776  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
777 #endif
778  }
779  else {
781  }
782  if (!flag) {
784  break;
785  }
786 #ifdef ECOSTACK_BIOPESTICIDE
787  SimpleEvent_(g_date->Date()+7, pl_wr_insecticide4b, false, m_farm, m_field); //what is the difference between using SimpleEvent() and SimpleEvent_()?
788  d1 = g_date->Date() + 14;
789  if (d1 < g_date->OldDays() + g_date->DayInYear(5, 4)) {
790  d1 = g_date->OldDays() + g_date->DayInYear(5, 4);
791  }
793  break;
794 #endif
795  }
796  d1 = g_date->Date() + 14;
797  if (d1 < g_date->OldDays() + g_date->DayInYear(5, 4)) {
798  d1 = g_date->OldDays() + g_date->DayInYear(5, 4);
799  }
801  break;
802 
803 #ifdef ECOSTACK_BIOPESTICIDE
804  case pl_wr_insecticide4b:
805  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
806  // here we check whether we are using ERA pesticide or not
807  d1 = g_date->DayInYear(37, 3) - g_date->DayInYear();
808  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
809  if (!flag) {
811  break;
812  }
813  }
814  break; // end of thread
815 #endif
816 
817  case pl_wr_insecticide5:
818 #ifdef ECOSTACK_BIOPESTICIDE
819  if (m_ev->m_lock || m_farm->DoIt(89))
820 #else
821  if (m_ev->m_lock || m_farm->DoIt(89))
822 #endif
823  {
824  // here we check whether we are using ERA pesticide or not
825  d1 = g_date->DayInYear(30, 4) - g_date->DayInYear();
826  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
827  {
828 #ifdef ECOSTACK_BIOPESTICIDE
829  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
830 #else
831  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
832 #endif
833  }
834  else {
836  }
837  if (!flag) {
839  break;
840  }
841 #ifdef ECOSTACK_BIOPESTICIDE
843  d1 = g_date->Date() + 14;
844  if (d1 < g_date->OldDays() + g_date->DayInYear(5, 5)) {
845  d1 = g_date->OldDays() + g_date->DayInYear(5, 5);
846  }
848  break;
849 #endif
850  }
851  d1 = g_date->Date() + 14;
852  if (d1 < g_date->OldDays() + g_date->DayInYear(5, 5)) {
853  d1 = g_date->OldDays() + g_date->DayInYear(5, 5);
854  }
856  break;
857 
858 #ifdef ECOSTACK_BIOPESTICIDE
859  case pl_wr_insecticide5b:
860  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
861  // here we check whether we are using ERA pesticide or not
862  d1 = g_date->DayInYear(37, 4) - g_date->DayInYear();
863  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
864  if (!flag) {
866  break;
867  }
868  }
869  break; // end of thread
870 #endif
871 
872  case pl_wr_insecticide6:
873 #ifdef ECOSTACK_BIOPESTICIDE
874  if (m_ev->m_lock || m_farm->DoIt(56))
875 #else
876  if (m_ev->m_lock || m_farm->DoIt(56))
877 #endif
878  {
879  // here we check whether we are using ERA pesticide or not
880  d1 = g_date->DayInYear(31, 5) - g_date->DayInYear();
881  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
882  {
883 #ifdef ECOSTACK_BIOPESTICIDE
884  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
885 #else
886  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
887 #endif
888  }
889  else {
891  }
892  if (!flag) {
894  break;
895  }
896 #ifdef ECOSTACK_BIOPESTICIDE
897  SimpleEvent(g_date->Date() + 7, pl_wr_insecticide6b, false);
898  break;
899 #endif
900  }
901  // End of thread
902  break;
903 
904 #ifdef ECOSTACK_BIOPESTICIDE
905  case pl_wr_insecticide6b:
906  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
907  // here we check whether we are using ERA pesticide or not
908  d1 = g_date->DayInYear(38, 5) - g_date->DayInYear();
909  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
910  if (!flag) {
912  break;
913  }
914  }
915  break; // end of thread
916 #endif
917 
918  case pl_wr_molluscicide:
919  if (m_ev->m_lock || m_farm->DoIt(30))
920  {
921  if (m_field->GetGreenBiomass() <= 0) { // spraying should be after the rape emergence
923  break;
924  }
925  else
926  {
927  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(25, 9) - g_date->DayInYear())) {
929  break;
930  }
931  }
932  }
933  // End of thread
934  break;
935  case pl_wr_herbicide4:
936  // Here the MAIN thread continues
937  // This is the desiccation thread with glyphosate or diquat
938  if (m_ev->m_lock || m_farm->DoIt(58))
939  {
940  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 7) - g_date->DayInYear())) {
942  break;
943  }
944  }
945  SimpleEvent_(g_date->Date() + 14, pl_wr_harvest, false, m_farm, m_field);
946  break;
947  case pl_wr_harvest:
948  // We don't move harvest days
949  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(0, 0) - g_date->DayInYear())) {
951  break;
952  }
954  break;
955 
956 
958  if (m_farm->IsStockFarmer()) //Stock Farmer
959  {
960  // 10% of stock farmers will do straw chopping, but rest will do hay bailing instead
961  if (m_ev->m_lock || m_farm->DoIt(10))
962  {
963  if (m_field->GetMConstants(0) == 0) {
964  if (!m_farm->StrawChopping(m_field, 0.0, -1)) { // raise an error
965  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'StrawChopping' execution", "");
966  exit(1);
967  }
968  }
969  else {
970  if (!m_farm->StrawChopping(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
972  break;
973  }
974  else
975  {
976  // Queue up the next event
978  break;
979  }
980  }
981 
982  }
984  break;
985  }
986  else
987  {
988  // 90% of arable farmers will do straw chopping, but rest will do hay bailing instead
989  if (m_ev->m_lock || m_farm->DoIt(90))
990  {
991  if (m_field->GetMConstants(0) == 0) {
992  if (!m_farm->StrawChopping(m_field, 0.0, -1)) { // raise an error
993  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'StrawChopping' execution", "");
994  exit(1);
995  }
996  }
997  else {
998  if (!m_farm->StrawChopping(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
1000  break;
1001  }
1002  else
1003  {
1004  // Queue up the next event
1006  break;
1007  }
1008  }
1009 
1010  }
1012  break;
1013  }
1014  case pl_wr_hay_bailing:
1015  if (m_field->GetMConstants(1) == 0) {
1016  if (!m_farm->HayBailing(m_field, 0.0, -1)) { // raise an error
1017  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'HayBailing' execution", "");
1018  exit(1);
1019  }
1020  }
1021  else {
1022  if (!m_farm->HayBailing(m_field, 0.0, m_field->GetMDates(1,1) - g_date->DayInYear())) {
1024  break;
1025  }
1026  }
1027  if (m_farm->IsStockFarmer()) //Stock Farmer
1028  {
1030  }
1032  break;
1033  case pl_wr_ferti_p9:
1034  if (m_ev->m_lock || m_farm->DoIt(20))
1035  {
1036  if (m_field->GetMConstants(2) == 0) {
1037  if (!m_farm->FP_RSM(m_field, 0.0, -1)) { // raise an error
1038  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'FP_RSM' execution", "");
1039  exit(1);
1040  }
1041  }
1042  else {
1043  if (!m_farm->FP_RSM(m_field, 0.0, m_field->GetMDates(1,2) - g_date->DayInYear())) {
1045  break;
1046  }
1047  }
1048  }
1049  if (m_farm->IsStockFarmer()) //Stock Farmer
1050  {
1052  }
1054  break;
1055  case pl_wr_ferti_s9:
1056  if (m_ev->m_lock || m_farm->DoIt(20))
1057  {
1058  if (m_field->GetMConstants(2) == 0) {
1059  if (!m_farm->FA_RSM(m_field, 0.0, -1)) { // raise an error
1060  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'FA_RSM' execution", "");
1061  exit(1);
1062  }
1063  }
1064  else {
1065  if (!m_farm->FA_RSM(m_field, 0.0, m_field->GetMDates(1, 2) - g_date->DayInYear())) {
1067  break;
1068  }
1069  }
1070  }
1071  if (m_farm->IsStockFarmer()) //Stock Farmer
1072  {
1074  }
1076  break;
1077  case pl_wr_ferti_p10:
1078  if (m_ev->m_lock || m_farm->DoIt(23))
1079  {
1080  if (m_field->GetMConstants(3) == 0) {
1081  if (!m_farm->FP_Calcium(m_field, 0.0, -1)) { // raise an error
1082  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'FP_Calcium' execution", "");
1083  exit(1);
1084  }
1085  }
1086  else {
1087  if (!m_farm->FP_Calcium(m_field, 0.0, m_field->GetMDates(1,3) - g_date->DayInYear())) {
1089  break;
1090  }
1091  }
1092  }
1093  done = true;
1094  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
1095  // END of MAIN THREAD
1096  break;
1097  case pl_wr_ferti_s10:
1098  if (m_ev->m_lock || m_farm->DoIt(23))
1099  {
1100  if (m_field->GetMConstants(3) == 0) {
1101  if (!m_farm->FA_Calcium(m_field, 0.0, -1)) { // raise an error
1102  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): failure in 'FA_Calcium' execution", "");
1103  exit(1);
1104  }
1105  }
1106  else {
1107  if (!m_farm->FA_Calcium(m_field, 0.0, m_field->GetMDates(1, 3) - g_date->DayInYear())) {
1109  break;
1110  }
1111  }
1112  }
1113  done = true;
1114  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
1115  // END of MAIN THREAD
1116  break;
1117  default:
1118  g_msg->Warn(WARN_BUG, "PLWinterRape::Do(): "
1119  "Unknown event type! ", "");
1120  exit(1);
1121  }
1122  return done;
1123 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), Farm::BiocideTreat(), cfg_pest_product_amounts, cfg_pest_winterrape_on, cfg_seedcoating_product_amounts, cfg_seedcoating_winterrape_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_ManganeseSulphate(), Farm::FA_NPKS(), Farm::FA_RSM(), Farm::FA_Slurry(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_ManganeseSulphate(), Farm::FP_NPKS(), Farm::FP_RSM(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetGreenBiomass(), LE::GetMConstants(), LE::GetMDates(), LE::GetOwner(), LE::GetPoly(), Farm::GetPreviousTov(), LE::GetRotIndex(), Farm::GetType(), Calendar::GetYearNumber(), 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_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, FarmEvent::m_startday, FarmEvent::m_todo, Farm::Molluscicide(), Calendar::OldDays(), pl_wr_autumn_harrow1, pl_wr_autumn_harrow2, pl_wr_autumn_harrow3, pl_wr_autumn_plough, pl_wr_autumn_roll, pl_wr_autumn_sow, PL_WR_DECIDE_TO_GR, PL_WR_FERTI_P1, pl_wr_ferti_p1, pl_wr_ferti_p10, pl_wr_ferti_p2, pl_wr_ferti_p3, pl_wr_ferti_p4, pl_wr_ferti_p5, pl_wr_ferti_p6, pl_wr_ferti_p7, pl_wr_ferti_p8, pl_wr_ferti_p9, PL_WR_FERTI_S1, pl_wr_ferti_s1, pl_wr_ferti_s10, pl_wr_ferti_s2, pl_wr_ferti_s3, pl_wr_ferti_s4, pl_wr_ferti_s5, pl_wr_ferti_s6, pl_wr_ferti_s7, pl_wr_ferti_s8, pl_wr_ferti_s9, pl_wr_fungicide1, pl_wr_fungicide2, pl_wr_fungicide3, pl_wr_fungicide4, pl_wr_harvest, pl_wr_hay_bailing, pl_wr_herbicide1, pl_wr_herbicide2, pl_wr_herbicide3, pl_wr_herbicide4, pl_wr_insecticide1, pl_wr_insecticide2, pl_wr_insecticide3, pl_wr_insecticide4, pl_wr_insecticide4b, pl_wr_insecticide5, pl_wr_insecticide5b, pl_wr_insecticide6, pl_wr_insecticide6b, pl_wr_molluscicide, pl_wr_preseeding_cultivator, pl_wr_start, pl_wr_straw_chopping, pl_wr_stubble_cultivator_heavy, pl_wr_stubble_harrow, PL_WR_STUBBLE_PLOUGH, pl_wr_stubble_plough, ppp_1, Farm::PreseedingCultivator(), Farm::ProductApplication(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Farm::StrawChopping(), Farm::StubbleCultivatorHeavy(), Farm::StubbleHarrowing(), Farm::StubblePlough(), tof_OptimisingFarm, tov_PLWinterRape, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void PLWinterRape::SetUpFarmCategoryInformation ( )
inline
116  {
117  const int elements = 2 + (pl_wr_foobar - PLWinterRape_BASE);
119 
120  FarmManagementCategory catlist[elements] =
121  {
122  fmc_Others, // zero element unused but must be here
123  fmc_Others,//pl_wr_start = 1, // Compulsory, must always be 1 (one).
124  fmc_Others,//pl_wr_sleep_all_day = PLWinterRape_BASE,
125  fmc_Fertilizer,//pl_wr_ferti_p1, // 20101
126  fmc_Fertilizer,//pl_wr_ferti_s1,
127  fmc_Cultivation,//pl_wr_stubble_plough,
128  fmc_Cultivation,//pl_wr_autumn_harrow1,
129  fmc_Cultivation,//pl_wr_autumn_harrow2,
130  fmc_Cultivation,//pl_wr_stubble_harrow,
131  fmc_Fertilizer,//pl_wr_ferti_p2,
132  fmc_Fertilizer,//pl_wr_ferti_s2,
133  fmc_Cultivation,//pl_wr_autumn_plough,
134  fmc_Others,//pl_wr_autumn_roll, //20110
135  fmc_Cultivation,//pl_wr_stubble_cultivator_heavy,
136  fmc_Fertilizer,//pl_wr_ferti_p3,
137  fmc_Fertilizer,//pl_wr_ferti_s3,
138  fmc_Cultivation,//pl_wr_preseeding_cultivator,
139  fmc_Cultivation,//pl_wr_autumn_harrow3,
140  fmc_Others,//pl_wr_autumn_sow,
141  fmc_Herbicide,//pl_wr_herbicide1,
142  fmc_Herbicide,//pl_wr_herbicide2,
143  fmc_Fungicide,//pl_wr_fungicide1,
144  fmc_Insecticide,//pl_wr_insecticide1, //20120
145  fmc_Insecticide,//pl_wr_insecticide2,
146  fmc_Insecticide,//pl_wr_insecticide3,
147  fmc_Insecticide,//pl_wr_molluscicide,
148  fmc_Fertilizer,//pl_wr_ferti_p4,
149  fmc_Fertilizer,//pl_wr_ferti_s4,
150  fmc_Fertilizer,//pl_wr_ferti_p5,
151  fmc_Fertilizer,//pl_wr_ferti_s5,
152  fmc_Fertilizer,//pl_wr_ferti_p6,
153  fmc_Fertilizer,//pl_wr_ferti_s6,
154  fmc_Fertilizer,//pl_wr_ferti_p7, //201030
155  fmc_Fertilizer,//pl_wr_ferti_s7,
156  fmc_Fertilizer,//pl_wr_ferti_p8,
157  fmc_Fertilizer,//pl_wr_ferti_s8,
158  fmc_Herbicide,//pl_wr_herbicide3,
159  fmc_Fungicide,//pl_wr_fungicide2,
160  fmc_Fungicide,//pl_wr_fungicide3,
161  fmc_Fungicide,//pl_wr_fungicide4,
162  fmc_Insecticide,//pl_wr_insecticide4,
163  fmc_Insecticide,//pl_wr_insecticide5,
164  fmc_Insecticide,//pl_wr_insecticide6, //20140
165  fmc_Herbicide,//pl_wr_herbicide4,
166  fmc_Harvest,//pl_wr_harvest,
167  fmc_Others,//pl_wr_straw_chopping,
168  fmc_Others,//pl_wr_hay_bailing,
169  fmc_Fertilizer,//pl_wr_ferti_p9,
170  fmc_Fertilizer,//pl_wr_ferti_s9,
171  fmc_Fertilizer,//pl_wr_ferti_p10,
172  fmc_Fertilizer//pl_wr_ferti_s10, //20148
173  };
174  // Iterate over the catlist elements and copy them to vector
175  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
176 
177  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, Crop::m_ManagementCategories, pl_wr_foobar, and PLWinterRape_BASE.

Referenced by PLWinterRape().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pl_wr_fungicide2
Definition: PLWinterRape.h:75
pl_wr_autumn_roll
Definition: PLWinterRape.h:50
PL_WR_FERTI_P1
#define PL_WR_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: PLWinterRape.h:28
pl_wr_insecticide6b
Definition: PLWinterRape.h:83
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
pl_wr_ferti_s1
Definition: PLWinterRape.h:42
pl_wr_autumn_harrow1
Definition: PLWinterRape.h:44
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
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
PL_WR_FERTI_S1
#define PL_WR_FERTI_S1
Definition: PLWinterRape.h:29
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
pl_wr_ferti_p1
Definition: PLWinterRape.h:41
pl_wr_ferti_p3
Definition: PLWinterRape.h:52
pl_wr_ferti_p7
Definition: PLWinterRape.h:70
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
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
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
pl_wr_ferti_s6
Definition: PLWinterRape.h:69
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
tov_PLWinterRape
Definition: LandscapeFarmingEnums.h:233
pl_wr_herbicide2
Definition: PLWinterRape.h:58
pl_wr_insecticide5
Definition: PLWinterRape.h:80
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
pl_wr_ferti_p6
Definition: PLWinterRape.h:68
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: FarmFuncs.cpp:232
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
pl_wr_ferti_p9
Definition: PLWinterRape.h:88
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
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
pl_wr_preseeding_cultivator
Definition: PLWinterRape.h:54
pl_wr_ferti_p5
Definition: PLWinterRape.h:66
pl_wr_insecticide4
Definition: PLWinterRape.h:78
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
cfg_seedcoating_winterrape_on
CfgBool cfg_seedcoating_winterrape_on
Turn on seed coating for winter rape.
pl_wr_start
Definition: PLWinterRape.h:39
pl_wr_ferti_p8
Definition: PLWinterRape.h:72
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_wr_fungicide1
Definition: PLWinterRape.h:59
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
pl_wr_autumn_harrow3
Definition: PLWinterRape.h:55
pl_wr_molluscicide
Definition: PLWinterRape.h:63
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
PLWinterRape::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLWinterRape.h:116
pl_wr_insecticide4b
Definition: PLWinterRape.h:79
pl_wr_insecticide1
Definition: PLWinterRape.h:60
Farm::FA_RSM
virtual bool FA_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1154
pl_wr_insecticide2
Definition: PLWinterRape.h:61
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
cfg_pest_winterrape_on
CfgBool cfg_pest_winterrape_on
Turn on pesticides for winter rape.
pl_wr_ferti_p10
Definition: PLWinterRape.h:90
pl_wr_harvest
Definition: PLWinterRape.h:85
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
pl_wr_herbicide4
Definition: PLWinterRape.h:84
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
pl_wr_autumn_harrow2
Definition: PLWinterRape.h:45
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
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
pl_wr_insecticide6
Definition: PLWinterRape.h:82
pl_wr_ferti_s7
Definition: PLWinterRape.h:71
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
pl_wr_autumn_sow
Definition: PLWinterRape.h:56
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
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
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
pl_wr_fungicide3
Definition: PLWinterRape.h:76
pl_wr_ferti_s3
Definition: PLWinterRape.h:53
pl_wr_stubble_cultivator_heavy
Definition: PLWinterRape.h:51
pl_wr_herbicide3
Definition: PLWinterRape.h:74
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.
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
pl_wr_ferti_s8
Definition: PLWinterRape.h:73
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
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
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
pl_wr_stubble_plough
Definition: PLWinterRape.h:43
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
pl_wr_stubble_harrow
Definition: PLWinterRape.h:46
pl_wr_ferti_s4
Definition: PLWinterRape.h:65
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
pl_wr_foobar
Definition: PLWinterRape.h:92
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
pl_wr_ferti_s10
Definition: PLWinterRape.h:91
pl_wr_ferti_p2
Definition: PLWinterRape.h:47
pl_wr_herbicide1
Definition: PLWinterRape.h:57
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
Farm::FP_RSM
virtual bool FP_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:940
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
pl_wr_fungicide4
Definition: PLWinterRape.h:77
PLWinterRape_BASE
#define PLWinterRape_BASE
Definition: PLWinterRape.h:24
pl_wr_ferti_s5
Definition: PLWinterRape.h:67
pl_wr_straw_chopping
Definition: PLWinterRape.h:86
PL_WR_DECIDE_TO_GR
#define PL_WR_DECIDE_TO_GR
Definition: PLWinterRape.h:31
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pl_wr_autumn_plough
Definition: PLWinterRape.h:49
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
pl_wr_insecticide5b
Definition: PLWinterRape.h:81
pl_wr_ferti_p4
Definition: PLWinterRape.h:64
pl_wr_ferti_s2
Definition: PLWinterRape.h:48
pl_wr_hay_bailing
Definition: PLWinterRape.h:87
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
pl_wr_ferti_s9
Definition: PLWinterRape.h:89
pl_wr_insecticide3
Definition: PLWinterRape.h:62
PL_WR_STUBBLE_PLOUGH
#define PL_WR_STUBBLE_PLOUGH
Definition: PLWinterRape.h:30
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
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
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:630
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
cfg_seedcoating_product_amounts
CfgArray_Double cfg_seedcoating_product_amounts
Amount of seed coating pesticide applied in grams of active substance per hectare for each of the 10 ...