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

#include <DK_Potato.h>

Inheritance diagram for DK_Potato:
Crop

Public Member Functions

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

DK_Potato::DK_Potato ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
85  : Crop(a_tov, a_toc, a_L)
86  {
87  m_first_date = g_date->DayInYear(1, 12); //
89  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

40 {
41  m_farm = a_farm;
42  m_field = a_field;
43  m_ev = a_ev;
44  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).
45  bool flag = false;
46  int d1 = 0;
47  int noDates = 1;
49 
50  switch (m_ev->m_todo)
51  {
52  case dk_po_start:
53  {
54  a_field->ClearManagementActionSum();
55  m_field->SetVegPatchy(true); // Root crop so is open until tall
56  DK_PO_FORCESPRING = false;
57  m_last_date = g_date->DayInYear(24, 10); // Should match the last flexdate below
58  //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
59  std::vector<std::vector<int>> flexdates(2 + 1, std::vector<int>(2, 0));
60  // Set up the date management stuff
61  // Start and stop dates for all events after harvest
62  flexdates[0][1] = g_date->DayInYear(25, 9); // last possible day of harvest - this is in effect day before the earliest date that a following crop can use - 31/10
63  // Now these are done in pairs, start & end for each operation. If its not used then -1
64  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
65  flexdates[1][1] = g_date->DayInYear(13, 10); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) - 1/11
66  flexdates[2][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 2 (start op 2)
67  flexdates[2][1] = g_date->DayInYear(14, 10); // This date will be moved back as far as necessary and potentially to flexdates 2 (end op 2) - 2/11
68 
69  // 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
70  int isSpring = 0;
71  if (StartUpCrop(isSpring, flexdates, int(dk_po_deep_harrow))) break;
72 
73  // End single block date checking code. Please see next line comment as well.
74  // Reinit d1 to first possible starting date.
75  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
76  // OK, let's go.
77  // Here we queue up the first event which changes dependent on whether it is a forced spring sow or not
78  if (m_ev->m_forcespring) {
79  int day_num_shift = 365;
80  if (g_date->DayInYear() < 70) day_num_shift = 0;
81  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + day_num_shift, dk_po_deep_harrow, false);
82  DK_PO_FORCESPRING = true;
83  break;
84  }
85  else SimpleEvent(d1, dk_po_remove_straw, false);
86  break;
87  }
88  break;
89 
90  case dk_po_remove_straw:
91  if (m_ev->m_lock || m_farm->DoIt_prob(0.80)) {
92  if (!m_farm->StrawRemoval(m_field, 0.0, g_date->DayInYear(28, 9) - g_date->DayInYear())) {
94  break;
95  }
96  }
97  SimpleEvent(g_date->Date() + 1, dk_po_stoneburier, false);
98  break;
99 
100  case dk_po_stoneburier:
101  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
103  SimpleEvent(g_date->Date() + 1, dk_po_stoneburier, true);
104  break;
105  }
106  }
107  SimpleEvent(g_date->Date() + 1, dk_po_autumn_plough, false);
108  break;
109 
110  case dk_po_autumn_plough:
111  if (m_ev->m_lock || m_farm->DoIt_prob(0.40)) {
114  break;
115  }
116  if (a_farm->IsStockFarmer()) {
117  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4) + 365, dk_po_ferti_s1, false);
118  break;
119  }
120  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4) + 365, dk_po_ferti_p1, false);
121  break;
122  }
123  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, dk_po_herbicide, false);
124  break;
125 
126  case dk_po_herbicide:
127  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
128  SimpleEvent(g_date->Date() + 1, dk_po_herbicide, true);
129  break;
130  }
131  SimpleEvent(g_date->Date() + 1, dk_po_deep_harrow, false);
132  break;
133 
134  case dk_po_deep_harrow:
135  if (!m_farm->StubbleHarrowing(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
136  SimpleEvent(g_date->Date() + 1, dk_po_deep_harrow, true);
137  break;
138  }
139  if (a_farm->IsStockFarmer()) {
141  break;
142  }
143  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), dk_po_ferti_p1, false);
144  break;
145 
146  case dk_po_ferti_s1:
147  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(19, 4) - g_date->DayInYear())) {
148  SimpleEvent(g_date->Date() + 1, dk_po_ferti_s1, true);
149  break;
150  }
151  SimpleEvent(g_date->Date() + 1, dk_po_sow, false); // main thread
152  SimpleEvent(g_date->Date() + 15, dk_po_ferti_s2, false); // ferti thread
153  break;
154 
155  case dk_po_ferti_p1:
156  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(19, 4) - g_date->DayInYear())) {
157  SimpleEvent(g_date->Date() + 1, dk_po_ferti_p1, true);
158  break;
159  }
160  SimpleEvent(g_date->Date() + 1, dk_po_sow, false); // main thread
161  SimpleEvent(g_date->Date() + 15, dk_po_ferti_p2, false); // ferti thread
162  break;
163 
164  case dk_po_sow:
165  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
166  SimpleEvent(g_date->Date() + 1, dk_po_sow, true);
167  break;
168  }
169  SimpleEvent(g_date->Date() + 1, dk_po_strigling, false);
170  break;
171 
172  case dk_po_ferti_s2:
173  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) {
174  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(1, 7) - g_date->DayInYear())) {
175  SimpleEvent(g_date->Date() + 1, dk_po_ferti_s2, true);
176  break;
177  }
178  }
179  break; // end of thread
180 
181  case dk_po_ferti_p2:
182  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) {
183  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(1, 7) - g_date->DayInYear())) {
184  SimpleEvent(g_date->Date() + 1, dk_po_ferti_p2, true);
185  break;
186  }
187  }
188  break; // end of thread
189 
190  case dk_po_strigling:
191  if (m_ev->m_lock || m_farm->DoIt_prob(0.05)) {
192  if (!m_farm->Strigling(m_field, 0.0, g_date->DayInYear(27, 4) - g_date->DayInYear())) {
193  SimpleEvent(g_date->Date() + 1, dk_po_strigling, true);
194  break;
195  }
196  SimpleEvent(g_date->Date() + 1, dk_po_harrow1, false);
197  break;
198  }
199  SimpleEvent(g_date->Date() + 1, dk_po_herbicide1, false); // herbi thread
200  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 5), dk_po_water, false); // water thread
201  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 5), dk_po_fungicide1, false); // main thread
202  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 6) + m_date_modifier, dk_po_insecticide1, false); // insecti thread
203  break;
204 
205  case dk_po_harrow1:
206  if (!m_farm->ShallowHarrow(m_field, 0.0, g_date->DayInYear(28, 4) - g_date->DayInYear())) {
207  SimpleEvent(g_date->Date() + 1, dk_po_harrow1, true);
208  break;
209  }
210  SimpleEvent(g_date->Date() + 1, dk_po_herbicide_mw, false); //the 5% doing mechanical weeding (mw) - 75% of those will have one herbi treatment before sprouts
211  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_po_hill_up1, false); // hill up thread
212  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 5), dk_po_water, false); // water thread
213  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 5), dk_po_fungicide1, false); // main thread
214  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 6) + m_date_modifier, dk_po_insecticide1, false); // insecti thread
215  break;
216 
217  case dk_po_hill_up1:
218  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
219  SimpleEvent(g_date->Date() + 1, dk_po_hill_up1, true);
220  break;
221  }
222  SimpleEvent(g_date->Date() + 30, dk_po_hill_up2, false); // hill up thread
223  break;
224 
225  case dk_po_hill_up2:
226  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(30, 7) - g_date->DayInYear())) {
227  SimpleEvent(g_date->Date() + 1, dk_po_hill_up2, true);
228  break;
229  }
230  SimpleEvent(g_date->Date() + 30, dk_po_hill_up3, false); // hill up thread
231  break;
232 
233  case dk_po_hill_up3:
234  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(30, 8) - g_date->DayInYear())) {
235  SimpleEvent(g_date->Date() + 1, dk_po_hill_up3, true);
236  break;
237  }
238  break; // end of thread
239 
240  case dk_po_herbicide_mw:
241  if (m_ev->m_lock || m_farm->DoIt_prob(0.75)) {
242  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
243  SimpleEvent(g_date->Date() + 1, dk_po_herbicide_mw, true);
244  break;
245  }
246  }
247  break; // end of thread
248 
249  case dk_po_herbicide1:
250  if (m_ev->m_lock || m_farm->DoIt_prob(0.85)) {
251  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
252  SimpleEvent(g_date->Date() + 1, dk_po_herbicide1, true);
253  break;
254  }
255  }
257  break;
258 
259  case dk_po_herbicide2:
260  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
261  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
262  SimpleEvent(g_date->Date() + 1, dk_po_herbicide2, true);
263  break;
264  }
265  }
267  break;
268 
269  case dk_po_herbicide3:
270  if (m_ev->m_lock || m_farm->DoIt_prob(0.50)) {
271  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
272  SimpleEvent(g_date->Date() + 1, dk_po_herbicide3, true);
273  break;
274  }
275  }
277  break;
278 
279  case dk_po_herbicide4:
280  if (m_ev->m_lock || m_farm->DoIt_prob(0.30)) {
281  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
282  SimpleEvent(g_date->Date() + 1, dk_po_herbicide4, true);
283  break;
284  }
285  }
286  SimpleEvent(g_date->Date() + 7, dk_po_herbicide5, false);
287  break;
288 
289  case dk_po_herbicide5:
290  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
291  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
292  SimpleEvent(g_date->Date() + 1, dk_po_herbicide5, true);
293  break;
294  }
295  }
296  SimpleEvent(g_date->Date() + 7, dk_po_herbicide6, false);
297  break;
298 
299  case dk_po_herbicide6:
300  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) {
301  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
302  SimpleEvent(g_date->Date() + 1, dk_po_herbicide6, true);
303  break;
304  }
305  }
306  break; // end of thread
307 
308  case dk_po_water:
309  if (m_ev->m_lock || m_farm->DoIt_prob(0.75)) {
310  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
311  SimpleEvent(g_date->Date() + 1, dk_po_water, true);
312  break;
313  }
314  }
315  break; // end of thread
316 
317  case dk_po_insecticide1:
318 #ifdef ECOSTACK_BIOPESTICIDE
319  if (m_ev->m_lock || m_farm->DoIt_prob(0.60) || AphidDamage(m_field)) {
320 #else
321  if (m_ev->m_lock || m_farm->DoIt_prob(0.30) || AphidDamage(m_field)) {
322 #endif
323  // here we check whether we are using ERA pesticide or not
324  d1 = g_date->DayInYear(30, 6) - g_date->DayInYear();
325  if (!cfg_pest_potatoes_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
326  {
327 #ifdef ECOSTACK_BIOPESTICIDE
328  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
329 #else
330  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
331 #endif
332  }
333  else {
334  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
335  }
336  if (!flag) {
337  SimpleEvent(g_date->Date() + 1, dk_po_insecticide1, true);
338  break;
339  }
340  }
341  break; // end of thread
342 
343  case dk_po_fungicide1:
344  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
345  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(29, 5) - g_date->DayInYear())) {
346  SimpleEvent(g_date->Date() + 1, dk_po_fungicide1, true);
347  break;
348  }
349  }
350  if (a_farm->IsStockFarmer()) {
352  break;
353  }
354  else SimpleEvent(g_date->Date(), dk_po_ferti_p3, false);
355  break;
356 
357  case dk_po_ferti_s3:
358  if (m_ev->m_lock || m_farm->DoIt_prob(0.01)) {
359  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(29, 5) - g_date->DayInYear())) {
360  SimpleEvent(g_date->Date() + 1, dk_po_ferti_s3, true);
361  break;
362  }
363  }
364  SimpleEvent(g_date->Date() + 7, dk_po_fungicide2, false);
365  break;
366 
367  case dk_po_ferti_p3:
368  if (m_ev->m_lock || m_farm->DoIt_prob(0.01)) {
369  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(29, 5) - g_date->DayInYear())) {
370  SimpleEvent(g_date->Date() + 1, dk_po_ferti_p3, true);
371  break;
372  }
373  }
374  SimpleEvent(g_date->Date() + 7, dk_po_fungicide2, false);
375  break;
376 
377  case dk_po_fungicide2:
378  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
379  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(6, 6) - g_date->DayInYear())) {
380  SimpleEvent(g_date->Date() + 1, dk_po_fungicide2, true);
381  break;
382  }
383  }
384  SimpleEvent(g_date->Date() + 7, dk_po_fungicide3, false);
385  break;
386 
387  case dk_po_fungicide3:
388  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
389  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 6) - g_date->DayInYear())) {
390  SimpleEvent(g_date->Date() + 1, dk_po_fungicide3, true);
391  break;
392  }
393  }
394  SimpleEvent(g_date->Date() + 7, dk_po_fungicide4, false);
395  break;
396 
397  case dk_po_fungicide4:
398  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
399  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(22, 6) - g_date->DayInYear())) {
400  SimpleEvent(g_date->Date() + 1, dk_po_fungicide4, true);
401  break;
402  }
403  }
404  SimpleEvent(g_date->Date() + 7, dk_po_fungicide5, false);
405  break;
406 
407  case dk_po_fungicide5:
408  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
409  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
410  SimpleEvent(g_date->Date() + 1, dk_po_fungicide5, true);
411  break;
412  }
413  }
414  SimpleEvent(g_date->Date() + 7, dk_po_fungicide6, false);
415  break;
416 
417  case dk_po_fungicide6:
418  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
419  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(6, 7) - g_date->DayInYear())) {
420  SimpleEvent(g_date->Date() + 1, dk_po_fungicide6, true);
421  break;
422  }
423  }
425  break;
426 
427  case dk_po_herbicide7:
428  if (m_ev->m_lock || m_farm->DoIt_prob(0.70)) {
429  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(6, 7) - g_date->DayInYear())) {
430  SimpleEvent(g_date->Date() + 1, dk_po_herbicide7, true);
431  break;
432  }
433  SimpleEvent(g_date->Date() + 7, dk_po_herbicide8, false); // herbi thread
434  SimpleEvent(g_date->Date() + 7, dk_po_fungicide7, false); // main thread
435  break;
436  }
437  SimpleEvent(g_date->Date() + 7, dk_po_fungicide7, false);
438  break;
439 
440  case dk_po_herbicide8:
441  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
442  SimpleEvent(g_date->Date() + 1, dk_po_herbicide8, true);
443  break;
444  }
445  break; // end og thread
446 
447  case dk_po_fungicide7:
448  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
449  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
450  SimpleEvent(g_date->Date() + 1, dk_po_fungicide7, true);
451  break;
452  }
453  }
454  SimpleEvent(g_date->Date() + 7, dk_po_fungicide8, false);
455  break;
456 
457  case dk_po_fungicide8:
458  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
459  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(22, 7) - g_date->DayInYear())) {
460  SimpleEvent(g_date->Date() + 1, dk_po_fungicide8, true);
461  break;
462  }
463  }
464  SimpleEvent(g_date->Date() + 7, dk_po_harvest, false);
465  break;
466 
467  case dk_po_harvest:
468  if (!m_farm->HarvestLong(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
469  SimpleEvent(g_date->Date() + 1, dk_po_harvest, true);
470  break;
471  }
472  SimpleEvent(g_date->Date() + 1, dk_po_harrow2, false);
473  break;
474  m_field->SetVegPatchy(false);
475  done = true;
476  break;
477 
478  case dk_po_harrow2:
479  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
480  if (!m_farm->AutumnHarrow(m_field, 0.0, m_field->GetMDates(1, 1) - g_date->DayInYear())) {
481  SimpleEvent(g_date->Date() + 1, dk_po_harrow2, true);
482  break;
483  }
484  SimpleEvent(g_date->Date() + 1, dk_po_harrow3, false);
485  break;
486  }
487  done = true;
488  break;
489 
490  case dk_po_harrow3:
491  if (!m_farm->AutumnHarrow(m_field, 0.0, m_field->GetMDates(1, 2) - g_date->DayInYear())) {
492  SimpleEvent(g_date->Date() + 1, dk_po_harrow3, true);
493  break;
494  }
495 
496  done = true;
497  break;
498 
499  default:
500  g_msg->Warn(WARN_BUG, "DK_Potato::Do(): "
501  "Unknown event type! ", "");
502  exit(1);
503  }
504  if (done) m_ev->m_forcespring = true; // Here we need to force the next crop to spring operation, so set the ev->forcespring to true
505  return done;
506 
507 }

