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

DK_SeedGrassFescue_Spring class
. More...

#include <DK_SeedGrassFescue_Spring.h>

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

DK_SeedGrassFescue_Spring class
.

See DK_SeedGrassFescue_Spring.h::DK_SeedGrassFescue_SpringToDo for a complete list of all possible events triggered codes by the DK_SetAside 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

◆ DK_SeedGrassFescue_Spring()

DK_SeedGrassFescue_Spring::DK_SeedGrassFescue_Spring ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
120  : Crop(a_tov, a_toc, a_L)
121  {
122  // When we start it off, the first possible date for a farm operation
123  // This information is used by other crops when they decide how much post processing of
124  // the management is allowed after harvest before the next crop starts.
125  m_first_date = g_date->DayInYear(30, 11);
127  }

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

Member Function Documentation

◆ Do()

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

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  m_ev = a_ev;
103  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
104  int d1 = 0;
106  // Depending what event has occured jump to the correct bit of code e.g. for ww_start jump to line 67 below
107  switch (a_ev->m_todo)
108  {
109  case dk_sgf_start:
110  {
112  DK_SGF_FORCESPRING = false;
113  a_field->ClearManagementActionSum();
114  m_last_date = g_date->DayInYear(31, 10); // Should match the last flexdate below // changed from 31/10
115  //Create a 2d array of 1 plus the number of operations you use. Change only 4+1 to what you need in the line below
116  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
117  // Set up the date management stuff
118  // Start and stop dates for all events after harvest
119  flexdates[0][1] = g_date->DayInYear(15, 9); // last possible day of grazing in this case // changed from
120  // Now these are done in pairs, start & end for each operation. If its not used then -1
121  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
122  flexdates[1][1] = g_date->DayInYear(15, 9); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) - cutting // changed from 7/1015
123 
124  // Below if this is a spring crop use 365, otherwise first parameter is always 0, second parameter is fixed, and the third is the start up operation in the first year
125  int isSpring = 0;
126  if (StartUpCrop(isSpring, flexdates, int(dk_sgf_spring_plough))) break;
127  // Here we queue up the first event which changes dependent on whether it is a forced spring sow or not
128  if (m_ev->m_forcespring) {
129  if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 0)
130  {
131  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
132  if (g_date->Date() >= d1) d1 += 365;
133  SimpleEvent(d1, dk_sgf_ferti_s2, false);
134  }
135  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 1)
136  {
137  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
138  if (g_date->Date() >= d1) d1 += 365;
139  SimpleEvent(d1, dk_sgf_ferti_s2, false);
140  }
141  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 2)
142  {
143  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
144  if (g_date->Date() >= d1) d1 += 365;
145  SimpleEvent(d1, dk_sgf_ferti_s_y3, false);
146  }
147  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 3)
148  {
149  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
150  if (g_date->Date() >= d1) d1 += 365;
151  SimpleEvent(d1, dk_sgf_spring_plough, false);
152  }
153  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 4)
154  {
155  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
156  if (g_date->Date() >= d1) d1 += 365;
157  SimpleEvent(d1, dk_sgf_spring_plough, false);
158  }
159  DK_SGF_FORCESPRING = true;
160  break;
161  }
162  else// End single block date checking code. Please see next line comment as well.
163  // Reinit d1 to first possible starting date.
164  if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 0)
165  {
166  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
167  if (g_date->Date() >= d1) d1 += 365;
168  SimpleEvent(d1, dk_sgf_ferti_s2, false);
169  }
170  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 1)
171  {
172  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
173  if (g_date->Date() >= d1) d1 += 365;
174  SimpleEvent(d1, dk_sgf_ferti_s2, false);
175  }
176  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 2)
177  {
178  d1 = g_date->OldDays() + g_date->DayInYear(1, 3);
179  if (g_date->Date() >= d1) d1 += 365;
180  SimpleEvent(d1, dk_sgf_ferti_s_y3, false);
181  }
182  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 3)
183  {
184  d1 = g_date->OldDays() + g_date->DayInYear(1, 10);
185  SimpleEvent(d1, dk_sgf_autumn_plough, false);
186  }
187  else if ((DK_SGF_EVERY_3RD_YEAR + g_date->GetYearNumber()) % 4 == 4)
188  {
189  d1 = g_date->OldDays() + g_date->DayInYear(1, 10);
190  SimpleEvent(d1, dk_sgf_autumn_plough, false);
191  }
192  break;
193 
194  }
195  break;
196  // LKM: This is the first real farm operation
197 
199  if (m_field->GetSoilType() != tos_Sand && m_field->GetSoilType() != tos_LoamySand && m_field->GetSoilType() != tos_SandyLoam && m_field->GetSoilType() != tos_SandyClayLoam) // on clay soils (NL KLEI & VEEN)
200 
201  {
202  if (a_ev->m_lock || a_farm->DoIt_prob(0.95)) {
203  if (!a_farm->AutumnPlough(a_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
205  break;
206  }
207  }
208  }
209  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, dk_sgf_spring_plough, false);
210  break;
211 
213  if (!a_farm->SpringPlough(a_field, 0.0, g_date->DayInYear(29, 4) - g_date->DayInYear())) {
215  break;
216  }
217  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_sgf_sow, false);
218  break;
219 
220  case dk_sgf_sow:
221  if (!a_farm->SpringSow(a_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
222  SimpleEvent(g_date->Date() + 1, dk_sgf_sow, true);
223  break;
224  }
225  SimpleEvent(g_date->Date()+7 , dk_sgf_herbicide1, false);
226  break;
227 
228  case dk_sgf_herbicide1:
229  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(22, 4) - g_date->DayInYear())) {
230  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide1, true);
231  break;
232  }
233  SimpleEvent(g_date->Date() + 7, dk_sgf_herbicide2, false);
234  break;
235 
236  case dk_sgf_herbicide2:
237  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
238  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide2, true);
239  break;
240  }
242  break;
243 
244  case dk_sgf_harvest: // harvest of cover crop
245  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
246  if (!a_farm->Harvest(a_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
247  SimpleEvent(g_date->Date() + 1, dk_sgf_harvest, true);
248  break;
249  }
250  }
251  SimpleEvent(g_date->Date() + 1, dk_sgf_remove_straw1, false);
252  break;
253 
255  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
256  if (!a_farm->StrawRemoval(a_field, 0.0, g_date->DayInYear(5, 9) - g_date->DayInYear())) { // changed from 30/9
258  break;
259  }
260  }
262  break;
263 
264  case dk_sgf_ferti_s1:
265  if (a_farm->IsStockFarmer()) {
266  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
267  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(10, 9) - g_date->DayInYear())) { // changed from 30/10
268  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_s1, true);
269  break;
270  }
271  }
272  SimpleEvent(g_date->Date()+1, dk_sgf_herbicide3, false);
273  break;
274  }
275  else {
277  break;
278  }
279 
280  case dk_sgf_ferti_p1:
281  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
282  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(10, 9) - g_date->DayInYear())) { // changed from 30/10
283  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_p1, true);
284  break;
285  }
286  }
287  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide3, false);
288  break;
289 
290  case dk_sgf_herbicide3:
291  if (a_ev->m_lock || a_farm->DoIt_prob(0.15)) {
292  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(11, 9) - g_date->DayInYear())) { // changed from 31/10
293  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide3, true);
294  break;
295  }
296  }
297  // End of management
298  done = true;
299  break;
300 
301  // year 1+2 after establishment year:
302 
303  case dk_sgf_ferti_s2:
304  if (a_farm->IsStockFarmer()) {
305  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
306  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_s2, true);
307  break;
308  }//here comes a fork of parallel events:
309  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_sgf_herbicide4, false); // herbi thread
310  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_sgf_growth_reg, false); // GR thread - main thread
311  break;
312  }
313  else {
315  break;
316  }
317 
318  case dk_sgf_ferti_p2:
319  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
320  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_p2, true);
321  break;
322  }
323  //here comes a fork of parallel events:
324  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_sgf_herbicide4, false); // herbi thread - may need revision (random or specific farmers doing 1 or more herbi sprays here ?)
325  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_sgf_growth_reg, false); // GR thread - main thread
326  break;
327 
328  case dk_sgf_herbicide4:
329  if (a_ev->m_lock || a_farm->DoIt_prob(0.30)) { // Hussar Plus + Renol (annual meadow grass)
330  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
331  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide4, true);
332  break;
333  }
334  }
335  SimpleEvent(g_date->Date()+7, dk_sgf_herbicide5, false);
336  break;
337 
338  case dk_sgf_herbicide5:
339  if (a_ev->m_lock || a_farm->DoIt_prob(0.40)) { // Zypar (Other dicot weeds)
340  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(22, 5) - g_date->DayInYear())) {
341  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide5, true);
342  break;
343  }
344  }
345  SimpleEvent(g_date->Date() + 7, dk_sgf_herbicide6, false);
346  break;
347 
348  case dk_sgf_herbicide6:
349  if (a_ev->m_lock || a_farm->DoIt_prob(0.50)) { // Agil (waste seeds and couch grass)
350  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
351  SimpleEvent(g_date->Date() + 1, dk_sgf_herbicide6, true);
352  break;
353  }
354  }
355  break; // end of thread
356 
357  case dk_sgf_growth_reg:
358  if (a_ev->m_lock || a_farm->DoIt_prob(0.95)) {
359  if (!a_farm->GrowthRegulator(a_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
360  SimpleEvent(g_date->Date() + 1, dk_sgf_growth_reg, true);
361  break;
362  }
363  }
365  break;
366 
367  case dk_sgf_swathing:
368  if (a_ev->m_lock || a_farm->DoIt_prob(0.05)) {
369  if (!a_farm->Swathing(a_field, 0.0, g_date->DayInYear(23, 7) - g_date->DayInYear())) {
370  SimpleEvent(g_date->Date() + 1, dk_sgf_swathing, true);
371  break;
372  }
373  SimpleEvent(g_date->Date() + 6, dk_sgf_seed_harvest, false);
374  break;
375  }
377  break;
378 
379  case dk_sgf_seed_harvest:
380  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
381  if (!a_farm->Harvest(a_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
383  break;
384  }
385  }
387  break;
388 
390  if (a_ev->m_lock || a_farm->DoIt_prob(0.2)) {
391  if (!a_farm->StrawChopping(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
393  break;
394  }
396  break;
397  }
398  else if (a_ev->m_lock || a_farm->DoIt_prob(0.8 / 0.8)) {
400  break;
401  }
402 
403  case dk_sgf_burn_straw:
404  if (!a_farm->BurnStrawStubble(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
405  SimpleEvent(g_date->Date() + 1, dk_sgf_burn_straw, true);
406  break;
407  }
408  SimpleEvent(g_date->Date() + 14, dk_sgf_cutting1, false);
409  break;
410 
411  case dk_sgf_remove_straw2:
412  if (!a_farm->StrawRemoval(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
414  break;
415  }
416  SimpleEvent(g_date->Date() + 14, dk_sgf_cutting1, false);
417  break;
418 
419  case dk_sgf_cutting1:
420  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
421  if (!a_farm->CutToHay(a_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
422  SimpleEvent(g_date->Date() + 1, dk_sgf_cutting1, true);
423  break;
424  }
425 
426  }
427  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_s3, false);
428  break;
429 
430  case dk_sgf_ferti_s3:
431  if (a_farm->IsStockFarmer()) {
432  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(16, 9) - g_date->DayInYear())) { // changed from 5/11
433  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_s3, true);
434  break;
435  }
436  // End of management
437  done = true;
438  break;
439  }
440  else {
442  break;
443  }
444 
445  case dk_sgf_ferti_p3:
446  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(16, 9) - g_date->DayInYear())) {
447  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_p3, true);
448  break;
449  }
450  // End of management
451  done = true;
452  break;
453 
454  //third year:
455 
456  case dk_sgf_ferti_s_y3:
457  if (a_farm->IsStockFarmer()) {
458  if (!a_farm->FA_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
459  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_s_y3, true);
460  break;
461  }
462  //here comes a fork of parallel events:
463  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_sgf_herbicide1_y3, false); // herbi thread
464  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_sgf_growth_reg_y3, false); // GR thread - main thread
465  break;
466  }
467  else {
469  break;
470  }
471 
472  case dk_sgf_ferti_p_y3:
473  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
474  SimpleEvent(g_date->Date() + 1, dk_sgf_ferti_p_y3, true);
475  break;
476  }
477  //here comes a fork of parallel events:
478  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_sgf_herbicide1_y3, false); // herbi thread
479  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_sgf_growth_reg_y3, false); // GR thread - main thread
480  break;
481 
483  if (a_ev->m_lock || a_farm->DoIt_prob(0.30)) { // Hussar Plus + Renol (annual meadow grass)
484  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
486  break;
487  }
488  }
490  break;
491 
493  if (a_ev->m_lock || a_farm->DoIt_prob(0.40)) { // Zypar (Other dicot weeds)
494  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(22, 5) - g_date->DayInYear())) {
496  break;
497  }
498  }
500  break;
501 
503  if (a_ev->m_lock || a_farm->DoIt_prob(0.50)) { // Agil (waste seeds and couch grass)
504  if (!a_farm->HerbicideTreat(a_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
506  break;
507  }
508  }
509  break; // end of thread
510 
512  if (!a_farm->GrowthRegulator(a_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
514  break;
515  }
517  break;
518 
519  case dk_sgf_swathing_y3:
520  if (a_ev->m_lock || a_farm->DoIt_prob(0.05)) {
521  if (!a_farm->Swathing(a_field, 0.0, g_date->DayInYear(23, 7) - g_date->DayInYear())) {
522  SimpleEvent(g_date->Date() + 1, dk_sgf_swathing_y3, true);
523  break;
524  }
526  break;
527  }
529  break;
530 
532  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
533  if (!a_farm->Harvest(a_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
535  break;
536  }
537  }
539  break;
540 
542  if (a_ev->m_lock || a_farm->DoIt_prob(0.2)) {
543  if (!a_farm->StrawChopping(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
545  break;
546  }
548  break;
549  }
550  else if (a_ev->m_lock || a_farm->DoIt_prob(0.8 / 0.8)) {
552  break;
553  }
554 
555  case dk_sgf_burn_straw_y3:
556  if (!a_farm->BurnStrawStubble(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
558  break;
559  }
560  SimpleEvent(g_date->Date() + 14, dk_sgf_cutting1_y3, false);
561  break;
562 
564  if (!a_farm->StrawRemoval(a_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
566  break;
567  }
568  SimpleEvent(g_date->Date() + 14, dk_sgf_cutting1_y3, false);
569  break;
570 
571  case dk_sgf_cutting1_y3:
572  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
573  if (!a_farm->CutToHay(a_field, 0.0, g_date->DayInYear(15, 8) - g_date->DayInYear())) {
574  SimpleEvent(g_date->Date() + 1, dk_sgf_cutting1_y3, true);
575  break;
576  }
577 
578  }
579  // End of management
580  done = true;
581  break;
582 
583  // So we are done, and somewhere else the farmer will queue up the start event of the next crop
584  // END OF MAIN THREAD
585  default:
586  g_msg->Warn(WARN_BUG, "DK_SeedGrassFescue_Spring::Do(): "
587  "Unknown event type! ", "");
588  exit(1);
589  }
590  return done;
591 }

References Farm::AutumnPlough(), Farm::BurnStrawStubble(), LE::ClearManagementActionSum(), Farm::CutToHay(), Calendar::Date(), Calendar::DayInYear(), dk_sgf_autumn_plough, dk_sgf_burn_straw, dk_sgf_burn_straw_y3, dk_sgf_cutting1, dk_sgf_cutting1_y3, DK_SGF_EVERY_3RD_YEAR, dk_sgf_ferti_p1, dk_sgf_ferti_p2, dk_sgf_ferti_p3, dk_sgf_ferti_p_y3, dk_sgf_ferti_s1, dk_sgf_ferti_s2, dk_sgf_ferti_s3, dk_sgf_ferti_s_y3, DK_SGF_FORCESPRING, dk_sgf_growth_reg, dk_sgf_growth_reg_y3, dk_sgf_harvest, dk_sgf_herbicide1, dk_sgf_herbicide1_y3, dk_sgf_herbicide2, dk_sgf_herbicide2_y3, dk_sgf_herbicide3, dk_sgf_herbicide3_y3, dk_sgf_herbicide4, dk_sgf_herbicide5, dk_sgf_herbicide6, dk_sgf_remove_straw1, dk_sgf_remove_straw2, dk_sgf_remove_straw2_y3, dk_sgf_seed_harvest, dk_sgf_seed_harvest_y3, dk_sgf_sow, dk_sgf_spring_plough, dk_sgf_start, dk_sgf_straw_chopping, dk_sgf_straw_chopping_y3, dk_sgf_swathing, dk_sgf_swathing_y3, Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_NPK(), Farm::FP_AmmoniumSulphate(), Farm::FP_NPK(), g_date, g_msg, LE::GetSoilType(), Calendar::GetYearNumber(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, FarmEvent::m_forcespring, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Calendar::OldDays(), Crop::SimpleEvent(), Farm::SpringPlough(), Farm::SpringSow(), Crop::StartUpCrop(), Farm::StrawChopping(), Farm::StrawRemoval(), Farm::Swathing(), tos_LoamySand, tos_Sand, tos_SandyClayLoam, tos_SandyLoam, tov_DKSeedGrassFescue_Spring, MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DK_SeedGrassFescue_Spring::SetUpFarmCategoryInformation ( )
inline
128  {
129  const int elements = 2 + (dk_sgf_foobar - DK_SGF_BASE);
131 
132  FarmManagementCategory catlist[elements] =
133  {
134  fmc_Others, // zero element unused but must be here
135  fmc_Others, // dk_sgf_start = 1, // Compulsory, must always be 1 (one).
136  fmc_Cultivation, // dk_sfg_autumn_plough = DK_SGF_BASE
137  fmc_Cultivation, // dk_sfg_spring_plough
138  fmc_Others, // dk_sgf_sow
139  fmc_Herbicide, // dk_sgf_herbicide1,
140  fmc_Herbicide, // dk_sgf_herbicide2,
141  fmc_Harvest, // dk_sgf_harvest,
142  fmc_Others, // dk_sgf_remove_straw1
143  fmc_Fertilizer, // dk_sgf_ferti_s1,
144  fmc_Fertilizer, // dk_sgf_ferti_p1,
145  fmc_Herbicide, // dk_sgf_herbicide3,
146  fmc_Fertilizer, // dk_sgf_ferti_s2,
147  fmc_Fertilizer, // dk_sgf_ferti_p2,
148  fmc_Herbicide, // dk_sgf_herbicide4,
149  fmc_Herbicide, // dk_sgf_herbicide5,
150  fmc_Herbicide, // dk_sgf_herbicide6,
151  fmc_Others, // dk_sgf_growth_reg,
152  fmc_Cutting, // dk_sgf_swathing,
153  fmc_Harvest, // dk_sgf_seed_harvest,
154  fmc_Cutting, // dk_sgf_straw_chopping,
155  fmc_Others, // dk_sgf_burn_straw
156  fmc_Others, // dk_sgf_remove_straw2
157  fmc_Cutting, // dk_sgf_cutting1,
158  fmc_Fertilizer, // dk_sgf_ferti_s3,
159  fmc_Fertilizer, // dk_sgf_ferti_p3,
160  fmc_Fertilizer, // dk_sgf_ferti_s_y3,
161  fmc_Fertilizer, // dk_sgf_ferti_p_y3,
162  fmc_Herbicide, // dk_sgf_herbicide1_y3,
163  fmc_Herbicide, // dk_sgf_herbicide2_y3,
164  fmc_Herbicide, // dk_sgf_herbicide3_y3,
165  fmc_Others, // dk_sgf_growth_reg_y3,
166  fmc_Cutting, // dk_sgf_swathing_y3,
167  fmc_Harvest, // dk_sgf_seed_harvest_y3,
168  fmc_Cutting, // dk_sgf_straw_chopping_y3,
169  fmc_Others, // dk_sgf_burn_straw_y3,
170  fmc_Others, // dk_sgf_remove_straw2_y3,
171  fmc_Cutting, // dk_sgf_cutting1_y3,
172 
173  // no foobar entry
174 
175  };
176  // Iterate over the catlist elements and copy them to vector
177  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
178 
179  }

References DK_SGF_BASE, dk_sgf_foobar, fmc_Cultivation, fmc_Cutting, fmc_Fertilizer, fmc_Harvest, fmc_Herbicide, fmc_Others, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DK_SeedGrassFescue_Spring().


The documentation for this class was generated from the following files:
dk_sgf_herbicide4
Definition: DK_SeedGrassFescue_Spring.h:80
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
dk_sgf_sow
Definition: DK_SeedGrassFescue_Spring.h:70
dk_sgf_herbicide1
Definition: DK_SeedGrassFescue_Spring.h:71
dk_sgf_herbicide5
Definition: DK_SeedGrassFescue_Spring.h:81
dk_sgf_swathing
Definition: DK_SeedGrassFescue_Spring.h:84
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
dk_sgf_cutting1_y3
Definition: DK_SeedGrassFescue_Spring.h:103
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
dk_sgf_start
Definition: DK_SeedGrassFescue_Spring.h:67
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
dk_sgf_seed_harvest
Definition: DK_SeedGrassFescue_Spring.h:85
dk_sgf_ferti_p2
Definition: DK_SeedGrassFescue_Spring.h:79
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
dk_sgf_foobar
Definition: DK_SeedGrassFescue_Spring.h:104
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
Farm::StrawRemoval
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1752
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
dk_sgf_burn_straw
Definition: DK_SeedGrassFescue_Spring.h:87
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
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
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_sgf_ferti_s_y3
Definition: DK_SeedGrassFescue_Spring.h:92
dk_sgf_autumn_plough
Definition: DK_SeedGrassFescue_Spring.h:68
Farm::CutToHay
virtual bool CutToHay(LE *a_field, double a_user, int a_days)
Carry out hay cutting on a_field.
Definition: FarmFuncs.cpp:1607
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
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
dk_sgf_growth_reg_y3
Definition: DK_SeedGrassFescue_Spring.h:97
dk_sgf_ferti_p1
Definition: DK_SeedGrassFescue_Spring.h:76
DK_SGF_BASE
#define DK_SGF_BASE
Definition: DK_SeedGrassFescue_Spring.h:56
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
dk_sgf_herbicide2
Definition: DK_SeedGrassFescue_Spring.h:72
dk_sgf_ferti_p_y3
Definition: DK_SeedGrassFescue_Spring.h:93
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
dk_sgf_harvest
Definition: DK_SeedGrassFescue_Spring.h:73
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_sgf_remove_straw1
Definition: DK_SeedGrassFescue_Spring.h:74
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
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
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
dk_sgf_herbicide3_y3
Definition: DK_SeedGrassFescue_Spring.h:96
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
dk_sgf_seed_harvest_y3
Definition: DK_SeedGrassFescue_Spring.h:99
DK_SeedGrassFescue_Spring::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_SeedGrassFescue_Spring.h:128
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Crop::StartUpCrop
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 a...
Definition: Farm.cpp:652
dk_sgf_ferti_p3
Definition: DK_SeedGrassFescue_Spring.h:91
dk_sgf_herbicide2_y3
Definition: DK_SeedGrassFescue_Spring.h:95
dk_sgf_ferti_s2
Definition: DK_SeedGrassFescue_Spring.h:78
dk_sgf_growth_reg
Definition: DK_SeedGrassFescue_Spring.h:83
dk_sgf_herbicide3
Definition: DK_SeedGrassFescue_Spring.h:77
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
dk_sgf_spring_plough
Definition: DK_SeedGrassFescue_Spring.h:69
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
tos_Sand
Definition: LandscapeFarmingEnums.h:719
dk_sgf_remove_straw2
Definition: DK_SeedGrassFescue_Spring.h:88
dk_sgf_swathing_y3
Definition: DK_SeedGrassFescue_Spring.h:98
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::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
dk_sgf_cutting1
Definition: DK_SeedGrassFescue_Spring.h:89
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
dk_sgf_straw_chopping_y3
Definition: DK_SeedGrassFescue_Spring.h:100
dk_sgf_ferti_s1
Definition: DK_SeedGrassFescue_Spring.h:75
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
tov_DKSeedGrassFescue_Spring
Definition: LandscapeFarmingEnums.h:407
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
DK_SGF_EVERY_3RD_YEAR
#define DK_SGF_EVERY_3RD_YEAR
Definition: DK_SeedGrassFescue_Spring.h:53
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
Farm::BurnStrawStubble
virtual bool BurnStrawStubble(LE *a_field, double a_user, int a_days)
Burn stubble on a_field.
Definition: FarmFuncs.cpp:1567
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: FarmFuncs.cpp:1350
dk_sgf_straw_chopping
Definition: DK_SeedGrassFescue_Spring.h:86
dk_sgf_remove_straw2_y3
Definition: DK_SeedGrassFescue_Spring.h:102
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_sgf_herbicide6
Definition: DK_SeedGrassFescue_Spring.h:82
dk_sgf_herbicide1_y3
Definition: DK_SeedGrassFescue_Spring.h:94
dk_sgf_burn_straw_y3
Definition: DK_SeedGrassFescue_Spring.h:101
WARN_BUG
Definition: MapErrorMsg.h:34
dk_sgf_ferti_s3
Definition: DK_SeedGrassFescue_Spring.h:90
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
DK_SGF_FORCESPRING
#define DK_SGF_FORCESPRING
Definition: DK_SeedGrassFescue_Spring.h:54