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

#include <WinterWheatStriglingSingle.h>

Inheritance diagram for WinterWheatStriglingSingle:
Crop

Public Member Functions

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

◆ WinterWheatStriglingSingle()

WinterWheatStriglingSingle::WinterWheatStriglingSingle ( 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 WinterWheatStriglingSingle::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  case wwss_start: {
50  a_field->ClearManagementActionSum();
51 
52  // Set up the date management stuff
53 
54  // Could save the start day in case it is needed later
55  // m_field->m_startday = m_ev->m_startday;
56 
57  // Start and stop dates for all events after harvest
58  int noDates = 5;
59  m_field->SetMDates( 0, 0, g_date->DayInYear( 20, 8 ) );
60 
61  // Determined by harvest date - used to see if at all possible
62  m_field->SetMDates( 1, 0, g_date->DayInYear( 20, 8 ) );
63  m_field->SetMDates( 0, 1, 0 ); // Subbleharrow start
64  m_field->SetMDates( 1, 1, g_date->DayInYear( 20, 8 ) );
65  m_field->SetMDates( 0, 2, g_date->DayInYear( 5, 8 ) );
66  m_field->SetMDates( 1, 2, g_date->DayInYear( 25, 8 ) );
67  m_field->SetMDates( 0, 3, g_date->DayInYear( 10, 8 ) );
68  m_field->SetMDates( 1, 3, g_date->DayInYear( 15, 9 ) );
69  m_field->SetMDates( 0, 4, g_date->DayInYear( 15, 8 ) );
70  m_field->SetMDates( 1, 4, g_date->DayInYear( 15, 10 ) );
71  // Can be up to 10 of these. If the shortening code is triggered
72  // then these will be reduced in value to 0
73  m_field->SetMConstants( 0, 1 );
74 
75  // Check the next crop for early start, unless it is a spring crop
76  // in which case we ASSUME that no checking is necessary!!!!
77  // So DO NOT implement a crop that runs over the year boundary
78  if ( m_ev->m_startday > g_date->DayInYear( 1, 7 ) ) {
79  if ( m_field->GetMDates( 0, 0 ) >= m_ev->m_startday ) {
80  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): ""Harvest too late for the next crop to start!!!", "" );
81  exit( 1 );
82  }
83  // Now fix any late finishing problems
84  bool toggle = false;
85  for ( int i = 0; i < noDates; i++ ) {
86  if ( m_field->GetMDates( 0, i ) >= m_ev->m_startday ) {
87  toggle = true;
88  m_field->SetMDates( 0, i, m_ev->m_startday - 1 );
89  }
90  if ( m_field->GetMDates( 1, i ) >= m_ev->m_startday ) {
91  toggle = true;
92  m_field->SetMDates( 1, i, m_ev->m_startday - 1 );
93  }
94  }
95  if ( toggle )
96  for ( int i = 0; i < 10; i++ ) m_field->SetMConstants( i, 0 );
97  }
98  // Now no operations can be timed after the start of the next crop.
99 
100  // CJT note:
101  // Start single block date checking code to be cut-'n-pasted...
102  int d1;
103  if ( !m_ev->m_first_year ) {
104 
105  // Are we before July 1st?
106  d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
107  if ( g_date->Date() < d1 ) {
108  // Yes, too early. We assumme this is because the last crop was late
109  printf( "Poly: %d\n", m_field->GetPoly() );
110  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): ""Crop start attempt between 1st Jan & 1st July", "" );
111  exit( 1 );
112  } else {
113  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
114  if ( g_date->Date() > d1 ) {
115  // Yes too late - should not happen - raise an error
116  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): ""Crop start attempt after last possible start date", "" );
117  exit( 1 );
118  }
119  }
120  } else {
121  // Is the first year
122  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ), wwss_spring_roll, false );
123  break;
124  }
125  // End single block date checking code. Please see next line
126  // comment as well.
127  // Reinit d1 to first possible starting date.
128  d1 = g_date->OldDays() + g_date->DayInYear( 21, 8 );
129  // OK, let's go.
130  if ( m_farm->IsStockFarmer() ) // StockFarmer
131  {
132  SimpleEvent( d1, wwss_ferti_s1, false );
133  } else
134  SimpleEvent( d1, wwss_ferti_p1, false );
135  }
136  break;
137 
138  case wwss_ferti_p1:
139  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
140  if ( !m_farm->FP_Slurry( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
141  SimpleEvent( g_date->Date() + 1, wwss_ferti_p1, true );
142  break;
143  }
144  }
146  break;
147 
148  case wwss_ferti_s1:
149  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
150  SimpleEvent( g_date->Date() + 1, wwss_ferti_s1, true );
151  break;
152  }
153  // This may cause two applications of fertilizer in one day...
154  // --FN--
155  SimpleEvent( g_date->Date(), wwss_ferti_s2, false );
156  // --FN--
157  break;
158 
159  case wwss_ferti_s2:
160  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
161  if ( !m_farm->FA_Manure( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
162  SimpleEvent( g_date->Date() + 1, wwss_ferti_s2, true );
163  break;
164  }
165  }
167  break;
168 
169  case wwss_autumn_plough:
170  if ( m_ev->m_lock || m_farm->DoIt( 95 ) ) {
171  if ( !m_farm->AutumnPlough( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
172  SimpleEvent( g_date->Date() + 1, wwss_autumn_plough, true );
173  break;
174  } else {
176  SimpleEvent( g_date->Date() + 1, wwss_autumn_harrow, false );
177  break;
178  }
179  }
180  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow1, false );
181  break;
182 
183  case wwss_autumn_harrow:
184  if ( !m_farm->AutumnHarrow( m_field, 0.0, g_date->DayInYear( 10, 10 ) - g_date->DayInYear() ) ) {
185  SimpleEvent( g_date->Date() + 1, wwss_autumn_harrow, true );
186  break;
187  }
188  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 9 ), wwss_autumn_sow, false );
189  break;
190 
192  if ( !m_farm->StubbleHarrowing( m_field, 0.0, g_date->DayInYear( 10, 10 ) - g_date->DayInYear() ) ) {
193  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow1, true );
194  break;
195  }
196  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 9 ), wwss_autumn_sow, false );
197  break;
198 
199  case wwss_autumn_sow:
200  if ( !m_farm->AutumnSow( m_field, 0.0, g_date->DayInYear( 20, 10 ) - g_date->DayInYear() ) ) {
201  SimpleEvent( g_date->Date() + 1, wwss_autumn_sow, true );
202  break;
203  }
204  SimpleEvent( g_date->Date() + 1, wwss_autumn_roll, false );
205  break;
206 
207  case wwss_autumn_roll:
208  if ( ( m_ev->m_lock || m_farm->DoIt( 5 ) ) && ( WWStriglingSingle_AUTUMN_PLOUGH ) ) {
209  if ( !m_farm->AutumnRoll( m_field, 0.0, g_date->DayInYear( 27, 10 ) - g_date->DayInYear() ) ) {
210  SimpleEvent( g_date->Date() + 1, wwss_autumn_roll, true );
211  break;
212  }
213  }
214  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 9 ), wwss_ferti_p2, false );
215  break;
216 
217  case wwss_ferti_p2:
218  if ( ( m_ev->m_lock || m_farm->DoIt( 20 ) ) && ( !m_farm->IsStockFarmer() ) ) {
219  if ( m_field->GetVegBiomass() > 0 )
220  //only when there has been a bit of growth
221  {
222  if ( !m_farm->FP_ManganeseSulphate( m_field, 0.0, g_date->DayInYear( 30, 10 ) - g_date->DayInYear() ) ) {
223  SimpleEvent( g_date->Date() + 1, wwss_ferti_p2, true );
224  break;
225  }
226  }
227  }
228  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 10 ), wwss_strigling0a, false );
229  break;
230 
231  case wwss_strigling0a:
232  if ( cfg_SingleStriglingTime.value() == 1 ) {
233  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
234  SimpleEvent( g_date->Date() + 1, wwss_strigling0a, true );
235  break;
236  }
237  }
238  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ) + 365, wwss_spring_roll, false );
239  break;
240 
241  case wwss_spring_roll:
242  if ( m_ev->m_lock || m_farm->DoIt( 5 ) ) {
243  if ( !m_farm->SpringRoll( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
244  SimpleEvent( g_date->Date() + 1, wwss_spring_roll, true );
245  break;
246  }
247  }
248  if ( m_farm->IsStockFarmer() ) // StockFarmer
249  {
250  SimpleEvent( g_date->Date() + 1, wwss_ferti_s3, false );
251  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 4 ), wwss_ferti_s4, false );
252  } else
253  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 3 ), wwss_ferti_p3, false );
254  // All need the next threads
255  if ( cfg_SingleStriglingTime.value() == 2 ) {
256  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 4 ), wwss_strigling0b, true );
257  }
258  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_GR, false );
259  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20, 4 ), wwss_fungicide, false );
260  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 5 ), wwss_insecticide1, false );
261  if ( cfg_SingleStriglingTime.value() == 3 ) {
262  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_strigling1, true );
263  }
264  if ( cfg_SingleStriglingTime.value() == 4 ) {
265  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 5 ), wwss_strigling2, true );
266  }
267  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 5 ), wwss_water1, false );
268  break;
269 
270  case wwss_strigling0b:
271  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 15, 4 ) - g_date->DayInYear() ) ) {
272  SimpleEvent( g_date->Date() + 1, wwss_strigling0a, true );
273  break;
274  }
275  // End of thread
276  break;
277 
278  case wwss_GR:
279  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 15 * cfg_greg_app_prop.value()) ) ) {
280  // --FN--
281  if ( !m_farm->GrowthRegulator( m_field, 0.0, g_date->DayInYear( 10, 5 ) - g_date->DayInYear() ) ) {
282  SimpleEvent( g_date->Date() + 1, wwss_GR, true );
283  break;
284  }
285  }
286  // End of thread
287  break;
288 
289  case wwss_fungicide:
290  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 70 * cfg_fungi_app_prop1.value() ))) {
291  if ( !m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 10, 5 ) - g_date->DayInYear() ) ) {
292  SimpleEvent( g_date->Date() + 1, wwss_fungicide, true );
293  break;
294  }
295  }
296  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20, 5 ), wwss_fungicide2, false );
297  break;
298 
299  case wwss_fungicide2:
300  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 50 * cfg_fungi_app_prop1.value() ) )) {
301  if ( !m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
302  SimpleEvent( g_date->Date() + 1, wwss_fungicide2, true );
303  break;
304  }
305  }
306  // End of thread
307  break;
308 
309  case wwss_insecticide1:
310  if ( m_ev->m_lock || m_farm->DoIt( (int) ( (int) ( 16 * cfg_ins_app_prop1.value() ))) ) {
311  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
312  SimpleEvent( g_date->Date() + 1, wwss_insecticide1, true );
313  break;
314  } else {
315  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 6 ), wwss_insecticide2, false );
316  break;
317  }
318  }
319  break;
320 
321  case wwss_insecticide2:
322  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 33 * cfg_ins_app_prop1.value() )) ) {
323  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 10, 6 ) - g_date->DayInYear() ) ) {
324  SimpleEvent( g_date->Date() + 1, wwss_insecticide2, true );
325  break;
326  } else {
327  if ( ( g_date->Date() + 7 ) < ( g_date->OldDays() + g_date->DayInYear( 15, 6 ) ) )
328  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 6 ), wwss_insecticide3, false ); else
329  SimpleEvent( g_date->Date() + 7, wwss_insecticide3, false );
330  break;
331  }
332  }
333  break;
334 
335  case wwss_insecticide3:
336  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 67 * cfg_ins_app_prop1.value() ) )) {
337  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 30, 6 ) - g_date->DayInYear() ) ) {
338  SimpleEvent( g_date->Date() + 1, wwss_insecticide3, true );
339  break;
340  }
341  }
342  // End of thread
343  break;
344 
345  case wwss_strigling1:
346  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 25, 4 ) - g_date->DayInYear() ) ) {
347  SimpleEvent( g_date->Date() + 1, wwss_strigling1, true );
348  break;
349  }
350  break;
351 
352  case wwss_strigling2:
353  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 5, 5 ) - g_date->DayInYear() ) ) {
354  SimpleEvent( g_date->Date() + 1, wwss_strigling2, true );
355  break;
356  }
357  // End of thread
358  break;
359 
360  case wwss_water1:
361  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) // **CJT** Soil type 1-4 only
362  {
363  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
364  SimpleEvent( g_date->Date() + 1, wwss_water1, true );
365  break;
366  } else if ( ( g_date->Date() + 5 ) < ( g_date->OldDays() + g_date->DayInYear( 2, 5 ) ) )
367  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 2, 5 ), wwss_water2, false ); else
368  SimpleEvent( g_date->Date() + 5, wwss_water2, false );
369  }
370  break;
371 
372  case wwss_water2:
373  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 1, 6 ) - g_date->DayInYear() ) ) {
374  SimpleEvent( g_date->Date() + 1, wwss_water2, true );
375  break;
376  }
377  // End of thread
378  break;
379 
380  case wwss_ferti_p3:
381  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 15, 4 ) - g_date->DayInYear() ) ) {
382  SimpleEvent( g_date->Date() + 1, wwss_ferti_p3, true );
383  break;
384  }
385 
386  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_ferti_p4, false );
387  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ), wwss_ferti_p5, false );
388  break;
389 
390  case wwss_ferti_p4:
391  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
392  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
393  SimpleEvent( g_date->Date() + 1, wwss_ferti_p4, true );
394  break;
395  }
396  }
397  // The Main thread
398  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 8 ), wwss_harvest, false );
399  break;
400 
401  case wwss_ferti_p5:
402  if ( m_ev->m_lock || m_farm->DoIt( 20 ) ) {
403  if ( !m_farm->FP_ManganeseSulphate( m_field, 0.0, g_date->DayInYear( 5, 5 ) - g_date->DayInYear() ) ) {
404  SimpleEvent( g_date->Date() + 1, wwss_ferti_p5, true );
405  break;
406  }
407  }
408  break;
409 
410  case wwss_ferti_s3:
411  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
412  SimpleEvent( g_date->Date() + 1, wwss_ferti_s3, true );
413  break;
414  }
415  // The Main thread
416  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 8 ), wwss_harvest, false );
417  break;
418 
419  case wwss_ferti_s4:
420  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
421  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 20, 4 ) - g_date->DayInYear() ) ) {
422  SimpleEvent( g_date->Date() + 1, wwss_ferti_s4, true );
423  break;
424  }
425  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 21, 4 ), wwss_ferti_s5, false );
426  }
427  break;
428 
429  case wwss_ferti_s5:
430  if ( m_ev->m_lock || m_farm->DoIt( 40 ) ) {
431  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 1, 5 ) - g_date->DayInYear() ) ) {
432  SimpleEvent( g_date->Date() + 1, wwss_ferti_s5, true );
433  break;
434  }
435  }
436  break;
437 
438  case wwss_harvest:
439  if ( !m_farm->Harvest( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
440  SimpleEvent( g_date->Date() + 1, wwss_harvest, true );
441  break;
442  }
444  break;
445 
446  case wwss_straw_chopping:
447  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
448  if ( !m_farm->StrawChopping( m_field, 0.0, m_field->GetMDates( 1, 0 ) - g_date->DayInYear() ) ) {
449  SimpleEvent( g_date->Date() + 1, wwss_straw_chopping, true );
450  break;
451  } else {
453  }
454  } else {
456  }
457  break;
458 
459  case wwss_hay_turning:
460  if ( m_ev->m_lock || m_farm->DoIt( 5 ) ) {
461  if ( !m_farm->HayTurning( m_field, 0.0, m_field->GetMDates( 1, 1 ) - g_date->DayInYear() ) ) {
462  SimpleEvent( g_date->Date() + 1, wwss_hay_turning, true );
463  break;
464  }
465  }
466  SimpleEvent( g_date->OldDays() + m_field->GetMDates( 0, 2 ), wwss_hay_baling, false );
467  break;
468 
469  case wwss_hay_baling:
470  if ( !m_farm->HayBailing( m_field, 0.0, m_field->GetMDates( 1, 2 ) - g_date->DayInYear() ) ) {
471  SimpleEvent( g_date->Date() + 1, wwss_hay_baling, true );
472  break;
473  }
475  break;
476 
478  if ( m_ev->m_lock || m_farm->DoIt( 65 ) ) {
479  if ( !m_farm->StubbleHarrowing( m_field, 0.0, m_field->GetMDates( 1, 3 ) - g_date->DayInYear() ) ) {
480  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow2, true );
481  break;
482  }
483  }
484  SimpleEvent( g_date->OldDays() + m_field->GetMDates( 0, 4 ), wwss_grubning, false );
485  break;
486 
487  case wwss_grubning:
488  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
489  if ( !m_farm->DeepPlough( m_field, 0.0, m_field->GetMDates( 1, 4 ) - g_date->DayInYear() ) ) {
490  SimpleEvent( g_date->Date() + 1, wwss_grubning, true );
491  break;
492  }
493  }
494  done = true;
495  // END OF MAIN THREAD
496  break;
497 
498  default:
499  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): ""Unknown event type! ", "" );
500  exit( 1 );
501  }
502  return done;
503 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), cfg_fungi_app_prop1, cfg_greg_app_prop, cfg_ins_app_prop1, cfg_SingleStriglingTime, 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(), wwss_autumn_harrow, wwss_autumn_plough, wwss_autumn_roll, wwss_autumn_sow, wwss_ferti_p1, wwss_ferti_p2, wwss_ferti_p3, wwss_ferti_p4, wwss_ferti_p5, wwss_ferti_s1, wwss_ferti_s2, wwss_ferti_s3, wwss_ferti_s4, wwss_ferti_s5, wwss_fungicide, wwss_fungicide2, wwss_GR, wwss_grubning, wwss_harvest, wwss_hay_baling, wwss_hay_turning, wwss_insecticide1, wwss_insecticide2, wwss_insecticide3, wwss_spring_roll, wwss_start, wwss_straw_chopping, wwss_strigling0a, wwss_strigling0b, wwss_strigling1, wwss_strigling2, wwss_stubble_harrow1, wwss_stubble_harrow2, wwss_water1, wwss_water2, WWStriglingSingle_AUTUMN_PLOUGH, and WWStriglingSingle_WAIT_FOR_PLOUGH.

