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

#include <SpringBarleySpr.h>

Inheritance diagram for SpringBarleySpr:
Crop

Public Member Functions

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

◆ SpringBarleySpr()

SpringBarleySpr::SpringBarleySpr ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

43 {
44 
45  double ins_app_prop=cfg_ins_app_prop1.value();
46  double herbi_app_prop=cfg_herbi_app_prop.value();
47  m_farm = a_farm;
48  m_field = a_field;
49  m_ev = a_ev;
50 
51  bool done = false;
52 
53  switch ( m_ev->m_todo )
54  {
55  case sbspr_start:
56  {
59  a_field->ClearManagementActionSum();
60 
61  // Record whether skylark scrapes are present and adjust flag accordingly
63  a_field->m_skylarkscrapes=true;
64  } else {
65  a_field->m_skylarkscrapes=false;
66  }
67  // Set up the date management stuff
68  // Could save the start day in case it is needed later
69  // m_field->m_startday = m_ev->m_startday;
71  // Start and stop dates for all events after harvest
72  int noDates=2;
73  m_field->SetMDates(0,0,g_date->DayInYear(20,8));
74  // Determined by harvest date - used to see if at all possible
75  m_field->SetMDates(1,0,g_date->DayInYear(10,8));
76  m_field->SetMDates(0,1,g_date->DayInYear(10,8));
77  m_field->SetMDates(1,1,g_date->DayInYear(30,8));
78  // Check the next crop for early start, unless it is a spring crop
79  // in which case we ASSUME that no checking is necessary!!!!
80  // So DO NOT implement a crop that runs over the year boundary
81 
82  //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)
83  int d1;
84  if (!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
85 
86  if (m_ev->m_startday > g_date->DayInYear( 1, 7 )) {
87  if (m_field->GetMDates( 0, 0 ) >= m_ev->m_startday) {
88  g_msg->Warn( WARN_BUG, "SpringBarleySpr::Do(): "
89  "Harvest too late for the next crop to start!!!", "" );
90  exit( 1 );
91  }
92  // Now fix any late finishing problems
93  for (int i = 0; i < noDates; i++) {
94  if (m_field->GetMDates( 0, i ) >= m_ev->m_startday) {
95  m_field->SetMDates( 0, i, m_ev->m_startday - 1 ); //move the starting date
96  }
97  if (m_field->GetMDates( 1, i ) >= m_ev->m_startday) {
98  m_field->SetMConstants( i, 0 );
99  m_field->SetMDates( 1, i, m_ev->m_startday - 1 ); //move the finishing date
100  }
101  }
102  }
103  // Now no operations can be timed after the start of the next crop.
104 
105  if (!m_ev->m_first_year) {
106  int today = g_date->Date();
107  d1 = g_date->OldDays() + m_first_date + 365; // Add 365 for spring crop
108  if (today > d1) {
109  // Yes too late - should not happen - raise an error
110  g_msg->Warn( WARN_BUG, "SpringBarleySpr::Do(): " "Crop start attempt after last possible start date", "" );
111  exit( 1 );
112  }
113  }
114  else {
115  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ),
116  sbspr_spring_plough, false );
117  break;
118  }
119  }//if
120 
121  // End single block date checking code. Please see next line
122  // comment as well.
123  // Reinit d1 to first possible starting date.
124  d1 = g_date->OldDays() + 365 + g_date->DayInYear( 1, 4 );
125  // OK, let's go.
126  SimpleEvent(d1, sbspr_spring_plough, false);
127  SBSPR_SLURRY_DONE = false;
128  SBSPR_MANURE_DONE=false;
129  SBSPR_SLURRY_EXEC=false;
130  SBSPR_MANURE_EXEC=false;
131  SBSPR_DID_AUTUMN_PLOUGH = false;
132  }
133  break;
134 
135  case sbspr_spring_plough:
136  if (!m_farm->SpringPlough( m_field, 0.0, g_date->DayInYear( 10,4 ) - g_date->DayInYear()))
137  {
139  break;
140  }
141  {
142  int d1 = g_date->Date();
143  if ( d1 < g_date->OldDays() + g_date->DayInYear( 20,3 ))
144  {
145  d1 = g_date->OldDays() + g_date->DayInYear( 20,3 );
146  }
147  SimpleEvent( d1, sbspr_spring_harrow, false );
148  }
149  break;
150 
151  case sbspr_spring_harrow:
152  if (!m_farm->SpringHarrow( m_field, 0.0,
153  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
154  SimpleEvent( g_date->Date() + 1, sbspr_spring_harrow, true );
155  break;
156  }
157  if (m_farm->IsStockFarmer()) {
158  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ), // was 5,4
160  } else {
161  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 ),
162  sbspr_fertmanure_plant, false );
163  }
164  break;
165 
167  if ( m_ev->m_lock || m_farm->DoIt( 65 ) ||
169  {
170  if (!m_farm->FA_NPK( m_field, 0.0,
171  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // was 10,4
173  break;
174  }
175  }
176  {
177  int d1 = g_date->Date();
178  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) {
179  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 );
180  }
181  SimpleEvent( d1, sbspr_spring_sow, false );
182  }
183  break;
184 
186  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
187  {
188  if (!m_farm->FP_NPK( m_field, 0.0,
189  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) { // WAS 10,4
191  break;
192  }
193  // Did FP_NPK so go directly to spring sow.
194  {
195  int d1 = g_date->Date();
196  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
197  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
198  }
199  SimpleEvent( d1, sbspr_spring_sow, false );
200  }
201  break;
202  }
204  break;
205 
207  if (!m_farm->FP_LiquidNH3( m_field, 0.0,
208  g_date->DayInYear( 10, 4 ) - // WAS 10,4
209  g_date->DayInYear())) {
210  SimpleEvent( g_date->Date() + 1, sbspr_fertlnh3_plant, true );
211  break;
212  }
214  break;
215 
216  case sbspr_fertpk_plant:
217  if (!m_farm->FP_PK( m_field, 0.0,
218  g_date->DayInYear( 10, 4 ) - // WAS 10,4
219  g_date->DayInYear())) {
220  SimpleEvent( g_date->Date() + 1, sbspr_fertpk_plant, true );
221  break;
222  }
223  {
224  int d1 = g_date->Date();
225  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
226  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
227  }
228  SimpleEvent( d1, sbspr_spring_sow, false );
229  }
230  break;
231 
232  case sbspr_spring_sow:
233  if (!m_farm->SpringSow( m_field, 0.0,
234  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
235  SimpleEvent( g_date->Date() + 1, sbspr_spring_sow, true );
236  break;
237  }
238  {
239  int d1 = g_date->Date();
240  if ( d1 < g_date->OldDays() + g_date->DayInYear( 5,4 )) {
241  d1 = g_date->OldDays() + g_date->DayInYear( 5,4 );
242  }
243  SimpleEvent( d1, sbspr_spring_roll, false );
244  }
245  break;
246 
247  case sbspr_spring_roll:
248  if ( m_ev->m_lock || m_farm->DoIt( 0 )) // was 30
249  {
250  if (!m_farm->SpringRoll( m_field, 0.0,
251  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
252  SimpleEvent( g_date->Date() + 1, sbspr_spring_roll, true );
253  break;
254  }
255  }
256  SBSPR_HERBI_DATE = 0;
257  SBSPR_GR_DATE = 0;
258  SBSPR_FUNGI_DATE = 0;
259  SBSPR_WATER_DATE = 0;
260  SBSPR_INSECT_DATE = 0;
261  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,5 ),
262  sbspr_herbicide_one, false );
263  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ), sbspr_fungicide_one, false ); // Main.
264  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
265  sbspr_GR, false );
266  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
267  sbspr_water_one, false );
268  break;
269 
270  // Herbicide thread
271 
272  //ask for your BIherb: >0 - want to spray, otherwise - don't spray even if you should
273 
274  case sbspr_herbicide_one:
275  if ( g_date->Date() < SBSPR_GR_DATE + 1 ) {
277  break;
278  }
279  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+70*herbi_app_prop * m_farm->Prob_multiplier()))) //modified probability
280  {
281  if (!m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 15,5 ) - g_date->DayInYear()))
282  {
283  SimpleEvent( g_date->Date() + 1, sbspr_herbicide_one, true );
284  break;
285  }
287  // Did first spray so see if should do another, 14 days later (min)
288  {
289  int d1 = g_date->Date() + 10;
290  if ( d1 < g_date->OldDays() + g_date->DayInYear( 16,5 )) {
291  d1 = g_date->OldDays() + g_date->DayInYear( 16,5 );
292  }
293  SimpleEvent( d1, sbspr_herbicide_two, false );
294  }
295  }
296  break;
297 
298  case sbspr_herbicide_two:
299  if ( g_date->Date() < SBSPR_GR_DATE + 1 ) {
301  break;
302  }
303  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+47*herbi_app_prop*SBSPR_DECIDE_TO_HERB * m_farm->Prob_multiplier()))) //modified probability
304  {
305  if (!m_farm->HerbicideTreat( m_field, 0.0,
306  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
307  SimpleEvent( g_date->Date() + 1, sbspr_herbicide_two, true );
308  break;
309  }
311  }
312  break;
313 
314  // GReg thread
315  case sbspr_GR:
316  if ( g_date->Date() < SBSPR_HERBI_DATE + 1 ||
317  g_date->Date() < SBSPR_FUNGI_DATE + 1 ) {
318  SimpleEvent( g_date->Date() + 1, sbspr_GR, m_ev->m_lock );
319  break;
320  }
321  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+5*cfg_greg_app_prop.value())))
322  {
323  if (!m_farm->GrowthRegulator( m_field, 0.0,
324  g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
325  SimpleEvent( g_date->Date() + 1, sbspr_GR, true );
326  break;
327  }
329  }
330  break;
331 
332  // Fungicide thread & MAIN THREAD
333  case sbspr_fungicide_one:
334  if ( g_date->Date() < SBSPR_HERBI_DATE + 1 || g_date->Date() < SBSPR_GR_DATE + 1 ) {
336  break;
337  }
338  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+30*cfg_fungi_app_prop1.value() * m_farm->Prob_multiplier()))) //modified probability
339  {
340  if (!m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
341  SimpleEvent( g_date->Date() + 1, sbspr_fungicide_one, true );
342  break;
343 
344  }
346  {
347  int d1 = g_date->Date() + 10;
348  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,5 )) {
349  d1 = g_date->OldDays() + g_date->DayInYear( 25,5 );
350  }
351  SimpleEvent( d1, sbspr_fungicide_two, false );
352  }
353  }
354  {
355  int d1 = g_date->Date();
356  if ( d1 < g_date->OldDays() + g_date->DayInYear( 15,5 )) {
357  d1 = g_date->OldDays() + g_date->DayInYear( 15,5 );
358  }
359  SimpleEvent( d1, sbspr_insecticide1, false );
360  }
361  break;
362 
363  case sbspr_fungicide_two:
364  if ( g_date->Date() < SBSPR_HERBI_DATE + 1 ||
365  g_date->Date() < SBSPR_GR_DATE + 1 ) {
367  break;
368  }
369  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+10*cfg_fungi_app_prop1.value()*SBSPR_DECIDE_TO_FI * m_farm->Prob_multiplier()) )) //modified probability
370  {
371  if (!m_farm->FungicideTreat( m_field, 0.0,
372  g_date->DayInYear( 10,6 ) - g_date->DayInYear())) {
373  SimpleEvent( g_date->Date() + 1, sbspr_fungicide_two, true );
374  break;
375  }
377  }
378  break;
379 
380  // Water thread
381  case sbspr_water_one:
382  if ( g_date->Date() < SBSPR_HERBI_DATE + 1 ||
383  g_date->Date() < SBSPR_FUNGI_DATE + 1 ) {
385  break;
386  }
387  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
388  {
389  if (!m_farm->Water( m_field, 0.0,
390  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
391  SimpleEvent( g_date->Date() + 1, sbspr_water_one, true );
392  break;
393  }
395  }
396  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
397  sbspr_water_two, false );
398  break;
399 
400  case sbspr_water_two:
401  if ( g_date->Date() < SBSPR_INSECT_DATE + 1 ) {
403  break;
404  }
405  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
406  {
407  if (!m_farm->Water( m_field, 0.0,
408  g_date->DayInYear( 1,7 ) - g_date->DayInYear())) {
409  SimpleEvent( g_date->Date() + 1, sbspr_water_two, true );
410  break;
411  }
413  }
414  break;
415 
416  // Insecticide thread & MAIN THREAD
417  case sbspr_insecticide1:
418  if ( g_date->Date() < SBSPR_WATER_DATE + 1 ) {
420  break;
421  }
422  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * ins_app_prop * m_farm->Prob_multiplier()))) //modified probability
423  {
424  // Here we check wheter we are using ERA pesticde or not
425  if (!cfg_pest_springbarley_on.value() || !a_field->GetLandscape()->SupplyShouldSpray())
426  {
427  if (!m_farm->InsecticideTreat(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear()))
428  {
429  SimpleEvent(g_date->Date() + 1, sbspr_insecticide1, true);
430  break;
431  }
432  else SBSPR_INSECT_DATE = g_date->Date();
433  }
434  else {
437  }
438 
439  }
440  ChooseNextCrop (2);
442  SimpleEvent(g_date->Date() + 14, sbspr_insecticide2, false);
443  break;
444 
445  case sbspr_insecticide2:
446  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * cfg_ins_app_prop2.value()*m_farm->Prob_multiplier()))) //modified probability
447  {
448  if (cfg_pest_springbarley_on.value() && a_field->GetLandscape()->SupplyShouldSpray())
449  {
451  }
452  else
453  {
455  SimpleEvent(g_date->Date() + 1, sbspr_insecticide2, true);
456  }
457  }
458  }
459  SimpleEvent(g_date->Date() + 14, sbspr_insecticide3, false);
460  break;
461 
462  case sbspr_insecticide3:
463  if (m_ev->m_lock || m_farm->DoIt((int)floor(0.5 + 35 * cfg_ins_app_prop3.value()*m_farm->Prob_multiplier()))) //modified probability
464  {
465  if (cfg_pest_springbarley_on.value() && a_field->GetLandscape()->SupplyShouldSpray())
466  {
468  }
469  else
470  {
472  SimpleEvent(g_date->Date() + 1, sbspr_insecticide3, true);
473  }
474  }
475  }
476  break;
477 
478  case sbspr_harvest:
479  if (!m_farm->Harvest( m_field, 0.0, g_date->DayInYear( 20,8 ) - g_date->DayInYear())) {
480  SimpleEvent( g_date->Date() + 1, sbspr_harvest, true );
481  break;
482  }
484  break;
485 
487  if ( m_ev->m_lock || m_farm->DoIt( 50 )) // was 50
488  {
489  // Force straw chopping to happen on the same day as harvest.
490  if (!m_farm->StrawChopping( m_field, 0.0, 0 )) {
491  // Shouldn't happen.
493  break;
494  }
495  // Did chop, so go directly to stubble harrowing.
497  sbspr_stubble_harrow, false );
498  break;
499  }
500  // Do hay baling first.
501  SimpleEvent( g_date->Date(), sbspr_hay_baling, false );
502  break;
503 
504  case sbspr_hay_baling:
505  if (m_field->GetMConstants(0)==0) {
506  if (!m_farm->HayBailing( m_field, 0.0, -1)) { //raise an error
507  g_msg->Warn( WARN_BUG, "SpringBarleySpr::Do(): failure in 'HayBailing' execution", "" );
508  exit( 1 );
509  }
510  }
511  else {
512  if (!m_farm->HayBailing( m_field, 0.0, m_field->GetMDates(1,0) - g_date->DayInYear())) {
513  SimpleEvent( g_date->Date() + 1, sbspr_hay_baling, true );
514  break;
515  }
516  }
518  sbspr_stubble_harrow, false );
519  break;
520 
522  if ( m_ev->m_lock || m_farm->DoIt( 60 )) // WAS 60
523  {
524  if (m_field->GetMConstants(1)==0) {
525  if (!m_farm->StubbleHarrowing( m_field, 0.0, -1)) { //raise an error
526  g_msg->Warn( WARN_BUG, "SpringBarleySpr::Do(): failure in 'StubbleHarrowing' execution", "" );
527  exit( 1 );
528  }
529  }
530  else {
531  if (!m_farm->StubbleHarrowing( m_field, 0.0, m_field->GetMDates(1,1) - g_date->DayInYear())) {
532  SimpleEvent( g_date->Date() + 1, sbspr_stubble_harrow, true );
533  break;
534  }
535  }
536  }
537  // END MAIN THREAD
538  done=true;
539  break;
540 
541  default:
542  g_msg->Warn( WARN_BUG, "SpringBarleySpr::Do(): "
543  "Unknown event type! ", "" );
544  exit( 1 );
545  }
546  return done;
547 }

