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

PLBeetSpr class
. More...

#include <PLBeetSpr.h>

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

PLBeetSpr class
.

See PLBeetSpr.h::PLBeetSprToDo for a complete list of all possible events triggered codes by the beet 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

◆ PLBeetSpr()

PLBeetSpr::PLBeetSpr ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
88  : Crop(a_tov, a_toc, a_L)
89  {
90  m_first_date=g_date->DayInYear( 31,3 );
92  }

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

Member Function Documentation

◆ Do()

bool PLBeetSpr::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 beet.

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_PLBeetSpr; // 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_bes_start:
82  {
83  // pl_bes_start just sets up all the starting conditions and reference dates that are needed to start a pl_sw
87  PL_BES_HERBI1 = false;
88  PL_BES_HERBI3 = false;
90 
91  // Set up the date management stuff
92  // The next bit of code just allows for altering dates after harvest if it is necessary
93  // to allow for a crop which starts its management early.
94 
95  // 2 start and stop dates for all 'movable' events for this crop
96  int noDates = 2;
97  m_field->SetMDates(0, 0, g_date->DayInYear(30, 12)); // last possible day of harvest
98  m_field->SetMDates(1, 0, g_date->DayInYear(30, 12)); // end day of calcium application
99  m_field->SetMDates(0, 1, 0);
100  m_field->SetMDates(1, 1, g_date->DayInYear(30, 12));
101 
102  m_field->SetMConstants(0, 1);
103 
104  // Check the next crop for early start, unless it is a spring crop
105  // in which case we ASSUME that no checking is necessary!!!!
106  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
107 
108  //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)
109  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
110  if (!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
111 
112  if (m_ev->m_startday > g_date->DayInYear(1, 7)) {
113  if (m_field->GetMDates(0, 0) >= m_ev->m_startday)
114  {
115  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): ", "Harvest too late for the next crop to start!!!");
116  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
117  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
118  }
119  // Now fix any late finishing problems
120  for (int i = 0; i < noDates; i++) {
121  if (m_field->GetMDates(0, i) >= m_ev->m_startday) {
122  m_field->SetMDates(0, i, m_ev->m_startday - 1); //move the starting date
123  }
124  if (m_field->GetMDates(1, i) >= m_ev->m_startday) {
125  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)
126  m_field->SetMDates(1, i, m_ev->m_startday - 1); //move the finishing date
127  }
128  }
129  }
130  // Now no operations can be timed after the start of the next crop.
131 
132  if (!m_ev->m_first_year) {
133  // Are we before July 1st?
134  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
135  if (g_date->Date() < d1) {
136  // Yes, too early. We assumme this is because the last crop was late
137  printf("Poly: %d\n", m_field->GetPoly());
138  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): ", "Crop start attempt between 1st Jan & 1st July");
139  int prev = m_field->GetLandscape()->BackTranslateVegTypes(m_field->GetOwner()->GetPreviousTov(m_field->GetRotIndex()));
140  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
141  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
142  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
143  }
144  else {
145  d1 = g_date->OldDays() + 365 + m_first_date; // Add 365 for spring crop
146  if (g_date->Date() > d1) {
147  // Yes too late - should not happen - raise an error
148  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): ", "Crop start attempt after last possible start date");
149  g_msg->Warn(WARN_BUG, "Previous Crop ", "");
151  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
152  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
153  }
154  }
155  }
156  else {
158  break;
159  }
160  }//if
161 
162  // End single block date checking code. Please see next line comment as well.
163  // Reinit d1 to first possible starting date.
164 
165 
166  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
167  if (g_date->Date() >= d1) d1 += 365;
169  break;
170  }
171  break;
172 
173  // This is the first real farm operation
175  if (!m_farm->SpringPlough(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
177  break;
178  }
179 
181  break;
183  if (!m_farm->SpringHarrow(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
185  break;
186  }
187  d1 = g_date->Date() + 1;
188  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 3)) {
189  d1 = g_date->OldDays() + g_date->DayInYear(15, 3);
190  }
191  if (m_farm->IsStockFarmer()) //Stock Farmer
192  {
194  }
195  else SimpleEvent_(d1, pl_bes_ferti_p4, false, m_farm, m_field);
196  break;
197  case pl_bes_ferti_p4:
198  if (m_ev->m_lock || m_farm->DoIt(98))
199  {
200  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
202  break;
203  }
204  PL_BES_SPRING_FERTI = true;
205  }
207  break;
208  case pl_bes_ferti_s4:
209  if (m_ev->m_lock || m_farm->DoIt(98))
210  {
211  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
213  break;
214  }
215  PL_BES_SPRING_FERTI = true;
216  }
218  break;
219  case pl_bes_ferti_p5:
220  if (m_ev->m_lock || m_farm->DoIt(25))
221  {
222  if (!m_farm->FP_PK(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
224  break;
225  }
226  PL_BES_SPRING_FERTI = true;
227  }
229  break;
230  case pl_bes_ferti_s5:
231  if (m_ev->m_lock || m_farm->DoIt(25))
232  {
233  if (!m_farm->FA_PK(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
235  break;
236  }
238  }
240  break;
242  if (PL_BES_SPRING_FERTI == 1)
243  {
246  break;
247  }
248  }
249  d1 = g_date->Date() + 1;
250  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 4)) {
251  d1 = g_date->OldDays() + g_date->DayInYear(1, 4);
252  }
254  break;
256  // 90% will do preseeding cultivation, the rest will do it together with sow
257  if (m_ev->m_lock || m_farm->DoIt(90))
258  {
259  if (!m_farm->PreseedingCultivator(m_field, 0.0, g_date->DayInYear(19, 4) - g_date->DayInYear())) {
261  break;
262  }
264  break;
265  }
267  break;
268  case pl_bes_spring_sow:
269  if (cfg_seedcoating_beet_on.value() && a_field->GetLandscape()->SupplyShouldSpray()) {
270  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear(),
273  break;
274  }
275  }
276  else {
277  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
279  break;
280  }
281  }
282  // Here is a fork leading to four parallel events
283  SimpleEvent_(g_date->Date() + 5, pl_bes_harrow_before_emergence, false, m_farm, m_field); // Harrowing before emergence, followed by thinning after emergence
284  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), pl_bes_watering1, false, m_farm, m_field); // Watering thread
285  SimpleEvent_(g_date->Date() + 5, pl_bes_herbicide1, false, m_farm, m_field); // Herbicide thread
286  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 7), pl_bes_fungicide1, false, m_farm, m_field); // Fungicide thread = MAIN THREAD
287  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 6) + m_date_modifier, pl_bes_insecticide, false, m_farm, m_field); // Insecticide thread
288  if (m_farm->IsStockFarmer()) //Stock Farmer
289  {
290  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(25, 4), pl_bes_ferti_s6, false, m_farm, m_field); // Fertilizers thread
291  }
293  break;
295  // 10% will do preseeding cultivation with sow
298  break;
299  }
300  // Here is a fork leading to four parallel events
301  SimpleEvent_(g_date->Date() + 5, pl_bes_harrow_before_emergence, false, m_farm, m_field); // Harrowing before emergence, followed by thinning after emergence
302  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), pl_bes_watering1, false, m_farm, m_field); // Watering thread
303  SimpleEvent_(g_date->Date() + 5, pl_bes_herbicide1, false, m_farm, m_field); // Herbicide thread
304  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 7), pl_bes_fungicide1, false, m_farm, m_field); // Fungicide thread = MAIN THREAD
305  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 6) + m_date_modifier, pl_bes_insecticide, false, m_farm, m_field); // Insecticide thread
306  if (m_farm->IsStockFarmer()) //Stock Farmer
307  {
308  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), pl_bes_ferti_s6, false, m_farm, m_field); // Fertilizers thread
309  }
311  break;
313  if (m_field->GetGreenBiomass() <= 0)
314  {
315  if (m_ev->m_lock || m_farm->DoIt(3))
316  {
317  if (!m_farm->SpringHarrow(m_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
319  break;
320  }
321  }
323  break;
324  }
325  else {
327  }
328  break;
329  case pl_bes_thinning:
330  if (m_ev->m_lock || m_farm->DoIt(5))
331  {
332  if (m_field->GetGreenBiomass() <= 0) {
334  }
335  else
336  {
337  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(5, 5) - g_date->DayInYear())) {
339  break;
340  }
341  }
342  }
343  // End of thread
344  break;
345  case pl_bes_watering1:
346  if (m_ev->m_lock || m_farm->DoIt(3))
347  {
348  if (m_field->GetGreenBiomass() <= 0) {
350  }
351  else
352  {
353  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
355  break;
356  }
358  }
359  d1 = g_date->Date() + 7;
360  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 6)) {
361  d1 = g_date->OldDays() + g_date->DayInYear(1, 6);
362  }
364  break;
365  }
366  break;
367 
368  case pl_bes_watering2:
369  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
371  break;
372  }
374  d1 = g_date->Date() + 7;
375  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
376  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
377  }
379  break;
380  case pl_bes_watering3:
381  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
383  break;
384  }
386  // End of thread
387  break;
388  case pl_bes_ferti_p6:
389  // Here comes fertilizers thread
390  if (m_field->GetGreenBiomass() <= 0) {
392  }
393  else
394  {
395  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(25, 5) - g_date->DayInYear())) {
397  break;
398  }
399  d1 = g_date->Date() + 1;
400  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 5)) {
401  d1 = g_date->OldDays() + g_date->DayInYear(20, 5);
402  }
404  break;
405  }
406  break;
407  case pl_bes_ferti_s6:
408  if (m_field->GetGreenBiomass() <= 0) {
410  }
411  else
412  {
413  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(25, 5) - g_date->DayInYear())) {
415  break;
416  }
417  d1 = g_date->Date() + 1;
418  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 5)) {
419  d1 = g_date->OldDays() + g_date->DayInYear(20, 5);
420  }
422  break;
423  }
424  break;
425  case pl_bes_ferti_p7:
426  if (m_ev->m_lock || m_farm->DoIt(89))
427  {
428  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
430  break;
431  }
432  }
433  // End of thread
434  break;
435  case pl_bes_ferti_s7:
436  if (m_ev->m_lock || m_farm->DoIt(89))
437  {
438  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
440  break;
441  }
442  }
443  // End of thread
444  break;
445  case pl_bes_herbicide1: // The first of the pesticide managements.
446  // Here comes the herbicide thread
447  // We assume that farmers do max 3 herbicide treatments
448  if (m_field->GetGreenBiomass() <= 0)
449  {
450  if (m_ev->m_lock || m_farm->DoIt(43))
451  {
452  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
454  break;
455  }
456  PL_BES_HERBI1 = true;
458  }
460  break;
461  }
463  break;
464  case pl_bes_herbicide2:
465  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
467  break;
468  }
471  break;
472  case pl_bes_herbicide3:
473  if (m_ev->m_lock || m_farm->DoIt(93))
474  {
475  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
477  break;
478  }
480  PL_BES_HERBI3 = true;
481  }
483  break;
484  case pl_bes_herbicide4:
485  if (m_ev->m_lock || (m_farm->DoIt(81) && (PL_BES_HERBI1 == false || PL_BES_HERBI3 == false))) // which gives 46% of all farmers (and 81% of those who did not apply herbicides before beet emergence)
486  {
487  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear())) {
489  break;
490  }
492  }
493  // End of thread
494  break;
495  case pl_bes_fungicide1:
496  // Here comes the fungicide thread
497  if (m_ev->m_lock || m_farm->DoIt(83))
498  {
499  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(5, 8) - g_date->DayInYear())) {
501  break;
502  }
503  }
505  break;
506  case pl_bes_fungicide2:
507  if (m_ev->m_lock || m_farm->DoIt(63))
508  {
509  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(25, 8) - g_date->DayInYear())) {
511  break;
512  }
513  }
515  break;
516  case pl_bes_insecticide:
517  // Here comes the insecticide thread
518 
519  if (PL_BES_HERBI_DATE >= g_date->Date() - 2) { // Should by at least 3 days after herbicide
521  }
522  else
523  {
524  if (m_ev->m_lock || m_farm->DoIt(58))
525  {
526  // here we check whether we are using ERA pesticide or not
527  d1 = g_date->DayInYear(25, 7) - g_date->DayInYear();
528  if (!cfg_pest_beet_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
529  {
530  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
531  }
532  else {
533  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
534  }
535  if (!flag) {
537  break;
538  }
539  }
540  }
541  // End of thread
542  break;
543  case pl_bes_harvest:
544  // Here the MAIN thread continues
545  // We don't move harvest days
546  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(0, 0) - g_date->DayInYear())) {
548  break;
549  }
550  if (m_farm->IsStockFarmer()) //Stock Farmer
551  {
553  }
554  else SimpleEvent_(g_date->Date() + 1, pl_bes_ferti_p8, false, m_farm, m_field);
555  break;
556 
557  case pl_bes_ferti_p8:
558  if (m_ev->m_lock || m_farm->DoIt(28))
559  {
560  if (m_field->GetMConstants(3) == 0) {
561  if (!m_farm->FP_Calcium(m_field, 0.0, -1)) { // raise an error
562  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): failure in 'FP_Calcium' execution", "");
563  exit(1);
564  }
565  }
566  else {
567  if (!m_farm->FP_Calcium(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
569  break;
570  }
571  }
572  }
573  done = true;
574  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
575  // END of MAIN THREAD
576  break;
577  case pl_bes_ferti_s8:
578  if (m_ev->m_lock || m_farm->DoIt(28))
579  {
580  if (m_field->GetMConstants(3) == 0) {
581  if (!m_farm->FA_Calcium(m_field, 0.0, -1)) { // raise an error
582  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): failure in 'FA_Calcium' execution", "");
583  exit(1);
584  }
585  }
586  else {
587  if (!m_farm->FA_Calcium(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
589  break;
590  }
591  }
592  }
593  done = true;
594  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
595  // END of MAIN THREAD
596  break;
597  default:
598  g_msg->Warn(WARN_BUG, "PLBeetSpr::Do(): "
599  "Unknown event type! ", "");
600  exit(1);
601  }
602  return done;
603 }

