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

#include <SpringBarleySilage.h>

Inheritance diagram for SpringBarleySilage:
Crop

Public Member Functions

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

◆ SpringBarleySilage()

SpringBarleySilage::SpringBarleySilage ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
80  : Crop(a_tov, a_toc, a_L)
81  {
84  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

48 {
49  m_farm = a_farm;
50  m_field = a_field;
51  m_ev = a_ev;
52  int d1;
53 
54  bool done = false;
55 
56  switch ( m_ev->m_todo )
57  {
58  case sbs_start:
59  {
60  a_field->ClearManagementActionSum();
61 
62  // Set up the date management stuff
63  // Could save the start day in case it is needed later
64  // m_field->m_startday = m_ev->m_startday;
66  // Start and stop dates for all events after harvest
67  int noDates=1;
68  m_field->SetMDates(0,0,g_date->DayInYear(1,7));
69  // Determined by harvest date - used to see if at all possible
70  m_field->SetMDates(1,0,g_date->DayInYear(25,7));
71  // Check the next crop for early start, unless it is a spring crop
72  // in which case we ASSUME that no checking is necessary!!!!
73  // So DO NOT implement a crop that runs over the year boundary
74 
75  //new if: do the check only for non-optimising farms and if year>0. (030713 - m_rotation used only in the hidden year, so I modified the condition from >7 to >0)
77 
78  if (m_ev->m_startday>g_date->DayInYear(1,7))
79  {
80  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
81  {
82  g_msg->Warn( WARN_BUG, "SpringBarleySilage::Do(): "
83  "Harvest too late for the next crop to start!!!", "" );
84  exit( 1 );
85  }
86  // Now fix any late finishing problems
87  for (int i=0; i<noDates; i++) {
88  if(m_field->GetMDates(0,i)>=m_ev->m_startday) {
89  m_field->SetMDates(0,i,m_ev->m_startday-1); //move the starting date
90  }
91  if(m_field->GetMDates(1,i)>=m_ev->m_startday){
92  m_field->SetMConstants(i,0);
93  m_field->SetMDates(1,i,m_ev->m_startday-1); //move the finishing date
94  }
95  }
96  }
97  // Now no operations can be timed after the start of the next crop.
98 
99  if ( ! m_ev->m_first_year )
100  {
101  // Are we before July 1st?
102  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
103  if (g_date->Date() < d1)
104  {
105  // Yes, too early. We assumme this is because the last crop was late
106  g_msg->Warn( WARN_BUG, "SpringBarleySilage::Do(): "
107  "Crop start attempt between 1st Jan & 1st July", "" );
108  exit( 1 );
109  }
110  else
111  {
112  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
113  if (g_date->Date() > d1)
114  {
115  // Yes too late - should not happen - raise an error
116  g_msg->Warn( WARN_BUG, "SpringBarleySilage::Do(): "
117  "Crop start attempt after last possible start date", "" );
118  exit( 1 );
119  }
120  }
121  }
122  else
123  {
124  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
125  sbs_spring_harrow, false );
126  break;
127  }
128  }//if
129 
130  // End single block date checking code. Please see next line
131  // comment as well.
132  // Reinit d1 to first possible starting date.
133  d1 = g_date->OldDays() + g_date->DayInYear( 1,11 );
134  if ( g_date->Date() > d1 ) {
135  d1 = g_date->Date();
136  }
137 
138  // OK, let's go.
139  SimpleEvent( d1, sbs_autumn_plough, false );
140  SBS_ISAUTUMNPLOUGH=false;
141  SBS_FERTI_DONE=false;
142  SBS_SPRAY=0;
143  SBS_MANURE_DONE=false;
144  SBS_NPK_DONE=false;
145  }
146  break;
147 
148  case sbs_autumn_plough:
149  if ( m_ev->m_lock || m_farm->DoIt( 70 ))
150  {
151  if (!m_farm->AutumnPlough( m_field, 0.0,
152  g_date->DayInYear( 30,11 ) - g_date->DayInYear())) {
153  SimpleEvent( g_date->Date() + 1, sbs_autumn_plough, true );
154  break;
155  }
156  SBS_ISAUTUMNPLOUGH=true;
157  }
158  // +365 for next year
159  if (m_farm->IsStockFarmer()) // StockFarmer
160  {
161  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365,
162  sbs_ferti_s1, false );
163  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365,
164  sbs_ferti_s2, false );
165  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,3 )+365,
166  sbs_ferti_s3, false );
167  }
168  else // PlantFarmer
169  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 )+365,
170  sbs_ferti_p1, false );
171  break;
172 
173  //*** The stock farmers thread
174  case sbs_ferti_s1:
175  if ( m_ev->m_lock || m_farm->DoIt( 90 ))
176  {
177  if (!m_farm->FA_Slurry( m_field, 0.0,
178  g_date->DayInYear( 15, 4 ) - g_date->DayInYear())) {
179  SimpleEvent( g_date->Date() + 1, sbs_ferti_s1, true );
180  break;
181  }
182  else
183  {
184  // Done fertilizer so remember
185  SBS_FERTI_DONE=true;
186  }
187  }
188  // Queue up the catch all
189  SimpleEvent( g_date->Date(),sbs_ferti_s4, false );
190  break;
191 
192  case sbs_ferti_s2:
193  if ( m_ev->m_lock || m_farm->DoIt( 70 ))
194  {
195  if (!m_farm->FA_NPK( m_field, 0.0,
196  g_date->DayInYear( 15, 4 ) - g_date->DayInYear())) {
197  SimpleEvent( g_date->Date() + 1, sbs_ferti_s2, true );
198  break;
199  }
200  else
201  {
202  // Done fertilizer so remember
203  SBS_FERTI_DONE=true;
204  }
205  }
206  SBS_NPK_DONE=true;
207  break;
208 
209  case sbs_ferti_s3:
210  if (( m_ev->m_lock || m_farm->DoIt( 67 ) ) && (!SBS_ISAUTUMNPLOUGH))
211  {
212  if (!m_farm->FA_Manure( m_field, 0.0,
213  g_date->DayInYear( 15, 4 ) - g_date->DayInYear()))
214  {
215  SimpleEvent( g_date->Date()+1, sbs_ferti_s3, true );
216  break;
217  }
218  else
219  {
220  // Done fertilizer so remember
221  SBS_FERTI_DONE=true;
222  }
223  }
224  SBS_MANURE_DONE=true;
225  break;
226 
227  case sbs_ferti_s4:
228  if (!SBS_FERTI_DONE)
229  {
230  if (!m_farm->FA_NPK( m_field, 0.0,
231  g_date->DayInYear( 15, 4 ) - g_date->DayInYear()))
232  {
233  SimpleEvent( g_date->Date()+1, sbs_ferti_s4, true );
234  break;
235  }
236  }
237  // re-join main thread
239  break;
240 
241  //*** The plant farmers thread
242  case sbs_ferti_p1:
243  // Make sure plant farmers don't suffer because they have not set the
244  // stock farmers SBS_flags
245  SBS_NPK_DONE=true;
246  SBS_MANURE_DONE=true;
247  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
248  {
249  if (!m_farm->FP_NPK( m_field, 0.0,
250  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) {
251  SimpleEvent( g_date->Date() + 1, sbs_ferti_p1, true );
252  break;
253  }
254  else
255  {
256  // Done fertilizer so try to do spring plough
257  SimpleEvent( g_date->Date()+1, sbs_spring_plough, false );
258  SBS_FERTI_DONE=true;
259  break;
260  }
261  }
262  // Did not do ferti_p1 so must do ferti_p2
263  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 ),
264  sbs_ferti_p2, false );
265  break;
266 
267  case sbs_ferti_p2:
268  if (!m_farm->FP_LiquidNH3( m_field, 0.0,
269  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) {
270  SimpleEvent( g_date->Date() + 1, sbs_ferti_p2, true );
271  break;
272  }
273  SimpleEvent( g_date->Date(), sbs_ferti_p3, false );
274  break;
275 
276  case sbs_ferti_p3:
277  if (!m_farm->FP_PK( m_field, 0.0,
278  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) {
279  SimpleEvent( g_date->Date()+1, sbs_ferti_p3, true );
280  break;
281  }
283  break;
284 
285  // re-join main thread
286  case sbs_spring_plough:
287  if ( !SBS_ISAUTUMNPLOUGH ) // Don't plough if you have already
288  {
289  if ((!SBS_NPK_DONE)||(!SBS_MANURE_DONE))
290  {
291  SimpleEvent( g_date->Date() + 1, sbs_spring_plough, true );
292  break;
293  }
294  if (!m_farm->SpringPlough( m_field, 0.0,
295  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) {
296  SimpleEvent( g_date->Date() + 1, sbs_spring_plough, true );
297  break;
298  }
299  }
300  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 ),
301  sbs_spring_harrow, false );
302  break;
303 
304  case sbs_spring_harrow:
305  if (!m_farm->SpringHarrow( m_field, 0.0,
306  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) {
307  SimpleEvent( g_date->Date() + 1, sbs_spring_harrow, true );
308  break;
309  }
310  SimpleEvent( g_date->Date(), sbs_spring_sow, false );
311  break;
312 
313  case sbs_spring_sow:
314  if (!m_farm->SpringSow( m_field, 0.0,
315  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) {
316  SimpleEvent( g_date->Date() + 1, sbs_spring_sow, true );
317  break;
318  }
319  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ),
320  sbs_spring_roll, false );
321  break;
322 
323  case sbs_spring_roll:
324  if ( m_ev->m_lock || m_farm->DoIt( 35 ))
325  {
326  if (!m_farm->SpringRoll( m_field, 0.0,
327  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
328  SimpleEvent( g_date->Date() + 1, sbs_spring_roll, true );
329  break;
330  }
331  }
332  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,4 ),
333  sbs_strigling1, false );
334  break;
335 
336  case sbs_strigling1:
337  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
338  {
339  if (!m_farm->Strigling( m_field, 0.0,
340  g_date->DayInYear( 25,4 ) - g_date->DayInYear())) {
341  SimpleEvent( g_date->Date() + 1, sbs_strigling1, true );
342  break;
343  }
344  // did strigling so do it again
345  SimpleEvent( g_date->Date()+10 , sbs_strigling2, false );
346  // --FN--
347  }
348  else
349  {
350  //No strigling so do herbicide
351  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,5 ),
352  sbs_herbicide1, false );
353  }
354  // Whether did it or not then start fungicide/GR/water
355  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
356  sbs_fungicide1, false );
357  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
358  sbs_GR, false );
360  sbs_water1, false);
361  if (cfg_pest_SBS_ERA.value())
362  {
363  SimpleEvent(g_date->OldDays() + g_date->DayInYear(cfg_SB_InsecticideDay.value(), cfg_SB_InsecticideMonth.value()), // Was 15,5 - changed for skylark testing
364  sbs_insecticide1, false);
365  }
366  break;
367 
368  case sbs_strigling2:
369  if (!m_farm->Strigling( m_field, 0.0,
370  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
371  SimpleEvent( g_date->Date() + 1, sbs_strigling2, true );
372  break;
373  }
374  break;
375 
376  // Herbicide thread
377  case sbs_herbicide1:
378  if ( m_ev->m_lock || m_farm->DoIt( (int) (100*cfg_herbi_app_prop.value() * m_farm->Prob_multiplier() ))) //modified probability
379  {
380  if (!m_farm->HerbicideTreat( m_field, 0.0,
381  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
382  SimpleEvent( g_date->Date() + 1, sbs_herbicide1, true );
383  break;
384  }
385  }
386  // End of thread
387  break;
388 
389  // GReg thread
390  case sbs_GR:
391  if ( m_ev->m_lock || m_farm->DoIt( (int) (5*cfg_greg_app_prop.value() )))
392  {
393  if (!m_farm->GrowthRegulator( m_field, 0.0,
394  g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
395  SimpleEvent( g_date->Date() + 1, sbs_GR, true );
396  break;
397  }
398  }
399  // End of thread
400  break;
401 
402  // Water thread
403  case sbs_water1:
404  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
405  {
406  if (SBS_SPRAY==g_date->DayInYear())
407  {
408  SimpleEvent( g_date->Date() + 1, sbs_water1, true );
409  break;
410  }
411  if (!m_farm->Water( m_field, 0.0,
412  g_date->DayInYear( 30,5 ) - g_date->DayInYear()))
413  {
414  SimpleEvent( g_date->Date() + 1, sbs_water2, true );
415  break;
416  }
417  if (g_date->DayInYear()+10<g_date->DayInYear( 1,6 ))
418  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
419  sbs_water2, false );
420  else
421  SimpleEvent( g_date->Date()+10, sbs_water2, false );
422  break;
423  }
424  // End of thread
425  // No, water2 have been started.
426  break;
427 
428  case sbs_water2:
429  if ( m_ev->m_lock || m_farm->DoIt( 50 ) )
430  {
431  if (SBS_SPRAY==g_date->DayInYear())
432  {
433  SimpleEvent( g_date->Date() + 1, sbs_water2, true );
434  break;
435  }
436  if (!m_farm->Water( m_field, 0.0,
437  g_date->DayInYear( 1,7 ) - g_date->DayInYear() ))
438  {
439  SimpleEvent( g_date->Date() + 1, sbs_water2, true );
440  break;
441  }
442  }
443  // End of thread
444  break;
445 
446 case sbs_insecticide1:
447  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * cfg_ins_app_prop1.value() * m_farm->Prob_multiplier()))) //modified probability
448  {
449  // Here we check wheter we are using ERA pesticde or not
450  if (!cfg_pest_springbarley_on.value() || !a_field->GetLandscape()->SupplyShouldSpray())
451  {
452  if (!m_farm->InsecticideTreat(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear()))
453  {
454  SimpleEvent(g_date->Date() + 1, sbs_insecticide1, true);
455  break;
456  }
457  else SBS_INSECT_DATE = g_date->Date();
458  }
459  else {
462  }
463  }
464  SimpleEvent(g_date->Date() + 14, sbs_insecticide2, false);
465  break;
466 
467  case sbs_insecticide2:
468  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * cfg_ins_app_prop2.value()*m_farm->Prob_multiplier()))) //modified probability
469  {
470  if (cfg_pest_springbarley_on.value() && a_field->GetLandscape()->SupplyShouldSpray())
471  {
473  }
474  else
475  {
477  SimpleEvent(g_date->Date() + 1, sbs_insecticide2, true);
478  }
479  }
480  }
481  SimpleEvent(g_date->Date() + 14, sbs_insecticide3, false);
482  break;
483 
484  case sbs_insecticide3:
485  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * cfg_ins_app_prop3.value()*m_farm->Prob_multiplier()))) //modified probability
486  {
487  if (cfg_pest_springbarley_on.value() && a_field->GetLandscape()->SupplyShouldSpray())
488  {
490  }
491  else
492  {
494  SimpleEvent(g_date->Date() + 1, sbs_insecticide3, true);
495  }
496  }
497  }
498  break;
499 
500  // Fungicide thread & MAIN THREAD
501  case sbs_fungicide1:
502  if ( m_ev->m_lock || m_farm->DoIt( (int) (62*cfg_herbi_app_prop.value() * m_farm->Prob_multiplier()))) //modified probability
503  {
504  if (!m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
505  SimpleEvent( g_date->Date() + 1, sbs_fungicide1, true );
506  break;
507  }
508  else
509  {
511  }
512 
513  }
514  ChooseNextCrop (1);
515  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,6 ),
516  sbs_harvest1, false );
517  break;
518 
519  case sbs_harvest1:
520  if (m_ev->m_lock || m_farm->DoIt(0)) //then there are just 2 cuts, i.e. the 2nd and the 3rd! The 1st one is impossible (the prob is now 0 instead of 50)
521  {
522  if (!m_farm->Harvest(m_field, 0.0, g_date->DayInYear(8, 7) - g_date->DayInYear())) {
523  SimpleEvent(g_date->Date() + 1, sbs_harvest1, true);
524  break;
525  }
527  sbs_wait, false);
528  break;
529  }
530  else
531  {
532  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,7 ),
533  sbs_harvest2, false );
534  }
535  break;
536 
537  case sbs_harvest2:
538  if (!m_farm->Harvest( m_field, 0.0,
539  g_date->DayInYear( 8,8 ) - g_date->DayInYear())) {
540  SimpleEvent( g_date->Date() + 1, sbs_harvest2, true );
541  break;
542  }
543  // END MAIN THREAD
544  done=true;
545  break;
546 
547  case sbs_wait: // is only called after June so just finish here.
548  // END MAIN THREAD
549  d1=g_date->DayInYear();
550  done=true;
551  break;
552 
553  default:
554  g_msg->Warn( WARN_BUG, "SpringBarleySilage::Do(): "
555  "Unknown event type! ", "" );
556  exit( 1 );
557  }
558  return done;
559 }

