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

BEPotatoesSpring class
. More...

#include <BEPotatoesSpring.h>

Inheritance diagram for BEPotatoesSpring:
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...
 
 BEPotatoesSpring (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
- 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

BEPotatoesSpring class
.

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

◆ BEPotatoesSpring()

BEPotatoesSpring::BEPotatoesSpring ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
92  : Crop(a_tov, a_toc, a_L)
93  {
94  // When we start it off, the first possible date for a farm operation is 5th November
95  // This information is used by other crops when they decide how much post processing of
96  // the management is allowed after harvest before the next crop starts.
97  m_first_date=g_date->DayInYear( 30,4 );
98  }

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

Member Function Documentation

◆ Do()

bool BEPotatoesSpring::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 a_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 potatoes.

Reimplemented from Crop.

65 {
66  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
67  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
68  m_field = a_field;
69  m_ev = a_ev;
70  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
71  bool flag = false;
72  int d1 = 0;
73  int noDates = 1;
74  TTypesOfVegetation l_tov = tov_BEPotatoesSpring; // The current type - change to match the crop you have
75  /**********************************************To Here *************************************************************************/
76  // Depending what event has occured jump to the correct bit of code
77  switch (a_ev->m_todo)
78  {
79  case BE_pots_start:
80  {
81  // BE_pots_start just sets up all the starting conditions and reference dates that are needed to start a BE_pot
82  BE_POTS_HERBI = false;
83  BE_POTS_FUNGI1 = false;
84  BE_POTS_FUNGI2 = false;
85  BE_POTS_FUNGI3 = false;
86  BE_POTS_FUNGI4 = false;
87  BE_POTS_FUNGI5 = false;
88 
89 
90  // Set up the date management stuff
91  // The next bit of code just allows for altering dates after harvest if it is necessary
92  // to allow for a crop which starts its management early.
93 
94  // 2 start and stop dates for all 'movable' events for this crop
95  int noDates = 1;
96  a_field->SetMDates(0, 0, g_date->DayInYear(30, 10)); // last possible day of harvest
97  a_field->SetMDates(1, 0, g_date->DayInYear(30, 10));
98 
99 
100  a_field->SetMConstants(0, 1);
101 
102  // Check the next crop for early start, uBEess it is a spring crop
103  // in which case we ASSUME that no checking is necessary!!!!
104  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
105 
106  //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)
107  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
108  if (!(a_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
109 
110  if (a_ev->m_startday > g_date->DayInYear(1, 7)) {
111  if (a_field->GetMDates(0, 0) >= a_ev->m_startday)
112  {
113  g_msg->Warn(WARN_BUG, "BEPotatoesSpring::Do(): ", "Harvest too late for the next crop to start!!!");
114  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
115  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
116  }
117  // Now fix any late finishing problems
118  for (int i = 0; i < noDates; i++) {
119  if (a_field->GetMDates(0, i) >= a_ev->m_startday) {
120  a_field->SetMDates(0, i, a_ev->m_startday - 1); //move the starting date
121  }
122  if (a_field->GetMDates(1, i) >= a_ev->m_startday) {
123  a_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)
124  a_field->SetMDates(1, i, a_ev->m_startday - 1); //move the finishing date
125  }
126  }
127  }
128  // Now no operations can be timed after the start of the next crop.
129 
130  if (!a_ev->m_first_year) {
131  d1 = g_date->OldDays() + 365 + m_first_date; // Add 365 for spring crop
132  if (g_date->Date() > d1) {
133  // Yes too late - should not happen - raise an error
134  g_msg->Warn(WARN_BUG, "BEPotatoesSpring::Do(): ", "Crop start attempt after last possible start date");
135  int prev = a_field->GetLandscape()->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousTov(a_field->GetRotIndex()));
136  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
137  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
138  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
139  exit(1);
140  }
141  }
142  else {
143  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4), BE_pots_spring_planting, false, a_farm, a_field);
144  break;
145  }
146  }//if
147 
148  // End single block date checking code. Please see next line comment as well.
149  // Reinit d1 to first possible starting date.
150  d1 = g_date->OldDays() + g_date->DayInYear(15, 3);
151  if (g_date->Date() >= d1) d1 += 365;
152  // OK, let's go.
153  // Here we queue up the first event - this differs depending on whether we have field on snady or clay soils
154  if (a_field->GetSoilType() <= 5 || a_field->GetSoilType() == 7) { // on sandy soils (BE ZAND & LOSS)
155  SimpleEvent_(d1, BE_pots_spring_plough_sandy, false, a_farm, a_field);
156  }
157  else
158  {
159  d1 = g_date->OldDays() + g_date->DayInYear(10, 4);
160  if (g_date->Date() >= d1) d1 += 365;
161  if (a_farm->IsStockFarmer()) //Stock Farmer
162  {
163  SimpleEvent_(d1, BE_pots_ferti_s2_clay, false, a_farm, a_field);
164  }
165  else SimpleEvent_(d1, BE_pots_ferti_p2_clay, false, a_farm, a_field);
166  }
167  }
168  break;
169 
170  // This is the first real farm operation
172  if (!a_farm->SpringPlough(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
173  SimpleEvent_(g_date->Date() + 1, BE_pots_spring_plough_sandy, true, a_farm, a_field);
174  break;
175  }
176  d1 = g_date->Date() + 7;
177  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 4)) {
178  d1 = g_date->OldDays() + g_date->DayInYear(10, 4);
179  }
180  if (a_farm->IsStockFarmer()) //Stock Farmer
181  {
182  SimpleEvent_(d1, BE_pots_ferti_s2_sandy, false, a_farm, a_field);
183  }
184  else SimpleEvent_(d1, BE_pots_ferti_p2_sandy, false, a_farm, a_field);
185  break;
187  if (a_ev->m_lock || a_farm->DoIt_prob(0.50))
188  {
189  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
190  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_p2_sandy, true, a_farm, a_field);
191  break;
192  }
193  }
194  SimpleEvent_(g_date->Date(), BE_pots_bed_forming, false, a_farm, a_field);
195  break;
197  if (a_ev->m_lock || a_farm->DoIt_prob(0.50))
198  {
199  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
200  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_s2_sandy, true, a_farm, a_field);
201  break;
202  }
203  }
204  SimpleEvent_(g_date->Date(), BE_pots_bed_forming, false, a_farm, a_field);
205  break;
207  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
208  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_p2_clay, true, a_farm, a_field);
209  break;
210  }
211  SimpleEvent_(g_date->Date(), BE_pots_bed_forming, false, a_farm, a_field);
212  break;
214  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
215  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_s2_clay, true, a_farm, a_field);
216  break;
217  }
218  SimpleEvent_(g_date->Date(), BE_pots_bed_forming, false, a_farm, a_field);
219  break;
220  case BE_pots_bed_forming:
221  if (!a_farm->BedForming(a_field, 0.0, g_date->DayInYear(9, 5) - g_date->DayInYear())) {
222  SimpleEvent_(g_date->Date() + 1, BE_pots_bed_forming, true, a_farm, a_field);
223  break;
224  }
225  SimpleEvent_(g_date->Date(), BE_pots_spring_planting, false, a_farm, a_field);
226  break;
228  if (!a_farm->SpringSow(a_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear())) {
229  SimpleEvent_(g_date->Date() + 1, BE_pots_spring_planting, true, a_farm, a_field);
230  break;
231  }
232  // Here is a fork leading to four parallel events
233  SimpleEvent_(g_date->Date() + 14, BE_pots_hilling1, false, a_farm, a_field); // Hilling + herbicides = MAIN THREAD
234  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 6), BE_pots_fungicide1, false, a_farm, a_field); // Fungicide thread
235  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 6) + m_date_modifier, BE_pots_insecticide, false, a_farm, a_field); // Insecticide thread
236  if (a_farm->IsStockFarmer()) //Stock Farmer // N thread
237  {
238  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_s3_clay, false, a_farm, a_field);
239  }
240  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_p3_clay, false, a_farm, a_field);
241  if (a_farm->IsStockFarmer()) //Stock Farmer // microelements thread
242  {
243  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_s4, false, a_farm, a_field);
244  }
245  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_p4, false, a_farm, a_field);
246  break;
248  if (a_field->GetSoilType() == 6 || a_field->GetSoilType() ==8)// on clay soils (BE KLEI & VEEN)
249  {
250  if (a_ev->m_lock || a_farm->DoIt_prob(0.25))
251  {
252  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
253  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_p3_clay, true, a_farm, a_field);
254  break;
255  }
256  }
257  // End of thread
258  break;
259  }
260  if (a_farm->IsStockFarmer()) //Stock Farmer // N thread
261  {
262  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_s3_sandy, false, a_farm, a_field);
263  }
264  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_p3_sandy, false, a_farm, a_field);
265  break;
267  if (a_field->GetSoilType() == 6 || a_field->GetSoilType() ==8)// on clay soils (BE KLEI & VEEN)
268  {
269  if (a_ev->m_lock || a_farm->DoIt_prob(0.25))
270  {
271  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
272  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_s3_clay, true, a_farm, a_field);
273  break;
274  }
275  }
276  // End of thread
277  break;
278  }
279  if (a_farm->IsStockFarmer()) //Stock Farmer // N thread
280  {
281  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_s3_sandy, false, a_farm, a_field);
282  }
283  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 6), BE_pots_ferti_p3_sandy, false, a_farm, a_field);
284  break;
286  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
287  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_p3_sandy, true, a_farm, a_field);
288  break;
289  }
290  // End of thread
291  break;
292 
294  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
295  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_s3_sandy, true, a_farm, a_field);
296  break;
297  }
298  // End of thread
299  break;
300 
301  case BE_pots_ferti_p4:
302  if (a_ev->m_lock || a_farm->DoIt_prob(0.25))
303  {
304  if (!a_farm->FP_ManganeseSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
305  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_p4, true, a_farm, a_field);
306  break;
307  }
308  }
309  // End of thread
310  break;
311  case BE_pots_ferti_s4:
312  if (a_ev->m_lock || a_farm->DoIt_prob(0.25))
313  {
314  if (!a_farm->FA_ManganeseSulphate(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
315  SimpleEvent_(g_date->Date() + 1, BE_pots_ferti_s4, true, a_farm, a_field);
316  break;
317  }
318  }
319  // End of thread
320  break;
321  case BE_pots_hilling1:
322  if (!a_farm->HillingUp(a_field, 0.0, g_date->DayInYear(25, 5) - g_date->DayInYear())) {
323  SimpleEvent_(g_date->Date() + 1, BE_pots_hilling1, true, a_farm, a_field);
324  break;
325  }
326  SimpleEvent_(g_date->Date() + 3, BE_pots_herbicide1, false, a_farm, a_field);
327  break;
328  case BE_pots_herbicide1:
329  if (a_ev->m_lock || a_farm->DoIt_prob(0.80))
330  {
331  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
332  SimpleEvent_(g_date->Date() + 1, BE_pots_herbicide1, true, a_farm, a_field);
333  break;
334  }
335  BE_POTS_HERBI = true;
336  }
337  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 9), BE_pots_dessication1, false, a_farm, a_field);
338  break;
340  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
341  SimpleEvent_(g_date->Date() + 1, BE_pots_dessication1, true, a_farm, a_field);
342  break;
343  }
344  SimpleEvent_(g_date->Date() + 5, BE_pots_dessication2, false, a_farm, a_field);
345  break;
346 
348  if (a_ev->m_lock || a_farm->DoIt_prob(0.75))
349  {
350  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(1, 10) - g_date->DayInYear())) {
351  SimpleEvent_(g_date->Date() + 1, BE_pots_dessication2, true, a_farm, a_field);
352  break;
353  }
354  }
355  SimpleEvent_(g_date->Date() + 10, BE_pots_harvest, false, a_farm, a_field);
356  break;
357  case BE_pots_fungicide1:
358  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(7, 6) - g_date->DayInYear())) {
359  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide1, true, a_farm, a_field);
360  break;
361  }
362  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide2, false, a_farm, a_field);
363  break;
364  case BE_pots_fungicide2:
365  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(14, 6) - g_date->DayInYear())) {
366  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide2, true, a_farm, a_field);
367  break;
368  }
369  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide3, false, a_farm, a_field);
370  break;
371  case BE_pots_fungicide3:
372  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(21, 6) - g_date->DayInYear())) {
373  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide3, true, a_farm, a_field);
374  break;
375  }
376  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide4, false, a_farm, a_field);
377  break;
378  case BE_pots_fungicide4:
379  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
380  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide4, true, a_farm, a_field);
381  break;
382  }
383  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide5, false, a_farm, a_field);
384  break;
385  case BE_pots_fungicide5:
386  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(7, 7) - g_date->DayInYear())) {
387  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide5, true, a_farm, a_field);
388  break;
389  }
390  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide6, false, a_farm, a_field);
391  break;
392  case BE_pots_fungicide6:
393  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
394  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide6, true, a_farm, a_field);
395  break;
396  }
397  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide7, false, a_farm, a_field);
398  break;
399  case BE_pots_fungicide7:
400  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(21, 7) - g_date->DayInYear())) {
401  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide7, true, a_farm, a_field);
402  break;
403  }
404  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide8, false, a_farm, a_field);
405  break;
406  case BE_pots_fungicide8:
407  if (a_ev->m_lock || a_farm->DoIt_prob(0.80))
408  {
409  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
410  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide8, true, a_farm, a_field);
411  break;
412  }
413  BE_POTS_FUNGI1 = true;
414  }
415  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide9, false, a_farm, a_field);
416  break;
417  case BE_pots_fungicide9:
418  if (a_ev->m_lock || (a_farm->DoIt_prob(1.00) && BE_POTS_FUNGI1 == 1))
419  {
420  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(7, 8) - g_date->DayInYear())) {
421  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide9, true, a_farm, a_field);
422  break;
423  }
424  BE_POTS_FUNGI2 = true;
425  }
426  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide10, false, a_farm, a_field);
427  break;
428  case BE_pots_fungicide10:
429  if (a_ev->m_lock || (a_farm->DoIt_prob(0.875) && BE_POTS_FUNGI2 == 1)) // 70% of all farmers
430  {
431  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(14, 8) - g_date->DayInYear())) {
432  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide10, true, a_farm, a_field);
433  break;
434  }
435  BE_POTS_FUNGI3 = true;
436  }
437  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide11, false, a_farm, a_field);
438  break;
439  case BE_pots_fungicide11:
440  if (a_ev->m_lock || (a_farm->DoIt_prob(1.00) && BE_POTS_FUNGI3 == 1))
441  {
442  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(21, 8) - g_date->DayInYear())) {
443  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide11, true, a_farm, a_field);
444  break;
445  }
446  BE_POTS_FUNGI4 = true;
447  }
448  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide12, false, a_farm, a_field);
449  break;
450  case BE_pots_fungicide12:
451  if (a_ev->m_lock || (a_farm->DoIt_prob(0.857) && BE_POTS_FUNGI4 == 1)) // 60% of all farmers
452  {
453  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
454  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide12, true, a_farm, a_field);
455  break;
456  }
457  BE_POTS_FUNGI5 = true;
458  }
459  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide13, false, a_farm, a_field);
460  break;
461  case BE_pots_fungicide13:
462  if (a_ev->m_lock || (a_farm->DoIt_prob(1.00) && BE_POTS_FUNGI5 == 1))
463  {
464  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(7, 9) - g_date->DayInYear())) {
465  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide13, true, a_farm, a_field);
466  break;
467  }
468  }
469  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide14, false, a_farm, a_field);
470  break;
471  case BE_pots_fungicide14:
472  if (a_ev->m_lock || (a_farm->DoIt_prob(1.00) && BE_POTS_FUNGI5 == 1))
473  {
474  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(14, 9) - g_date->DayInYear())) {
475  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide14, true, a_farm, a_field);
476  break;
477  }
478  }
479  SimpleEvent_(g_date->Date() + 7, BE_pots_fungicide15, false, a_farm, a_field);
480  break;
481  case BE_pots_fungicide15:
482  if (a_ev->m_lock || (a_farm->DoIt_prob(1.00) && BE_POTS_FUNGI5 == 1))
483  {
484  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(21, 9) - g_date->DayInYear())) {
485  SimpleEvent_(g_date->Date() + 1, BE_pots_fungicide15, true, a_farm, a_field);
486  break;
487  }
488  }
489  // End of thread
490  break;
491  case BE_pots_insecticide:
492 #ifdef ECOSTACK_BIOPESTICIDE
493  if (a_ev->m_lock || a_farm->DoIt_prob(0.80))
494 #else
495  if (a_ev->m_lock || a_farm->DoIt_prob(0.40))
496 #endif
497  {
498  // here we check whether we are using ERA pesticide or not
499  d1 = g_date->DayInYear(30, 6) - g_date->DayInYear();
500  if (!cfg_pest_potatoes_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
501  {
502 #ifdef ECOSTACK_BIOPESTICIDE
503  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
504 #else
505  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
506 #endif
507  }
508  else {
509  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
510  }
511  if (!flag) {
513  break;
514  }
515  }
516  // End of thread
517  break;
518  case BE_pots_harvest:
519  // We don't move harvest days
520  if (!a_farm->Harvest(a_field, 0.0, a_field->GetMDates(0, 0) - g_date->DayInYear())) {
521  SimpleEvent_(g_date->Date() + 1, BE_pots_harvest, true, a_farm, a_field);
522  break;
523  }
524  done = true;
525  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
526  // END of MAIN THREAD
527  break;
528  default:
529  g_msg->Warn(WARN_BUG, "BEPotatoesSpring::Do(): "
530  "Unknown event type! ", "");
531  exit(1);
532  }
533  return done;
534 }

