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

#include <DK_WinterRye_CC.h>

Inheritance diagram for DK_WinterRye_CC:
Crop

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 DK_WinterRye_CC (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
void SetUpFarmCategoryInformation ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
int GetFirstDate (void)
 
void ChooseNextCrop (int a_no_dates)
 Chooses the next crop to grow in a field. More...
 
int GetCropClassification ()
 
void SetCropClassification (int a_classification)
 
void GetCropType (TTypesOfCrops a_toc)
 
TTypesOfCrops GetCropType ()
 
FarmManagementCategory LookUpManagementCategory (int a_todo)
 
bool GetForceSpringOK ()
 

Additional Inherited Members

- Public Attributes inherited from Crop
TTypesOfVegetation m_tov
 
- Protected Member Functions inherited from Crop
void SimpleEvent (long a_date, int a_todo, bool a_lock)
 Adds an event to this crop management. More...
 
void SimpleEvent_ (long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
 Adds an event to this crop management without relying on member variables. More...
 
bool StartUpCrop (int a_spring, std::vector< std::vector< int >> a_flexdates, int a_todo)
 
Holds the translation between the farm operation enum for each cropand the farm management category associated with it More...
 
bool AphidDamage (LE *a_field)
 Compares aphid numbers per m2 with a threshold to return true if threshold is exceeded. More...
 
- Protected Attributes inherited from Crop
Farmm_farm
 
LEm_field
 
FarmEventm_ev
 
int m_first_date
 
int m_count
 
int m_last_date
 
int m_ddegstoharvest
 
int m_base_elements_no
 
Landscapem_OurLandscape
 
bool m_forcespringpossible = false
 Used to signal that the crop can be forced to start in spring. More...
 
TTypesOfCrops m_toc
 The Crop type in terms of the TTypesOfCrops list (smaller list than tov, no country designation) More...
 
int m_CropClassification
 Contains information on whether this is a winter crop, spring crop, or catch crop that straddles the year boundary (0,1,2) More...
 
vector< FarmManagementCategorym_ManagementCategories
 Holds the translation between the farm operation enum for each crop and the farm management category associated with it. More...
 
- Static Protected Attributes inherited from Crop
static int m_date_modifier = 0
 Holds a value that shifts test pesticide use by this many days in crops modified to use it. More...
 

Constructor & Destructor Documentation

◆ DK_WinterRye_CC()

DK_WinterRye_CC::DK_WinterRye_CC ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
79  : Crop(a_tov, a_toc, a_L)
80  {
81  m_first_date = g_date->DayInYear(20, 10);
83  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

42 {
43  m_farm = a_farm;
44  m_field = a_field;
45  m_ev = a_ev;
46  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true, m_farm, m_field).
47  bool flag = false;
48  int d1 = 0;
49  int noDates = 1;
51  int l_nextcropstartdate;
52 
53  switch (m_ev->m_todo)
54  {
55  case dk_wrcc_start:
56  {
57  a_field->ClearManagementActionSum();
58 
59  DK_WRCC_MN_S = false;
60  DK_WRCC_MN_P = false;
61  DK_WRCC_TILL_1 = false;
62  DK_WRCC_TILL_2 = false;
63 
64  a_field->ClearManagementActionSum();
65 
66  m_last_date = g_date->DayInYear(30, 8); // Should match the last flexdate below
67  //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
68  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
69  // Set up the date management stuff
70  // Start and stop dates for all events after harvest
71  flexdates[0][1] = g_date->DayInYear(30, 8); // last possible day of harvest
72  // Now these are done in pairs, start & end for each operation. If its not used then -1
73  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
74  flexdates[1][1] = g_date->DayInYear(30, 8); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) // harvest
75 
76  // 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
77  if (StartUpCrop(0, flexdates, int(dk_wrcc_wait))) break;
78 
79  // End single block date checking code. Please see next line comment as well.
80  // Reinit d1 to first possible starting date.
81  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
82  // OK, let's go.
84  }
85  break;
86 
87  // done if manye weeds, or waste plants from earlier catch crops
88 
90  if (m_ev->m_lock || m_farm->DoIt_prob(0.60)) {
91  if (!m_farm->StubbleHarrowing(m_field, 0.0,
92  g_date->DayInYear(15, 10) - g_date->DayInYear())) { // changed from 31/8 to 15/10 to fit maizesilage and clovergrassgrazed as prior crops
94  break;
95  }
96  DK_WRCC_TILL_1 = true; // we need to remember farmers doing stubble harrow
98  break;
99  } // 15% no cultivation
100  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.40)) {
102  break;
103  }
104  else SimpleEvent(g_date->Date(), dk_wrcc_remove_straw, false); // no till requires the previous crop have straw chopped (previous crop code), and then remove straw
105  break;
107  if (!m_farm->AutumnPlough(m_field, 0.0,
108  g_date->DayInYear(20, 10) - g_date->DayInYear())) {
110  break;
111  }
113  break;
114 
115  case dk_wrcc_autumn_roll:
116  if (!m_farm->AutumnRoll(m_field, 0.0,
117  g_date->DayInYear(20, 10) - g_date->DayInYear())) {
119  break;
120  }
121  SimpleEvent(g_date->Date() + 1, dk_wrcc_autumn_sow, false);
122  break;
123 
125  if (!m_farm->StrawRemoval(m_field, 0.0,
126  g_date->DayInYear(20, 10) - g_date->DayInYear())) {
128  break;
129  }
130  SimpleEvent(g_date->Date() + 1, dk_wrcc_autumn_sow, false);
131  break;
132 
133  case dk_wrcc_autumn_sow:
135  g_date->DayInYear(25, 10) - g_date->DayInYear())) {
136  SimpleEvent(g_date->Date() + 1, dk_wrcc_autumn_sow, true);
137  break;
138  }
139  if (a_farm->IsStockFarmer()) //Stock Farmer
140  {
142  break;
143  }
144  else SimpleEvent(g_date->Date(), dk_wrcc_ferti_p1, false);
145  break;
146 
147  case dk_wrcc_ferti_s1:
148  if (m_ev->m_lock || m_farm->DoIt_prob(0.01)) {
149  if (!m_farm->FA_PK(m_field, 0.0,
150  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
151  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s1, true);
152  break;
153  }
154  }
156  break;
157 
158  case dk_wrcc_ferti_p1:
159  if (m_ev->m_lock || m_farm->DoIt_prob(0.01)) {
160  if (!m_farm->FP_PK(m_field, 0.0,
161  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
162  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p1, true);
163  break;
164  }
165  }
167  break;
168 
169  case dk_wrcc_ferti_s2:
170  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
171  {
173  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
174  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s2, true);
175  break;
176  }
177  }
178  else if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
180  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
181  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s2, true);
182  break;
183  }
184  DK_WRCC_MN_S = true; // we need to remember who sprays Mn
185  }
186  SimpleEvent(g_date->Date() + 7, dk_wrcc_herbicide1, false);
187  break;
188 
189  case dk_wrcc_ferti_p2:
190  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
191  {
193  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
194  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p2, true);
195  break;
196  }
197  }
198  else if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
200  g_date->DayInYear(26, 10) - g_date->DayInYear())) {
201  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p2, true);
202  break;
203  }
204  DK_WRCC_MN_P = true; // we need to remember who sprays Mn
205  }
206  SimpleEvent(g_date->Date() + 7, dk_wrcc_herbicide1, false);
207  break;
208 
209  case dk_wrcc_herbicide1:
210  if (m_ev->m_lock || m_farm->DoIt_prob(0.95)) {
211  if (!m_farm->HerbicideTreat(m_field, 0.0,
212  g_date->DayInYear(3, 11) - g_date->DayInYear())) {
213  SimpleEvent(g_date->Date() + 1, dk_wrcc_herbicide1, true);
214  break;
215  }
216  }
217  SimpleEvent(g_date->Date() + 7, dk_wrcc_herbicide2, false);
218  break;
219 
220  case dk_wrcc_herbicide2:
221  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) {
222  if (!m_farm->HerbicideTreat(m_field, 0.0,
223  g_date->DayInYear(11, 11) - g_date->DayInYear())) {
224  SimpleEvent(g_date->Date() + 1, dk_wrcc_herbicide2, true);
225  break;
226  }
227  }
228  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + 365, dk_wrcc_wait, false);
229  break;
230 
231  case dk_wrcc_wait:
232  if (!m_farm->SleepAllDay(m_field, 0.0,
233  g_date->DayInYear(28, 2) - g_date->DayInYear())) {
234  SimpleEvent(g_date->Date() + 1, dk_wrcc_wait, true);
235  break;
236  }
237  if (a_farm->IsStockFarmer()) //Stock Farmer
238  {
243  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_wrcc_gr1, false);
245  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_wrcc_fungicide, false); // main thread
246  break;
247  }
248  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3), dk_wrcc_ferti_p3, false);
252  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_wrcc_gr1, false);
254  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_wrcc_fungicide, false); // main thread
255  break;
256 
257  case dk_wrcc_ferti_s3:
258  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
259  {
261  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
262  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s3, true);
263  break;
264  }
265  }
266  else if (DK_WRCC_MN_S == true) {
268  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
269  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s3, true);
270  break;
271  }
272  }
273  break; // end of thread
274 
275  case dk_wrcc_ferti_p3:
276  if (m_field->GetSoilType() == tos_Sand || m_field->GetSoilType() == tos_LoamySand || m_field->GetSoilType() == tos_SandyLoam || m_field->GetSoilType() == tos_SandyClayLoam) // on sandy soils (NL ZAND & LOSS)
277  {
279  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
280  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p3, true);
281  break;
282  }
283  }
284  else if (DK_WRCC_MN_P == true) {
286  g_date->DayInYear(3, 10) - g_date->DayInYear())) {
287  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p3, true);
288  break;
289  }
290  }
291  break;
292 
293  case dk_wrcc_herbicide3:
294  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
295  if (!m_farm->HerbicideTreat(m_field, 0.0,
296  g_date->DayInYear(20, 4) - g_date->DayInYear())) {
297  SimpleEvent(g_date->Date() + 1, dk_wrcc_herbicide3, true);
298  break;
299  }
300  }
301  SimpleEvent(g_date->Date() + 14, dk_wrcc_herbicide4, false);
302  break;
303 
304  case dk_wrcc_herbicide4:
305  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
306  if (!m_farm->HerbicideTreat(m_field, 0.0,
307  g_date->DayInYear(20, 4) - g_date->DayInYear())) {
308  SimpleEvent(g_date->Date() + 1, dk_wrcc_herbicide4, true);
309  break;
310  }
311  }
312  break; // end of thread
313 
314  case dk_wrcc_ferti_s4:
315  if (!m_farm->FA_Slurry(m_field, 0.0,
316  g_date->DayInYear(10, 4) - g_date->DayInYear())) {
317  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s4, true);
318  break;
319  }
320  break; // end of thread
321 
322  case dk_wrcc_ferti_p4:
323  if (!m_farm->FP_Slurry(m_field, 0.0,
324  g_date->DayInYear(10, 4) - g_date->DayInYear())) {
325  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p4, true);
326  break;
327  }
328  break; // end of thread
329 
330  case dk_wrcc_ferti_s5:
331  if (!m_farm->FA_NPK(m_field, 0.0,
332  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
333  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s5, true);
334  break;
335  }
337  break;
338 
339  case dk_wrcc_ferti_p5:
340  if (!m_farm->FP_NPK(m_field, 0.0,
341  g_date->DayInYear(31, 3) - g_date->DayInYear())) {
342  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p5, true);
343  break;
344  }
346  break;
347 
348  case dk_wrcc_ferti_s6:
349  if (!m_farm->FA_NPK(m_field, 0.0,
350  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
351  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s6, true);
352  break;
353  }
354  break; // end of thread
355 
356  case dk_wrcc_ferti_p6:
357  if (!m_farm->FP_NPK(m_field, 0.0,
358  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
359  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p6, true);
360  break;
361  }
362  break; // end of thread
363 
364  case dk_wrcc_gr1:
365  if (m_ev->m_lock || m_farm->DoIt_prob(0.80)) {
366  if (!m_farm->GrowthRegulator(m_field, 0.0,
367  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
368  SimpleEvent(g_date->Date() + 1, dk_wrcc_gr1, true);
369  break;
370  }
371  }
372  SimpleEvent(g_date->Date() + 14, dk_wrcc_gr2, false);
373  break;
374 
375  case dk_wrcc_gr2:
376  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
377  if (!m_farm->GrowthRegulator(m_field, 0.0,
378  g_date->DayInYear(15, 5) - g_date->DayInYear())) {
379  SimpleEvent(g_date->Date() + 1, dk_wrcc_gr2, true);
380  break;
381  }
382  }
383  break; // end of thread
384 
385  case dk_wrcc_insecticide:
386  if (m_ev->m_lock || m_farm->DoIt_prob(0.10) || AphidDamage(m_field)) {
387  // here we check whether we are using ERA pesticide or not
388  d1 = g_date->DayInYear(31, 5) - g_date->DayInYear();
389  if (!cfg_pest_winterrye_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
390  {
391  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
392  }
393  else {
395  }
396  if (!flag) {
398  break;
399  }
400  }
401  break; // end of thread
402 
403  case dk_wrcc_fungicide:
404  if (m_ev->m_lock || m_farm->DoIt_prob(0.90)) {
405  if (!m_farm->FungicideTreat(m_field, 0.0,
406  g_date->DayInYear(31, 5) - g_date->DayInYear())) {
407  SimpleEvent(g_date->Date() + 1, dk_wrcc_fungicide, true);
408  break;
409  }
410  }
412  break;
413 
414  case dk_wrcc_herbicide5: // only if for fodder- not allowed for consume
415  if (m_ev->m_lock || m_farm->DoIt_prob(0.15)) {
416  if (!m_farm->HerbicideTreat(m_field, 0.0,
417  g_date->DayInYear(14, 8) - g_date->DayInYear())) {
418  SimpleEvent(g_date->Date() + 1, dk_wrcc_herbicide5, true);
419  break;
420  }
421  }
422  if (a_farm->IsStockFarmer()) //Stock Farmer
423  {
424  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s7, false);
425  SimpleEvent(g_date->Date() + 14, dk_wrcc_harvest, false); // main thread
426  break;
427  }
428  else SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p7, false);
429  SimpleEvent(g_date->Date() + 14, dk_wrcc_harvest, false); // main thread
430  break;
431 
432  case dk_wrcc_ferti_s7:
433  if (m_ev->m_lock || m_farm->DoIt_prob(0.02)) {
434  if (!m_farm->FA_Calcium(m_field, 0.0,
435  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
436  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_s7, true);
437  break;
438  }
439  }
440  break; // end of thread
441 
442  case dk_wrcc_ferti_p7:
443  if (m_ev->m_lock || m_farm->DoIt_prob(0.02)) {
444  if (!m_farm->FP_Calcium(m_field, 0.0,
445  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
446  SimpleEvent(g_date->Date() + 1, dk_wrcc_ferti_p7, true);
447  break;
448  }
449  }
450  break; // end of thread
451 
452  case dk_wrcc_harvest:
453  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
454  SimpleEvent(g_date->Date() + 1, dk_wrcc_harvest, true);
455  break;
456  }
457  if (m_ev->m_lock || m_farm->DoIt_prob(cfg_DKCatchCropPct.value())) { //set to 100% from this code - in reality ~ 42% of all winter rye
458  // So we are done,but this crop uses a catch crop
459  l_nextcropstartdate = m_farm->GetNextCropStartDate(m_ev->m_field, l_tov);
460  m_field->BumpRunNum();
461  m_field->SetVegPatchy(false); // reverse the patchy before the next crop
462  m_farm->AddNewEvent(tov_DKCatchCrop, g_date->Date(), m_ev->m_field, PROG_START, m_ev->m_field->GetRunNum(), false, l_nextcropstartdate, false, l_tov, fmc_Others, false, false);
463  m_field->SetVegType(tov_DKCatchCrop, tov_Undefined); // Two vegetation curves are specified
464  if (m_field->GetUnsprayedMarginPolyRef() != -1)
465  {
468  }
469  // NB no "done = true" because this crop effectively continues into the catch crop.
470  break;
471  }
472  else
473  done = true;
474  break;
475 
476  default:
477  g_msg->Warn(WARN_BUG, "DK_WinterRye_CC::Do(): "
478  "Unknown event type! ", "");
479  exit(1);
480  }
481  return done;
482 }

