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

PLSpringBarley class
. More...

#include <PLSpringBarley.h>

Inheritance diagram for PLSpringBarley:
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...
 
 PLSpringBarley (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

PLSpringBarley class
.

See PLSpringBarley.h::PLSpringBarleyToDo for a complete list of all possible events triggered codes by the spring barley 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

◆ PLSpringBarley()

PLSpringBarley::PLSpringBarley ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
99  : Crop(a_tov, a_toc, a_L)
100  {
101  // When we start it off, the first possible date for a farm operation is 5th November
102  // This information is used by other crops when they decide how much post processing of
103  // the management is allowed after harvest before the next crop starts.
104  m_first_date=g_date->DayInYear( 5,11 );
106  }

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

Member Function Documentation

◆ Do()

bool PLSpringBarley::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 m_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 - in this case conventional spring barley.

Reimplemented from Crop.

66 {
67  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
68  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
69  m_field = a_field;
70  m_ev = a_ev;
71  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
72  bool flag = false;
73  int d1 = 0;
74  int noDates = 1;
75  TTypesOfVegetation l_tov = tov_PLSpringBarley; // The current type - change to match the crop you have
76 /**********************************************To Here *************************************************************************/
77 
78  // Depending what event has occured jump to the correct bit of code
79  switch (m_ev->m_todo)
80  {
81  case pl_sb_start:
82  {
83  // pl_sb_start just sets up all the starting conditions and reference dates that are needed to start a pl_sb
84  PL_SB_FERTI_P1 = false;
85  PL_SB_FERTI_S1 = false;
86  PL_SB_STUBBLE_PLOUGH = false;
87  PL_SB_FERTI_P4 = false;
88  PL_SB_FERTI_S4 = false;
90  PL_SB_DECIDE_TO_GR = false;
91 
92  a_field->ClearManagementActionSum();
93 
94  // Set up the date management stuff
95  // The next bit of code just allows for altering dates after harvest if it is necessary
96  // to allow for a crop which starts its management early.
97 
98  // 5 start and stop dates for all 'movable' events for this crop
99  int noDates = 4;
100  m_field->SetMDates(0, 0, g_date->DayInYear(15, 8)); // last possible day of harvest
101  m_field->SetMDates(1, 0, g_date->DayInYear(20, 8)); // last possible day of starw chopping, equal to harvest in this case
102  m_field->SetMDates(0, 1, 0); // start day of hay bailing (not used as it depend on previous treatment)
103  m_field->SetMDates(1, 1, g_date->DayInYear(25, 8)); // end day of hay bailing
104  m_field->SetMDates(0, 2, 0); // start day of RSM
105  m_field->SetMDates(1, 2, g_date->DayInYear(25, 8)); // end day of RSM
106  m_field->SetMDates(0, 3, 0); // start day of calcium application
107  m_field->SetMDates(1, 3, g_date->DayInYear(25, 8)); // end day of calcium application
108  // Can be up to 10 of these. If the shortening code is triggered
109  // then these will be reduced in value to 0
110 
111  m_field->SetMConstants(0, 1);
112 
113  // Check the next crop for early start, unless it is a spring crop
114  // in which case we ASSUME that no checking is necessary!!!!
115  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
116 
117  //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)
118  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
119  if (!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
120 
121  if (m_ev->m_startday > g_date->DayInYear(1, 7)) {
122  if (m_field->GetMDates(0, 0) >= m_ev->m_startday)
123  {
124  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): ", "Harvest too late for the next crop to start!!!");
125  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
126  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
127  }
128  // Now fix any late finishing problems
129  for (int i = 0; i < noDates; i++) {
130  if (m_field->GetMDates(0, i) >= m_ev->m_startday) {
131  m_field->SetMDates(0, i, m_ev->m_startday - 1); //move the starting date
132  }
133  if (m_field->GetMDates(1, i) >= m_ev->m_startday) {
134  m_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)
135  m_field->SetMDates(1, i, m_ev->m_startday - 1); //move the finishing date
136  }
137  }
138  }
139  // Now no operations can be timed after the start of the next crop.
140 
141  if (!m_ev->m_first_year) {
142  // Are we before July 1st?
143  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
144  if (g_date->Date() < d1) {
145  // Yes, too early. We assumme this is because the last crop was late
146  printf("Poly: %d\n", m_field->GetPoly());
147  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): ", "Crop start attempt between 1st Jan & 1st July");
148  int prev = m_field->GetLandscape()->BackTranslateVegTypes(m_field->GetOwner()->GetPreviousTov(m_field->GetRotIndex()));
149  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
150  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
151  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
152  }
153  else {
154  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
155  if (g_date->Date() > d1) {
156  // Yes too late - should not happen - raise an error
157  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): ", "Crop start attempt after last possible start date");
158  g_msg->Warn(WARN_BUG, "Previous Crop ", "");
160  int almassnum = m_field->GetLandscape()->BackTranslateVegTypes(m_ev->m_next_tov);
161  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
162  }
163  }
164  }
165  else {
166  // Is the first year
167  // Some special code to cope with that first start-up year in ALMaSS - ignore for all practical purposes
168  // Code for first spring treatment used
169  if (m_farm->IsStockFarmer()) //Stock Farmer
170  {
172  }
174  break;
175  }
176  }//if
177 
178  // End single block date checking code. Please see next line comment as well.
179  // Reinit d1 to first possible starting date.
180  d1 = g_date->OldDays() + g_date->DayInYear(20, 7);
181  // OK, let's go.
182  // Here we queue up the first event - this differs depending on whether we have a
183  // stock or arable farmer
184  if (m_farm->IsStockFarmer()) { // StockFarmer
186  }
187  else SimpleEvent_(d1, pl_sb_ferti_p1, false, m_farm, m_field);
188  }
189  break;
190 
191  // This is the first real farm operation
192  case pl_sb_ferti_p1:
193  // In total 10% of arable farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
194  // We therefore assume that half of them (5%) do it now
195  if (m_ev->m_lock || m_farm->DoIt(5))
196  {
197  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(5, 11) - g_date->DayInYear())) {
198  // If we don't suceed on the first try, then try and try again (until 20/8 when we will suceed)
200  break;
201  }
202  else
203  {
204  //Rest of farmers do slurry before autumn plough/stubble cultivation so we need to remeber who already did it
205  PL_SB_FERTI_P1 = true;
206  }
207  }
208  // Queue up the next event -in this case stubble ploughing
210  break;
211  case pl_sb_ferti_s1:
212  // In total 40% of stock farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
213  // We therefore assume that half of them (40%) do it now
214  if (m_ev->m_lock || m_farm->DoIt(40))
215  {
216  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(5, 11) - g_date->DayInYear())) {
218  break;
219  }
220  else
221  {
222  //Rest of farmers do slurry before autumn plough/stubble cultivation so we need to remeber who already did it
223  PL_SB_FERTI_S1 = true;
224  }
225  }
226  // Queue up the next event -in this case stubble ploughing
228  break;
230  // 50% will do stubble plough, but rest will get away with non-inversion cultivation
231  if (m_ev->m_lock || m_farm->DoIt(50))
232  {
233  if (!m_farm->StubblePlough(m_field, 0.0, g_date->DayInYear(5, 11) - g_date->DayInYear())) {
235  break;
236  }
237  else
238  {
239  // 50% of farmers will do this, but the other 50% won't so we need to remember whether we are in one or the other group
240  PL_SB_STUBBLE_PLOUGH = true;
241  // Queue up the next event
243  break;
244  }
245  }
247  break;
249  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->DayInYear(5, 11) - g_date->DayInYear())) {
251  break;
252  }
254  break;
256  if (m_ev->m_lock || m_farm->DoIt(40))
257  {
258  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->Date() + 7 - g_date->DayInYear())) {
260  break;
261  }
262  }
263  d1 = g_date->Date() + 1;
264  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 9)) {
265  d1 = g_date->OldDays() + g_date->DayInYear(10, 9);
266  }
267  if (m_farm->IsStockFarmer()) //Stock Farmer
268  {
270  }
271  else SimpleEvent_(d1, pl_sb_ferti_p2, false, m_farm, m_field);
272  break;
274  if (!m_farm->StubbleHarrowing(m_field, 0.0, g_date->DayInYear(10, 11) - g_date->DayInYear())) {
276  break;
277  }
278  d1 = g_date->Date() + 1;
279  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 9)) {
280  d1 = g_date->OldDays() + g_date->DayInYear(10, 9);
281  }
282  if (m_farm->IsStockFarmer()) //Stock Farmer
283  {
285  }
286  else SimpleEvent_(d1, pl_sb_ferti_p2, false, m_farm, m_field);
287  break;
288  case pl_sb_ferti_p2:
289  // In total 10% of arable farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
290  // We therefore assume that half of them (5%) do it now (if haven't done before)
291  if ((m_ev->m_lock || m_farm->DoIt(static_cast<int>((5.0 / 95.0) * 100))) && (PL_SB_FERTI_P1 == false))
292  {
293  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
295  break;
296  }
297  }
299  break;
300  case pl_sb_ferti_s2:
301  // In total 80% of stock farmers do slurry in the autumn, either before stubble plough/harrow or later before autumn plough/cultivation
302  // We therefore assume that half of them (40%) do it now (if haven't done before)
303  if ((m_ev->m_lock || m_farm->DoIt(static_cast<int>((40.0 / 60.0) * 100))) && (PL_SB_FERTI_S1 == false))
304  {
305  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
307  break;
308  }
309  }
311  break;
312  case pl_sb_ferti_p3:
313  if (m_ev->m_lock || m_farm->DoIt(28))
314  {
315  if (!m_farm->FP_NPKS(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
317  break;
318  }
319  }
321  break;
322  case pl_sb_ferti_s3:
323  if (m_ev->m_lock || m_farm->DoIt(28))
324  {
325  if (!m_farm->FA_NPKS(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
327  break;
328  }
329  }
331  break;
332  case pl_sb_winter_plough:
333  if (m_ev->m_lock || m_farm->DoIt(30))
334  {
335  if (!m_farm->WinterPlough(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
337  break;
338  }
339  }
340  if (m_farm->IsStockFarmer()) //Stock Farmer
341  {
343  }
344  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, pl_sb_ferti_p4, false, m_farm, m_field);
345  break;
346  case pl_sb_ferti_p4:
347  if (m_ev->m_lock || m_farm->DoIt(23))
348  {
349  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(25, 3) - g_date->DayInYear())) {
351  break;
352  }
353  else
354  {
355  //All farmers who do spring slurry have to do harrow
356  PL_SB_FERTI_P4 = true;
357  }
358  }
360  break;
361  case pl_sb_ferti_s4:
362  if (m_ev->m_lock || m_farm->DoIt(23))
363  {
364  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(25, 3) - g_date->DayInYear())) {
366  break;
367  }
368  else
369  {
370  //All farmers who do spring slurry have to do harrow
371  PL_SB_FERTI_S4 = true;
372  }
373  }
375  break;
376  case pl_sb_spring_harrow:
377  if ((m_ev->m_lock) || (PL_SB_FERTI_P4) || (PL_SB_FERTI_S4) || (m_farm->DoIt(13)))
378  {
379  if (!m_farm->SpringHarrow(m_field, 0.0, g_date->DayInYear(25, 3) - g_date->DayInYear())) {
381  break;
382  }
383  }
384  d1 = g_date->Date() + 1;
385  if (d1 < g_date->OldDays() + g_date->DayInYear(5, 3)) {
386  d1 = g_date->OldDays() + g_date->DayInYear(5, 3);
387  }
388  if (m_farm->IsStockFarmer()) //Stock Farmer
389  {
391  }
392  else SimpleEvent_(d1, pl_sb_ferti_p5, false, m_farm, m_field);
393  break;
394  case pl_sb_ferti_p5:
395  if (m_ev->m_lock || m_farm->DoIt(88))
396  {
397  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
399  break;
400  }
401  PL_SB_SPRING_FERTI = true;
402  }
404  break;
405  case pl_sb_ferti_s5:
406  if (m_ev->m_lock || m_farm->DoIt(88))
407  {
408  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
410  break;
411  }
412  PL_SB_SPRING_FERTI = 1;
413  }
415  break;
417  if (PL_SB_SPRING_FERTI == 1)
418  {
421  break;
422  }
423  }
424  d1 = g_date->Date() + 1;
425  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 3)) {
426  d1 = g_date->OldDays() + g_date->DayInYear(20, 3);
427  }
429  break;
431  // 20% will do preseeding cultivation, the rest will do it together with sow
432  if (m_ev->m_lock || m_farm->DoIt(20))
433  {
436  break;
437  }
439  break;
440  }
442  break;
443  case pl_sb_spring_sow:
444  if (cfg_seedcoating_springbarley_on.value() && a_field->GetLandscape()->SupplyShouldSpray()) {
445  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear(),
448  break;
449  }
450  }
451  else {
452  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
454  break;
455  }
456  }
457 
458  // Here is a fork leading to four parallel events
459  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4), pl_sb_herbicide1, false, m_farm, m_field); // Herbidide thread
460  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), pl_sb_fungicide1, false, m_farm, m_field); // Fungicide thread
461  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 5) + m_date_modifier, pl_sb_insecticide1, false, m_farm, m_field); // Insecticide thread = MAIN THREAD
462  if (m_farm->IsStockFarmer()) //Stock Farmer // N thread
463  {
465  }
467  if (m_farm->IsStockFarmer()) //Stock Farmer // Microelemnts thread
468  {
470  }
472  break;
474  // 80% will do preseeding cultivation with sow
477  break;
478  }
479  // Here is a fork leading to four parallel events
480  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4), pl_sb_herbicide1, false, m_farm, m_field); // Herbidide thread
481  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), pl_sb_fungicide1, false, m_farm, m_field); // Fungicide thread
482  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 5) + m_date_modifier, pl_sb_insecticide1, false, m_farm, m_field); // Insecticide thread = MAIN THREAD
483  if (m_farm->IsStockFarmer()) //Stock Farmer // N thread
484  {
486  }
488  if (m_farm->IsStockFarmer()) //Stock Farmer // Microelemnts thread
489  {
491  }
493  break;
494  case pl_sb_ferti_p6:
495  // Here comes N thread
496  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
498  break;
499  }
500  // End of thread
501  break;
502  case pl_sb_ferti_s6:
503  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
505  break;
506  }
507  // End of thread
508  break;
509  case pl_sb_ferti_p7:
510  // Here comes the mickroelements thread
511  if (m_ev->m_lock || m_farm->DoIt(43))
512  {
513  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
515  break;
516  }
517  }
518  d1 = g_date->Date() + 14;
519  if (d1 < g_date->OldDays() + g_date->DayInYear(25, 5)) {
520  d1 = g_date->OldDays() + g_date->DayInYear(25, 5);
521  }
523  break;
524  case pl_sb_ferti_s7:
525  if (m_ev->m_lock || m_farm->DoIt(43))
526  {
527  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
529  break;
530  }
531  }
532  d1 = g_date->Date() + 14;
533  if (d1 < g_date->OldDays() + g_date->DayInYear(25, 5)) {
534  d1 = g_date->OldDays() + g_date->DayInYear(25, 5);
535  }
537  break;
538  case pl_sb_ferti_p8:
539  if (m_ev->m_lock || m_farm->DoIt(3))
540  {
541  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
543  break;
544  }
545  }
546  // End of thread
547  break;
548  case pl_sb_ferti_s8:
549  if (m_ev->m_lock || m_farm->DoIt(3))
550  {
551  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear())) {
553  break;
554  }
555  }
556  // End of thread
557  break;
558  case pl_sb_herbicide1: // The first of the pesticide managements.
559  // Here comes the herbicide thread
560  if (m_ev->m_lock || m_farm->DoIt(97))
561  {
562  if (m_field->GetGreenBiomass() <= 0) {
564  }
565  else
566  {
567  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear())) {
569  break;
570  }
571  }
572  }
573  // End of thread
574  break;
575  case pl_sb_fungicide1:
576  // Here comes the fungicide thread
577  if (m_ev->m_lock || m_farm->DoIt(83))
578  {
579  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
581  break;
582  }
583  }
585  break;
586  case pl_sb_fungicide2:
587  if (m_ev->m_lock || m_farm->DoIt(23))
588  {
589  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
591  break;
592  }
593  }
594  d1 = g_date->Date() + 14;
595  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 5)) {
596  d1 = g_date->OldDays() + g_date->DayInYear(20, 5);
597  }
599  break;
600  case pl_sb_fungicide3:
601  if (m_ev->m_lock || m_farm->DoIt(4))
602  {
603  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear())) {
605  break;
606  }
607  }
608  // End of thread
609  break;
610  case pl_sb_insecticide1:
611  // Here comes the insecticide thread = MAIN THREAD
612  if (m_ev->m_lock || m_farm->DoIt(65))
613  {
614  // here we check whether we are using ERA pesticide or not
615  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
616  if (!cfg_pest_springbarley_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
617  {
618  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
619  }
620  else {
622  }
623  if (!flag) {
625  break;
626  }
627  }
629  break;
630  case pl_sb_insecticide2:
631  if (m_ev->m_lock || m_farm->DoIt(46))
632  {
633  // here we check whether we are using ERA pesticide or not
634  d1 = g_date->DayInYear(30, 6) - g_date->DayInYear();
635  if (!cfg_pest_springbarley_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
636  {
637  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
638  }
639  else {
641  }
642  if (!flag) {
644  break;
645  }
646  }
648  break;
649  case pl_sb_harvest:
650  // Here the MAIN thread continues
651  // We don't move harvest days
652  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(0, 0) - g_date->DayInYear())) {
654  break;
655  }
657  break;
659  if (m_farm->IsStockFarmer()) //Stock Farmer
660  {
661  // 10% of stock farmers will do straw chopping, but rest will do hay bailing instead
662  if (m_ev->m_lock || m_farm->DoIt(10))
663  {
664  if (m_field->GetMConstants(0) == 0) {
665  if (!m_farm->StrawChopping(m_field, 0.0, -1)) { // raise an error
666  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'StrawChopping' execution", "");
667  exit(1);
668  }
669  }
670  else {
671  if (!m_farm->StrawChopping(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
673  break;
674  }
675  else
676  {
677  // Queue up the next event
679  break;
680  }
681  }
682 
683  }
685  break;
686  }
687  else
688  {
689  // 90% of arable farmers will do straw chopping, but rest will do hay bailing instead
690  if (m_ev->m_lock || m_farm->DoIt(90))
691  {
692  if (m_field->GetMConstants(0) == 0) {
693  if (!m_farm->StrawChopping(m_field, 0.0, -1)) { // raise an error
694  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'StrawChopping' execution", "");
695  exit(1);
696  }
697  }
698  else {
699  if (!m_farm->StrawChopping(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
701  break;
702  }
703  else
704  {
705  // Queue up the next event
707  break;
708  }
709  }
710 
711  }
713  break;
714  }
715  case pl_sb_hay_bailing:
716  if (m_field->GetMConstants(1) == 0) {
717  if (!m_farm->HayBailing(m_field, 0.0, -1)) { // raise an error
718  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'HayBailing' execution", "");
719  exit(1);
720  }
721  }
722  else {
723  if (!m_farm->HayBailing(m_field, 0.0, m_field->GetMDates(1, 1) - g_date->DayInYear())) {
725  break;
726  }
727  }
728  if (m_farm->IsStockFarmer()) //Stock Farmer
729  {
731  }
733  break;
734  case pl_sb_ferti_p9:
735  if (m_ev->m_lock || m_farm->DoIt(18))
736  {
737  if (m_field->GetMConstants(2) == 0) {
738  if (!m_farm->FP_RSM(m_field, 0.0, -1)) { // raise an error
739  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'FP_RSM' execution", "");
740  exit(1);
741  }
742  }
743  else {
744  if (!m_farm->FP_RSM(m_field, 0.0, m_field->GetMDates(1, 2) - g_date->DayInYear())) {
746  break;
747  }
748  }
749  }
750  if (m_farm->IsStockFarmer()) //Stock Farmer
751  {
753  }
755  break;
756  case pl_sb_ferti_s9:
757  if (m_ev->m_lock || m_farm->DoIt(18))
758  {
759  if (m_field->GetMConstants(2) == 0) {
760  if (!m_farm->FA_RSM(m_field, 0.0, -1)) { // raise an error
761  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'FA_RSM' execution", "");
762  exit(1);
763  }
764  }
765  else {
766  if (!m_farm->FA_RSM(m_field, 0.0, m_field->GetMDates(1, 2) - g_date->DayInYear())) {
768  break;
769  }
770  }
771  }
772  if (m_farm->IsStockFarmer()) //Stock Farmer
773  {
775  }
777  break;
778  case pl_sb_ferti_p10:
779  if (m_ev->m_lock || m_farm->DoIt(23))
780  {
781  if (m_field->GetMConstants(3) == 0) {
782  if (!m_farm->FP_Calcium(m_field, 0.0, -1)) { // raise an error
783  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'FP_Calcium' execution", "");
784  exit(1);
785  }
786  }
787  else {
788  if (!m_farm->FP_Calcium(m_field, 0.0, m_field->GetMDates(1, 3) - g_date->DayInYear())) {
790  break;
791  }
792  }
793  }
794  done = true;
795  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
796  // END of MAIN THREAD
797  break;
798  case pl_sb_ferti_s10:
799  if (m_ev->m_lock || m_farm->DoIt(23))
800  {
801  if (m_field->GetMConstants(3) == 0) {
802  if (!m_farm->FA_Calcium(m_field, 0.0, -1)) { // raise an error
803  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): failure in 'FA_Calcium' execution", "");
804  exit(1);
805  }
806  }
807  else {
808  if (!m_farm->FA_Calcium(m_field, 0.0, m_field->GetMDates(1, 3) - g_date->DayInYear())) {
810  break;
811  }
812  }
813  }
814  done = true;
815  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
816  // END of MAIN THREAD
817  break;
818  default:
819  g_msg->Warn(WARN_BUG, "PLSpringBarley::Do(): "
820  "Unknown event type! ", "");
821  exit(1);
822  }
823  return done;
824 }

