File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IRSpringBarley Class Reference

IRSpringBarley class
. More...

#include <IRSpringBarley.h>

Inheritance diagram for IRSpringBarley:
Crop

Public Member Functions

virtual bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 The one and only method for a crop management plan. All farm actions go through here. More...
 
 IRSpringBarley (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...
 

Detailed Description

IRSpringBarley class
.

See IRSpringBarley.h::IRSpringBarleyToDo for a complete list of all possible events triggered codes by the management plan. When triggered these events are handled by Farm and are available as information for other objects such as animal and bird models.

Constructor & Destructor Documentation

◆ IRSpringBarley()

IRSpringBarley::IRSpringBarley ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
111  : Crop(a_tov, a_toc, a_L)
112  {
113  // When we start it off, the first possible date for a farm operation is 1st October
114  // This information is used by other crops when they decide how much post processing of
115  // the management is allowed after harvest before the next crop starts.
116  m_first_date = g_date->DayInYear(16, 8);
118  }

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

Member Function Documentation

◆ Do()

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

The one and only method for a crop management plan. All farm actions go through here.

Called every time something is done to the crop by the farmer in the first instance it is always called with a_ev->todo set to start, but susequently will be called whenever the farmer wants to carry out a new operation.
This method details all the management and relationships between operations necessary to grow and ALMaSS crop.

Reimplemented from Crop.

99 {
100  m_field = a_field; // this is needed because of possible calls to other methods and currently we do not pass parameters.
101  m_farm = a_farm; // this is needed because of possible calls to other methods and currently we do not pass parameters.
102  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
103  int d1 = 0;
104  // Depending what event has occured jump to the correct bit of code e.g. for ww_start jump to line 67 below
105  switch (a_ev->m_todo)
106  {
107  case ir_sb_start:
108  {
109  // This is just to hold a local variable in scope and prevent compiler errors
110  // ww_start just sets up all the starting conditions and reference dates that are needed to start a ww
111  // crop off
112  IR_SB_MT = false; // 10% do minimum tillage
113  IR_SB_CP = false; // 90% do conventional plough
114 
115  a_field->ClearManagementActionSum();
116 
117  // Record whether skylark scrapes are present and adjust flag accordingly
119  a_field->m_skylarkscrapes = true;
120  }
121  else {
122  a_field->m_skylarkscrapes = false;
123  }
124  // Set up the date management stuff
125  // The next bit of code just allows for altering dates after harvest if it is necessary
126  // to allow for a crop which starts its management early.
127 
128  int noDates = 1;
129  a_field->SetMDates(0, 0, g_date->DayInYear(15, 8)); // last possible day of harvest
130  a_field->SetMDates(1, 0, g_date->DayInYear(15, 8)); // las possible day of hay baling
131  // Can be up to 10 of these. If the shortening code is triggered
132  // then these will be reduced in value to 0
133 
134  a_field->SetMConstants(0, 1);
135 
136  // Check the next crop for early start, unless it is a spring crop
137  // in which case we ASSUME that no checking is necessary!!!!
138  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
139 
140  //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)
141  int d1;
142  if (!(a_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
143 
144  if (a_ev->m_startday > g_date->DayInYear(1, 7)) {
145  if (a_field->GetMDates(0, 0) >= a_ev->m_startday)
146  {
147  g_msg->Warn(WARN_BUG, "IRSpringBarley::Do(): ", "Harvest too late for the next crop to start!!!");
148  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
149  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
150  }
151  // Now fix any late finishing problems
152  for (int i = 0; i < noDates; i++) {
153  if (a_field->GetMDates(0, i) >= a_ev->m_startday) {
154  a_field->SetMDates(0, i, a_ev->m_startday - 1); //move the starting date
155  }
156  if (a_field->GetMDates(1, i) >= a_ev->m_startday) {
157  a_field->SetMConstants(i, 0); //change the default value of the MConst (=1) to 0 (necessary to correctly execute farm events in case the finishing date (MDate) was moved)
158  a_field->SetMDates(1, i, a_ev->m_startday - 1); //move the finishing date
159  }
160  }
161  }
162  // Now no operations can be timed after the start of the next crop.
163 
164  if (!a_ev->m_first_year) {
165  // Are we before July 1st?
166  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
167  if (g_date->Date() < d1) {
168  // Yes, too early. We assumme this is because the last crop was late
169  printf("Poly: %d\n", a_field->GetPoly());
170  g_msg->Warn(WARN_BUG, "IRSpringBarley::Do(): ", "Crop start attempt between 1st Jan & 1st July");
171  int prev = a_field->GetLandscape()->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousTov(a_field->GetRotIndex()));
172  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
173  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
174  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
175  }
176  else {
177  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
178  if (g_date->Date() > d1) {
179  // Yes too late - should not happen - raise an error
180  g_msg->Warn(WARN_BUG, "IRSpringBarley::Do(): ", "Crop start attempt after last possible start date");
181  g_msg->Warn(WARN_BUG, "Previous Crop ", "");
182  a_field->GetOwner()->GetPreviousTov(a_field->GetRotIndex());
183  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
184  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
185  }
186  }
187  }
188  else {
189  // Is the first year
190  // Some special code to cope with that first start-up year in ALMaSS - ignore for all practical purposes (start woth the first event on the after winter time) - Date here is a suggestion (not stated in crop scheme!)
192  break;
193  }
194  }//if
195 
196  // End single block date checking code. Please see next line comment as well.
197  // Reinit d1 to first possible starting date.
198  d1 = g_date->OldDays() + g_date->DayInYear(15, 8);
199  // OK, let's go.
200  // LKM: Here we queue up the first event - 10% do minimum tillage (mt) stubble harrow, 90% do conventional plough (cp), where half (45%) do stubble harrow as well
201  //
202  if (a_ev->m_lock || a_farm->DoIt_prob(.10)) {
204  break;
205  }
206  else if (a_ev->m_lock || a_farm->DoIt_prob(.90 /.90)) {
208  break;
209  }
210  break;
211  }
212  break;
213  // This is the first real farm operation
215  if (!a_farm->StubbleHarrowing(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
217  break;
218  }
219  IR_SB_MT = true; // we need to remember who do mt
221  break;
222 
223  case ir_sb_stubble_harrow_cp: // 27% (30% of conventional plough) do this
224  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
225  if (!a_farm->StubbleHarrowing(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
227  break;
228  }
229  }
231  break;
232 
233  case ir_sb_sow_cover_crop: // 25% sow cover crop and stubble cultivation, 75% leave natural regeneration to grow
234  if (a_ev->m_lock || a_farm->DoIt_prob(.25)) {
235  if (!a_farm->AutumnSow(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
237  break;
238  }
240  break;
241  }
242  if (IR_SB_MT == true) { // minimal tillage w. CC
243  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_herbicide1_mt, false);
244  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_stubble_cultivator_mt, false); // cultivation thread - main thread
245  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_molluscicide, false); // mollusc thread
246  if (a_farm->IsStockFarmer()) {
247  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_ferti_s1, false); // ferti stock thread
248  break;
249  }
250  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_ferti_p1, false); // ferti plant thread
251  break;
252  }
253  else // conventional plough w. CC
254  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_herbicide1_cp, false);
255  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_spring_plough_cp, false); // cultivation thread - main thread
256  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_molluscicide, false); // mollusc thread
257  if (a_farm->IsStockFarmer()) {
258  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_ferti_s1, false); // ferti stock thread
259  break;
260  }
261  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_ferti_p1, false); // ferti plant thread
262  break;
263 
265  if (!a_farm->StubblePlough(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
267  break;
268  }
269  if (IR_SB_MT == true) { // minimal tillage w/o CC
270  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_herbicide1_mt, false); // herbi thread
271  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_stubble_cultivator_mt, false); // cultivation thread - main thread
272  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_molluscicide, false); // mollusc thread
273  if (a_farm->IsStockFarmer()) {
274  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3)+365, ir_sb_ferti_s1, false); // ferti stock thread
275  break;
276  }
277  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3)+365, ir_sb_ferti_p1, false); // ferti plant thread
278  break;
279  }
280  else // conventional plough w/o CC
281  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_herbicide1_cp, false); // herbi thread
282  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 1) + 365, ir_sb_spring_plough_cp, false); // cultivation thread - main thread
283  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, ir_sb_molluscicide, false); // mollusc thread
284  if (a_farm->IsStockFarmer()) {
285  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3)+365, ir_sb_ferti_s1, false); // ferti stock thread
286  break;
287  }
288  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3)+365, ir_sb_ferti_p1, false); // ferti plant thread
289  break;
290 
291  case ir_sb_herbicide1_mt: // 100% or mt farmers
292  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(5, 3) - g_date->DayInYear())) {
294  break;
295  }
296  break; // end of thread
297 
298  case ir_sb_herbicide1_cp: // 35% (of 90% - all of CP) do this, rest (65% of 90%) skips this step
299  if (a_ev->m_lock || a_farm->DoIt_prob(.35)) {
300  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(5, 3) - g_date->DayInYear())) {
302  break;
303  }
304  }
305  break; // end of thread
306 
307  case ir_sb_molluscicide:
308  if (a_ev->m_lock || a_farm->DoIt_prob(.05)) {
309  if (!a_farm->Molluscicide(a_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
310  SimpleEvent(g_date->Date() + 1, ir_sb_molluscicide, true);
311  break;
312  }
313  }
314  break; // end of thread
315 
316  case ir_sb_ferti_s1: // 15% of all farmers do
317  if (a_ev->m_lock || a_farm->DoIt_prob(.15)) {
318  if (!a_farm->FA_Slurry(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
319  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_s1, true);
320  break;
321  }
322  }
323  break; // end of thread
324 
325  case ir_sb_ferti_p1: // 15% of all farmers do
326  if (a_ev->m_lock || a_farm->DoIt_prob(.15)) {
327  if (!a_farm->FP_Slurry(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
328  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_p1, true);
329  break;
330  }
331  }
332  break; // end of thread
333 
334  //CP do spring plough, MT do stubble cultivator
336  if (!a_farm->StubblePlough(a_field, 0.0,
337  g_date->DayInYear(5, 4) - g_date->DayInYear())) {
339  break;
340  }
342  break;
343 
345  if (!a_farm->PreseedingCultivatorSow(a_field, 0.0,
346  g_date->DayInYear(8, 4) - g_date->DayInYear())) {
348  break;
349  }
350  SimpleEvent(g_date->Date() + 2,ir_sb_spring_roll, false);
351  break;
352 
354  if (!a_farm->SpringPlough(a_field, 0.0,
355  g_date->DayInYear(5, 4) - g_date->DayInYear())) {
357  break;
358  }
360  break;
361 
362  case ir_sb_spring_sow_cp:
363  if (!a_farm->SpringSow(a_field, 0.0,
364  g_date->DayInYear(5, 4) - g_date->DayInYear())) {
366  break;
367  }
369  break;
370 
372  if (!a_farm->SpringHarrow(a_field, 0.0,
373  g_date->DayInYear(5, 4) - g_date->DayInYear())) {
375  break;
376  }
377  SimpleEvent(g_date->Date() + 2, ir_sb_spring_roll, false);
378  break;
379  //CP and MT comes together for spring roll
380  case ir_sb_spring_roll:
381  if (!a_farm->SpringRoll(a_field, 0.0,
382  g_date->DayInYear(8, 4) - g_date->DayInYear())) {
383  SimpleEvent(g_date->Date() + 1, ir_sb_spring_roll, true);
384  break;
385  }
386  //Here comes a fork of parallel events
387  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 4), ir_sb_herbicide2, false); //herbi thread
388  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 4), ir_sb_insecticide1, false); //insecti thread
389  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), ir_sb_fungicide1, false); //fungi thread, main thread
390  if (a_farm->IsStockFarmer())
391  {
392  SimpleEvent(g_date->OldDays() + g_date->DayInYear(25, 3), ir_sb_ferti_s2, false); //stock ferti thread
393  break;
394  }
395  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(25, 3), ir_sb_ferti_p2, false); //plant ferti thread
396  break;
397 
398  case ir_sb_ferti_s2:
399  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(5, 4) - g_date->DayInYear())) {
400  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_s2, true);
401  break;
402  }
403  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 4), ir_sb_ferti_s3, false);
404  break;
405 
406  case ir_sb_ferti_p2:
407  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(5, 4) - g_date->DayInYear())) {
408  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_p2, true);
409  break;
410  }
411  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 4), ir_sb_ferti_p3, false);
412  break;
413 
414  case ir_sb_ferti_s3:
415  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
416  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_s3, true);
417  break;
418  }
419  break; // end of thread
420 
421  case ir_sb_ferti_p3:
422  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
423  SimpleEvent(g_date->Date() + 1, ir_sb_ferti_p3, true);
424  break;
425  }
426  break; // end of thread
427 
428 
429 
430  case ir_sb_herbicide2:
431  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
432  SimpleEvent(g_date->Date() + 1, ir_sb_herbicide2, true);
433  break;
434  }
435  break; // end of thread
436 
437  case ir_sb_insecticide1:
438  if (a_ev->m_lock || a_farm->DoIt_prob(.70)) {
439  if (!a_farm->InsecticideTreat(a_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
440  SimpleEvent(g_date->Date() + 1, ir_sb_insecticide1, true);
441  break;
442  }
443  }
445  break;
446 
447  case ir_sb_insecticide2: // 60% will do it every 5 years if pest levels are high - suggests 12% do it
448  if (a_ev->m_lock || a_farm->DoIt_prob(.12)) {
449  if (!a_farm->InsecticideTreat(a_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear())) {
450  SimpleEvent(g_date->Date() + 1, ir_sb_insecticide2, true);
451  break;
452  }
453  }
454  break; // end of thread
455 
456 
457  case ir_sb_fungicide1:
458  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear())) {
459  SimpleEvent(g_date->Date() + 1, ir_sb_fungicide1, true);
460  break;
461  }
463  break;
464 
465  case ir_sb_fungicide2:
466  if (!a_farm->FungicideTreat(a_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
467  SimpleEvent(g_date->Date() + 1, ir_sb_fungicide2, true);
468  break;
469  }
471  break;
472 
473  case ir_sb_harvest:
474  if (!a_farm->Harvest(a_field, 0.0, a_field->GetMDates(0, 0) - g_date->DayInYear())) {
475  SimpleEvent(g_date->Date() + 1, ir_sb_harvest, true);
476  break;
477  }
479  break;
480 
481  case ir_sb_hay_bailing:
482  if (!a_farm->HayBailing(a_field, 0.0, a_field->GetMDates(1, 0) - g_date->DayInYear())) {
483  SimpleEvent(g_date->Date() + 1, ir_sb_hay_bailing, true);
484  break;
485  }
486  done = true;
487  // So we are done, and somewhere else the farmer will queue up the start event of the next crop
488  // END OF MAIN THREAD
489  break;
490  default:
491  g_msg->Warn(WARN_BUG, "IRSpringBarley::Do(): "
492  "Unknown event type! ", "");
493  exit(1);
494  }
495  return done;
496 }