References cfg_fungi_app_prop1, 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_springbarley_on, cfg_SpringBarley_SkScrapes, Crop::ChooseNextCrop(), LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_NPK(), Farm::FP_LiquidNH3(), Farm::FP_NPK(), Farm::FP_PK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMConstants(), LE::GetMDates(), Farm::GetType(), Calendar::GetYearNumber(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HayBailing(), 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, LE::m_skylarkscrapes, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), ppp_1, Farm::Prob_multiplier(), Farm::ProductApplication_DateLimited(), SBSPR_DECIDE_TO_FI, SBSPR_DECIDE_TO_HERB, SBSPR_DID_AUTUMN_PLOUGH, sbspr_fertlnh3_plant, sbspr_fertmanure_plant, sbspr_fertmanure_stock_two, sbspr_fertpk_plant, SBSPR_FUNGI_DATE, sbspr_fungicide_one, sbspr_fungicide_two, sbspr_GR, SBSPR_GR_DATE, sbspr_harvest, sbspr_hay_baling, SBSPR_HERBI_DATE, sbspr_herbicide_one, sbspr_herbicide_two, SBSPR_INSECT_DATE, sbspr_insecticide1, sbspr_insecticide2, sbspr_insecticide3, SBSPR_MANURE_DONE, SBSPR_MANURE_EXEC, SBSPR_SLURRY_DONE, SBSPR_SLURRY_EXEC, sbspr_spring_harrow, sbspr_spring_plough, sbspr_spring_roll, sbspr_spring_sow, sbspr_start, sbspr_straw_chopping, sbspr_stubble_harrow, SBSPR_WATER_DATE, sbspr_water_one, sbspr_water_two, LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::StrawChopping(), Farm::StubbleHarrowing(), tof_OptimisingFarm, CfgFloat::value(), CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void SpringBarleySpr::SetUpFarmCategoryInformation ( )
inline
85  {
86  const int elements = 2 + (sbspr_foobar - SSPRBARLEY_BASE);
88 
89  FarmManagementCategory catlist[elements] =
90  {
91  fmc_Others, // zero element unused but must be here
92  fmc_Others,//sbspr_start = 1, // Compulsory, start event must always be 1 (one).
93  fmc_Cultivation,//sbspr_spring_plough = SSPRBARLEY_BASE,
94  fmc_Cultivation,//sbspr_spring_harrow,
95  fmc_Fertilizer,//sbspr_fertmanure_plant,
96  fmc_Fertilizer,//sbspr_fertlnh3_plant,
97  fmc_Fertilizer,//sbspr_fertpk_plant,
98  fmc_Fertilizer,//sbspr_fertmanure_stock_two,
99  fmc_Fertilizer,//sbspr_fertnpk_stock,
100  fmc_Others,//sbspr_spring_sow,
101  fmc_Others,//sbspr_spring_roll,
102  fmc_Herbicide,//sbspr_herbicide_one,
103  fmc_Herbicide,//sbspr_herbicide_two,
104  fmc_Others,//sbspr_GR,
105  fmc_Insecticide,//sbspr_insecticide1,
106  fmc_Insecticide,//sbspr_insecticide2,
107  fmc_Insecticide,//sbspr_insecticide3,
108  fmc_Fungicide,//sbspr_fungicide_one,
109  fmc_Fungicide,//sbspr_fungicide_two,
110  fmc_Watering,//sbspr_water_one,
111  fmc_Watering,//sbspr_water_two,
112  fmc_Harvest,//sbspr_harvest,
113  fmc_Others,//sbspr_straw_chopping,
114  fmc_Others,//sbspr_hay_baling,
115  fmc_Cultivation//sbspr_stubble_harrow
116 
117  // no foobar entry
118 
119  };
120  // Iterate over the catlist elements and copy them to vector
121  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
122 
123  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, sbspr_foobar, and SSPRBARLEY_BASE.

Referenced by SpringBarleySpr().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
cfg_SpringBarley_SkScrapes
CfgBool cfg_SpringBarley_SkScrapes
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
sbspr_spring_sow
Definition: SpringBarleySpr.h:55
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
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
SBSPR_GR_DATE
#define SBSPR_GR_DATE
Definition: SpringBarleySpr.h:39
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
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
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
Farm::FP_NPK
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:645
sbspr_fungicide_one
Definition: SpringBarleySpr.h:63
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
sbspr_spring_plough
Definition: SpringBarleySpr.h:48
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
SBSPR_DID_AUTUMN_PLOUGH
#define SBSPR_DID_AUTUMN_PLOUGH
Definition: SpringBarleySpr.h:36
sbspr_fungicide_two
Definition: SpringBarleySpr.h:64
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
SBSPR_HERBI_DATE
#define SBSPR_HERBI_DATE
Definition: SpringBarleySpr.h:38
sbspr_straw_chopping
Definition: SpringBarleySpr.h:68
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
SBSPR_DECIDE_TO_HERB
#define SBSPR_DECIDE_TO_HERB
Definition: SpringBarleySpr.h:43
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
SpringBarleySpr::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: SpringBarleySpr.h:85
CfgFloat::value
double value() const
Definition: Configurator.h:142
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
sbspr_water_one
Definition: SpringBarleySpr.h:65
sbspr_start
Definition: SpringBarleySpr.h:47
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
sbspr_herbicide_two
Definition: SpringBarleySpr.h:58
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
sbspr_fertpk_plant
Definition: SpringBarleySpr.h:52
sbspr_hay_baling
Definition: SpringBarleySpr.h:69
sbspr_herbicide_one
Definition: SpringBarleySpr.h:57
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
SBSPR_MANURE_DONE
#define SBSPR_MANURE_DONE
Definition: SpringBarleySpr.h:33
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
sbspr_fertmanure_plant
Definition: SpringBarleySpr.h:50
SBSPR_MANURE_EXEC
#define SBSPR_MANURE_EXEC
Definition: SpringBarleySpr.h:35
sbspr_harvest
Definition: SpringBarleySpr.h:67
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
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.
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
SBSPR_INSECT_DATE
#define SBSPR_INSECT_DATE
Definition: SpringBarleySpr.h:42
LE::m_skylarkscrapes
bool m_skylarkscrapes
For management testing of skylark scrapes.
Definition: Elements.h:95
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
sbspr_spring_harrow
Definition: SpringBarleySpr.h:49
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
sbspr_GR
Definition: SpringBarleySpr.h:59
SBSPR_WATER_DATE
#define SBSPR_WATER_DATE
Definition: SpringBarleySpr.h:41
SBSPR_DECIDE_TO_FI
#define SBSPR_DECIDE_TO_FI
Definition: SpringBarleySpr.h:44
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
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
sbspr_insecticide3
Definition: SpringBarleySpr.h:62
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
sbspr_spring_roll
Definition: SpringBarleySpr.h:56
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
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
sbspr_foobar
Definition: SpringBarleySpr.h:71
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
sbspr_insecticide2
Definition: SpringBarleySpr.h:61
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
sbspr_stubble_harrow
Definition: SpringBarleySpr.h:70
sbspr_water_two
Definition: SpringBarleySpr.h:66
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
SBSPR_FUNGI_DATE
#define SBSPR_FUNGI_DATE
Definition: SpringBarleySpr.h:40
sbspr_fertlnh3_plant
Definition: SpringBarleySpr.h:51
SSPRBARLEY_BASE
#define SSPRBARLEY_BASE
Definition: SpringBarleySpr.h:31
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
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
cfg_pest_springbarley_on
CfgBool cfg_pest_springbarley_on
Turn on pesticides for spring barley.
sbspr_insecticide1
Definition: SpringBarleySpr.h:60
SBSPR_SLURRY_DONE
#define SBSPR_SLURRY_DONE
Definition: SpringBarleySpr.h:32
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
sbspr_fertmanure_stock_two
Definition: SpringBarleySpr.h:53
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
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
SBSPR_SLURRY_EXEC
#define SBSPR_SLURRY_EXEC
Definition: SpringBarleySpr.h:34