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

#include <WinterWheatStriglingCulm.h>

Inheritance diagram for WinterWheatStriglingCulm:
Crop

Public Member Functions

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

◆ WinterWheatStriglingCulm()

WinterWheatStriglingCulm::WinterWheatStriglingCulm ( 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 WinterWheatStriglingCulm::Do ( Farm a_farm,
LE a_field,
FarmEvent a_ev 
)
virtual

Reimplemented from Crop.

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

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), cfg_CulmLastStriglingTime, cfg_fungi_app_prop1, cfg_greg_app_prop, cfg_ins_app_prop1, 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(), CfgInt::value(), CfgFloat::value(), MapErrorMsg::Warn(), WARN_BUG, Farm::Water(), wwsc_autumn_harrow, wwsc_autumn_plough, wwsc_autumn_roll, wwsc_autumn_sow, wwsc_ferti_p1, wwsc_ferti_p2, wwsc_ferti_p3, wwsc_ferti_p4, wwsc_ferti_p5, wwsc_ferti_s1, wwsc_ferti_s2, wwsc_ferti_s3, wwsc_ferti_s4, wwsc_ferti_s5, wwsc_fungicide, wwsc_fungicide2, wwsc_GR, wwsc_grubning, wwsc_harvest, wwsc_hay_baling, wwsc_hay_turning, wwsc_insecticide1, wwsc_insecticide2, wwsc_insecticide3, wwsc_spring_roll, wwsc_start, wwsc_straw_chopping, wwsc_strigling0a, wwsc_strigling0b, wwsc_strigling1, wwsc_strigling2, wwsc_stubble_harrow1, wwsc_stubble_harrow2, wwsc_water1, wwsc_water2, WWStriglingCulm_AUTUMN_PLOUGH, and WWStriglingCulm_WAIT_FOR_PLOUGH.

◆ SetUpFarmCategoryInformation()

