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

#include <WinterBarleyStrigling.h>

Inheritance diagram for WinterBarleyStrigling:
Crop

Public Member Functions

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

◆ WinterBarleyStrigling()

WinterBarleyStrigling::WinterBarleyStrigling ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
92  : Crop(a_tov, a_toc, a_L)
93  {
96  }

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

Member Function Documentation

◆ Do()

bool WinterBarleyStrigling::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  bool done = false;
44 
45  switch ( m_ev->m_todo )
46  {
47  case wbs_start:
48  {
49  a_field->ClearManagementActionSum();
50 
51  // Set up the date management stuff
53  // Start and stop dates for all events after harvest
54  int noDates= 3;
55  m_field->SetMDates(0,0,g_date->DayInYear(20,7));
56  // Determined by harvest date - used to see if at all possible
57  m_field->SetMDates(1,0,g_date->DayInYear(5,8));
58  m_field->SetMDates(0,1,g_date->DayInYear(25,7));
59  m_field->SetMDates(1,1,g_date->DayInYear(10,8));
60  m_field->SetMDates(0,2,g_date->DayInYear(20,7));
61  m_field->SetMDates(1,2,g_date->DayInYear(5,8));
62  // Check the next crop for early start, unless it is a spring crop
63  // in which case we ASSUME that no checking is necessary!!!!
64  // So DO NOT implement a crop that runs over the year boundary
65  if (m_ev->m_startday>g_date->DayInYear(1,7))
66  {
67  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
68  {
69  g_msg->Warn( WARN_BUG, "WinterBarley::Do(): "
70  "Harvest too late for the next crop to start!!!", "" );
71  exit( 1 );
72  }
73  // Now fix any late finishing problems
74  for (int i=0; i<noDates; i++)
75  {
76  if (m_field->GetMDates(0,i)>=m_ev->m_startday)
78  if (m_field->GetMDates(1,i)>=m_ev->m_startday)
80  }
81  }
82  // Now no operations can be timed after the start of the next crop.
83 
84  int d1;
85  if ( ! m_ev->m_first_year )
86  {
87  int today=g_date->Date();
88  // Are we before July 1st?
89  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
90  if (today < d1)
91  {
92  // Yes, too early. We assumme this is because the last crop was late
93  g_msg->Warn( WARN_BUG, "WinterBarley::Do(): "
94  "Crop start attempt between 1st Jan & 1st July", "" );
95  exit( 1 );
96  }
97  else
98  {
99  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
100  if (today > d1)
101  {
102  // Yes too late - should not happen - raise an error
103  g_msg->Warn( WARN_BUG, "WinterBarley::Do(): "
104  "Crop start attempt after last possible start date", "" );
105  exit( 1 );
106  }
107  }
108  }
109  else
110  {
111  // Is the first year so must start in spring like nothing was unusual
112  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,7 )
113  ,wbs_harvest, false );
114  }
115  // End single block date checking code. Please see next line
116  // comment as well.
117  // Reinit d1 to first possible starting date.
118  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
119  if ( g_date->Date() > d1 ) {
120  d1 = g_date->Date();
121  }
122  // OK, let's go.
123  WBS_DID_SEVEN_ONE = false;
124  WBS_DID_SEVEN_TWO = false;
125  WBS_DID_SEVEN_THREE = false;
126  WBS_DID_SEVEN_FOUR = false;
127  WBS_FUNGICIDE_DATE = 0;
128  WBS_HERBICIDE_DATE = 0;
129 
130  if ( m_farm->IsStockFarmer()) {
131  SimpleEvent( d1, wbs_fertmanure_stock, false );
132  d1 += 14;
134  } else {
136  }
137  }
138  break;
139 
141  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
142  {
143  if (!m_farm->FA_Manure( m_field, 0.0,
144  g_date->DayInYear( 5, 9 ) -
145  g_date->DayInYear())) {
146  SimpleEvent( g_date->Date() + 1, wbs_fertmanure_stock, true );
147  break;
148  }
149  }
150  break;
151 
153  if ( m_ev->m_lock || m_farm->DoIt( 95 ))
154  {
155  if (!m_farm->FA_Slurry( m_field, 0.0,
156  g_date->DayInYear( 10, 9 ) -
157  g_date->DayInYear())) {
159  break;
160  }
161  }
162  SimpleEvent( g_date->Date() + 1, wbs_autumn_plough, false );
163  break;
164 
166  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
167  {
168  if (!m_farm->FP_Sludge( m_field, 0.0,
169  g_date->DayInYear( 5, 9 ) -
170  g_date->DayInYear())) {
172  break;
173  }
174  }
175  SimpleEvent( g_date->Date() + 1, wbs_autumn_plough, false );
176  break;
177 
178  case wbs_autumn_plough:
179  if (!m_farm->AutumnPlough( m_field, 0.0,
180  g_date->DayInYear( 5, 9 ) -
181  g_date->DayInYear())) {
182  SimpleEvent( g_date->Date() + 1, wbs_autumn_plough, true );
183  break;
184  }
186  break;
187 
188  case wbs_autumn_harrow:
189  if (!m_farm->AutumnHarrow( m_field, 0.0,
190  g_date->DayInYear( 5, 9 ) -
191  g_date->DayInYear())) {
192  SimpleEvent( g_date->Date() + 1, wbs_autumn_harrow, true );
193  break;
194  }
195  {
196  int d1 = g_date->Date();
197  if ( d1 < g_date->OldDays() + g_date->DayInYear( 1, 9 )) {
198  d1 = g_date->OldDays() + g_date->DayInYear( 1, 9 );
199  }
200  SimpleEvent( d1, wbs_autumn_sow, false );
201  }
202  break;
203 
204  case wbs_autumn_sow:
205  if (!m_farm->AutumnSow( m_field, 0.0,
206  g_date->DayInYear( 15,9 ) -
207  g_date->DayInYear())) {
208  SimpleEvent( g_date->Date() + 1, wbs_autumn_sow, true );
209  break;
210  }
211  {
212  int d1 = g_date->Date() + 10;
213  if ( d1 < g_date->OldDays() + g_date->DayInYear( 15, 9 )) {
214  d1 = g_date->OldDays() + g_date->DayInYear( 15, 9 );
215  }
216  SimpleEvent( d1, wbs_strigling_one, false );
217  }
218  break;
219 
220 case wbs_strigling_one:
221  if (!m_farm->Strigling( m_field, 0.0,
222  g_date->DayInYear( 10,10 ) -
223  g_date->DayInYear())) {
224  SimpleEvent( g_date->Date() + 1, wbs_strigling_one, true );
225  break;
226  }
227  if ( m_farm->IsStockFarmer()) {
228  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ) + 365,
229  wbs_fertslurry_stock_two, false );
230  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ) + 365,
231  wbs_fertnpk_stock_one, false );
232  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ) + 365,
233  wbs_fungicide_one, false );
234  } else {
235  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 16,9 ),
237  }
238  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ) + 365,
239  wbs_strigling_two, false );
240  break;
241 
243  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
244  {
245  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
246  g_date->DayInYear( 30,10 ) -
247  g_date->DayInYear())) {
249  break;
250  }
251  // Did first, so do second manganese too.
252  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ) + 365,
254  } else {
255  // Event 'wbs_fertmanganese_plant_two' was not queued up, so we will
256  // signal its completion already here...
257  WBS_DID_SEVEN_ONE = true;
258  }
259  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ) + 365,
260  wbs_fertnpk_plant_one, false );
261  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ) + 365,
262  wbs_fungicide_one, false );
263  break;
264 
266  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
267  g_date->DayInYear( 5,5 ) -
268  g_date->DayInYear())) {
270  break;
271  }
272  WBS_DID_SEVEN_ONE = true;
273  if ( WBS_DID_SEVEN_TWO &&
276  // We are the last surviving thread. Enter switchboard.
277  SimpleEvent( g_date->Date(), wbs_switchboard, false );
278  }
279  break;
280 
282  if (!m_farm->FP_NPK( m_field, 0.0,
283  g_date->DayInYear( 1,5 ) -
284  g_date->DayInYear())) {
285  SimpleEvent( g_date->Date() + 1, wbs_fertnpk_plant_one, true );
286  break;
287  }
288  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 2,5 ),
289  wbs_fertnpk_plant_two, false );
290  break;
291 
293  if ( m_ev->m_lock || m_farm->DoIt( 15 )) {
294  if (!m_farm->FP_NPK( m_field, 0.0,
295  g_date->DayInYear( 20,5 ) -
296  g_date->DayInYear())) {
297  SimpleEvent( g_date->Date() + 1, wbs_fertnpk_plant_two, true );
298  break;
299  }
300  }
301  WBS_DID_SEVEN_TWO = true;
302  if ( WBS_DID_SEVEN_ONE &&
305  // We are the last surviving thread. Enter switchboard.
306  SimpleEvent( g_date->Date(), wbs_switchboard, false );
307  }
308  break;
309 
311  if ( m_ev->m_lock || m_farm->DoIt( 20 )) {
312  if (!m_farm->FA_Slurry( m_field, 0.0,
313  g_date->DayInYear( 15,5 ) -
314  g_date->DayInYear())) {
316  break;
317  }
318  }
319  WBS_DID_SEVEN_ONE = true;
320  if ( WBS_DID_SEVEN_TWO &&
323  // We are the last surviving thread. Enter switchboard.
324  SimpleEvent( g_date->Date(), wbs_switchboard, false );
325  }
326  break;
327 
329  if ( m_ev->m_lock || m_farm->DoIt( 90 )) {
330  if (!m_farm->FA_NPK( m_field, 0.0,
331  g_date->DayInYear( 30,4 ) -
332  g_date->DayInYear())) {
333  SimpleEvent( g_date->Date() + 1, wbs_fertnpk_stock_one, true );
334  break;
335  }
336  }
337  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
338  wbs_fertnpk_stock_two, false );
339  break;
340 
342  if ( m_ev->m_lock || m_farm->DoIt( 14 )) {
343  if (!m_farm->FA_NPK( m_field, 0.0,
344  g_date->DayInYear( 15,5 ) -
345  g_date->DayInYear())) {
346  SimpleEvent( g_date->Date() + 1, wbs_fertnpk_stock_two, true );
347  break;
348  }
349  }
350  WBS_DID_SEVEN_TWO = true;
351  if ( WBS_DID_SEVEN_ONE &&
354  // We are the last surviving thread. Enter switchboard.
355  SimpleEvent( g_date->Date(), wbs_switchboard, false );
356  }
357  break;
358 
359  case wbs_strigling_two:
360  if ( m_ev->m_lock || m_farm->DoIt( (int) ((int) (60*cfg_herbi_app_prop.value() )) )) {
361  if (!m_farm->HerbicideTreat( m_field, 0.0,
362  g_date->DayInYear( 25,5 ) -
363  g_date->DayInYear())) {
364  SimpleEvent( g_date->Date() + 1, wbs_strigling_two, true );
365  break;
366  }
368  }
369  WBS_DID_SEVEN_THREE = true;
370  if ( WBS_DID_SEVEN_ONE &&
373  // We are the last surviving thread. Enter switchboard.
374  SimpleEvent( g_date->Date(), wbs_switchboard, false );
375  }
376  break;
377 
378  case wbs_fungicide_one:
379  if ( m_ev->m_lock || m_farm->DoIt( (int) (90*cfg_fungi_app_prop1.value() ))) {
380  if (!m_farm->FungicideTreat( m_field, 0.0,
381  g_date->DayInYear( 15,5 ) -
382  g_date->DayInYear())) {
383  SimpleEvent( g_date->Date() + 1, wbs_fungicide_one, true );
384  break;
385  }
387  }
388  WBS_DID_SEVEN_FOUR = true;
389  if ( WBS_DID_SEVEN_ONE &&
392  // We are the last surviving thread. Enter switchboard.
393  SimpleEvent( g_date->Date(), wbs_switchboard, false );
394  }
395  break;
396 
397  case wbs_switchboard:
398  // Welcome to the Winterbarley switchboard, where all threads
399  // meet and have a jolly good time.
400 
401  // Reset all flags for the second round of parallel execution.
402  // Flags double as date indicators when each action took place
403  // (for checking proximity to watering).
404  WBS_DID_EIGHT_ONE = false;
405  WBS_DID_EIGHT_TWO = false;
406  WBS_DID_EIGHT_THREE = false;
407  WBS_DID_EIGHT_FOUR = false;
408 
409  // Start all four threads.
410  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
411  wbs_fungicide_two, false );
412  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
413  wbs_growth_reg, false );
414  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
415  wbs_water, false );
416  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
417  wbs_insecticide, false );
418  break;
419 
420  case wbs_fungicide_two:
421  if ( g_date->Date() < WBS_DID_EIGHT_THREE + 1 ||
422  g_date->Date() < WBS_FUNGICIDE_DATE + 7 ) {
423  // Try again tomorrow.
425  break;
426  }
427  if ( m_ev->m_lock || m_farm->DoIt( (int) (27*cfg_fungi_app_prop1.value() ))) {
428  if (!m_farm->FungicideTreat( m_field, 0.0,
429  g_date->DayInYear( 30,5 ) -
430  g_date->DayInYear())) {
431  SimpleEvent( g_date->Date() + 1, wbs_fungicide_two, true );
432  break;
433  }
434  }
436  if ( WBS_DID_EIGHT_TWO &&
439  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,7 ),
440  wbs_harvest, false );
441  }
442  break;
443 
444  case wbs_growth_reg:
445  if ( g_date->Date() < WBS_DID_EIGHT_THREE + 1 ) {
446  // Try again tomorrow.
448  break;
449  }
450  if ( m_ev->m_lock || m_farm->DoIt( (int) (50*cfg_greg_app_prop.value() ))) {
451  if (!m_farm->GrowthRegulator( m_field, 0.0,
452  g_date->DayInYear( 31,5 ) -
453  g_date->DayInYear())) {
454  SimpleEvent( g_date->Date() + 1, wbs_growth_reg, true );
455  break;
456  }
457  }
459  if ( WBS_DID_EIGHT_ONE &&
462  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,7 ),
463  wbs_harvest, false );
464  }
465  break;
466 
467  case wbs_water:
468  if ( g_date->Date() < WBS_HERBICIDE_DATE + 1 ||
469  g_date->Date() < WBS_DID_EIGHT_ONE + 1 ||
470  g_date->Date() < WBS_DID_EIGHT_TWO + 1 ||
471  g_date->Date() < WBS_DID_EIGHT_FOUR + 1 ) {
472  // Try again tomorrow.
474  break;
475  }
476  if ( m_ev->m_lock || m_farm->DoIt( 5 )) {
477  if (!m_farm->Water( m_field, 0.0,
478  g_date->DayInYear( 15,6 ) -
479  g_date->DayInYear())) {
480  SimpleEvent( g_date->Date() + 1, wbs_water, true );
481  break;
482  }
483  }
485  if ( WBS_DID_EIGHT_ONE &&
488  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,7 ),
489  wbs_harvest, false );
490  }
491  break;
492 
493  case wbs_insecticide:
494  if ( g_date->Date() < WBS_DID_EIGHT_THREE + 1 ) {
495  // Try again tomorrow.
497  break;
498  }
499  if ( m_ev->m_lock || m_farm->DoIt( (int) (5*cfg_ins_app_prop1.value() ))) {
500  if (!m_farm->InsecticideTreat( m_field, 0.0,
501  g_date->DayInYear( 1,6 ) -
502  g_date->DayInYear())) {
503  SimpleEvent( g_date->Date() + 1, wbs_insecticide, true );
504  break;
505  }
506  }
508  if ( WBS_DID_EIGHT_ONE &&
511  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,7 ),
512  wbs_harvest, false );
513  }
514  break;
515 
516  case wbs_harvest:
517  if (!m_farm->Harvest( m_field, 0.0,
518  m_field->GetMDates(1,0) -
519  g_date->DayInYear())) {
520  SimpleEvent( g_date->Date() + 1, wbs_harvest, true );
521  break;
522  }
523 
524  if ( m_farm->IsStockFarmer()) {
525  if ( m_farm->DoIt( 15 )) {
526  // Force straw chopping on the same day as harvest.
527  m_farm->StrawChopping( m_field, 0.0, 0 );
529  wbs_stubble_harrowing, false );
530  break;
531  }
532  // No chopping and harrowing, so try hay turning.
534  wbs_hay_turning, false );
535  break;
536  } else {
537  // Plant farmer.
538  if ( m_farm->DoIt( 75 )) {
539  // Force straw chopping on the same day as harvest.
540  m_farm->StrawChopping( m_field, 0.0, 0 );
542  wbs_stubble_harrowing, false );
543  break;
544  }
546  wbs_hay_turning, false );
547  }
548  break;
549 
550  case wbs_hay_turning:
551  if ( m_ev->m_lock || m_farm->DoIt( 50 ))
552  {
553  if (!m_farm->HayTurning( m_field, 0.0,
554  m_field->GetMDates(1,2) -
555  g_date->DayInYear())) {
556  SimpleEvent( g_date->Date() + 1, wbs_hay_turning, true );
557  break;
558  }
559  }
561  wbs_hay_bailing, false );
562  break;
563 
564  case wbs_hay_bailing:
565  if (!m_farm->HayBailing( m_field, 0.0,
566  m_field->GetMDates(1,2) -
567  g_date->DayInYear())) {
568  SimpleEvent( g_date->Date() + 1, wbs_hay_bailing, true );
569  break;
570  }
571  {
572  int d1 = g_date->Date();
573  if ( d1 < g_date->OldDays() + m_field->GetMDates(0,1)) {
574  d1 = g_date->OldDays() + m_field->GetMDates(0,1);
575  }
576  SimpleEvent( d1, wbs_stubble_harrowing, false );
577  }
578  break;
579 
581  if ( m_ev->m_lock || m_farm->DoIt( 40 )) {
582  if (!m_farm->StubbleHarrowing( m_field, 0.0,
583  m_field->GetMDates(1,2) -
584  g_date->DayInYear())) {
585  SimpleEvent( g_date->Date() + 1, wbs_stubble_harrowing, true );
586  break;
587  }
588  }
589  done = true;
590  break;
591 
592  default:
593  g_msg->Warn( WARN_BUG, "WinterBarley::Do(): "
594  "Unknown event type! ", "" );
595  exit( 1 );
596  }
597 
598  return done;
599 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnSow(), cfg_fungi_app_prop1, cfg_greg_app_prop, cfg_herbi_app_prop, cfg_ins_app_prop1, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_Sludge(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HayBailing(), Farm::HayTurning(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), LE::SetMDates(), Crop::SimpleEvent(), Farm::StrawChopping(), Farm::Strigling(), Farm::StubbleHarrowing(), CfgFloat::value(), MapErrorMsg::Warn(), WARN_BUG, Farm::Water(), wbs_autumn_harrow, wbs_autumn_plough, wbs_autumn_sow, WBS_DID_EIGHT_FOUR, WBS_DID_EIGHT_ONE, WBS_DID_EIGHT_THREE, WBS_DID_EIGHT_TWO, WBS_DID_SEVEN_FOUR, WBS_DID_SEVEN_ONE, WBS_DID_SEVEN_THREE, WBS_DID_SEVEN_TWO, wbs_fertmanganese_plant_one, wbs_fertmanganese_plant_two, wbs_fertmanure_stock, wbs_fertnpk_plant_one, wbs_fertnpk_plant_two, wbs_fertnpk_stock_one, wbs_fertnpk_stock_two, wbs_fertsludge_plant_one, wbs_fertslurry_stock_one, wbs_fertslurry_stock_two, WBS_FUNGICIDE_DATE, wbs_fungicide_one, wbs_fungicide_two, wbs_growth_reg, wbs_harvest, wbs_hay_bailing, wbs_hay_turning, WBS_HERBICIDE_DATE, wbs_insecticide, wbs_start, wbs_strigling_one, wbs_strigling_two, wbs_stubble_harrowing, wbs_switchboard, and wbs_water.

◆ SetUpFarmCategoryInformation()

void WinterBarleyStrigling::SetUpFarmCategoryInformation ( )
inline
97  {
98  const int elements = 2 + (wbs_foobar - WBarleyStrigling_BASE);
100 
101  FarmManagementCategory catlist[elements] =
102  {
103  fmc_Others, // zero element unused but must be here
104  fmc_Others,//wbs_start = 1, // Compulsory, start event must always be 1 (one).
105  fmc_Fertilizer,//wbs_fertsludge_plant_one = WBarleyStrigling_BASE,
106  fmc_Fertilizer,//wbs_fertmanure_stock,
107  fmc_Fertilizer,//wbs_fertslurry_stock_one,
108  fmc_Cultivation,//wbs_autumn_plough,
109  fmc_Cultivation,//wbs_autumn_harrow,
110  fmc_Others,//wbs_autumn_sow,
111  fmc_Cultivation,//wbs_strigling_one,
112  fmc_Fertilizer,//wbs_fertmanganese_plant_one,
113  fmc_Fertilizer,//wbs_fertmanganese_plant_two,
114  fmc_Fertilizer,//wbs_fertnpk_plant_one,
115  fmc_Fertilizer,//wbs_fertnpk_plant_two,
116  fmc_Fertilizer,//wbs_fertslurry_stock_two,
117  fmc_Fertilizer,//wbs_fertnpk_stock_one,
118  fmc_Fertilizer,//wbs_fertnpk_stock_two,
119  fmc_Cultivation,//wbs_strigling_two,
120  fmc_Insecticide,//wbs_fungicide_one,
121  fmc_Others,//wbs_switchboard,
122  fmc_Insecticide,//wbs_fungicide_two,
123  fmc_Others,//wbs_growth_reg,
124  fmc_Watering,//wbs_water,
125  fmc_Insecticide,//wbs_insecticide,
126  fmc_Harvest,//wbs_harvest,
127  fmc_Others,//wbs_hay_turning,
128  fmc_Others,//wbs_hay_bailing,
129  fmc_Cultivation//wbs_stubble_harrowing
130 
131  // no foobar entry
132 
133  };
134  // Iterate over the catlist elements and copy them to vector
135  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
136 
137  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Harvest, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, WBarleyStrigling_BASE, and wbs_foobar.

Referenced by WinterBarleyStrigling().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::FP_Sludge
virtual bool FP_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:926
WBS_DID_EIGHT_FOUR
#define WBS_DID_EIGHT_FOUR
Definition: WinterBarleyStrigling.h:53
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
wbs_start
Definition: WinterBarleyStrigling.h:56
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
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
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
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
WBS_DID_SEVEN_TWO
#define WBS_DID_SEVEN_TWO
Definition: WinterBarleyStrigling.h:43
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
wbs_water
Definition: WinterBarleyStrigling.h:76
wbs_autumn_harrow
Definition: WinterBarleyStrigling.h:61
wbs_fertnpk_plant_two
Definition: WinterBarleyStrigling.h:67
wbs_autumn_sow
Definition: WinterBarleyStrigling.h:62
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
WBarleyStrigling_BASE
#define WBarleyStrigling_BASE
Definition: WinterBarleyStrigling.h:40
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wbs_fertnpk_stock_two
Definition: WinterBarleyStrigling.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
WBS_DID_SEVEN_FOUR
#define WBS_DID_SEVEN_FOUR
Definition: WinterBarleyStrigling.h:45
wbs_strigling_two
Definition: WinterBarleyStrigling.h:71
CfgFloat::value
double value() const
Definition: Configurator.h:142
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wbs_fertmanganese_plant_two
Definition: WinterBarleyStrigling.h:65
wbs_autumn_plough
Definition: WinterBarleyStrigling.h:60
wbs_hay_bailing
Definition: WinterBarleyStrigling.h:80
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
wbs_fertslurry_stock_one
Definition: WinterBarleyStrigling.h:59
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
WBS_DID_EIGHT_THREE
#define WBS_DID_EIGHT_THREE
Definition: WinterBarleyStrigling.h:52
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_greg_app_prop
CfgFloat cfg_greg_app_prop
WBS_DID_EIGHT_TWO
#define WBS_DID_EIGHT_TWO
Definition: WinterBarleyStrigling.h:51
WBS_DID_EIGHT_ONE
#define WBS_DID_EIGHT_ONE
Definition: WinterBarleyStrigling.h:50
wbs_stubble_harrowing
Definition: WinterBarleyStrigling.h:81
wbs_insecticide
Definition: WinterBarleyStrigling.h:77
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wbs_fungicide_two
Definition: WinterBarleyStrigling.h:74
wbs_fertsludge_plant_one
Definition: WinterBarleyStrigling.h:57
Calendar::Date
long Date(void)
Definition: Calendar.h:57
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
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
wbs_fertnpk_plant_one
Definition: WinterBarleyStrigling.h:66
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
WBS_HERBICIDE_DATE
#define WBS_HERBICIDE_DATE
Definition: WinterBarleyStrigling.h:48
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
WBS_FUNGICIDE_DATE
#define WBS_FUNGICIDE_DATE
Definition: WinterBarleyStrigling.h:47
wbs_fungicide_one
Definition: WinterBarleyStrigling.h:72
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
wbs_strigling_one
Definition: WinterBarleyStrigling.h:63
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
WBS_DID_SEVEN_ONE
#define WBS_DID_SEVEN_ONE
Definition: WinterBarleyStrigling.h:42
wbs_growth_reg
Definition: WinterBarleyStrigling.h:75
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
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
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
WinterBarleyStrigling::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterBarleyStrigling.h:97
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
wbs_fertnpk_stock_one
Definition: WinterBarleyStrigling.h:69
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
wbs_fertslurry_stock_two
Definition: WinterBarleyStrigling.h:68
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wbs_hay_turning
Definition: WinterBarleyStrigling.h:79
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
wbs_switchboard
Definition: WinterBarleyStrigling.h:73
wbs_harvest
Definition: WinterBarleyStrigling.h:78
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
wbs_fertmanure_stock
Definition: WinterBarleyStrigling.h:58
wbs_foobar
Definition: WinterBarleyStrigling.h:82
WARN_BUG
Definition: MapErrorMsg.h:34
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
WBS_DID_SEVEN_THREE
#define WBS_DID_SEVEN_THREE
Definition: WinterBarleyStrigling.h:44
wbs_fertmanganese_plant_one
Definition: WinterBarleyStrigling.h:64