References cfg_pest_beet_on, cfg_pest_product_amounts, cfg_seedcoating_beet_on, cfg_seedcoating_product_amounts, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_ManganeseSulphate(), Farm::FA_PK(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_ManganeseSulphate(), Farm::FP_PK(), 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::HeavyCultivatorAggregate(), 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, Calendar::OldDays(), pl_bes_ferti_p4, pl_bes_ferti_p5, pl_bes_ferti_p6, pl_bes_ferti_p7, pl_bes_ferti_p8, pl_bes_ferti_s4, pl_bes_ferti_s5, pl_bes_ferti_s6, pl_bes_ferti_s7, pl_bes_ferti_s8, pl_bes_fungicide1, pl_bes_fungicide2, pl_bes_harrow_before_emergence, pl_bes_harvest, pl_bes_heavy_cultivator, PL_BES_HERBI1, PL_BES_HERBI3, PL_BES_HERBI_DATE, pl_bes_herbicide1, pl_bes_herbicide2, pl_bes_herbicide3, pl_bes_herbicide4, pl_bes_insecticide, pl_bes_preseeding_cultivator, pl_bes_preseeding_cultivator_sow, PL_BES_SPRING_FERTI, pl_bes_spring_harrow, pl_bes_spring_plough, pl_bes_spring_sow, pl_bes_start, pl_bes_thinning, PL_BES_WATER_DATE, pl_bes_watering1, pl_bes_watering2, pl_bes_watering3, ppp_1, Farm::PreseedingCultivator(), Farm::PreseedingCultivatorSow(), Farm::ProductApplication(), Farm::RowCultivation(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent_(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringSow(), tof_OptimisingFarm, tov_PLBeetSpr, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void PLBeetSpr::SetUpFarmCategoryInformation ( )
inline
93  {
94  const int elements = 2 + (pl_bes_foobar - PLBEETSPR_BASE);
96 
97  FarmManagementCategory catlist[elements] =
98  {
99  fmc_Others, // zero element unused but must be here
100  fmc_Others,//pl_bes_start = 1, // Compulsory, must always be 1 (one).
101  fmc_Others,//pl_bes_sleep_all_day = PLBEETSPR_BASE,
102  fmc_Cultivation,//pl_bes_spring_plough,
103  fmc_Cultivation,//pl_bes_spring_harrow,
104  fmc_Fertilizer,//pl_bes_ferti_p4,
105  fmc_Fertilizer,//pl_bes_ferti_s4,
106  fmc_Fertilizer,//pl_bes_ferti_p5,
107  fmc_Fertilizer,//pl_bes_ferti_s5,
108  fmc_Cultivation,//pl_bes_heavy_cultivator,
109  fmc_Cultivation,//pl_bes_preseeding_cultivator,
110  fmc_Cultivation,//pl_bes_preseeding_cultivator_sow,
111  fmc_Others,//pl_bes_spring_sow,
112  fmc_Cultivation,//pl_bes_harrow_before_emergence,
113  fmc_Others,//pl_bes_thinning,
114  fmc_Watering,//pl_bes_watering1,
115  fmc_Watering,//pl_bes_watering2,
116  fmc_Watering,//pl_bes_watering3,
117  fmc_Herbicide,//pl_bes_herbicide1,
118  fmc_Herbicide,//pl_bes_herbicide2,
119  fmc_Herbicide,//pl_bes_herbicide3,
120  fmc_Herbicide,//pl_bes_herbicide4,
121  fmc_Fungicide,//pl_bes_fungicide1,
122  fmc_Fungicide,//pl_bes_fungicide2,
123  fmc_Insecticide,//pl_bes_insecticide,
124  fmc_Fertilizer,//pl_bes_ferti_p6,
125  fmc_Fertilizer,//pl_bes_ferti_s6,
126  fmc_Fertilizer,//pl_bes_ferti_p7,
127  fmc_Fertilizer,//pl_bes_ferti_s7,
128  fmc_Harvest,//pl_bes_harvest,
129  fmc_Fertilizer,//pl_bes_ferti_p8,
130  fmc_Fertilizer//pl_bes_ferti_s8,
131 
132  };
133  // Iterate over the catlist elements and copy them to vector
134  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
135 
136  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, pl_bes_foobar, and PLBEETSPR_BASE.

Referenced by PLBeetSpr().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
PLBeetSpr::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLBeetSpr.h:93
pl_bes_herbicide4
Definition: PLBeetSpr.h:61
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
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_BES_HERBI1
#define PL_BES_HERBI1
Definition: PLBeetSpr.h:31
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
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
pl_bes_spring_plough
Definition: PLBeetSpr.h:43
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
cfg_pest_beet_on
CfgBool cfg_pest_beet_on
Turn on pesticides for beet.
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
PL_BES_WATER_DATE
#define PL_BES_WATER_DATE
Definition: PLBeetSpr.h:29
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
pl_bes_watering2
Definition: PLBeetSpr.h:56
PL_BES_HERBI3
#define PL_BES_HERBI3
Definition: PLBeetSpr.h:32
Farm::SpringSow
virtual bool SpringSow(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 spring on a_field.
Definition: FarmFuncs.cpp:501
pl_bes_heavy_cultivator
Definition: PLBeetSpr.h:49
pl_bes_ferti_s5
Definition: PLBeetSpr.h:48
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_bes_watering1
Definition: PLBeetSpr.h:55
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_bes_ferti_s6
Definition: PLBeetSpr.h:66
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
CfgBool::value
bool value() const
Definition: Configurator.h:164
PLBEETSPR_BASE
#define PLBEETSPR_BASE
Definition: PLBeetSpr.h:24
PL_BES_HERBI_DATE
#define PL_BES_HERBI_DATE
Definition: PLBeetSpr.h:30
pl_bes_ferti_p6
Definition: PLBeetSpr.h:65
pl_bes_insecticide
Definition: PLBeetSpr.h:64
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
cfg_pest_product_amounts
CfgArray_Double cfg_pest_product_amounts
Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.
pl_bes_herbicide1
Definition: PLBeetSpr.h:58
pl_bes_start
Definition: PLBeetSpr.h:41
pl_bes_spring_sow
Definition: PLBeetSpr.h:52
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_bes_watering3
Definition: PLBeetSpr.h:57
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
pl_bes_ferti_p7
Definition: PLBeetSpr.h:67
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
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_bes_ferti_p5
Definition: PLBeetSpr.h:47
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_bes_preseeding_cultivator_sow
Definition: PLBeetSpr.h:51
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 ...
pl_bes_ferti_p4
Definition: PLBeetSpr.h:45
pl_bes_herbicide2
Definition: PLBeetSpr.h:59
pl_bes_fungicide1
Definition: PLBeetSpr.h:62
pl_bes_thinning
Definition: PLBeetSpr.h:54
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
pl_bes_ferti_s7
Definition: PLBeetSpr.h:68
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
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
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
pl_bes_ferti_p8
Definition: PLBeetSpr.h:70
pl_bes_harvest
Definition: PLBeetSpr.h:69
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
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
pl_bes_spring_harrow
Definition: PLBeetSpr.h:44
cfg_seedcoating_beet_on
CfgBool cfg_seedcoating_beet_on
Turn on seed coating for beet.
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
pl_bes_foobar
Definition: PLBeetSpr.h:72
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_bes_ferti_s8
Definition: PLBeetSpr.h:71
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
pl_bes_harrow_before_emergence
Definition: PLBeetSpr.h:53
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
pl_bes_ferti_s4
Definition: PLBeetSpr.h:46
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pl_bes_herbicide3
Definition: PLBeetSpr.h:60
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
pl_bes_preseeding_cultivator
Definition: PLBeetSpr.h:50
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
PL_BES_SPRING_FERTI
#define PL_BES_SPRING_FERTI
A flag used to indicate autumn ploughing status.
Definition: PLBeetSpr.h:28
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
tov_PLBeetSpr
Definition: LandscapeFarmingEnums.h:248
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
Farm::HeavyCultivatorAggregate
virtual bool HeavyCultivatorAggregate(LE *a_field, double a_user, int a_days)
Carry out a heavy cultivation event on a_field. This is non-inversion type of cultivation which can b...
Definition: FarmFuncs.cpp:259
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
pl_bes_fungicide2
Definition: PLBeetSpr.h:63
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: FarmFuncs.cpp:459
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