void WinterWheatStriglingCulm::SetUpFarmCategoryInformation ( )
inline
94  {
95  const int elements = 2 + (wwsc_foobar - WINTERWHEATStriglingCulm_BASE);
97 
98  FarmManagementCategory catlist[elements] =
99  {
100  fmc_Others, // zero element unused but must be here
101  fmc_Others,//wwsc_start = 1, // Compulsory, must always be 1 (one).
102  fmc_Others,//wwsc_sleep_all_day = WINTERWHEATStriglingCulm_BASE,
103  fmc_Fertilizer,//wwsc_ferti_p1,
104  fmc_Fertilizer,//wwsc_ferti_s1,
105  fmc_Fertilizer,//wwsc_ferti_s2,
106  fmc_Cultivation,//wwsc_autumn_plough,
107  fmc_Cultivation,//wwsc_autumn_harrow,
108  fmc_Cultivation,//wwsc_stubble_harrow1,
109  fmc_Others,//wwsc_autumn_sow,
110  fmc_Others,//wwsc_autumn_roll,
111  fmc_Fertilizer,//wwsc_ferti_p2,
112  fmc_Cultivation,//wwsc_strigling0a,
113  fmc_Others,//wwsc_spring_roll,
114  fmc_Cultivation,//wwsc_strigling0b,
115  fmc_Others,//wwsc_GR,
116  fmc_Fungicide,//wwsc_fungicide,
117  fmc_Fungicide,//wwsc_fungicide2,
118  fmc_Insecticide,//wwsc_insecticide1,
119  fmc_Insecticide,//wwsc_insecticide2,
120  fmc_Insecticide,//wwsc_insecticide3,
121  fmc_Cultivation,//wwsc_strigling1,
122  fmc_Cultivation,//wwsc_strigling2,
123  fmc_Watering,//wwsc_water1,
124  fmc_Watering,//wwsc_water2,
125  fmc_Fertilizer,//wwsc_ferti_p3,
126  fmc_Fertilizer,//wwsc_ferti_p4,
127  fmc_Fertilizer,//wwsc_ferti_p5,
128  fmc_Fertilizer,//wwsc_ferti_s3,
129  fmc_Fertilizer,//wwsc_ferti_s4,
130  fmc_Fertilizer,//wwsc_ferti_s5,
131  fmc_Harvest,//wwsc_harvest,
132  fmc_Others,//wwsc_straw_chopping,
133  fmc_Others,//wwsc_hay_turning,
134  fmc_Others,//wwsc_hay_baling,
135  fmc_Cultivation,//wwsc_stubble_harrow2,
136  fmc_Cultivation//wwsc_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, WINTERWHEATStriglingCulm_BASE, and wwsc_foobar.

Referenced by WinterWheatStriglingCulm().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
WINTERWHEATStriglingCulm_BASE
#define WINTERWHEATStriglingCulm_BASE
Definition: WinterWheatStriglingCulm.h:40
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
wwsc_stubble_harrow2
Definition: WinterWheatStriglingCulm.h:79
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
wwsc_autumn_sow
Definition: WinterWheatStriglingCulm.h:53
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
wwsc_fungicide
Definition: WinterWheatStriglingCulm.h:60
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
wwsc_water2
Definition: WinterWheatStriglingCulm.h:68
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
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
wwsc_strigling0b
Definition: WinterWheatStriglingCulm.h:58
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
wwsc_ferti_s1
Definition: WinterWheatStriglingCulm.h:48
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
wwsc_strigling1
Definition: WinterWheatStriglingCulm.h:65
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wwsc_ferti_p5
Definition: WinterWheatStriglingCulm.h:71
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
CfgFloat::value
double value() const
Definition: Configurator.h:142
wwsc_spring_roll
Definition: WinterWheatStriglingCulm.h:57
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wwsc_insecticide3
Definition: WinterWheatStriglingCulm.h:64
wwsc_strigling0a
Definition: WinterWheatStriglingCulm.h:56
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
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
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
cfg_CulmLastStriglingTime
CfgInt cfg_CulmLastStriglingTime
wwsc_insecticide1
Definition: WinterWheatStriglingCulm.h:62
wwsc_start
Definition: WinterWheatStriglingCulm.h:45
wwsc_ferti_p3
Definition: WinterWheatStriglingCulm.h:69
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wwsc_ferti_s5
Definition: WinterWheatStriglingCulm.h:74
wwsc_autumn_harrow
Definition: WinterWheatStriglingCulm.h:51
wwsc_hay_baling
Definition: WinterWheatStriglingCulm.h:78
Calendar::Date
long Date(void)
Definition: Calendar.h:57
WinterWheatStriglingCulm::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterWheatStriglingCulm.h:94
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
wwsc_harvest
Definition: WinterWheatStriglingCulm.h:75
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
wwsc_hay_turning
Definition: WinterWheatStriglingCulm.h:77
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
wwsc_ferti_p2
Definition: WinterWheatStriglingCulm.h:55
wwsc_grubning
Definition: WinterWheatStriglingCulm.h:80
wwsc_insecticide2
Definition: WinterWheatStriglingCulm.h:63
wwsc_autumn_plough
Definition: WinterWheatStriglingCulm.h:50
WWStriglingCulm_WAIT_FOR_PLOUGH
#define WWStriglingCulm_WAIT_FOR_PLOUGH
Definition: WinterWheatStriglingCulm.h:41
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
CfgInt::value
int value() const
Definition: Configurator.h:116
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
wwsc_foobar
Definition: WinterWheatStriglingCulm.h:81
wwsc_water1
Definition: WinterWheatStriglingCulm.h:67
wwsc_ferti_p1
Definition: WinterWheatStriglingCulm.h:47
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
wwsc_GR
Definition: WinterWheatStriglingCulm.h:59
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
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
wwsc_strigling2
Definition: WinterWheatStriglingCulm.h:66
wwsc_stubble_harrow1
Definition: WinterWheatStriglingCulm.h:52
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
wwsc_ferti_s4
Definition: WinterWheatStriglingCulm.h:73
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wwsc_straw_chopping
Definition: WinterWheatStriglingCulm.h:76
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
wwsc_ferti_p4
Definition: WinterWheatStriglingCulm.h:70
wwsc_fungicide2
Definition: WinterWheatStriglingCulm.h:61
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
WWStriglingCulm_AUTUMN_PLOUGH
#define WWStriglingCulm_AUTUMN_PLOUGH
Definition: WinterWheatStriglingCulm.h:42
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
wwsc_autumn_roll
Definition: WinterWheatStriglingCulm.h:54
wwsc_ferti_s2
Definition: WinterWheatStriglingCulm.h:49
wwsc_ferti_s3
Definition: WinterWheatStriglingCulm.h:72
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