References Farm::AutumnPlough(), cfg_greg_app_prop, cfg_herbi_app_prop, cfg_ins_app_prop1, cfg_ins_app_prop2, cfg_ins_app_prop3, cfg_pest_product_amounts, cfg_pest_SBS_ERA, cfg_pest_springbarley_on, cfg_SB_InsecticideDay, cfg_SB_InsecticideMonth, Crop::ChooseNextCrop(), LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_LiquidNH3(), Farm::FP_NPK(), Farm::FP_PK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GetType(), Calendar::GetYearNumber(), Farm::GrowthRegulator(), Farm::Harvest(), 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(), ppp_1, Farm::Prob_multiplier(), Farm::ProductApplication_DateLimited(), sbs_autumn_plough, SBS_FERTI_DONE, sbs_ferti_p1, sbs_ferti_p2, sbs_ferti_p3, sbs_ferti_s1, sbs_ferti_s2, sbs_ferti_s3, sbs_ferti_s4, sbs_fungicide1, sbs_GR, sbs_harvest1, sbs_harvest2, sbs_herbicide1, SBS_INSECT_DATE, sbs_insecticide1, sbs_insecticide2, sbs_insecticide3, SBS_ISAUTUMNPLOUGH, SBS_MANURE_DONE, SBS_NPK_DONE, SBS_SPRAY, sbs_spring_harrow, sbs_spring_plough, sbs_spring_roll, sbs_spring_sow, sbs_start, sbs_strigling1, sbs_strigling2, sbs_wait, sbs_water1, sbs_water2, LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::Strigling(), tof_OptimisingFarm, CfgInt::value(), CfgFloat::value(), CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void SpringBarleySilage::SetUpFarmCategoryInformation ( )
inline
85  {
86  const int elements = 2 + (sbs_foobar - SBARLEYSILAGE_BASE);
88 
89  FarmManagementCategory catlist[elements] =
90  {
91  fmc_Others, // zero element unused but must be here
92  fmc_Others,//sbs_start = 1, // Compulsory, start event must always be 1 (one).
93  fmc_Fertilizer,//sbs_ferti_p1 = SBARLEYSILAGE_BASE,
94  fmc_Fertilizer,//sbs_ferti_p2,
95  fmc_Fertilizer,//sbs_ferti_p3,
96  fmc_Fertilizer,//sbs_ferti_s1,
97  fmc_Fertilizer,//sbs_ferti_s2,
98  fmc_Fertilizer,//sbs_ferti_s3,
99  fmc_Fertilizer,//sbs_ferti_s4,
100  fmc_Harvest,//sbs_harvest1,
101  fmc_Harvest,//sbs_harvest2,
102  fmc_Cultivation,//sbs_spring_plough,
103  fmc_Cultivation,//sbs_autumn_plough,
104  fmc_Cultivation,//sbs_spring_harrow,
105  fmc_Others,//sbs_spring_roll,
106  fmc_Others,//sbs_spring_sow,
107  fmc_Others,//sbs_hay_baling,
108  fmc_Cultivation,//sbs_strigling1,
109  fmc_Cultivation,//sbs_strigling2,
110  fmc_Cutting,//sbs_straw_chopping,
111  fmc_Others,//sbs_GR,
112  fmc_Watering,//sbs_water1,
113  fmc_Watering,//sbs_water2,
114  fmc_Herbicide,//sbs_herbicide1,
115  fmc_Herbicide,//sbs_herbicide2,
116  fmc_Fungicide,//sbs_fungicide1,
117  fmc_Fungicide,//sbs_fungicide2,
118  fmc_Cultivation,//sbs_stubble_harrow,
119  fmc_Insecticide,//sbs_insecticide1,
120  fmc_Insecticide,//sbs_insecticide2,
121  fmc_Insecticide,//sbs_insecticide3,
122  fmc_Others//sbs_wait
123 
124  // no foobar entry
125 
126  };
127  // Iterate over the catlist elements and copy them to vector
128  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
129 
130  }