References Farm::AutumnHarrow(), cfg_pest_product_amounts, cfg_pest_springbarley_on, cfg_seedcoating_product_amounts, cfg_seedcoating_springbarley_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FA_NPKS(), Farm::FA_RSM(), Farm::FA_Slurry(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_NPKS(), Farm::FP_RSM(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetGreenBiomass(), LE::GetMConstants(), LE::GetMDates(), LE::GetOwner(), LE::GetPoly(), Farm::GetPreviousTov(), LE::GetRotIndex(), Farm::GetType(), Calendar::GetYearNumber(), Farm::Harvest(), Farm::HayBailing(), Farm::HeavyCultivatorAggregate(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), pl_sb_autumn_harrow1, pl_sb_autumn_harrow2, PL_SB_DECIDE_TO_GR, PL_SB_FERTI_P1, pl_sb_ferti_p1, pl_sb_ferti_p10, pl_sb_ferti_p2, pl_sb_ferti_p3, PL_SB_FERTI_P4, pl_sb_ferti_p4, pl_sb_ferti_p5, pl_sb_ferti_p6, pl_sb_ferti_p7, pl_sb_ferti_p8, pl_sb_ferti_p9, PL_SB_FERTI_S1, pl_sb_ferti_s1, pl_sb_ferti_s10, pl_sb_ferti_s2, pl_sb_ferti_s3, PL_SB_FERTI_S4, pl_sb_ferti_s4, pl_sb_ferti_s5, pl_sb_ferti_s6, pl_sb_ferti_s7, pl_sb_ferti_s8, pl_sb_ferti_s9, pl_sb_fungicide1, pl_sb_fungicide2, pl_sb_fungicide3, pl_sb_harvest, pl_sb_hay_bailing, pl_sb_heavy_cultivator, pl_sb_herbicide1, pl_sb_insecticide1, pl_sb_insecticide2, pl_sb_preseeding_cultivator, pl_sb_preseeding_cultivator_sow, PL_SB_SPRING_FERTI, pl_sb_spring_harrow, pl_sb_spring_sow, pl_sb_start, pl_sb_straw_chopping, pl_sb_stubble_harrow, PL_SB_STUBBLE_PLOUGH, pl_sb_stubble_plough, pl_sb_winter_plough, ppp_1, Farm::PreseedingCultivator(), Farm::PreseedingCultivatorSow(), Farm::ProductApplication(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent_(), Farm::SpringHarrow(), Farm::SpringSow(), Farm::StrawChopping(), Farm::StubbleHarrowing(), Farm::StubblePlough(), tof_OptimisingFarm, tov_PLSpringBarley, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::WinterPlough().

◆ SetUpFarmCategoryInformation()

void PLSpringBarley::SetUpFarmCategoryInformation ( )
inline
107  {
108  const int elements = 2 + (pl_sb_foobar - PLSPRINGBARLEY_BASE);
110 
111  FarmManagementCategory catlist[elements] =
112  {
113  fmc_Others, // zero element unused but must be here
114  fmc_Others,//pl_sb_start = 1, // Compulsory, must always be 1 (one).
115  fmc_Others,//pl_sb_sleep_all_day = PLSPRINGBARLEY_BASE,
116  fmc_Fertilizer,//pl_sb_ferti_p1, // 20601
117  fmc_Fertilizer,//pl_sb_ferti_s1,
118  fmc_Cultivation,//pl_sb_stubble_plough,
119  fmc_Cultivation,//pl_sb_autumn_harrow1,
120  fmc_Cultivation,//pl_sb_autumn_harrow2,
121  fmc_Cultivation,//pl_sb_stubble_harrow,
122  fmc_Fertilizer,//pl_sb_ferti_p2,
123  fmc_Fertilizer,//pl_sb_ferti_s2,
124  fmc_Fertilizer,//pl_sb_ferti_p3,
125  fmc_Fertilizer,//pl_sb_ferti_s3, // 20610
126  fmc_Cultivation,//pl_sb_winter_plough,
127  fmc_Fertilizer,//pl_sb_ferti_p4,
128  fmc_Fertilizer,//pl_sb_ferti_s4,
129  fmc_Cultivation,//pl_sb_spring_harrow,
130  fmc_Fertilizer,//pl_sb_ferti_p5,
131  fmc_Fertilizer,//pl_sb_ferti_s5,
132  fmc_Cultivation,//pl_sb_heavy_cultivator,
133  fmc_Cultivation,//pl_sb_preseeding_cultivator,
134  fmc_Cultivation,//pl_sb_preseeding_cultivator_sow, // 20620
135  fmc_Others,//pl_sb_spring_sow,
136  fmc_Herbicide,//pl_sb_herbicide1,
137  fmc_Fungicide,//pl_sb_fungicide1,
138  fmc_Fungicide,//pl_sb_fungicide2,
139  fmc_Fungicide,//pl_sb_fungicide3,
140  fmc_Insecticide,//pl_sb_insecticide1,
141  fmc_Insecticide,//pl_sb_insecticide2,
142  fmc_Fertilizer,//pl_sb_ferti_p6,
143  fmc_Fertilizer,//pl_sb_ferti_s6,
144  fmc_Fertilizer,//pl_sb_ferti_p7, // 20630
145  fmc_Fertilizer,//pl_sb_ferti_s7,
146  fmc_Fertilizer,//pl_sb_ferti_p8,
147  fmc_Fertilizer,//pl_sb_ferti_s8,
148  fmc_Harvest,//pl_sb_harvest,
149  fmc_Others,//pl_sb_straw_chopping,
150  fmc_Others,//pl_sb_hay_bailing,
151  fmc_Fertilizer,//pl_sb_ferti_p9,
152  fmc_Fertilizer,//pl_sb_ferti_s9,
153  fmc_Fertilizer,//pl_sb_ferti_p10,
154  fmc_Fertilizer//pl_sb_ferti_s10, // 20640
155  };
156  // Iterate over the catlist elements and copy them to vector
157  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
158 
159  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, Crop::m_ManagementCategories, pl_sb_foobar, and PLSPRINGBARLEY_BASE.

Referenced by PLSpringBarley().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
cfg_seedcoating_product_amounts
CfgArray_Double cfg_seedcoating_product_amounts
Amount of seed coating pesticide applied in grams of active substance per hectare for each of the 10 ...
PL_SB_STUBBLE_PLOUGH
#define PL_SB_STUBBLE_PLOUGH
Definition: PLSpringBarley.h:30
pl_sb_ferti_s5
Definition: PLSpringBarley.h:59
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
pl_sb_ferti_p10
Definition: PLSpringBarley.h:81
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: FarmFuncs.cpp:312
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
pl_sb_winter_plough
Definition: PLSpringBarley.h:54
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
PL_SB_DECIDE_TO_GR
#define PL_SB_DECIDE_TO_GR
Definition: PLSpringBarley.h:34
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
pl_sb_ferti_p1
Definition: PLSpringBarley.h:44
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
pl_sb_spring_harrow
Definition: PLSpringBarley.h:57
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
cfg_seedcoating_springbarley_on
CfgBool cfg_seedcoating_springbarley_on
Turn on seed coating for spring barley.
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
pl_sb_foobar
Definition: PLSpringBarley.h:83
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.
pl_sb_harvest
Definition: PLSpringBarley.h:76
pl_sb_preseeding_cultivator
Definition: PLSpringBarley.h:61
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
pl_sb_ferti_s8
Definition: PLSpringBarley.h:75
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
pl_sb_ferti_p9
Definition: PLSpringBarley.h:79
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_sb_preseeding_cultivator_sow
Definition: PLSpringBarley.h:62
pl_sb_ferti_p6
Definition: PLSpringBarley.h:70
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
pl_sb_ferti_p7
Definition: PLSpringBarley.h:72
pl_sb_autumn_harrow1
Definition: PLSpringBarley.h:47
CfgBool::value
bool value() const
Definition: Configurator.h:164
pl_sb_ferti_s3
Definition: PLSpringBarley.h:53
tov_PLSpringBarley
Definition: LandscapeFarmingEnums.h:238
pl_sb_fungicide2
Definition: PLSpringBarley.h:66
pl_sb_ferti_s1
Definition: PLSpringBarley.h:45
Farm::FA_RSM
virtual bool FA_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1154
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
pl_sb_start
Definition: PLSpringBarley.h:42
Calendar::Date
long Date(void)
Definition: Calendar.h:57
pl_sb_ferti_p8
Definition: PLSpringBarley.h:74
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
pl_sb_herbicide1
Definition: PLSpringBarley.h:64
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
cfg_pest_springbarley_on
CfgBool cfg_pest_springbarley_on
Turn on pesticides for spring barley.
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
pl_sb_ferti_p3
Definition: PLSpringBarley.h:52
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
pl_sb_spring_sow
Definition: PLSpringBarley.h:63
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
pl_sb_ferti_p2
Definition: PLSpringBarley.h:50
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
pl_sb_stubble_harrow
Definition: PLSpringBarley.h:49
PLSpringBarley::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLSpringBarley.h:107
pl_sb_insecticide2
Definition: PLSpringBarley.h:69
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
pl_sb_stubble_plough
Definition: PLSpringBarley.h:46
PL_SB_FERTI_P1
#define PL_SB_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: PLSpringBarley.h:28
PL_SB_FERTI_S4
#define PL_SB_FERTI_S4
Definition: PLSpringBarley.h:32
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
pl_sb_fungicide3
Definition: PLSpringBarley.h:67
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
pl_sb_ferti_s2
Definition: PLSpringBarley.h:51
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
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
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
pl_sb_autumn_harrow2
Definition: PLSpringBarley.h:48
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
pl_sb_ferti_s7
Definition: PLSpringBarley.h:73
PL_SB_FERTI_P4
#define PL_SB_FERTI_P4
Definition: PLSpringBarley.h:31
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
Farm::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
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
Farm::FP_RSM
virtual bool FP_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:940
pl_sb_insecticide1
Definition: PLSpringBarley.h:68
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::WinterPlough
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
Definition: FarmFuncs.cpp:395
PLSPRINGBARLEY_BASE
#define PLSPRINGBARLEY_BASE
Definition: PLSpringBarley.h:24
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
pl_sb_fungicide1
Definition: PLSpringBarley.h:65
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pl_sb_ferti_s6
Definition: PLSpringBarley.h:71
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
pl_sb_heavy_cultivator
Definition: PLSpringBarley.h:60
pl_sb_ferti_s4
Definition: PLSpringBarley.h:56
pl_sb_ferti_p5
Definition: PLSpringBarley.h:58
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
pl_sb_hay_bailing
Definition: PLSpringBarley.h:78
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
pl_sb_ferti_p4
Definition: PLSpringBarley.h:55
pl_sb_straw_chopping
Definition: PLSpringBarley.h:77
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
Farm::HeavyCultivatorAggregate
virtual bool HeavyCultivatorAggregate(LE *a_field, double a_user, int a_days)
Carry out a heavy cultivation event on a_field. This is non-inversion type of cultivation which can b...
Definition: FarmFuncs.cpp:259
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
pl_sb_ferti_s10
Definition: PLSpringBarley.h:82
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
PL_SB_FERTI_S1
#define PL_SB_FERTI_S1
Definition: PLSpringBarley.h:29
pl_sb_ferti_s9
Definition: PLSpringBarley.h:80
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
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:630
Crop::SimpleEvent_
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.
Definition: Farm.cpp:751
PL_SB_SPRING_FERTI
#define PL_SB_SPRING_FERTI
Definition: PLSpringBarley.h:33