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

NLWinterWheat class
. More...

#include <NLWinterWheat.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...
 
 NLWinterWheat ()
 
- 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

NLWinterWheat class
.

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

Constructor & Destructor Documentation

◆ NLWinterWheat()

NLWinterWheat::NLWinterWheat ( )
inline
81  {
82  // When we start it off, the first possible date for a farm operation is 15th September
83  // This information is used by other crops when they decide how much post processing of
84  // the management is allowed after harvest before the next crop starts.
85  m_first_date=g_date->DayInYear( 10,10 );
86  }

References Crop::m_first_date.

Member Function Documentation

◆ Do()

bool NLWinterWheat::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 winter wheat.

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_ww_start:
72  {
73  // nl_ww_start just sets up all the starting conditions and reference dates that are needed to start a nl_ww
74 
75  // Set up the date management stuff
76  // The next bit of code just allows for altering dates after harvest if it is necessary
77  // to allow for a crop which starts its management early.
78 
79  // 2 start and stop dates for all 'movable' events for this crop
80  int noDates = 2;
81  a_field->SetMDates(0, 0, g_date->DayInYear(31, 8)); // last possible day of harvest
82  a_field->SetMDates(1, 0, g_date->DayInYear(5, 9)); // last possible day of straw chopping
83  a_field->SetMDates(0, 1, 0); // start day of hay bailing (not used as it depend on previous treatment)
84  a_field->SetMDates(1, 1, g_date->DayInYear(10, 9)); // end day of hay bailing
85 
86  // Can be up to 10 of these. If the shortening code is triggered
87  // then these will be reduced in value to 0
88 
89  a_field->SetMConstants(0, 1);
90 
91  // Check the next crop for early start, unless it is a spring crop
92  // in which case we ASSUME that no checking is necessary!!!!
93  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
94 
95  //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)
96  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
97  if (!(a_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
98 
99  if (a_ev->m_startday > g_date->DayInYear(1, 7)) {
100  if (a_field->GetMDates(0, 0) >= a_ev->m_startday)
101  {
102  g_msg->Warn(WARN_BUG, "NLWinterWheat::Do(): ", "Harvest too late for the next crop to start!!!");
103  int almassnum = g_landscape_p->BackTranslateVegTypes(a_ev->m_next_tov);
104  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
105  }
106  // Now fix any late finishing problems
107  for (int i = 0; i < noDates; i++) {
108  if (a_field->GetMDates(0, i) >= a_ev->m_startday) {
109  a_field->SetMDates(0, i, a_ev->m_startday - 1); //move the starting date
110  }
111  if (a_field->GetMDates(1, i) >= a_ev->m_startday) {
112  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)
113  a_field->SetMDates(1, i, a_ev->m_startday - 1); //move the finishing date
114  }
115  }
116  }
117  // Now no operations can be timed after the start of the next crop.
118 
119  if (!a_ev->m_first_year) {
120  // Are we before July 1st?
121  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
122  if (g_date->Date() < d1) {
123  // Yes, too early. We assumme this is because the last crop was late
124  printf("Poly: %d\n", a_field->GetPoly());
125  g_msg->Warn(WARN_BUG, "NLWinterWheat::Do(): ", "Crop start attempt between 1st Jan & 1st July");
126  int prev = g_landscape_p->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousCrop(a_field->GetRotIndex()));
127  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
128  int almassnum = g_landscape_p->BackTranslateVegTypes(a_ev->m_next_tov);
129  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
130  exit(1);
131  }
132  else {
133  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
134  if (g_date->Date() > d1) {
135  // Yes too late - should not happen - raise an error
136  g_msg->Warn(WARN_BUG, "NLWinterWheat::Do(): ", "Crop start attempt after last possible start date");
137  int prev = g_landscape_p->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousCrop(a_field->GetRotIndex()));
138  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
139  int almassnum = g_landscape_p->BackTranslateVegTypes(a_ev->m_next_tov);
140  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
141  exit(1);
142  }
143  }
144  }
145  else {
146  // Is the first year
147  // Some special code to cope with that first start-up year in ALMaSS - ignore for all practical purposes
148  // Code for first spring treatment used
149  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 3), nl_ww_herbicide3, false, a_farm, a_field);
150  break;
151  }
152  }//if
153 
154  // End single block date checking code. Please see next line comment as well.
155  // Reinit d1 to first possible starting date.
156  d1 = g_date->OldDays() + g_date->DayInYear(15, 8);
157  // OK, let's go.
158  // Here we queue up the first event - cultivation of stubble after previous crop
159  SimpleEvent_(d1, nl_ww_stubble_cultivator, false, a_farm, a_field);
160  }
161  break;
162 
163  // This is the first real farm operation
165  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
166  {
167  if (!a_farm->StubbleHarrowing(a_field, 0.0, g_date->DayInYear(10, 10) - g_date->DayInYear())) {
168  SimpleEvent_(g_date->Date() + 1, nl_ww_stubble_cultivator, true, a_farm, a_field);
169  break;
170  }
171  }
172  d1 = g_date->Date() + 10;
173  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 9)) {
174  d1 = g_date->OldDays() + g_date->DayInYear(15, 9);
175  }
176  SimpleEvent_(d1, nl_ww_herbicide1, false, a_farm, a_field);
177  break;
178  case nl_ww_herbicide1:
179  // Some farmers will use total herbicide on a field, and some mole (deep) ploughing
180  if (a_ev->m_lock || a_farm->DoIt_prob(0.20))
181  {
182  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
183  SimpleEvent_(g_date->Date() + 1, nl_ww_herbicide1, true, a_farm, a_field);
184  break;
185  }
186  else
187  {
188  SimpleEvent_(g_date->Date() + 14, nl_ww_autumn_plough, false, a_farm, a_field);
189  break;
190  }
191  }
192  SimpleEvent_(g_date->Date() + 1, nl_ww_mole_plough, false, a_farm, a_field);
193  break;
194  case nl_ww_mole_plough:
195  if (a_ev->m_lock || a_farm->DoIt_prob(0.375)) // 30% from the rest 80% of farmers who don't do herbicide1
196  {
197  if (!a_farm->DeepPlough(a_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
198  SimpleEvent_(g_date->Date() + 1, nl_ww_mole_plough, true, a_farm, a_field);
199  break;
200  }
201  }
202  SimpleEvent_(g_date->Date() + 14, nl_ww_autumn_plough, false, a_farm, a_field);
203  break;
204  case nl_ww_autumn_plough:
205  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
206  {
207  if (!a_farm->AutumnPlough(a_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
208  SimpleEvent_(g_date->Date() + 1, nl_ww_autumn_plough, true, a_farm, a_field);
209  break;
210  }
211  }
212  SimpleEvent_(g_date->Date() + 10, nl_ww_preseeding_cultivator_sow, false, a_farm, a_field);
213  break;
215  // all farmers do preseeding cultivation together with sowing
216  if (!a_farm->PreseedingCultivatorSow(a_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
217  SimpleEvent_(g_date->Date() + 1, nl_ww_preseeding_cultivator_sow, true, a_farm, a_field);
218  break;
219  }
220  // Here is a fork leading to four parallel events
221  SimpleEvent_(g_date->Date() + 3, nl_ww_herbicide2, false, a_farm, a_field); // Herbidide thread = Main thread
222  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(25, 3) + 365, nl_ww_fungicide1, false, a_farm, a_field); // Fungicide thread
223  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 4) + 365, nl_ww_insecticide1, false, a_farm, a_field); // Insecticide thread
224  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4) + 365, nl_ww_growth_regulator1, false, a_farm, a_field); // GR thread
225  if (a_farm->IsStockFarmer()) //Stock Farmer // slurry thread
226  {
227  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_s1, false, a_farm, a_field);
228  }
229  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_p1, false, a_farm, a_field);
230  if (a_farm->IsStockFarmer()) //Stock Farmer // PK thread
231  {
232  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_s2, false, a_farm, a_field);
233  }
234  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_p2, false, a_farm, a_field);
235  if (a_farm->IsStockFarmer()) //Stock Farmer // N thread
236  {
237  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_s3, false, a_farm, a_field);
238  }
239  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_ww_ferti_p3, false, a_farm, a_field);
240  break;
241  case nl_ww_herbicide2: // The first of the pesticide managements.
242  // Here comes the herbicide thread
243  if (a_ev->m_lock || a_farm->DoIt_prob(0.75))
244  {
245  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 12) - g_date->DayInYear())) {
246  SimpleEvent_(g_date->Date() + 1, nl_ww_herbicide2, true, a_farm, a_field);
247  break;
248  }
249  }
250  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 3) + 365, nl_ww_herbicide3, false, a_farm, a_field);
251  break;
252  case nl_ww_herbicide3:
253  if (a_ev->m_lock || a_farm->DoIt_prob(1.00))
254  {
255  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
256  SimpleEvent_(g_date->Date() + 1, nl_ww_herbicide3, true, a_farm, a_field);
257  break;
258  }
259  }
260  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 7), nl_ww_desiccation, false, a_farm, a_field);
261  break;
262  case nl_ww_desiccation:
263  if (a_ev->m_lock || a_farm->DoIt_prob(0.40))
264  {
265  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 8) - g_date->DayInYear())) {
266  SimpleEvent_(g_date->Date() + 1, nl_ww_desiccation, true, a_farm, a_field);
267  break;
268  }
269  }
270  SimpleEvent_(g_date->Date() + 14, nl_ww_harvest, false, a_farm, a_field);
271  break;
272  case nl_ww_fungicide1:
273  // Here comes the fungicide thread
274  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
275  SimpleEvent_(g_date->Date() + 1, nl_ww_fungicide1, true, a_farm, a_field);
276  break;
277  }
278  SimpleEvent_(g_date->Date() + 21, nl_ww_fungicide2, false, a_farm, a_field);
279  break;
280  case nl_ww_fungicide2:
281  if (a_ev->m_lock || a_farm->DoIt_prob(0.90))
282  {
283  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
284  SimpleEvent_(g_date->Date() + 1, nl_ww_fungicide2, true, a_farm, a_field);
285  break;
286  }
287  }
288  SimpleEvent_(g_date->Date() + 21, nl_ww_fungicide3, false, a_farm, a_field);
289  break;
290  case nl_ww_fungicide3:
291  if (a_ev->m_lock || a_farm->DoIt_prob(0.78)) // 70% of all farmers spray 3 times
292  {
293  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
294  SimpleEvent_(g_date->Date() + 1, nl_ww_fungicide3, true, a_farm, a_field);
295  break;
296  }
297  }
298  // End of thread
299  break;
300  case nl_ww_insecticide1:
301  // here we check wheter we are using ERA pesticide or not
302  if (!cfg_pest_winterwheat_on.value() ||
303  !g_landscape_p->SupplyShouldSpray()) // Not using pesticide spray
304  {
305  if (!a_farm->InsecticideTreat(a_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
306  SimpleEvent_(g_date->Date() + 1, nl_ww_insecticide1, true, a_farm, a_field);
307  break;
308  }
309  }
310  else {
311  a_farm->ProductApplication(a_field, 0.0, 0, cfg_pest_product_1_amount.value(), ppp_1);
312  }
313  SimpleEvent_(g_date->Date() + 21, nl_ww_insecticide2, false, a_farm, a_field);
314  break;
315  case nl_ww_insecticide2:
316  if (a_ev->m_lock || a_farm->DoIt_prob(0.50))
317  {
318  // here we check wheter we are using ERA pesticide or not
319  if (!cfg_pest_winterwheat_on.value() ||
320  !g_landscape_p->SupplyShouldSpray()) // Not using pesticide spray
321  {
322  if (!a_farm->InsecticideTreat(a_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear())) {
323  SimpleEvent_(g_date->Date() + 1, nl_ww_insecticide2, true, a_farm, a_field);
324  break;
325  }
326  }
327  else {
328  a_farm->ProductApplication(a_field, 0.0, 0, cfg_pest_product_1_amount.value(), ppp_1);
329  }
330  }
331  // End of thread
332  break;
334  // Here comes the GR thread
335  if (!a_farm->GrowthRegulator(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
336  SimpleEvent_(g_date->Date() + 1, nl_ww_growth_regulator1, true, a_farm, a_field);
337  break;
338  }
339  SimpleEvent_(g_date->Date() + 14, nl_ww_growth_regulator2, false, a_farm, a_field);
340  break;
342  if (a_ev->m_lock || a_farm->DoIt_prob(0.80))
343  {
344  if (!a_farm->GrowthRegulator(a_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
345  SimpleEvent_(g_date->Date() + 1, nl_ww_growth_regulator2, true, a_farm, a_field);
346  break;
347  }
348  }
349  // End of thread
350  break;
351  case nl_ww_ferti_p1:
352  // Here comes the slurry thread
353  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
354  {
355  if (!a_farm->FP_Slurry(a_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
356  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_p1, true, a_farm, a_field);
357  break;
358  }
359  }
360  // End of thread
361  break;
362  case nl_ww_ferti_s1:
363  // Here comes the slurry thread
364  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
365  {
366  if (!a_farm->FA_Slurry(a_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
367  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_s1, true, a_farm, a_field);
368  break;
369  }
370  }
371  // End of thread
372  break;
373  case nl_ww_ferti_p2:
374  // Here comes the PK thread
375  if (a_ev->m_lock || a_farm->DoIt_prob(0.75))
376  {
377  if (!a_farm->FP_PK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
378  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_p2, true, a_farm, a_field);
379  break;
380  }
381  }
382  // End of thread
383  break;
384  case nl_ww_ferti_s2:
385  // Here comes the PK thread
386  if (a_ev->m_lock || a_farm->DoIt_prob(0.75))
387  {
388  if (!a_farm->FA_PK(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
389  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_s2, true, a_farm, a_field);
390  break;
391  }
392  }
393  // End of thread
394  break;
395  case nl_ww_ferti_p3:
396  // Here comes the N thread
397  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
398  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_p3, true, a_farm, a_field);
399  break;
400  }
401  d1 = g_date->Date() + 21;
402  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 3)) {
403  d1 = g_date->OldDays() + g_date->DayInYear(20, 3);
404  }
405  SimpleEvent_(d1, nl_ww_ferti_p4, false, a_farm, a_field);
406  break;
407  case nl_ww_ferti_s3:
408  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
409  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_s3, true, a_farm, a_field);
410  break;
411  }
412  d1 = g_date->Date() + 21;
413  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 3)) {
414  d1 = g_date->OldDays() + g_date->DayInYear(20, 3);
415  }
416  SimpleEvent_(d1, nl_ww_ferti_s4, false, a_farm, a_field);
417  break;
418  case nl_ww_ferti_p4:
419  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
420  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_p4, true, a_farm, a_field);
421  break;
422  }
423  d1 = g_date->Date() + 21;
424  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 4)) {
425  d1 = g_date->OldDays() + g_date->DayInYear(15, 4);
426  }
427  SimpleEvent_(d1, nl_ww_ferti_p5, false, a_farm, a_field);
428  break;
429  case nl_ww_ferti_s4:
430  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
431  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_s4, true, a_farm, a_field);
432  break;
433  }
434  d1 = g_date->Date() + 21;
435  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 4)) {
436  d1 = g_date->OldDays() + g_date->DayInYear(15, 4);
437  }
438  SimpleEvent_(d1, nl_ww_ferti_s5, false, a_farm, a_field);
439  break;
440  case nl_ww_ferti_p5:
441  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
442  {
443  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
444  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_p5, true, a_farm, a_field);
445  break;
446  }
447  }
448  // End of thread
449  break;
450  case nl_ww_ferti_s5:
451  if (a_ev->m_lock || a_farm->DoIt_prob(0.70))
452  {
453  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
454  SimpleEvent_(g_date->Date() + 1, nl_ww_ferti_s5, true, a_farm, a_field);
455  break;
456  }
457  }
458  // End of thread
459  break;
460  case nl_ww_harvest:
461  // Here the MAIN thread continues
462  // We don't move harvest days
463  if (!a_farm->Harvest(a_field, 0.0, a_field->GetMDates(0, 0) - g_date->DayInYear())) {
464  SimpleEvent_(g_date->Date() + 1, nl_ww_harvest, true, a_farm, a_field);
465  break;
466  }
467  // 75% of farmers will leave straw on field and rest will do hay bailing
468  if (m_farm->DoIt_prob(0.75))
469  {
470  SimpleEvent_(g_date->Date() + 1, nl_ww_straw_chopping, false, a_farm, a_field);
471  }
472  else
473  {
474  SimpleEvent_(g_date->Date() + 1, nl_ww_hay_bailing, false, a_farm, a_field);
475  }
476  break;
478  if (a_field->GetMConstants(0) == 0) {
479  if (!a_farm->StrawChopping(a_field, 0.0, -1)) { // raise an error
480  g_msg->Warn(WARN_BUG, "NLWinterWheat::Do(): failure in 'StrawChopping' execution", "");
481  exit(1);
482  }
483  }
484  else {
485  if (!a_farm->StrawChopping(a_field, 0.0, a_field->GetMDates(1, 0) - g_date->DayInYear())) {
486  SimpleEvent_(g_date->Date() + 1, nl_ww_straw_chopping, true, a_farm, a_field);
487  break;
488  }
489  }
490  done = true;
491  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
492  // END of MAIN THREAD
493  break;
494  case nl_ww_hay_bailing:
495  if (a_field->GetMConstants(1) == 0) {
496  if (!a_farm->HayBailing(a_field, 0.0, -1)) { // raise an error
497  g_msg->Warn(WARN_BUG, "NLWinterWheat::Do(): failure in 'HayBailing' execution", "");
498  exit(1);
499  }
500  }
501  else {
502  if (!a_farm->HayBailing(a_field, 0.0, a_field->GetMDates(1,1) - g_date->DayInYear())) {
503  SimpleEvent_(g_date->Date() + 1, nl_ww_hay_bailing, true, a_farm, a_field);
504  break;
505  }
506  }
507  done = true;
508  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
509  // END of MAIN THREAD
510  break;
511  default:
512  g_msg->Warn(WARN_BUG, "PLWinterWheat::Do(): "
513  "Unknown event type! ", "");
514  exit(1);
515  }
516  return done;
517 }