◆ SetUpFarmCategoryInformation()

void WinterWheatStriglingSingle::SetUpFarmCategoryInformation ( )
inline
94  {
95  const int elements = 2 + (wwss_foobar - WINTERWHEATStriglingSingle_BASE);
97 
98  FarmManagementCategory catlist[elements] =
99  {
100  fmc_Others, // zero element unused but must be here
101  fmc_Others,//wwss_start = 1, // Compulsory, must always be 1 (one).
102  fmc_Others,//wwss_sleep_all_day = WINTERWHEATStriglingSingle_BASE,
103  fmc_Fertilizer,//wwss_ferti_p1,
104  fmc_Fertilizer,//wwss_ferti_s1,
105  fmc_Fertilizer,//wwss_ferti_s2,
106  fmc_Cultivation,//wwss_autumn_plough,
107  fmc_Cultivation,//wwss_autumn_harrow,
108  fmc_Cultivation,//wwss_stubble_harrow1,
109  fmc_Others,//wwss_autumn_sow,
110  fmc_Others,//wwss_autumn_roll,
111  fmc_Fertilizer,//wwss_ferti_p2,
112  fmc_Cultivation,//wwss_strigling0a,
113  fmc_Others,//wwss_spring_roll,
114  fmc_Cultivation,//wwss_strigling0b,
115  fmc_Others,//wwss_GR,
116  fmc_Fungicide,//wwss_fungicide,
117  fmc_Fungicide,//wwss_fungicide2,
118  fmc_Insecticide,//wwss_insecticide1,
119  fmc_Insecticide,//wwss_insecticide2,
120  fmc_Insecticide,//wwss_insecticide3,
121  fmc_Cultivation,//wwss_strigling1,
122  fmc_Cultivation,//wwss_strigling2,
123  fmc_Harvest,//wwss_water1,
124  fmc_Harvest,//wwss_water2,
125  fmc_Fertilizer,//wwss_ferti_p3,
126  fmc_Fertilizer,//wwss_ferti_p4,
127  fmc_Fertilizer,//wwss_ferti_p5,
128  fmc_Fertilizer,//wwss_ferti_s3,
129  fmc_Fertilizer,//wwss_ferti_s4,
130  fmc_Fertilizer,//wwss_ferti_s5,
131  fmc_Harvest,//wwss_harvest,
132  fmc_Others,//wwss_straw_chopping,
133  fmc_Others,//wwss_hay_turning,
134  fmc_Others,//wwss_hay_baling,
135  fmc_Cultivation,//wwss_stubble_harrow2,
136  fmc_Cultivation//wwss_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, Crop::m_base_elements_no, Crop::m_ManagementCategories, WINTERWHEATStriglingSingle_BASE, and wwss_foobar.

Referenced by WinterWheatStriglingSingle().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
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
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
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
WINTERWHEATStriglingSingle_BASE
#define WINTERWHEATStriglingSingle_BASE
Definition: WinterWheatStriglingSingle.h:40
wwss_autumn_roll
Definition: WinterWheatStriglingSingle.h:54
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
wwss_grubning
Definition: WinterWheatStriglingSingle.h:80
wwss_fungicide
Definition: WinterWheatStriglingSingle.h:60
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
wwss_straw_chopping
Definition: WinterWheatStriglingSingle.h:76
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
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
wwss_insecticide2
Definition: WinterWheatStriglingSingle.h:63
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
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
wwss_insecticide3
Definition: WinterWheatStriglingSingle.h:64
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
wwss_strigling0b
Definition: WinterWheatStriglingSingle.h:58
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wwss_ferti_s3
Definition: WinterWheatStriglingSingle.h:72
wwss_ferti_s4
Definition: WinterWheatStriglingSingle.h:73
wwss_ferti_s2
Definition: WinterWheatStriglingSingle.h:49
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
wwss_ferti_p3
Definition: WinterWheatStriglingSingle.h:69
CfgFloat::value
double value() const
Definition: Configurator.h:142
cfg_SingleStriglingTime
CfgInt cfg_SingleStriglingTime
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wwss_insecticide1
Definition: WinterWheatStriglingSingle.h:62
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
wwss_strigling1
Definition: WinterWheatStriglingSingle.h:65
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
wwss_GR
Definition: WinterWheatStriglingSingle.h:59
LE::GetVegBiomass
virtual double GetVegBiomass(void)
Definition: Elements.h:164
wwss_spring_roll
Definition: WinterWheatStriglingSingle.h:57
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
wwss_fungicide2
Definition: WinterWheatStriglingSingle.h:61
wwss_ferti_p5
Definition: WinterWheatStriglingSingle.h:71
wwss_water2
Definition: WinterWheatStriglingSingle.h:68
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wwss_foobar
Definition: WinterWheatStriglingSingle.h:81
wwss_strigling0a
Definition: WinterWheatStriglingSingle.h:56
wwss_autumn_harrow
Definition: WinterWheatStriglingSingle.h:51
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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
wwss_ferti_p2
Definition: WinterWheatStriglingSingle.h:55
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
wwss_ferti_p4
Definition: WinterWheatStriglingSingle.h:70
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
wwss_ferti_s1
Definition: WinterWheatStriglingSingle.h:48
wwss_ferti_s5
Definition: WinterWheatStriglingSingle.h:74
wwss_hay_baling
Definition: WinterWheatStriglingSingle.h:78
wwss_stubble_harrow1
Definition: WinterWheatStriglingSingle.h:52
wwss_water1
Definition: WinterWheatStriglingSingle.h:67
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
wwss_autumn_sow
Definition: WinterWheatStriglingSingle.h:53
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
WWStriglingSingle_WAIT_FOR_PLOUGH
#define WWStriglingSingle_WAIT_FOR_PLOUGH
Definition: WinterWheatStriglingSingle.h:41
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
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
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
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
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
wwss_ferti_p1
Definition: WinterWheatStriglingSingle.h:47
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
WinterWheatStriglingSingle::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterWheatStriglingSingle.h:94
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wwss_start
Definition: WinterWheatStriglingSingle.h:45
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
wwss_stubble_harrow2
Definition: WinterWheatStriglingSingle.h:79
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
wwss_hay_turning
Definition: WinterWheatStriglingSingle.h:77
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
WWStriglingSingle_AUTUMN_PLOUGH
#define WWStriglingSingle_AUTUMN_PLOUGH
Definition: WinterWheatStriglingSingle.h:42
WARN_BUG
Definition: MapErrorMsg.h:34
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
wwss_strigling2
Definition: WinterWheatStriglingSingle.h:66
wwss_autumn_plough
Definition: WinterWheatStriglingSingle.h:50
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
wwss_harvest
Definition: WinterWheatStriglingSingle.h:75
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