References Farm::AutumnSow(), cfg_IR_SpringBarley_SkScrapes, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_AmmoniumSulphate(), Farm::FP_NPK(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), LE::GetOwner(), LE::GetPoly(), Farm::GetPreviousTov(), LE::GetRotIndex(), Farm::GetType(), Calendar::GetYearNumber(), Farm::Harvest(), Farm::HayBailing(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), IR_SB_CP, ir_sb_cultivation_sow_mt, ir_sb_ferti_p1, ir_sb_ferti_p2, ir_sb_ferti_p3, ir_sb_ferti_s1, ir_sb_ferti_s2, ir_sb_ferti_s3, ir_sb_fungicide1, ir_sb_fungicide2, ir_sb_harvest, ir_sb_hay_bailing, ir_sb_herbicide1_cp, ir_sb_herbicide1_mt, ir_sb_herbicide2, ir_sb_insecticide1, ir_sb_insecticide2, ir_sb_molluscicide, IR_SB_MT, ir_sb_sow_cover_crop, ir_sb_spring_harrow_cp, ir_sb_spring_plough_cp, ir_sb_spring_roll, ir_sb_spring_sow_cp, ir_sb_start, ir_sb_stubble_cultivator, ir_sb_stubble_cultivator_mt, ir_sb_stubble_harrow_cp, ir_sb_stubble_harrow_mt, Farm::IsStockFarmer(), Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, LE::m_skylarkscrapes, FarmEvent::m_startday, FarmEvent::m_todo, Farm::Molluscicide(), Calendar::OldDays(), Farm::PreseedingCultivatorSow(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::StubbleHarrowing(), Farm::StubblePlough(), tof_OptimisingFarm, CfgBool::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void IRSpringBarley::SetUpFarmCategoryInformation ( )
inline
119  {
120  const int elements = 2 + (ir_sb_foobar - IR_SB_BASE);
122 
123  FarmManagementCategory catlist[elements] =
124  {
125  fmc_Others, // zero element unused but must be here
126  fmc_Others, // ir_sb_start = 1, // Compulsory, must always be 1 (one).
127  fmc_Others, // ir_sb_sleep_all_day = IR_SB_BASE,
128  fmc_Fertilizer, // ir_sb_ferti_s1
129  fmc_Fertilizer, // ir_sb_ferti_p1
130  fmc_Cultivation, // ir_sb_stubble_harrow_mt,
131  fmc_Cultivation, // ir_sb_stubble_harrow_cp,
132  fmc_Others, // ir_sb_sow_cover_crop,
133  fmc_Cultivation, // ir_sb_stubble_cultivator,
134  fmc_Herbicide,// ir_sb_herbicide1_mt,
135  fmc_Herbicide,// ir_sb_herbicide1_cp,
136  fmc_Cultivation, // ir_sb_stubble_cultivator_mt,
137  fmc_Cultivation, // ir_sb_cultivation_sow_mt,
138  fmc_Cultivation, // ir_sB_spring_plough_cp,
139  fmc_Others, // ir_sb_spring_sow_cp,
140  fmc_Cultivation, // ir_sb_spring_harrow_cp,
141  fmc_Cultivation, // ir_sb_spring_roll,
142  fmc_Fertilizer, // ir_sb_ferti_s2
143  fmc_Fertilizer, // ir_sb_ferti_p2
144  fmc_Fertilizer, // ir_sb_ferti_s3
145  fmc_Fertilizer, // ir_sb_ferti_p3
146  fmc_Others, // ir_sb_molluscicide
147  fmc_Herbicide, // ir_sb_herbicide2,
148  fmc_Insecticide, // ir_sb_insecticide1,
149  fmc_Insecticide, // ir_sb_insecticide2,
150  fmc_Fungicide, // ir_sb_fungicide1,
151  fmc_Fungicide, // ir_sb_fungicide2,
152  fmc_Harvest, // ir_sb_harvest,
153  fmc_Others, // ir_sb_hay_bailing,
154 
155 
156  // no foobar entry
157 
158  };
159  // Iterate over the catlist elements and copy them to vector
160  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
161 
162  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, IR_SB_BASE, ir_sb_foobar, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by IRSpringBarley().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::SpringRoll
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
Definition: FarmFuncs.cpp:487
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1067
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
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
ir_sb_spring_roll
Definition: IRSpringBarley.h:82
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::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
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
ir_sb_herbicide1_mt
Definition: IRSpringBarley.h:75
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: FarmFuncs.cpp:232
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
ir_sb_stubble_harrow_cp
Definition: IRSpringBarley.h:72
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
ir_sb_ferti_s2
Definition: IRSpringBarley.h:83
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
ir_sb_molluscicide
Definition: IRSpringBarley.h:87
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
ir_sb_foobar
Definition: IRSpringBarley.h:95
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
IR_SB_CP
#define IR_SB_CP
Definition: IRSpringBarley.h:58
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
ir_sb_spring_harrow_cp
Definition: IRSpringBarley.h:81
ir_sb_stubble_cultivator_mt
Definition: IRSpringBarley.h:77
ir_sb_hay_bailing
Definition: IRSpringBarley.h:94
CfgBool::value
bool value() const
Definition: Configurator.h:164
ir_sb_herbicide1_cp
Definition: IRSpringBarley.h:76
ir_sb_herbicide2
Definition: IRSpringBarley.h:88
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
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
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
ir_sb_stubble_harrow_mt
Definition: IRSpringBarley.h:71
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
ir_sb_harvest
Definition: IRSpringBarley.h:93
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
IRSpringBarley::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: IRSpringBarley.h:119
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
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
ir_sb_stubble_cultivator
Definition: IRSpringBarley.h:74
ir_sb_ferti_p2
Definition: IRSpringBarley.h:84
ir_sb_ferti_s3
Definition: IRSpringBarley.h:85
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
ir_sb_insecticide2
Definition: IRSpringBarley.h:90
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
cfg_IR_SpringBarley_SkScrapes
CfgBool cfg_IR_SpringBarley_SkScrapes("IR_CROP_SB_SK_SCRAPES", CFG_CUSTOM, false)
ir_sb_fungicide2
Definition: IRSpringBarley.h:92
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
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: FarmFuncs.cpp:325
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
ir_sb_spring_sow_cp
Definition: IRSpringBarley.h:80
ir_sb_fungicide1
Definition: IRSpringBarley.h:91
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
ir_sb_insecticide1
Definition: IRSpringBarley.h:89
ir_sb_start
Definition: IRSpringBarley.h:67
IR_SB_MT
#define IR_SB_MT
A flag used to indicate autumn ploughing status.
Definition: IRSpringBarley.h:57
ir_sb_ferti_p1
Definition: IRSpringBarley.h:70
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
ir_sb_spring_plough_cp
Definition: IRSpringBarley.h:79
ir_sb_sow_cover_crop
Definition: IRSpringBarley.h:73
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
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
ir_sb_ferti_p3
Definition: IRSpringBarley.h:86
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
ir_sb_ferti_s1
Definition: IRSpringBarley.h:69
IR_SB_BASE
#define IR_SB_BASE
Definition: IRSpringBarley.h:53
WARN_BUG
Definition: MapErrorMsg.h:34
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
ir_sb_cultivation_sow_mt
Definition: IRSpringBarley.h:78
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