Loading [MathJax]/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
WinterWheatStrigling Class Reference

#include <WinterWheatStrigling.h>

Inheritance diagram for WinterWheatStrigling:
Crop

Public Member Functions

virtual bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 WinterWheatStrigling (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...
 

Constructor & Destructor Documentation

◆ WinterWheatStrigling()

WinterWheatStrigling::WinterWheatStrigling ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
89  : Crop(a_tov, a_toc, a_L)
90  {
91  m_first_date=g_date->DayInYear( 1,10 );
93  }

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

Member Function Documentation

◆ Do()

bool WinterWheatStrigling::Do ( Farm a_farm,
LE a_field,
FarmEvent a_ev 
)
virtual

Reimplemented from Crop.

39 {
40  m_farm = a_farm;
41  m_field = a_field;
42  m_ev = a_ev;
43 
44  bool done = false;
45 
46  switch ( m_ev->m_todo )
47  {
48  case wws_start:
49  {
52  a_field->ClearManagementActionSum();
53 
54  // Set up the date management stuff
55 
56  // Could save the start day in case it is needed later
57  // m_field->m_startday = m_ev->m_startday;
58 
59  // Start and stop dates for all events after harvest
60  int noDates=5;
61  m_field->SetMDates(0,0,g_date->DayInYear(20,8));
62 
63  // Determined by harvest date - used to see if at all possible
64  m_field->SetMDates(1,0,g_date->DayInYear(20,8));
65  m_field->SetMDates(0,1,0); // Subbleharrow start
66  m_field->SetMDates(1,1,g_date->DayInYear(20,8));
67  m_field->SetMDates(0,2,g_date->DayInYear(5,8));
68  m_field->SetMDates(1,2,g_date->DayInYear(25,8));
69  m_field->SetMDates(0,3,g_date->DayInYear(10,8));
70  m_field->SetMDates(1,3,g_date->DayInYear(15,9));
71  m_field->SetMDates(0,4,g_date->DayInYear(15,8));
72  m_field->SetMDates(1,4,g_date->DayInYear(15,10));
73  // Can be up to 10 of these. If the shortening code is triggered
74  // then these will be reduced in value to 0
75  m_field->SetMConstants(0,1);
76 
77  // Check the next crop for early start, unless it is a spring crop
78  // in which case we ASSUME that no checking is necessary!!!!
79  // So DO NOT implement a crop that runs over the year boundary
80  if (m_ev->m_startday>g_date->DayInYear(1,7))
81  {
82  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
83  {
84  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): "
85  "Harvest too late for the next crop to start!!!", "" );
86  exit( 1 );
87  }
88  // Now fix any late finishing problems
89  bool toggle=false;
90  for (int i=0; i<noDates; i++) {
91  if (m_field->GetMDates(0,i)>=m_ev->m_startday) {
92  toggle=true;
94  }
95  if (m_field->GetMDates(1,i)>=m_ev->m_startday){
96  toggle=true;
98  }
99  }
100  if (toggle) for (int i=0; i<10; i++) m_field->SetMConstants(i,0);
101  }
102  // Now no operations can be timed after the start of the next crop.
103 
104  // CJT note:
105  // Start single block date checking code to be cut-'n-pasted...
106  int d1;
107  if ( ! m_ev->m_first_year ) {
108 
109  // Are we before July 1st?
110  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
111  if (g_date->Date() < d1 ) {
112  // Yes, too early. We assumme this is because the last crop was late
113  printf ("Poly: %d\n", m_field->GetPoly());
114  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): "
115  "Crop start attempt between 1st Jan & 1st July", "" );
116  exit( 1 );
117  }
118  else
119  {
120  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
121  if (g_date->Date() > d1)
122  {
123  // Yes too late - should not happen - raise an error
124  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): "
125  "Crop start attempt after last possible start date", "" );
126  exit( 1 );
127  }
128  }
129  }
130  else
131  {
132  // Is the first year
133  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
134  wws_spring_roll, false );
135  break;
136  }
137  // End single block date checking code. Please see next line
138  // comment as well.
139  // Reinit d1 to first possible starting date.
140  d1 = g_date->OldDays() + g_date->DayInYear( 21,8 );
141  // OK, let's go.
142  if (m_farm->IsStockFarmer()) // StockFarmer
143  {
144  SimpleEvent( d1, wws_ferti_s1, false );
145  }
146  else SimpleEvent( d1, wws_ferti_p1, false );
147  }
148  break;
149 
150  case wws_ferti_p1:
151  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
152  {
153  if (!m_farm->FP_Slurry( m_field, 0.0,
154  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
155  SimpleEvent( g_date->Date() + 1, wws_ferti_p1, true );
156  break;
157  }
158  }
160  break;
161 
162  case wws_ferti_s1:
163  if (!m_farm->FA_Slurry( m_field, 0.0,
164  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
165  SimpleEvent( g_date->Date() + 1, wws_ferti_s1, true );
166  break;
167  }
168  // This may cause two applications of fertilizer in one day...
169  // --FN--
170  SimpleEvent( g_date->Date(),wws_ferti_s2, false );
171  // --FN--
172  break;
173 
174  case wws_ferti_s2:
175  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
176  {
177  if (!m_farm->FA_Manure( m_field, 0.0,
178  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
179  SimpleEvent( g_date->Date() + 1, wws_ferti_s2, true );
180  break;
181  }
182  }
184  break;
185 
186  case wws_autumn_plough:
187  if ( m_ev->m_lock || m_farm->DoIt( 95 ))
188  {
189  if (!m_farm->AutumnPlough( m_field, 0.0,
190  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
191  SimpleEvent( g_date->Date() + 1, wws_autumn_plough, true );
192  break;
193  }
194  else
195  {
197  SimpleEvent( g_date->Date()+1,wws_autumn_harrow, false );
198  break;
199  }
200  }
202  break;
203 
204  case wws_autumn_harrow:
205  if (!m_farm->AutumnHarrow( m_field, 0.0,
206  g_date->DayInYear( 10,10 ) - g_date->DayInYear())) {
207  SimpleEvent( g_date->Date() + 1, wws_autumn_harrow, true );
208  break;
209  }
210  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,9 ),
211  wws_autumn_sow, false );
212  break;
213 
214  case wws_stubble_harrow1:
215  if (!m_farm->StubbleHarrowing( m_field, 0.0,
216  g_date->DayInYear( 10,10 ) - g_date->DayInYear())) {
217  SimpleEvent( g_date->Date() + 1, wws_stubble_harrow1, true );
218  break;
219  }
220  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,9 ),
221  wws_autumn_sow, false );
222  break;
223 
224  case wws_autumn_sow:
225  if (!m_farm->AutumnSow( m_field, 0.0,
226  g_date->DayInYear( 20,10 ) - g_date->DayInYear())) {
227  SimpleEvent( g_date->Date() + 1, wws_autumn_sow, true );
228  break;
229  }
230  // --FN-- Oooo!
231  //SimpleEvent( g_date->OldDays() + g_date->Date( ),
232  // wws_autumn_roll, false );
233  SimpleEvent( g_date->Date() + 1, wws_autumn_roll, false );
234  break;
235 
236  case wws_autumn_roll:
237  if (( m_ev->m_lock || m_farm->DoIt( 5 ))&& (WWStrigling_AUTUMN_PLOUGH))
238  {
239  if (!m_farm->AutumnRoll( m_field, 0.0,
240  g_date->DayInYear( 27,10 ) - g_date->DayInYear())) {
241  SimpleEvent( g_date->Date() + 1, wws_autumn_roll, true );
242  break;
243  }
244  }
245  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,9 ),
246  wws_ferti_p2, false );
247  break;
248 
249  case wws_ferti_p2:
250  if (( m_ev->m_lock || m_farm->DoIt( 20 )) && (!m_farm->IsStockFarmer()))
251  {
252  if ( m_field->GetVegBiomass()>0)
253  //only when there has been a bit of growth
254  {
255  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
256  g_date->DayInYear( 30,10 ) - g_date->DayInYear()))
257  {
258  SimpleEvent( g_date->Date() + 1, wws_ferti_p2, true );
259  break;
260  }
261  }
262  }
263  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,9 ),
264  wws_strigling0a, false );
265  break;
266 
267  case wws_strigling0a:
268  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 100*cfg_strigling_prop.value() )))
269  {
270  if (!m_farm->Strigling( m_field, 0.0,
271  g_date->DayInYear( 5,10 ) - g_date->DayInYear())) {
272  SimpleEvent( g_date->Date() + 1, wws_strigling0a, true );
273  break;
274  }
275  }
276  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 )+365,
277  wws_spring_roll, false );
278  break;
279 
280  case wws_spring_roll:
281  if ( m_ev->m_lock || m_farm->DoIt( 5 ))
282  {
283  if (!m_farm->SpringRoll( m_field, 0.0,
284  g_date->DayInYear( 30,4 ) - g_date->DayInYear())) {
285  SimpleEvent( g_date->Date() + 1, wws_spring_roll, true );
286  break;
287  }
288  }
289  if (m_farm->IsStockFarmer()) // StockFarmer
290  {
291  SimpleEvent( g_date->Date() + 1, wws_ferti_s3, false );
292  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,4 ),
293  wws_ferti_s4, false );
294  }
295  else
296  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,3 ),
297  wws_ferti_p3, false );
298  // All need the next threads
300  wws_strigling0b, false );
301  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4 ),
302  wws_GR, false );
303  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,4 ),
304  wws_fungicide, false );
305  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
306  wws_insecticide1, false );
307  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,4 ),
308  wws_strigling1, false );
309  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
310  wws_water1, false );
311  break;
312 
313  case wws_strigling0b:
314  if ( m_ev->m_lock || m_farm->DoIt( (int) ( (int) ( 100*cfg_strigling_prop.value() ))))
315  {
316  if (!m_farm->Strigling( m_field, 0.0,
317  g_date->DayInYear( 30,4 ) - g_date->DayInYear())) {
318  SimpleEvent( g_date->Date() + 1, wws_strigling0a, true );
319  break;
320  }
321  }
322  // End of thread
323  break;
324 
325  case wws_GR:
326  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 15*cfg_greg_app_prop.value() )))
327  {
328  // --FN--
329  if (!m_farm->GrowthRegulator( m_field, 0.0,
330  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
331  SimpleEvent( g_date->Date() + 1, wws_GR, true );
332  break;
333  }
334  }
335  // End of thread
336  break;
337 
338  case wws_fungicide:
339  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 70*cfg_fungi_app_prop1.value() )))
340  {
341  if (!m_farm->FungicideTreat( m_field, 0.0,
342  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
343  SimpleEvent( g_date->Date() + 1, wws_fungicide, true );
344  break;
345  }
346  }
347  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,5 ),
348  wws_fungicide2, false );
349  break;
350 
351  case wws_fungicide2:
352  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 50*cfg_fungi_app_prop1.value() )))
353  {
354  if (!m_farm->FungicideTreat( m_field, 0.0,
355  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
356  SimpleEvent( g_date->Date() + 1, wws_fungicide2, true );
357  break;
358  }
359  }
360  // End of thread
361  break;
362 
363  case wws_insecticide1:
364  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 16*cfg_ins_app_prop1.value() )))
365  {
366  if (!m_farm->InsecticideTreat( m_field, 0.0,
367  g_date->DayInYear( 15,5 ) - g_date->DayInYear()))
368  {
369  SimpleEvent( g_date->Date() + 1, wws_insecticide1, true );
370  break;
371  }
372  else
373  {
374  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
375  wws_insecticide2, false );
376  break;
377  }
378  }
379  break;
380 
381  case wws_insecticide2:
382  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 33*cfg_ins_app_prop1.value() )))
383  {
384  if (!m_farm->InsecticideTreat( m_field, 0.0,
385  g_date->DayInYear( 10,6 ) - g_date->DayInYear())) {
386  SimpleEvent( g_date->Date() + 1, wws_insecticide2, true );
387  break;
388  }
389  else
390  {
391  if ((g_date->Date()+7)<( g_date->OldDays() + g_date->DayInYear( 15,6 )))
392  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,6 ),
393  wws_insecticide3, false );
394  else
395  SimpleEvent( g_date->Date()+7, wws_insecticide3, false );
396  break;
397  }
398  }
399  break;
400 
401  case wws_insecticide3:
402  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 67*cfg_ins_app_prop1.value() )))
403  {
404  if (!m_farm->InsecticideTreat( m_field, 0.0,
405  g_date->DayInYear( 30,6 ) - g_date->DayInYear())) {
406  SimpleEvent( g_date->Date() + 1, wws_insecticide3, true );
407  break;
408  }
409  }
410  // End of thread
411  break;
412 
413  case wws_strigling1:
414  if ( m_ev->m_lock || m_farm->DoIt( 5 ))
415  {
416  if (!m_farm->Strigling( m_field, 0.0,
417  g_date->DayInYear( 25,4 ) - g_date->DayInYear())) {
418  SimpleEvent( g_date->Date() + 1, wws_strigling1, true );
419  break;
420  }
421  else
422  {
423  if ((g_date->Date()+7)<( g_date->OldDays() + g_date->DayInYear( 15,6 )))
424  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4),
425  wws_strigling2, false );
426  else
427  SimpleEvent( g_date->Date()+7,wws_strigling2, false );
428  }
429  }
430  break;
431 
432  case wws_strigling2:
433  if (!m_farm->Strigling( m_field, 0.0,
434  g_date->DayInYear( 5,5 ) - g_date->DayInYear())) {
435  SimpleEvent( g_date->Date() + 1, wws_strigling2, true );
436  break;
437  }
438  // End of thread
439  break;
440 
441  case wws_water1:
442  if ( m_ev->m_lock || m_farm->DoIt( 10 )) // **CJT** Soil type 1-4 only
443  {
444  if (!m_farm->Water( m_field, 0.0,
445  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
446  SimpleEvent( g_date->Date() + 1, wws_water1, true );
447  break;
448  }
449  else
450  if ((g_date->Date()+5)<( g_date->OldDays() + g_date->DayInYear( 2,5 )))
451  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 2,5 ),
452  wws_water2, false );
453  else
454  SimpleEvent( g_date->Date()+5, wws_water2, false );
455  }
456  break;
457 
458  case wws_water2:
459  if (!m_farm->Water( m_field, 0.0,
460  g_date->DayInYear( 1,6 ) - g_date->DayInYear())) {
461  SimpleEvent( g_date->Date() + 1, wws_water2, true );
462  break;
463  }
464  // End of thread
465  break;
466 
467  case wws_ferti_p3:
468  if (!m_farm->FP_NPK( m_field, 0.0,
469  g_date->DayInYear( 15,4 ) - g_date->DayInYear())) {
470  SimpleEvent( g_date->Date() + 1, wws_ferti_p3, true );
471  break;
472  }
473 
474  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4 ),
475  wws_ferti_p4, false );
476  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
477  wws_ferti_p5, false );
478  break;
479 
480  case wws_ferti_p4:
481  if ( m_ev->m_lock || m_farm->DoIt( 50 ))
482  {
483  if (!m_farm->FP_NPK( m_field, 0.0,
484  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
485  SimpleEvent( g_date->Date() + 1, wws_ferti_p4, true );
486  break;
487  }
488  }
489 
490  // The Main thread
491  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,8 ),
492  wws_harvest, false );
493  break;
494 
495  case wws_ferti_p5:
496  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
497  {
498  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
499  g_date->DayInYear( 5,5 ) - g_date->DayInYear())) {
500  SimpleEvent( g_date->Date() + 1, wws_ferti_p5, true );
501  break;
502  }
503  }
504  break;
505 
506  case wws_ferti_s3:
507  if (!m_farm->FA_Slurry(m_field, 0.0,
508  g_date->DayInYear( 30,4 ) - g_date->DayInYear())) {
509  SimpleEvent( g_date->Date() + 1, wws_ferti_s3, true );
510  break;
511  }
512  // The Main thread
513  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,8 ),
514  wws_harvest, false );
515  break;
516 
517  case wws_ferti_s4:
518  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
519  {
520  if (!m_farm->FA_NPK( m_field, 0.0,
521  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
522  SimpleEvent( g_date->Date() + 1, wws_ferti_s4, true );
523  break;
524  }
525  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 21,4 ),
526  wws_ferti_s5, false );
527  }
528  break;
529 
530  case wws_ferti_s5:
531  if ( m_ev->m_lock || m_farm->DoIt( 40 ))
532  {
533  if (!m_farm->FA_NPK( m_field, 0.0,
534  g_date->DayInYear( 1,5 ) - g_date->DayInYear())) {
535  SimpleEvent( g_date->Date() + 1, wws_ferti_s5, true );
536  break;
537  }
538  }
539  break;
540 
541  case wws_harvest:
542  if (!m_farm->Harvest( m_field, 0.0,
543  g_date->DayInYear( 20,8 ) - g_date->DayInYear()))
544  {
545  SimpleEvent( g_date->Date() + 1, wws_harvest, true );
546  break;
547  }
549  break;
550 
551  case wws_straw_chopping:
552  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
553  {
554  if (!m_farm->StrawChopping( m_field, 0.0,
555  m_field->GetMDates(1,0) - g_date->DayInYear())) {
556  SimpleEvent( g_date->Date() + 1, wws_straw_chopping, true );
557  break;
558  }
559  else
560  {
562  }
563  }
564  else
565  {
567  }
568  break;
569 
570  case wws_hay_turning:
571  if ( m_ev->m_lock || m_farm->DoIt( 5 ))
572  {
573  if (!m_farm->HayTurning( m_field, 0.0,
574  m_field->GetMDates(1,1) - g_date->DayInYear())) {
575  SimpleEvent( g_date->Date() + 1, wws_hay_turning, true );
576  break;
577  }
578  }
580  wws_hay_baling, false );
581  break;
582 
583  case wws_hay_baling:
584  if (!m_farm->HayBailing( m_field, 0.0,
585  m_field->GetMDates(1,2) - g_date->DayInYear())) {
586  SimpleEvent( g_date->Date() + 1, wws_hay_baling, true );
587  break;
588  }
590  wws_stubble_harrow2, false );
591  break;
592 
593  case wws_stubble_harrow2:
594  if ( m_ev->m_lock || m_farm->DoIt( 65 ))
595  {
596  if (!m_farm->StubbleHarrowing( m_field, 0.0,
597  m_field->GetMDates(1,3) - g_date->DayInYear())) {
598  SimpleEvent( g_date->Date() + 1, wws_stubble_harrow2, true );
599  break;
600  }
601  }
603  wws_grubning, false );
604  break;
605 
606  case wws_grubning:
607  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
608  {
609  if (!m_farm->DeepPlough( m_field, 0.0,
610  m_field->GetMDates(1,4) - g_date->DayInYear())) {
611  SimpleEvent( g_date->Date() + 1, wws_grubning, true );
612  break;
613  }
614  }
615  done=true;
616  // END OF MAIN THREAD
617  break;
618 
619  default:
620  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): "
621  "Unknown event type! ", "" );
622  exit( 1 );
623  }
624  return done;
625 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), cfg_fungi_app_prop1, cfg_greg_app_prop, cfg_ins_app_prop1, cfg_strigling_prop, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DeepPlough(), Farm::DoIt(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMConstants(), LE::GetMDates(), LE::GetPoly(), LE::GetVegBiomass(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HayBailing(), Farm::HayTurning(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringRoll(), Farm::StrawChopping(), Farm::Strigling(), Farm::StubbleHarrowing(), CfgFloat::value(), MapErrorMsg::Warn(), WARN_BUG, Farm::Water(), wws_autumn_harrow, wws_autumn_plough, wws_autumn_roll, wws_autumn_sow, wws_ferti_p1, wws_ferti_p2, wws_ferti_p3, wws_ferti_p4, wws_ferti_p5, wws_ferti_s1, wws_ferti_s2, wws_ferti_s3, wws_ferti_s4, wws_ferti_s5, wws_fungicide, wws_fungicide2, wws_GR, wws_grubning, wws_harvest, wws_hay_baling, wws_hay_turning, wws_insecticide1, wws_insecticide2, wws_insecticide3, wws_spring_roll, wws_start, wws_straw_chopping, wws_strigling0a, wws_strigling0b, wws_strigling1, wws_strigling2, wws_stubble_harrow1, wws_stubble_harrow2, wws_water1, wws_water2, WWStrigling_AUTUMN_PLOUGH, and WWStrigling_WAIT_FOR_PLOUGH.

◆ SetUpFarmCategoryInformation()

void WinterWheatStrigling::SetUpFarmCategoryInformation ( )
inline
94  {
95  const int elements = 2 + (wws_foobar - WINTERWHEATStrigling_BASE);
97 
98  FarmManagementCategory catlist[elements] =
99  {
100  fmc_Others, // zero element unused but must be here
101  fmc_Others,//wws_start = 1, // Compulsory, must always be 1 (one).
102  fmc_Others,//wws_sleep_all_day = WINTERWHEATStrigling_BASE,
103  fmc_Fertilizer,//wws_ferti_p1,
104  fmc_Fertilizer,//wws_ferti_s1,
105  fmc_Fertilizer,//wws_ferti_s2,
106  fmc_Cultivation,//wws_autumn_plough,
107  fmc_Cultivation,//wws_autumn_harrow,
108  fmc_Cultivation,//wws_stubble_harrow1,
109  fmc_Others,//wws_autumn_sow,
110  fmc_Others,//wws_autumn_roll,
111  fmc_Fertilizer,//wws_ferti_p2,
112  fmc_Cultivation,//wws_strigling0a,
113  fmc_Others,//wws_spring_roll,
114  fmc_Others,//wws_strigling0b,
115  fmc_Others,//wws_GR,
116  fmc_Fungicide,//wws_fungicide,
117  fmc_Fungicide,//wws_fungicide2,
118  fmc_Insecticide,//wws_insecticide1,
119  fmc_Insecticide,//wws_insecticide2,
120  fmc_Insecticide,//wws_insecticide3,
121  fmc_Cultivation,//wws_strigling1,
122  fmc_Cultivation,//wws_strigling2,
123  fmc_Watering,//wws_water1,
124  fmc_Watering,//wws_water2,
125  fmc_Fertilizer,//wws_ferti_p3,
126  fmc_Fertilizer,//wws_ferti_p4,
127  fmc_Fertilizer,//wws_ferti_p5,
128  fmc_Fertilizer,//wws_ferti_s3,
129  fmc_Fertilizer,//wws_ferti_s4,
130  fmc_Fertilizer,//wws_ferti_s5,
131  fmc_Harvest,//wws_harvest,
132  fmc_Others,//wws_straw_chopping,
133  fmc_Others,//wws_hay_turning,
134  fmc_Others,//wws_hay_baling,
135  fmc_Cultivation,//wws_stubble_harrow2,
136  fmc_Cultivation//wws_grubning,
137 
138  // no foobar entry
139 
140  };
141  // Iterate over the catlist elements and copy them to vector
142  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
143 
144  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, WINTERWHEATStrigling_BASE, and wws_foobar.

Referenced by WinterWheatStrigling().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::SpringRoll
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
Definition: FarmFuncs.cpp:487
wws_straw_chopping
Definition: WinterWheatStrigling.h:76
wws_strigling0a
Definition: WinterWheatStrigling.h:56
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1067
wws_ferti_p1
Definition: WinterWheatStrigling.h:47
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
wws_strigling1
Definition: WinterWheatStrigling.h:65
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
wws_stubble_harrow1
Definition: WinterWheatStrigling.h:52
wws_grubning
Definition: WinterWheatStrigling.h:80
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
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
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
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
wws_strigling2
Definition: WinterWheatStrigling.h:66
wws_start
Definition: WinterWheatStrigling.h:45
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
WWStrigling_AUTUMN_PLOUGH
#define WWStrigling_AUTUMN_PLOUGH
Definition: WinterWheatStrigling.h:42
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
wws_ferti_s5
Definition: WinterWheatStrigling.h:74
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wws_ferti_p4
Definition: WinterWheatStrigling.h:70
Farm::FA_Manure
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1110
wws_autumn_roll
Definition: WinterWheatStrigling.h:54
CfgFloat::value
double value() const
Definition: Configurator.h:142
wws_ferti_p5
Definition: WinterWheatStrigling.h:71
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wws_harvest
Definition: WinterWheatStrigling.h:75
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
wws_strigling0b
Definition: WinterWheatStrigling.h:58
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
LE::GetVegBiomass
virtual double GetVegBiomass(void)
Definition: Elements.h:164
wws_GR
Definition: WinterWheatStrigling.h:59
wws_autumn_plough
Definition: WinterWheatStrigling.h:50
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
WinterWheatStrigling::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterWheatStrigling.h:94
wws_water2
Definition: WinterWheatStrigling.h:68
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
wws_insecticide3
Definition: WinterWheatStrigling.h:64
wws_insecticide2
Definition: WinterWheatStrigling.h:63
wws_fungicide2
Definition: WinterWheatStrigling.h:61
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
wws_ferti_s1
Definition: WinterWheatStrigling.h:48
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wws_autumn_harrow
Definition: WinterWheatStrigling.h:51
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
wws_hay_baling
Definition: WinterWheatStrigling.h:78
wws_ferti_s4
Definition: WinterWheatStrigling.h:73
Calendar::Date
long Date(void)
Definition: Calendar.h:57
wws_hay_turning
Definition: WinterWheatStrigling.h:77
wws_fungicide
Definition: WinterWheatStrigling.h:60
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: FarmFuncs.cpp:1507
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
wws_stubble_harrow2
Definition: WinterWheatStrigling.h:79
wws_ferti_s3
Definition: WinterWheatStrigling.h:72
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
wws_spring_roll
Definition: WinterWheatStrigling.h:57
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
Crop::m_ManagementCategories
vector< FarmManagementCategory > m_ManagementCategories
Holds the translation between the farm operation enum for each crop and the farm management category ...
Definition: Farm.h:530
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
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: FarmFuncs.cpp:299
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
wws_ferti_p2
Definition: WinterWheatStrigling.h:55
WWStrigling_WAIT_FOR_PLOUGH
#define WWStrigling_WAIT_FOR_PLOUGH
Definition: WinterWheatStrigling.h:41
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
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
wws_insecticide1
Definition: WinterWheatStrigling.h:62
WINTERWHEATStrigling_BASE
#define WINTERWHEATStrigling_BASE
Definition: WinterWheatStrigling.h:40
Farm::DeepPlough
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
Definition: FarmFuncs.cpp:408
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the autumn on a_field.
Definition: FarmFuncs.cpp:360
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
wws_ferti_s2
Definition: WinterWheatStrigling.h:49
wws_foobar
Definition: WinterWheatStrigling.h:81
wws_water1
Definition: WinterWheatStrigling.h:67
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
wws_ferti_p3
Definition: WinterWheatStrigling.h:69
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
wws_autumn_sow
Definition: WinterWheatStrigling.h:53
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Farm::HayTurning
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
Definition: FarmFuncs.cpp:1491
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
cfg_strigling_prop
CfgFloat cfg_strigling_prop
WARN_BUG
Definition: MapErrorMsg.h:34
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523