References fmc_Cultivation, fmc_Cutting, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, SBARLEYSILAGE_BASE, and sbs_foobar.

Referenced by SpringBarleySilage().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
SpringBarleySilage::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: SpringBarleySilage.h:85
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
sbs_herbicide1
Definition: SpringBarleySilage.h:62
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
sbs_ferti_s3
Definition: SpringBarleySilage.h:46
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
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
cfg_pest_springbarley_on
CfgBool cfg_pest_springbarley_on
Turn on pesticides for spring barley.
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
sbs_insecticide2
Definition: SpringBarleySilage.h:68
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
sbs_ferti_s4
Definition: SpringBarleySilage.h:47
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
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
sbs_strigling2
Definition: SpringBarleySilage.h:57
sbs_ferti_p2
Definition: SpringBarleySilage.h:42
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
cfg_SB_InsecticideMonth
CfgInt cfg_SB_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in spring barley crops - this ...
Definition: SpringBarleySilage.cpp:43
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
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
sbs_spring_roll
Definition: SpringBarleySilage.h:53
sbs_spring_sow
Definition: SpringBarleySilage.h:54
Farm::SpringSow
virtual bool SpringSow(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 spring on a_field.
Definition: FarmFuncs.cpp:501
CfgFloat::value
double value() const
Definition: Configurator.h:142
sbs_water1
Definition: SpringBarleySilage.h:60
cfg_SB_InsecticideDay
CfgInt cfg_SB_InsecticideDay
Provided to allow configuration control of the first insecticide spray in spring barley crops - this ...
Definition: SpringBarleySilage.cpp:42
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
SBS_ISAUTUMNPLOUGH
#define SBS_ISAUTUMNPLOUGH
Definition: SpringBarleySilage.h:32
sbs_ferti_p1
Definition: SpringBarleySilage.h:41
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
sbs_autumn_plough
Definition: SpringBarleySilage.h:51
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
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
sbs_spring_plough
Definition: SpringBarleySilage.h:50
SBS_INSECT_DATE
#define SBS_INSECT_DATE
Definition: SpringBarleySilage.h:37
sbs_start
Definition: SpringBarleySilage.h:40
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
SBS_NPK_DONE
#define SBS_NPK_DONE
Definition: SpringBarleySilage.h:36
sbs_spring_harrow
Definition: SpringBarleySilage.h:52
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: Farm.h:778
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
sbs_fungicide1
Definition: SpringBarleySilage.h:64
sbs_insecticide1
Definition: SpringBarleySilage.h:67
Farm::ProductApplication_DateLimited
virtual bool ProductApplication_DateLimited(LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false)
Special pesticide trial functionality.
Definition: FarmFuncs.cpp:2342
sbs_ferti_s2
Definition: SpringBarleySilage.h:45
Calendar::Date
long Date(void)
Definition: Calendar.h:57
sbs_strigling1
Definition: SpringBarleySilage.h:56
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
SBARLEYSILAGE_BASE
#define SBARLEYSILAGE_BASE
Definition: SpringBarleySilage.h:31
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
sbs_water2
Definition: SpringBarleySilage.h:61
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
sbs_harvest2
Definition: SpringBarleySilage.h:49
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
SBS_MANURE_DONE
#define SBS_MANURE_DONE
Definition: SpringBarleySilage.h:35
sbs_insecticide3
Definition: SpringBarleySilage.h:69
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
SBS_FERTI_DONE
#define SBS_FERTI_DONE
Definition: SpringBarleySilage.h:33
cfg_pest_product_amounts
CfgArray_Double cfg_pest_product_amounts
Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.
sbs_wait
Definition: SpringBarleySilage.h:70
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
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
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Farm::FP_LiquidNH3
virtual bool FP_LiquidNH3(LE *a_field, double a_user, int a_days)
Apply liquid ammonia fertilizer to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:808
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
sbs_ferti_s1
Definition: SpringBarleySilage.h:44
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
SBS_SPRAY
#define SBS_SPRAY
Definition: SpringBarleySilage.h:34
sbs_ferti_p3
Definition: SpringBarleySilage.h:43
sbs_harvest1
Definition: SpringBarleySilage.h:48
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
sbs_GR
Definition: SpringBarleySilage.h:59
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
cfg_pest_SBS_ERA
CfgBool cfg_pest_SBS_ERA
Turn on pesticides for spring barley silage.
Crop::ChooseNextCrop
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
Definition: Farm.cpp:756
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
sbs_foobar
Definition: SpringBarleySilage.h:71
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: FarmFuncs.cpp:459
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop