Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DK_Carrots Class Reference

#include <DK_Carrots.h>

Inheritance diagram for DK_Carrots:
Crop

Public Member Functions

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

DK_Carrots::DK_Carrots ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

38  {
39  m_farm = a_farm;
40  m_field = a_field;
41  m_ev = a_ev;
42  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).
43  bool flag = false;
44  int d1 = 0;
45  int noDates = 1;
47 
48  switch (m_ev->m_todo) {
49  case dk_car_start:
50  {
51  a_field->ClearManagementActionSum();
52 
53  // Set up the date management stuff
54  DK_CAR_FORCESPRING = false;
55  m_last_date = g_date->DayInYear(30, 11); // Should match the last flexdate below
56  //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
57  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
58  // Set up the date management stuff
59  // Start and stop dates for all events after harvest
60  flexdates[0][1] = g_date->DayInYear(30, 11); // last possible day of harvest - this is in effect day before the earliest date that a following crop can use
61  // Now these are done in pairs, start & end for each operation. If its not used then -1
62  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
63  flexdates[1][1] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
64 
65 
66  // 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
67  int isSpring = 0;
68  if (StartUpCrop(isSpring, flexdates, int(dk_car_stoneburier))) break;
69 
70  // End single block date checking code. Please see next line comment as well.
71  // Reinit d1 to first possible starting date.
72  d1 = g_date->OldDays() + g_date->DayInYear(1, 9);
73  // OK, let's go.
74  // Here we queue up the first event which changes dependent on whether it is a forced spring sow or not
75  if (m_ev->m_forcespring) {
76  int day_num_shift = 365;
77  if (g_date->DayInYear() < 70) day_num_shift = 0;
78  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + day_num_shift, dk_car_stoneburier, false);
79  break;
80  DK_CAR_FORCESPRING = true;
81  }
82  else SimpleEvent(d1, dk_car_herbicide1, false);
83  break;
84  }
85  break;
86  // OK, Let's go - LKM: first treatment, herbicide1, do it before the 30th of Octotber - if not done, try again +1 day until the the 30th of October when we succeed - 100% of farmers do this
87  case dk_car_herbicide1:
88  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(1, 12) - g_date->DayInYear())) {
90  break;
91  }
92  // LKM: Queue up next event - Stoneburier after 1st of February next year
93  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + 365, dk_car_stoneburier, false);
94  break;
95  // LKM: Do stoneburier before 15th of April - if not done, try again +1 day until the the 15th of April when we succeed
96  case dk_car_stoneburier:
97  if (!m_farm->DeepPlough(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
99  break;
100  }
101  // LKM: Queue up the next event - Deep harrow done before the 20th of April - if not done, try again +1 day until the 20th of April when we will succeed
103  break;
104  case dk_car_deep_harrow:
105  if (!m_farm->DeepPlough(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
106  SimpleEvent(g_date->Date() + 1, dk_car_deep_harrow, true);
107  break;
108  }
109  // LKM: Queue up the next event - Bedformer done before the 20th of April - if not done, try again +1 day until the 20th of April when we will succeed
111  break;
112  case dk_car_bedformer:
113  if (!m_farm->BedForming(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
114  SimpleEvent(g_date->Date() + 1, dk_car_bedformer, true);
115  break;
116  }
117  // LKM: Queue up the next event - shallow harrow1 (making seedbed) done after the 5th of February and before the 5th of May - if not done, try again +1 day until the 5th of May when we will succeed
119  break;
120  case dk_car_sharrow1:
121  if (!m_farm->ShallowHarrow(m_field, 0.0, g_date->DayInYear(5, 5) - g_date->DayInYear()))
122  {
123  SimpleEvent(g_date->Date() + 1, dk_car_sharrow1, true);
124  break;
125  }
126  // LKM: Queue up the next event - shallow harrow2 (making seedbed) done 5 days after, and before the 10th of May - if not done, try again +1 day until the 10th of May when we will succeed
127  SimpleEvent(g_date->Date() + 5, dk_car_sharrow2, false);
128  break;
129  case dk_car_sharrow2:
130  if (!m_farm->ShallowHarrow(m_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear()))
131  {
132  SimpleEvent(g_date->Date() + 1, dk_car_sharrow2, true);
133  break;
134  }
135  // LKM: Queue up the next event - shallow harrow3 (making seedbed) done 5 days after, and before the 15th of May - if not done, try again +1 day until the 15th of May when we will succeed
136  SimpleEvent(g_date->Date() + 5, dk_car_sharrow3, false);
137  break;
138  case dk_car_sharrow3:
139  if (!m_farm->ShallowHarrow(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear()))
140  {
141  SimpleEvent(g_date->Date() + 1, dk_car_sharrow3, true);
142  break;
143  }
144  // LKM: Queue up the next event - shallow harrow4 (making seedbed) done 5 days after, and before the 20th of May - if not done, try again +1 day until the 20th of May when we will succeed
145  SimpleEvent(g_date->Date() + 5, dk_car_sharrow4, false);
146  break;
147  case dk_car_sharrow4:
148  if (!m_farm->ShallowHarrow(m_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear()))
149  {
150  SimpleEvent(g_date->Date() + 1, dk_car_sharrow4, true);
151  break;
152  }
153  // LKM: Queue up the next event - water1 done before the 25th of May - if not done, try again +1 day until the 25th of May when we will succeed
154  SimpleEvent(g_date->Date() + 1, dk_car_water1, false);
155  break;
156  case dk_car_water1:
157  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(25, 5) - g_date->DayInYear()))
158  {
159  SimpleEvent(g_date->Date() + 1, dk_car_water1, true);
160  break;
161  }
162  // LKM: Queue up the next event - fungicide1 done before the 30th of May - if not done, try again +1 day until the 30th of May when we will succeed
163  SimpleEvent(g_date->Date() + 1, dk_car_fungicide1, false);
164  break;
165  case dk_car_fungicide1:
166  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear()))
167  {
168  SimpleEvent(g_date->Date() + 1, dk_car_fungicide1, true);
169  break;
170  }
171  // LKM: Queue up the next event - sow done before the 30th of May - if not done, try again +1 day until the 30th of May when we will succeed
172  SimpleEvent(g_date->Date(), dk_car_sow, false);
173  break;
174  case dk_car_sow:
175  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear()))
176  {
177  SimpleEvent(g_date->Date() + 1, dk_car_sow, true);
178  break;
179  }
180  // LKM: Queue up the next event - herbicide2 done before the 5th of June - if not done, try again + 1 day until the 5th of June when we will succeed
181  SimpleEvent(g_date->Date() + 1, dk_car_herbicide2, false);
182  break;
183  case dk_car_herbicide2:
184  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(5, 6) - g_date->DayInYear()))
185  {
186  SimpleEvent(g_date->Date() + 1, dk_car_herbicide2, true);
187  break;
188  }
189  // LKM: Queue up the next event - herbicide3 done before the 10th of June - if not done, try again + 1 day until the 10th of June when we will succeed
190  SimpleEvent(g_date->Date() + 1, dk_car_herbicide3, false);
191  break;
192  case dk_car_herbicide3:
193  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(10, 6) - g_date->DayInYear()))
194  {
195  SimpleEvent(g_date->Date() + 1, dk_car_herbicide3, true);
196  break;
197  }
198  // LKM: Queue up the next event - fertilizer1 done before the 15th of June - if not done, try again + 1 day until the 15th of June when we will succeed
199  SimpleEvent(g_date->Date() + 1, dk_car_ferti_s1, false);
200  break;
201  case dk_car_ferti_s1:
202  if (a_farm->IsStockFarmer()) {
203  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear()))
204  {
205  SimpleEvent(g_date->Date() + 1, dk_car_ferti_s1, true);
206  break;
207  }// LKM: Queue up the next event - herbicide4 + row cultivation1 at the same time done before the 20th of June - if not done, try again + 1 day until the 20th of June when we will succeed
208  SimpleEvent(g_date->Date() + 1, dk_car_herbicide4, false);
209  break;
210  }
211  else SimpleEvent(g_date->Date() + 1, dk_car_ferti_p1, false);
212  break;
213 
214  case dk_car_ferti_p1:
215  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear()))
216  {
217  SimpleEvent(g_date->Date() + 1, dk_car_ferti_p1, true);
218  break;
219  }// LKM: Queue up the next event - herbicide4 + row cultivation1 at the same time done before the 20th of June - if not done, try again + 1 day until the 20th of June when we will succeed
220  SimpleEvent(g_date->Date() + 1, dk_car_herbicide4, false);
221  break;
222 
223  case dk_car_herbicide4:
224  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(20, 6) - g_date->DayInYear()))
225  {
226  SimpleEvent(g_date->Date() + 1, dk_car_herbicide4, true);
227  break;
228  }
230  break;
232  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(21, 6) - g_date->DayInYear()))
233  {
235  break;
236  }
237  // LKM: Queue up the next event - herbicide5 + row cultivation2 (+8 days after) at the same time done before the 30th of June - if not done, try again + 1 day until the 30th of June when we will succeed
238  SimpleEvent(g_date->Date() + 8, dk_car_herbicide5, false);
239  break;
240  case dk_car_herbicide5:
241  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(29, 6) - g_date->DayInYear()))
242  {
243  SimpleEvent(g_date->Date() + 1, dk_car_herbicide5, true);
244  break;
245  }
247  break;
249  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear()))
250  {
252  break;
253  }
254  // LKM: Queue up the next event - water2 done before the 30th of June - if not done, try again +1 day until the 30th of June when we will succeed
255  SimpleEvent(g_date->Date(), dk_car_water2, false);
256  break;
257  case dk_car_water2:
258  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(1, 7) - g_date->DayInYear()))
259  {
260  SimpleEvent(g_date->Date() + 1, dk_car_water2, true);
261  break;
262  }
263  // LKM: Queue up the next event - hilling up1 done before the 5th of July - if not done, try again +1 day until the 5th of July when we will succeed
264  SimpleEvent(g_date->Date() + 1, dk_car_hilling_up1, false);
265  break;
266  case dk_car_hilling_up1:
267  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(5, 7) - g_date->DayInYear()))
268  {
269  SimpleEvent(g_date->Date() + 1, dk_car_hilling_up1, true);
270  break;
271  }
272  // LKM: Queue up the next event - herbicide6 done before the 10th of July - if not done, try again + 1 day until the 10th of July when we will succeed
273  SimpleEvent(g_date->Date() + 1, dk_car_herbicide6, false);
274  break;
275  case dk_car_herbicide6:
276  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(10, 7) - g_date->DayInYear()))
277  {
278  SimpleEvent(g_date->Date() + 1, dk_car_herbicide6, true);
279  break;
280  }
281  // LKM: Queue up the next event - add boron1 done before the 10th of July - if not done, try again + 1 day until the 10th of July when we will succeed
283  break;
284  case dk_car_boron_s1:
285  if (a_farm->IsStockFarmer()) {
286  if (!m_farm->FA_Boron(m_field, 0.0, g_date->DayInYear(11, 7) - g_date->DayInYear()))
287  {
288  SimpleEvent(g_date->Date() + 1, dk_car_boron_s1, true);
289  break;
290  }
291  // LKM: Queue up the next event - water3 done before the 20th of July - if not done, try again +1 day until the 10th of July when we will succeed
292  SimpleEvent(g_date->Date() + 1, dk_car_water3, false);
293  break;
294  }
295  else
297  break;
298 
299  case dk_car_boron_p1:
300  if (!m_farm->FP_Boron(m_field, 0.0, g_date->DayInYear(11, 7) - g_date->DayInYear()))
301  {
302  SimpleEvent(g_date->Date() + 1, dk_car_boron_p1, true);
303  break;
304  }
305  // LKM: Queue up the next event - water3 done before the 20th of July - if not done, try again +1 day until the 10th of July when we will succeed
306  SimpleEvent(g_date->Date() + 1, dk_car_water3, false);
307  break;
308 
309  case dk_car_water3:
310  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(20, 7) - g_date->DayInYear()))
311  {
312  SimpleEvent(g_date->Date() + 1, dk_car_water3, true);
313  break;
314  }
315  // LKM: Queue up the next event - hilling up2 done before the 30th of July - if not done, try again +1 day until the 30th of July when we will succeed
316  SimpleEvent(g_date->Date() + 1, dk_car_hilling_up2, false);
317  break;
318  case dk_car_hilling_up2:
319  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(30, 7) - g_date->DayInYear()))
320  {
321  SimpleEvent(g_date->Date() + 1, dk_car_hilling_up2, true);
322  break;
323  }
324  // LKM: Queue up the next event - boron2 done after the 1st of May, and before the 30th of August - if not done, try again +1 day until the 30th of August when we will succeed
326  break;
327  case dk_car_boron_s2:
328  if (a_farm->IsStockFarmer()) {
329  if (!m_farm->FA_Boron(m_field, 0.0, g_date->DayInYear(28, 8) - g_date->DayInYear()))
330  {
331  SimpleEvent(g_date->Date() + 1, dk_car_boron_s2, true);
332  break;
333  }
334  // LKM: Queue up the next event - hilling up3 done before the 30th of August - if not done, try again +1 day until the 30th of July when we will succeed
336  break;
337  }
338  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_car_boron_p2, false);
339  break;
340 
341  case dk_car_boron_p2:
342  if (!m_farm->FP_Boron(m_field, 0.0, g_date->DayInYear(28, 8) - g_date->DayInYear()))
343  {
344  SimpleEvent(g_date->Date() + 1, dk_car_boron_p2, true);
345  break;
346  }
347  // LKM: Queue up the next event - hilling up3 done before the 30th of August - if not done, try again +1 day until the 30th of July when we will succeed
349  break;
350 
351  case dk_car_hilling_up3:
352  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(29, 8) - g_date->DayInYear()))
353  {
354  SimpleEvent(g_date->Date() + 1, dk_car_hilling_up3, true);
355  break;
356  }
357  // LKM: Queue up the next event - fertilizer2 done after the 10th of June and before the 30th of August - if not done, try again +1 day until the 30th of August when we will succeed
359  break;
360  case dk_car_ferti_s2:
361  if (a_farm->IsStockFarmer()) {
362  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 8) - g_date->DayInYear()))
363  {
364  SimpleEvent(g_date->Date() + 1, dk_car_ferti_s2, true);
365  break;
366  }
367  // LKM: Here is a fork leading to two parallel events
368  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 6) + m_date_modifier, dk_car_insecticide1, false); // Insecticide thread
369  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 6), dk_car_fungicide2, false); // Fungicide thread
370  break;
371  }
372  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 6), dk_car_ferti_p2, false);
373  break;
374 
375  case dk_car_ferti_p2:
376  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 8) - g_date->DayInYear()))
377  {
378  SimpleEvent(g_date->Date() + 1, dk_car_ferti_p2, true);
379  break;
380  }
381  // LKM: Here is a fork leading to two parallel events
382  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 6) + m_date_modifier, dk_car_insecticide1, false); // Insecticide thread
383  SimpleEvent(g_date->OldDays() + g_date->DayInYear(10, 6), dk_car_fungicide2, false); // Fungicide thread
384  break;
385 
386  case dk_car_insecticide1:
387  // here we check whether we are using ERA pesticide or not
388  d1 = g_date->DayInYear(30, 9) - g_date->DayInYear();
389  if (!cfg_pest_carrots_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
390  {
391  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
392  }
393  else {
394  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
395  }
396  if (!flag) {
398  break;
399  }
400  //LKM: Queue up the next event - insecticide2 (+ 7 days after) done before the 7th of October - if not done, try again +1 day until the 7th of October when we will succeed
401  SimpleEvent(g_date->Date() + 7, dk_car_insecticide2, false);
402  break;
403  case dk_car_insecticide2:
404  // here we check whether we are using ERA pesticide or not
405  d1 = g_date->DayInYear(8, 10) - g_date->DayInYear();
406  if (!cfg_pest_carrots_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
407  {
408  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
409  }
410  else {
411  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
412  }
413  if (!flag) {
415  break;
416  }
417  //End of thread
418  break;
419 
420  case dk_car_fungicide2:
421  // Here comes the fungicide thread - done before the 30th of September - if not done, try again +1 day until the 30th of September when we will succeed
422  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear()))
423  {
424  SimpleEvent(g_date->Date() + 1, dk_car_fungicide2, true);
425  break;
426  }
427  // LKM: Queue up the next event - fungicide3 (+ 14 days after) done before the 15th of October - if not done, try again +1 day until the 15th of October when we will succeed
428  SimpleEvent(g_date->Date() + 14, dk_car_fungicide3, false);
429  break;
430  case dk_car_fungicide3:
431  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear()))
432  {
433  SimpleEvent(g_date->Date() + 1, dk_car_fungicide3, true);
434  break;
435  }
436  //End of thread
437  // LKM: Queue up the next event - harvest done before the 30th of November - if not done, try again +1 day until the 30th of November when we will succeed
438  SimpleEvent(g_date->Date() + 1, dk_car_harvest, false);
439  break;
440  case dk_car_harvest:
441  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
442  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
443  SimpleEvent(g_date->Date() + 1, dk_car_harvest, true);
444  break;
445  }
446  d1 = g_date->Date();
447  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
448  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 7), dk_car_wait, false);
449  // Because we are ending harvest before 1.7 so we need to wait until the 1.7
450  break;
451  }
452  else {
453  done = true; // end of plan
454  }
455  }
456  case dk_car_wait:
457  done = true;
458  break;
459  default:
460  g_msg->Warn(WARN_BUG, "DK_Carrots::Do(): ""Unknown event type! ", "");
461  exit(1);
462  }
463  return done;
464 }

References Farm::BedForming(), cfg_pest_carrots_on, cfg_pest_product_amounts, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DeepPlough(), dk_car_bedformer, dk_car_boron_p1, dk_car_boron_p2, dk_car_boron_s1, dk_car_boron_s2, dk_car_deep_harrow, dk_car_ferti_p1, dk_car_ferti_p2, dk_car_ferti_s1, dk_car_ferti_s2, DK_CAR_FORCESPRING, dk_car_fungicide1, dk_car_fungicide2, dk_car_fungicide3, dk_car_harvest, dk_car_herbicide1, dk_car_herbicide2, dk_car_herbicide3, dk_car_herbicide4, dk_car_herbicide5, dk_car_herbicide6, dk_car_hilling_up1, dk_car_hilling_up2, dk_car_hilling_up3, dk_car_insecticide1, dk_car_insecticide2, dk_car_row_cultivation1, dk_car_row_cultivation2, dk_car_sharrow1, dk_car_sharrow2, dk_car_sharrow3, dk_car_sharrow4, dk_car_sow, dk_car_start, dk_car_stoneburier, dk_car_wait, dk_car_water1, dk_car_water2, dk_car_water3, Farm::DoIt_prob(), Farm::FA_Boron(), Farm::FA_NPK(), Farm::FP_Boron(), Farm::FP_NPK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::Harvest(), 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(), Farm::RowCultivation(), Farm::ShallowHarrow(), Crop::SimpleEvent(), Farm::SpringSow(), Crop::StartUpCrop(), tov_DKCarrots, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void DK_Carrots::SetUpFarmCategoryInformation ( )
inline
84  {
85  const int elements = 2 + (dk_car_foobar - DK_CAR_BASE);
87 
88  FarmManagementCategory catlist[elements] =
89  {
90  fmc_Others, // zero element unused but must be here
91  fmc_Others, // dk_car_start = 1, // Compulsory, start event must always be 1 (one).
92  fmc_Cultivation, // dk_car_stoneburier = DK_CAR_BASE,
93  fmc_Herbicide, // dk_car_herbicide1,
94  fmc_Cultivation, // dk_car_deep_harrow,
95  fmc_Cultivation, // dk_car_bedformer,
96  fmc_Cultivation, // dk_car_sharrow1,
97  fmc_Cultivation, // dk_car_sharrow2,
98  fmc_Cultivation, // dk_car_sharrow3,
99  fmc_Cultivation, // dk_car_sharrow4,
100  fmc_Watering, // dk_car_water1,
101  fmc_Fungicide, // dk_car_fungicide1,
102  fmc_Others, // dk_car_sow,
103  fmc_Herbicide, // dk_car_herbicide2,
104  fmc_Herbicide, // dk_car_herbicide3,
105  fmc_Fertilizer, // dk_car_ferti_s1,
106  fmc_Fertilizer, // dk_car_ferti_p1,
107  fmc_Herbicide, // dk_car_herbicide4,
108  fmc_Cultivation, // dk_car_row_cultivation1,
109  fmc_Herbicide, // dk_car_herbicide5,
110  fmc_Cultivation, // dk_car_row_cultivation2,
111  fmc_Watering, // dk_car_water2,
112  fmc_Cultivation, // dk_car_hilling_up1,
113  fmc_Herbicide, // dk_car_herbicide6,
114  fmc_Fertilizer, // dk_car_boron_s1,
115  fmc_Fertilizer, // dk_car_boron_p1,
116  fmc_Watering, // dk_car_water3,
117  fmc_Cultivation, // dk_car_hilling_up2,
118  fmc_Fertilizer, // dk_car_boron_s2,
119  fmc_Fertilizer, // dk_car_boron_p2,
120  fmc_Cultivation, // dk_car_hilling_up3,
121  fmc_Fertilizer, // dk_car_ferti_s2,
122  fmc_Fertilizer, // dk_car_ferti_p2,
123  fmc_Insecticide, // dk_car_insecticide1,
124  fmc_Insecticide, // dk_car_insecticide2,
125  fmc_Fungicide, // dk_car_fungicide2,
126  fmc_Fungicide, // dk_car_fungicide3,
127  fmc_Harvest, // dk_car_harvest,
128  fmc_Others // dk_car_wait,
129 
130  // no foobar entry
131 
132  };
133  // Iterate over the catlist elements and copy them to vector
134  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
135  }

References DK_CAR_BASE, dk_car_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_Carrots().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
dk_car_water1
Definition: DK_Carrots.h:44
dk_car_ferti_s2
Definition: DK_Carrots.h:65
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
dk_car_fungicide2
Definition: DK_Carrots.h:69
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
dk_car_deep_harrow
Definition: DK_Carrots.h:38
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
dk_car_boron_s2
Definition: DK_Carrots.h:62
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
dk_car_boron_p1
Definition: DK_Carrots.h:59
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
dk_car_herbicide5
Definition: DK_Carrots.h:53
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
DK_Carrots::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_Carrots.h:84
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_car_sharrow3
Definition: DK_Carrots.h:42
dk_car_ferti_p1
Definition: DK_Carrots.h:50
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
Farm::BedForming
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
Definition: FarmFuncs.cpp:1316
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
dk_car_sharrow4
Definition: DK_Carrots.h:43
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_car_stoneburier
Definition: DK_Carrots.h:36
DK_CAR_FORCESPRING
#define DK_CAR_FORCESPRING
Definition: DK_Carrots.h:32
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
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_car_sharrow2
Definition: DK_Carrots.h:41
dk_car_hilling_up2
Definition: DK_Carrots.h:61
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
dk_car_fungicide1
Definition: DK_Carrots.h:45
dk_car_bedformer
Definition: DK_Carrots.h:39
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
tov_DKCarrots
Definition: LandscapeFarmingEnums.h:353
dk_car_fungicide3
Definition: DK_Carrots.h:70
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_car_ferti_p2
Definition: DK_Carrots.h:66
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
dk_car_row_cultivation1
Definition: DK_Carrots.h:52
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
dk_car_hilling_up3
Definition: DK_Carrots.h:64
dk_car_insecticide1
Definition: DK_Carrots.h:67
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
dk_car_sharrow1
Definition: DK_Carrots.h:40
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FA_Boron
virtual bool FA_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:868
dk_car_herbicide2
Definition: DK_Carrots.h:47
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
Farm::FP_Boron
virtual bool FP_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:854
dk_car_wait
Definition: DK_Carrots.h:72
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
dk_car_herbicide3
Definition: DK_Carrots.h:48
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
dk_car_ferti_s1
Definition: DK_Carrots.h:49
dk_car_herbicide4
Definition: DK_Carrots.h:51
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
dk_car_insecticide2
Definition: DK_Carrots.h:68
dk_car_harvest
Definition: DK_Carrots.h:71
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
dk_car_water3
Definition: DK_Carrots.h:60
dk_car_herbicide1
Definition: DK_Carrots.h:37
dk_car_start
Definition: DK_Carrots.h:35
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
dk_car_row_cultivation2
Definition: DK_Carrots.h:54
dk_car_boron_s1
Definition: DK_Carrots.h:58
Farm::DeepPlough
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
Definition: FarmFuncs.cpp:408
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
dk_car_hilling_up1
Definition: DK_Carrots.h:56
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
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::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
cfg_pest_carrots_on
CfgBool cfg_pest_carrots_on
Turn on pesticides for carrots.
dk_car_water2
Definition: DK_Carrots.h:55
DK_CAR_BASE
#define DK_CAR_BASE
Definition: DK_Carrots.h:31
dk_car_sow
Definition: DK_Carrots.h:46
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
dk_car_herbicide6
Definition: DK_Carrots.h:57
dk_car_boron_p2
Definition: DK_Carrots.h:63
dk_car_foobar
Definition: DK_Carrots.h:73
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001