References Farm::AddNewEvent(), Crop::AphidDamage(), Farm::AutumnPlough(), Farm::AutumnRoll(), cfg_DKCatchCropPct, cfg_pest_product_amounts, cfg_pest_winterrye_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), dk_wrcc_autumn_plough, dk_wrcc_autumn_roll, dk_wrcc_autumn_sow, dk_wrcc_ferti_p1, dk_wrcc_ferti_p2, dk_wrcc_ferti_p3, dk_wrcc_ferti_p4, dk_wrcc_ferti_p5, dk_wrcc_ferti_p6, dk_wrcc_ferti_p7, dk_wrcc_ferti_s1, dk_wrcc_ferti_s2, dk_wrcc_ferti_s3, dk_wrcc_ferti_s4, dk_wrcc_ferti_s5, dk_wrcc_ferti_s6, dk_wrcc_ferti_s7, dk_wrcc_fungicide, dk_wrcc_gr1, dk_wrcc_gr2, dk_wrcc_harvest, dk_wrcc_herbicide1, dk_wrcc_herbicide2, dk_wrcc_herbicide3, dk_wrcc_herbicide4, dk_wrcc_herbicide5, dk_wrcc_insecticide, DK_WRCC_MN_P, DK_WRCC_MN_S, dk_wrcc_remove_straw, dk_wrcc_start, dk_wrcc_stubble_harrow, DK_WRCC_TILL_1, DK_WRCC_TILL_2, dk_wrcc_wait, Farm::DoIt_prob(), Farm::FA_Calcium(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FA_PK(), Farm::FA_Slurry(), fmc_Others, Farm::FP_Calcium(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_PK(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GetNextCropStartDate(), LE::GetSoilType(), LE::GetUnsprayedMarginPolyRef(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, FarmEvent::m_field, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, Crop::m_OurLandscape, FarmEvent::m_todo, Calendar::OldDays(), ppp_1, Farm::PreseedingCultivatorSow(), Farm::ProductApplication(), PROG_START, LE::SetVegPatchy(), LE::SetVegType(), Crop::SimpleEvent(), Farm::SleepAllDay(), Crop::StartUpCrop(), Farm::StrawRemoval(), Farm::StubbleHarrowing(), Landscape::SupplyLEPointer(), tos_LoamySand, tos_Sand, tos_SandyClayLoam, tos_SandyLoam, tov_DKCatchCrop, tov_DKOCatchCrop, tov_DKWinterRye_CC, tov_Undefined, CfgFloat::value(), CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DK_WinterRye_CC::SetUpFarmCategoryInformation ( )
inline
84  {
85  const int elements = 2 + (dk_wrcc_foobar - DK_WRCC_BASE);
87 
88  FarmManagementCategory catlist[elements] =
89  {
90  fmc_Others, // zero element unused but must be here
91  fmc_Others, // dk_wrcc_start = 1, // Compulsory, start event must always be 1 (one).
92  fmc_Harvest, // dk_wrcc_harvest = DK_wrcc_BASE,
93  fmc_Cultivation, // dk_wrcc_autumn_plough,
94  fmc_Cultivation, // dk_wrcc_stubble_harrow,
95  fmc_Others, // dk_wrcc_autumn_roll,
96  fmc_Others, // dk_wrcc_remove_straw,
97  fmc_Fertilizer, // dk_wrcc_ferti_s1,
98  fmc_Fertilizer, // dk_wrcc_ferti_p1,
99  fmc_Fertilizer, // dk_wrcc_ferti_s2,
100  fmc_Fertilizer, // dk_wrcc_ferti_p2,
101  fmc_Cultivation, // dk_wrcc_autumn_sow,
102  fmc_Herbicide, // dk_wrcc_herbicide1,
103  fmc_Fertilizer, // dk_wrcc_ferti_s3,
104  fmc_Fertilizer, // dk_wrcc_ferti_p3,
105  fmc_Fertilizer, // dk_wrcc_ferti_s4,
106  fmc_Fertilizer, // dk_wrcc_ferti_p4,
107  fmc_Fertilizer, // dk_wrcc_ferti_s5,
108  fmc_Fertilizer, // dk_wrcc_ferti_p5,
109  fmc_Fertilizer, // dk_wrcc_ferti_s6,
110  fmc_Fertilizer, // dk_wrcc_ferti_p6,
111  fmc_Fertilizer, // dk_wrcc_ferti_s7,
112  fmc_Fertilizer, // dk_wrcc_ferti_p7,
113  fmc_Herbicide, // dk_wrcc_herbicide2,
114  fmc_Herbicide, // dk_wrcc_herbicide3,
115  fmc_Herbicide, // dk_wrcc_herbicide4,
116  fmc_Herbicide, // dk_wrcc_herbicide5,
117  fmc_Fungicide, // dk_wrcc_fungicide,
118  fmc_Insecticide, // dk_wrcc_insecticide,
119  fmc_Others, // dk_wrcc_gr1,
120  fmc_Others, // dk_wrcc_gr2,
121  fmc_Others, // dk_wrcc_wait,
122 
123  // no foobar entry
124 
125  };
126  // Iterate over the catlist elements and copy them to vector
127  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
128  }

References DK_WRCC_BASE, dk_wrcc_foobar, fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DK_WinterRye_CC().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
DK_WRCC_MN_P
#define DK_WRCC_MN_P
Definition: DK_WinterRye_CC.h:34
dk_wrcc_ferti_p1
Definition: DK_WinterRye_CC.h:46
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Returns a pointer to the object referred to by the polygon number.
Definition: Landscape.h:1722
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
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
dk_wrcc_herbicide1
Definition: DK_WinterRye_CC.h:50
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::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
Farm::FP_NPK
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:645
Farm::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
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
cfg_pest_winterrye_on
CfgBool cfg_pest_winterrye_on
Turn on pesticides for winter rye.
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
dk_wrcc_ferti_s1
Definition: DK_WinterRye_CC.h:45
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
Farm::GetNextCropStartDate
int GetNextCropStartDate(LE *a_field, TTypesOfVegetation &a_curr_veg)
Returns the start date of the next crop in the rotation.
Definition: Farm.cpp:920
dk_wrcc_insecticide
Definition: DK_WinterRye_CC.h:66
DK_WRCC_TILL_1
#define DK_WRCC_TILL_1
Definition: DK_WinterRye_CC.h:35
Farm::AddNewEvent
void AddNewEvent(TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop, FarmManagementCategory a_fmc, bool a_forcespring, bool a_forcespringOK)
Adds an event to the event queue for a farm.
Definition: Farm.cpp:845
CfgFloat::value
double value() const
Definition: Configurator.h:142
cfg_DKCatchCropPct
CfgFloat cfg_DKCatchCropPct
dk_wrcc_ferti_s2
Definition: DK_WinterRye_CC.h:47
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_wrcc_remove_straw
Definition: DK_WinterRye_CC.h:44
dk_wrcc_autumn_sow
Definition: DK_WinterRye_CC.h:49
dk_wrcc_ferti_p7
Definition: DK_WinterRye_CC.h:60
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
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
dk_wrcc_foobar
Definition: DK_WinterRye_CC.h:70
dk_wrcc_gr1
Definition: DK_WinterRye_CC.h:67
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
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.
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_wrcc_wait
Definition: DK_WinterRye_CC.h:69
CfgBool::value
bool value() const
Definition: Configurator.h:164
dk_wrcc_harvest
Definition: DK_WinterRye_CC.h:40
dk_wrcc_ferti_s6
Definition: DK_WinterRye_CC.h:57
dk_wrcc_ferti_s5
Definition: DK_WinterRye_CC.h:55
dk_wrcc_gr2
Definition: DK_WinterRye_CC.h:68
tov_DKOCatchCrop
Definition: LandscapeFarmingEnums.h:421
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
tov_DKWinterRye_CC
Definition: LandscapeFarmingEnums.h:424
dk_wrcc_herbicide2
Definition: DK_WinterRye_CC.h:61
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
dk_wrcc_ferti_p3
Definition: DK_WinterRye_CC.h:52
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
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
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
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
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
dk_wrcc_autumn_roll
Definition: DK_WinterRye_CC.h:43
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_wrcc_autumn_plough
Definition: DK_WinterRye_CC.h:41
dk_wrcc_ferti_p5
Definition: DK_WinterRye_CC.h:56
FarmEvent::m_field
LE * m_field
Definition: Farm.h:391
DK_WRCC_MN_S
#define DK_WRCC_MN_S
Definition: DK_WinterRye_CC.h:33
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_wrcc_herbicide3
Definition: DK_WinterRye_CC.h:62
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
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
tos_Sand
Definition: LandscapeFarmingEnums.h:719
tov_Undefined
Definition: LandscapeFarmingEnums.h:610
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: FarmFuncs.cpp:299
dk_wrcc_ferti_s4
Definition: DK_WinterRye_CC.h:53
LE::SetVegType
virtual void SetVegType(TTypesOfVegetation)
Definition: Elements.h:175
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
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: FarmFuncs.cpp:272
dk_wrcc_ferti_p6
Definition: DK_WinterRye_CC.h:58
dk_wrcc_ferti_p4
Definition: DK_WinterRye_CC.h:54
LE
Definition: Elements.h:86
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
dk_wrcc_ferti_s7
Definition: DK_WinterRye_CC.h:59
dk_wrcc_ferti_s3
Definition: DK_WinterRye_CC.h:51
DK_WinterRye_CC::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_WinterRye_CC.h:84
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
dk_wrcc_fungicide
Definition: DK_WinterRye_CC.h:65
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
LE::GetUnsprayedMarginPolyRef
int GetUnsprayedMarginPolyRef(void)
Definition: Elements.h:383
tov_DKCatchCrop
Definition: LandscapeFarmingEnums.h:420
DK_WRCC_TILL_2
#define DK_WRCC_TILL_2
Definition: DK_WinterRye_CC.h:36
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_wrcc_stubble_harrow
Definition: DK_WinterRye_CC.h:42
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
PROG_START
#define PROG_START
Definition: Farm.h:69
Crop::AphidDamage
bool AphidDamage(LE *a_field)
Compares aphid numbers per m2 with a threshold to return true if threshold is exceeded.
Definition: Farm.cpp:726
dk_wrcc_herbicide5
Definition: DK_WinterRye_CC.h:64
dk_wrcc_herbicide4
Definition: DK_WinterRye_CC.h:63
dk_wrcc_ferti_p2
Definition: DK_WinterRye_CC.h:48
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
Crop::m_OurLandscape
Landscape * m_OurLandscape
Definition: Farm.h:506
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
DK_WRCC_BASE
#define DK_WRCC_BASE
Definition: DK_WinterRye_CC.h:31
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
dk_wrcc_start
Definition: DK_WinterRye_CC.h:39