References Crop::AphidDamage(), Farm::AutumnHarrow(), Farm::BiocideTreat(), cfg_pest_potatoes_on, cfg_pest_product_amounts, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), dk_po_autumn_plough, dk_po_deep_harrow, dk_po_ferti_p1, dk_po_ferti_p2, dk_po_ferti_p3, dk_po_ferti_s1, dk_po_ferti_s2, dk_po_ferti_s3, DK_PO_FORCESPRING, dk_po_fungicide1, dk_po_fungicide2, dk_po_fungicide3, dk_po_fungicide4, dk_po_fungicide5, dk_po_fungicide6, dk_po_fungicide7, dk_po_fungicide8, dk_po_harrow1, dk_po_harrow2, dk_po_harrow3, dk_po_harvest, dk_po_herbicide, dk_po_herbicide1, dk_po_herbicide2, dk_po_herbicide3, dk_po_herbicide4, dk_po_herbicide5, dk_po_herbicide6, dk_po_herbicide7, dk_po_herbicide8, dk_po_herbicide_mw, dk_po_hill_up1, dk_po_hill_up2, dk_po_hill_up3, dk_po_insecticide1, dk_po_remove_straw, dk_po_sow, dk_po_start, dk_po_stoneburier, dk_po_strigling, dk_po_water, Farm::DoIt_prob(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::HarvestLong(), Farm::HerbicideTreat(), Farm::HillingUp(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, FarmEvent::m_forcespring, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Calendar::OldDays(), ppp_1, Farm::ProductApplication(), LE::SetVegPatchy(), Farm::ShallowHarrow(), Crop::SimpleEvent(), Farm::SpringSow(), Crop::StartUpCrop(), Farm::StrawRemoval(), Farm::Strigling(), Farm::StubbleCultivatorHeavy(), Farm::StubbleHarrowing(), tov_DKPotato, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void DK_Potato::SetUpFarmCategoryInformation ( )
inline
90  {
91  const int elements = 2 + (dk_po_foobar - DK_PO_BASE);
93 
94  FarmManagementCategory catlist[elements] =
95  {
96  fmc_Others, // zero element unused but must be here
97  fmc_Others, // dk_po_start = 1, // Compulsory, start event must always be 1 (one).
98  fmc_Harvest, // dk_po_harvest = DK_PO_BASE,
99  fmc_Others, // dk_po_remove_straw,
100  fmc_Cultivation, //dk_po_stoneburier,
101  fmc_Cultivation, //dk_po_autumn_plough,
102  fmc_Cultivation, // dk_po_deep_harrow,
103  fmc_Fertilizer, // dk_po_ferti_s1,
104  fmc_Fertilizer, // dk_po_ferti_p1,
105  fmc_Fertilizer, // dk_po_ferti_s2,
106  fmc_Fertilizer, // dk_po_ferti_p2,
107  fmc_Others, // dk_po_sow,
108  fmc_Watering, // dk_po_water,
109  fmc_Cultivation, // dk_po_strigling,
110  fmc_Cultivation, // dk_po_harrow1,
111  fmc_Cultivation, // dk_po_hill_up1,
112  fmc_Cultivation, // dk_po_hill_up2,
113  fmc_Cultivation, // dk_po_hill_up3,
114  fmc_Herbicide, // dk_po_herbicide,
115  fmc_Herbicide, // dk_po_herbicide_mw,
116  fmc_Herbicide, // dk_po_herbicide1,
117  fmc_Herbicide, // dk_po_herbicide2,
118  fmc_Herbicide, // dk_po_herbicide3,
119  fmc_Herbicide, // dk_po_herbicide4,
120  fmc_Herbicide, // dk_po_herbicide5,
121  fmc_Herbicide, // dk_po_herbicide6,
122  fmc_Fertilizer, // dk_po_ferti_s3,
123  fmc_Fertilizer, // dk_po_ferti_p3,
124  fmc_Fungicide, // dk_po_fungicide1,
125  fmc_Fungicide, // dk_po_fungicide2,
126  fmc_Fungicide, // dk_po_fungicide3,
127  fmc_Fungicide, // dk_po_fungicide4,
128  fmc_Fungicide, // dk_po_fungicide5,
129  fmc_Fungicide, // dk_po_fungicide6,
130  fmc_Fungicide, // dk_po_fungicide7,
131  fmc_Fungicide, // dk_po_fungicide8,
132  fmc_Insecticide, // dk_po_insecticide1,
133  fmc_Cultivation, // dk_po_harrow2,
134  fmc_Cultivation, // dk_po_harrow3,
135  fmc_Herbicide, // dk_po_herbicide7,
136  fmc_Herbicide, // dk_po_herbicide8,
137 
138 
139  // no foobar entry
140 
141  };
142  // Iterate over the catlist elements and copy them to vector
143  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
144 
145  }

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

Referenced by DK_Potato().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
dk_po_start
Definition: DK_Potato.h:36
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
dk_po_strigling
Definition: DK_Potato.h:48
dk_po_ferti_p3
Definition: DK_Potato.h:62
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
dk_po_fungicide1
Definition: DK_Potato.h:63
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
dk_po_harrow3
Definition: DK_Potato.h:73
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
Farm::StubbleCultivatorHeavy
virtual bool StubbleCultivatorHeavy(LE *a_field, double a_user, int a_days)
Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can...
Definition: FarmFuncs.cpp:245
dk_po_water
Definition: DK_Potato.h:47
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
dk_po_autumn_plough
Definition: DK_Potato.h:40
DK_PO_BASE
#define DK_PO_BASE
Definition: DK_Potato.h:31
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
dk_po_herbicide1
Definition: DK_Potato.h:55
dk_po_herbicide
Definition: DK_Potato.h:53
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
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
dk_po_hill_up2
Definition: DK_Potato.h:51
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
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_po_harrow2
Definition: DK_Potato.h:72
Farm::HillingUp
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
Definition: FarmFuncs.cpp:1302
dk_po_herbicide3
Definition: DK_Potato.h:57
dk_po_fungicide2
Definition: DK_Potato.h:64
dk_po_stoneburier
Definition: DK_Potato.h:39
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_po_herbicide5
Definition: DK_Potato.h:59
dk_po_herbicide_mw
Definition: DK_Potato.h:54
CfgBool::value
bool value() const
Definition: Configurator.h:164
tov_DKPotato
Definition: LandscapeFarmingEnums.h:404
dk_po_sow
Definition: DK_Potato.h:46
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
DK_Potato::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_Potato.h:90
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
dk_po_ferti_s2
Definition: DK_Potato.h:44
dk_po_hill_up3
Definition: DK_Potato.h:52
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
dk_po_herbicide8
Definition: DK_Potato.h:75
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
dk_po_fungicide6
Definition: DK_Potato.h:68
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
dk_po_herbicide6
Definition: DK_Potato.h:60
dk_po_harrow1
Definition: DK_Potato.h:49
dk_po_remove_straw
Definition: DK_Potato.h:38
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_po_deep_harrow
Definition: DK_Potato.h:41
dk_po_fungicide4
Definition: DK_Potato.h:66
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
Crop::m_ManagementCategories
vector< FarmManagementCategory > m_ManagementCategories
Holds the translation between the farm operation enum for each crop and the farm management category ...
Definition: Farm.h:530
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
Farm::ShallowHarrow
virtual bool ShallowHarrow(LE *a_field, double a_user, int a_days)
Carry out a shallow harrow event on a_field, e.g., after grass cutting event.
Definition: FarmFuncs.cpp:473
Farm::HarvestLong
virtual bool HarvestLong(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field (only differs in the DoIt chance cf harvest)
Definition: FarmFuncs.cpp:1421
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
dk_po_ferti_p1
Definition: DK_Potato.h:43
dk_po_fungicide3
Definition: DK_Potato.h:65
dk_po_fungicide8
Definition: DK_Potato.h:70
dk_po_herbicide7
Definition: DK_Potato.h:74
DK_PO_FORCESPRING
#define DK_PO_FORCESPRING
Definition: DK_Potato.h:33
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
cfg_pest_product_amounts
CfgArray_Double cfg_pest_product_amounts
Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.
Farm::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
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
dk_po_fungicide7
Definition: DK_Potato.h:69
dk_po_herbicide2
Definition: DK_Potato.h:56
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
dk_po_hill_up1
Definition: DK_Potato.h:50
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
dk_po_foobar
Definition: DK_Potato.h:76
dk_po_ferti_s3
Definition: DK_Potato.h:61
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
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_po_ferti_p2
Definition: DK_Potato.h:45
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
dk_po_ferti_s1
Definition: DK_Potato.h:42
dk_po_harvest
Definition: DK_Potato.h:37
dk_po_herbicide4
Definition: DK_Potato.h:58
dk_po_fungicide5
Definition: DK_Potato.h:67
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
dk_po_insecticide1
Definition: DK_Potato.h:71