References Landscape::BackTranslateVegTypes(), cfg_pest_product_1_amount, cfg_pest_winterwheat_on, Farm::DoIt_prob(), g_landscape_p, Farm::GetType(), Farm::HerbicideTreat(), Crop::m_farm, Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, FarmEvent::m_startday, FarmEvent::m_todo, nl_ww_autumn_plough, nl_ww_desiccation, nl_ww_ferti_p1, nl_ww_ferti_p2, nl_ww_ferti_p3, nl_ww_ferti_p4, nl_ww_ferti_p5, nl_ww_ferti_s1, nl_ww_ferti_s2, nl_ww_ferti_s3, nl_ww_ferti_s4, nl_ww_ferti_s5, nl_ww_fungicide1, nl_ww_fungicide2, nl_ww_fungicide3, nl_ww_growth_regulator1, nl_ww_growth_regulator2, nl_ww_harvest, nl_ww_hay_bailing, nl_ww_herbicide1, nl_ww_herbicide2, nl_ww_herbicide3, nl_ww_insecticide1, nl_ww_insecticide2, nl_ww_mole_plough, nl_ww_preseeding_cultivator_sow, nl_ww_start, nl_ww_straw_chopping, nl_ww_stubble_cultivator, ppp_1, Crop::SimpleEvent_(), Farm::StubbleHarrowing(), Landscape::SupplyShouldSpray(), and tof_OptimisingFarm.