References BE_pots_bed_forming, BE_pots_dessication1, BE_pots_dessication2, BE_pots_ferti_p2_clay, BE_pots_ferti_p2_sandy, BE_pots_ferti_p3_clay, BE_pots_ferti_p3_sandy, BE_pots_ferti_p4, BE_pots_ferti_s2_clay, BE_pots_ferti_s2_sandy, BE_pots_ferti_s3_clay, BE_pots_ferti_s3_sandy, BE_pots_ferti_s4, BE_POTS_FUNGI1, BE_POTS_FUNGI2, BE_POTS_FUNGI3, BE_POTS_FUNGI4, BE_POTS_FUNGI5, BE_pots_fungicide1, BE_pots_fungicide10, BE_pots_fungicide11, BE_pots_fungicide12, BE_pots_fungicide13, BE_pots_fungicide14, BE_pots_fungicide15, BE_pots_fungicide2, BE_pots_fungicide3, BE_pots_fungicide4, BE_pots_fungicide5, BE_pots_fungicide6, BE_pots_fungicide7, BE_pots_fungicide8, BE_pots_fungicide9, BE_pots_harvest, BE_POTS_HERBI, BE_pots_herbicide1, BE_pots_hilling1, BE_pots_insecticide, BE_pots_spring_planting, BE_pots_spring_plough_sandy, BE_pots_start, Farm::BiocideTreat(), cfg_pest_potatoes_on, cfg_pest_product_amounts, Calendar::Date(), Calendar::DayInYear(), Farm::DoIt_prob(), Farm::FP_NPK(), g_date, g_msg, LE::GetMDates(), LE::GetOwner(), Farm::GetPreviousTov(), LE::GetRotIndex(), LE::GetSoilType(), Farm::GetType(), Calendar::GetYearNumber(), 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(), ppp_1, Farm::ProductApplication(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent_(), Farm::SpringPlough(), tof_OptimisingFarm, tov_BEPotatoesSpring, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
BE_pots_insecticide
Definition: BEPotatoesSpring.h:73
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
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
BE_pots_hilling1
Definition: BEPotatoesSpring.h:50
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
BE_pots_fungicide3
Definition: BEPotatoesSpring.h:60
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
BE_pots_ferti_s3_clay
Definition: BEPotatoesSpring.h:52
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::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
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
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
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
BE_pots_fungicide4
Definition: BEPotatoesSpring.h:61
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
BE_pots_fungicide6
Definition: BEPotatoesSpring.h:63
BE_pots_bed_forming
Definition: BEPotatoesSpring.h:48
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
BE_pots_fungicide10
Definition: BEPotatoesSpring.h:67
BE_pots_ferti_s3_sandy
Definition: BEPotatoesSpring.h:54
BE_POTS_FUNGI2
#define BE_POTS_FUNGI2
Definition: BEPotatoesSpring.h:30
BE_pots_ferti_p3_clay
Definition: BEPotatoesSpring.h:51
CfgBool::value
bool value() const
Definition: Configurator.h:164
BE_pots_ferti_p2_clay
Definition: BEPotatoesSpring.h:43
BE_pots_fungicide15
Definition: BEPotatoesSpring.h:72
BE_pots_ferti_s2_clay
Definition: BEPotatoesSpring.h:44
Calendar::Date
long Date(void)
Definition: Calendar.h:57
BE_pots_fungicide9
Definition: BEPotatoesSpring.h:66
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
BE_POTS_FUNGI3
#define BE_POTS_FUNGI3
Definition: BEPotatoesSpring.h:31
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
BE_pots_fungicide11
Definition: BEPotatoesSpring.h:68
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
BE_pots_dessication2
Definition: BEPotatoesSpring.h:75
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
BE_pots_fungicide8
Definition: BEPotatoesSpring.h:65
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
BE_pots_dessication1
Definition: BEPotatoesSpring.h:74
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
BE_pots_fungicide12
Definition: BEPotatoesSpring.h:69
BE_pots_herbicide1
Definition: BEPotatoesSpring.h:57
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
BE_POTS_FUNGI4
#define BE_POTS_FUNGI4
Definition: BEPotatoesSpring.h:32
BE_pots_start
Definition: BEPotatoesSpring.h:41
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
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.
BE_pots_spring_planting
Definition: BEPotatoesSpring.h:49
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
BE_pots_ferti_p4
Definition: BEPotatoesSpring.h:55
BE_pots_ferti_p2_sandy
Definition: BEPotatoesSpring.h:46
BE_pots_ferti_s2_sandy
Definition: BEPotatoesSpring.h:47
BE_POTS_FUNGI1
#define BE_POTS_FUNGI1
Definition: BEPotatoesSpring.h:29
tov_BEPotatoesSpring
Definition: LandscapeFarmingEnums.h:300
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
BE_pots_fungicide2
Definition: BEPotatoesSpring.h:59
BE_POTS_FUNGI5
#define BE_POTS_FUNGI5
Definition: BEPotatoesSpring.h:33
BE_pots_harvest
Definition: BEPotatoesSpring.h:76
BE_pots_spring_plough_sandy
Definition: BEPotatoesSpring.h:45
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
BE_POTS_HERBI
#define BE_POTS_HERBI
A flag used to indicate autumn ploughing status.
Definition: BEPotatoesSpring.h:28
BE_pots_fungicide7
Definition: BEPotatoesSpring.h:64
BE_pots_ferti_s4
Definition: BEPotatoesSpring.h:56
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
BE_pots_ferti_p3_sandy
Definition: BEPotatoesSpring.h:53
BE_pots_fungicide1
Definition: BEPotatoesSpring.h:58
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
BE_pots_fungicide14
Definition: BEPotatoesSpring.h:71
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
BE_pots_fungicide13
Definition: BEPotatoesSpring.h:70
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
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
BE_pots_fungicide5
Definition: BEPotatoesSpring.h:62