ALMaSS Skylark ODDox  1.1
The skylark model description following ODdox protocol
NLPotatoesSpring Class Reference

NLPotatoesSpring class
. More...

#include <NLPotatoesSpring.h>

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...
 
 NLPotatoesSpring ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop ()
 
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)
 

Additional Inherited Members

- 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...
 
- Protected Attributes inherited from Crop
Farmm_farm
 
LE * m_field
 
FarmEventm_ev
 
int m_first_date
 
int m_count
 
int m_last_date
 
int m_ddegstoharvest
 
int m_CropClassification
 

Detailed Description

NLPotatoesSpring class
.

See NLPotatoesSpring.h::NLPotatoesSpringToDo 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

◆ NLPotatoesSpring()

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

References Crop::m_first_date.

Member Function Documentation

◆ Do()

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

References Landscape::BackTranslateVegTypes(), cfg_pest_potatoes_on, cfg_pest_product_1_amount, Farm::DoIt_prob(), Farm::FP_NPK(), g_landscape_p, Farm::GetType(), Farm::IsStockFarmer(), Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, FarmEvent::m_startday, FarmEvent::m_todo, nl_pots_bed_forming, nl_pots_dessication1, nl_pots_dessication2, nl_pots_ferti_p2_clay, nl_pots_ferti_p2_sandy, nl_pots_ferti_p3_clay, nl_pots_ferti_p3_sandy, nl_pots_ferti_p4, nl_pots_ferti_s2_clay, nl_pots_ferti_s2_sandy, nl_pots_ferti_s3_clay, nl_pots_ferti_s3_sandy, nl_pots_ferti_s4, NL_POTS_FUNGI1, NL_POTS_FUNGI2, NL_POTS_FUNGI3, NL_POTS_FUNGI4, NL_POTS_FUNGI5, nl_pots_fungicide1, nl_pots_fungicide10, nl_pots_fungicide11, nl_pots_fungicide12, nl_pots_fungicide13, nl_pots_fungicide14, nl_pots_fungicide15, nl_pots_fungicide2, nl_pots_fungicide3, nl_pots_fungicide4, nl_pots_fungicide5, nl_pots_fungicide6, nl_pots_fungicide7, nl_pots_fungicide8, nl_pots_fungicide9, nl_pots_harvest, NL_POTS_HERBI, nl_pots_herbicide1, nl_pots_herbicide2, nl_pots_hilling1, nl_pots_insecticide, nl_pots_spring_planting, nl_pots_spring_plough_sandy, nl_pots_start, ppp_1, Crop::SimpleEvent_(), Farm::SpringPlough(), Landscape::SupplyShouldSpray(), and tof_OptimisingFarm.


The documentation for this class was generated from the following files:
nl_pots_dessication2
Definition: NLPotatoesSpring.h:76
nl_pots_fungicide2
Definition: NLPotatoesSpring.h:60
nl_pots_hilling1
Definition: NLPotatoesSpring.h:50
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:444
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: farm.h:905
nl_pots_herbicide1
Definition: NLPotatoesSpring.h:57
nl_pots_herbicide2
Definition: NLPotatoesSpring.h:58
FarmEvent::m_lock
bool m_lock
Definition: farm.h:465
nl_pots_ferti_s4
Definition: NLPotatoesSpring.h:56
Landscape::SupplyShouldSpray
bool SupplyShouldSpray()
Definition: Landscape.h:357
nl_pots_dessication1
Definition: NLPotatoesSpring.h:75
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:629
nl_pots_ferti_p3_clay
Definition: NLPotatoesSpring.h:51
nl_pots_fungicide12
Definition: NLPotatoesSpring.h:70
FarmEvent::m_first_year
bool m_first_year
Definition: farm.h:467
tof_OptimisingFarm
Definition: farm.h:273
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: farm.cpp:808
nl_pots_ferti_s3_clay
Definition: NLPotatoesSpring.h:52
Landscape::BackTranslateVegTypes
int BackTranslateVegTypes(TTypesOfVegetation VegReference)
Definition: Landscape.h:1669
nl_pots_start
Definition: NLPotatoesSpring.h:41
nl_pots_fungicide8
Definition: NLPotatoesSpring.h:66
NL_POTS_FUNGI2
#define NL_POTS_FUNGI2
Definition: NLPotatoesSpring.h:30
Farm::GetType
TTypesOfFarm GetType(void)
Definition: farm.h:901
Crop::m_first_date
int m_first_date
Definition: farm.h:540
FarmEvent::m_startday
int m_startday
Definition: farm.h:466
nl_pots_ferti_s2_sandy
Definition: NLPotatoesSpring.h:47
nl_pots_ferti_p2_sandy
Definition: NLPotatoesSpring.h:46
nl_pots_spring_plough_sandy
Definition: NLPotatoesSpring.h:45
nl_pots_fungicide9
Definition: NLPotatoesSpring.h:67
nl_pots_ferti_p3_sandy
Definition: NLPotatoesSpring.h:53
NL_POTS_FUNGI1
#define NL_POTS_FUNGI1
Definition: NLPotatoesSpring.h:29
nl_pots_fungicide3
Definition: NLPotatoesSpring.h:61
nl_pots_fungicide4
Definition: NLPotatoesSpring.h:62
nl_pots_fungicide14
Definition: NLPotatoesSpring.h:72
nl_pots_fungicide13
Definition: NLPotatoesSpring.h:71
NL_POTS_FUNGI4
#define NL_POTS_FUNGI4
Definition: NLPotatoesSpring.h:32
nl_pots_ferti_p2_clay
Definition: NLPotatoesSpring.h:43
nl_pots_ferti_s2_clay
Definition: NLPotatoesSpring.h:44
nl_pots_spring_planting
Definition: NLPotatoesSpring.h:49
nl_pots_harvest
Definition: NLPotatoesSpring.h:77
nl_pots_ferti_s3_sandy
Definition: NLPotatoesSpring.h:54
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: farm.h:471
NL_POTS_HERBI
#define NL_POTS_HERBI
A flag used to indicate autumn ploughing status.
Definition: NLPotatoesSpring.h:28
nl_pots_fungicide7
Definition: NLPotatoesSpring.h:65
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
FarmEvent::m_todo
int m_todo
Definition: farm.h:469
nl_pots_fungicide11
Definition: NLPotatoesSpring.h:69
ppp_1
Definition: farm.h:422
nl_pots_fungicide15
Definition: NLPotatoesSpring.h:73
nl_pots_ferti_p4
Definition: NLPotatoesSpring.h:55
nl_pots_fungicide5
Definition: NLPotatoesSpring.h:63
nl_pots_fungicide6
Definition: NLPotatoesSpring.h:64
nl_pots_fungicide1
Definition: NLPotatoesSpring.h:59
NL_POTS_FUNGI5
#define NL_POTS_FUNGI5
Definition: NLPotatoesSpring.h:33
NL_POTS_FUNGI3
#define NL_POTS_FUNGI3
Definition: NLPotatoesSpring.h:31
nl_pots_bed_forming
Definition: NLPotatoesSpring.h:48
nl_pots_fungicide10
Definition: NLPotatoesSpring.h:68
nl_pots_insecticide
Definition: NLPotatoesSpring.h:74
cfg_pest_product_1_amount
CfgFloat cfg_pest_product_1_amount
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
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:312