The documentation for this class was generated from the following files:
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: farmfuncs.cpp:1156
nl_ww_start
Definition: NLWinterWheat.h:35
FarmEvent::m_lock
bool m_lock
Definition: farm.h:465
Landscape::SupplyShouldSpray
bool SupplyShouldSpray()
Definition: Landscape.h:357
nl_ww_autumn_plough
Definition: NLWinterWheat.h:40
nl_ww_ferti_s1
Definition: NLWinterWheat.h:44
nl_ww_ferti_s4
Definition: NLWinterWheat.h:50
nl_ww_fungicide2
Definition: NLWinterWheat.h:55
FarmEvent::m_first_year
bool m_first_year
Definition: farm.h:467
nl_ww_ferti_p4
Definition: NLWinterWheat.h:49
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
Landscape::BackTranslateVegTypes
int BackTranslateVegTypes(TTypesOfVegetation VegReference)
Definition: Landscape.h:1669
nl_ww_ferti_s5
Definition: NLWinterWheat.h:52
nl_ww_growth_regulator1
Definition: NLWinterWheat.h:59
Farm::GetType
TTypesOfFarm GetType(void)
Definition: farm.h:901
nl_ww_fungicide1
Definition: NLWinterWheat.h:54
nl_ww_harvest
Definition: NLWinterWheat.h:62
Crop::m_first_date
int m_first_date
Definition: farm.h:540
FarmEvent::m_startday
int m_startday
Definition: farm.h:466
nl_ww_desiccation
Definition: NLWinterWheat.h:61
nl_ww_straw_chopping
Definition: NLWinterWheat.h:63
nl_ww_mole_plough
Definition: NLWinterWheat.h:39
nl_ww_ferti_p5
Definition: NLWinterWheat.h:51
cfg_pest_winterwheat_on
CfgBool cfg_pest_winterwheat_on
nl_ww_preseeding_cultivator_sow
Definition: NLWinterWheat.h:41
nl_ww_insecticide2
Definition: NLWinterWheat.h:58
nl_ww_stubble_cultivator
Definition: NLWinterWheat.h:37
nl_ww_ferti_p2
Definition: NLWinterWheat.h:45
nl_ww_hay_bailing
Definition: NLWinterWheat.h:64
cfg_pest_product_1_amount
CfgFloat cfg_pest_product_1_amount
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: farm.h:471
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
FarmEvent::m_todo
int m_todo
Definition: farm.h:469
nl_ww_ferti_p1
Definition: NLWinterWheat.h:43
ppp_1
Definition: farm.h:422
nl_ww_ferti_p3
Definition: NLWinterWheat.h:47
nl_ww_insecticide1
Definition: NLWinterWheat.h:57
nl_ww_growth_regulator2
Definition: NLWinterWheat.h:60
nl_ww_herbicide3
Definition: NLWinterWheat.h:53
nl_ww_herbicide2
Definition: NLWinterWheat.h:42
nl_ww_ferti_s2
Definition: NLWinterWheat.h:46
nl_ww_ferti_s3
Definition: NLWinterWheat.h:48
nl_ww_herbicide1
Definition: NLWinterWheat.h:38
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: farmfuncs.cpp:2209
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
nl_ww_fungicide3
Definition: NLWinterWheat.h:56