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

#include <DK_MixedVeg.h>

Inheritance diagram for DK_MixedVeg:
Crop

Public Member Functions

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

DK_MixedVeg::DK_MixedVeg ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
88  : Crop(a_tov, a_toc, a_L)
89  {
92  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

35 {
36  m_farm = a_farm;
37  m_field = a_field;
38  m_ev = a_ev;
39  bool done = false;
40  bool flag = false;
41  int d1 = 0;
43 
44  switch ( m_ev->m_todo ) {
45  case dk_mv_start:
46  {
47  a_field->ClearManagementActionSum();
48  DK_MV_FORCESPRING = false;
49  m_last_date = g_date->DayInYear(31, 10); // Should match the last flexdate below
50  //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
51  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
52  // Set up the date management stuff
53  // Start and stop dates for all events after harvest
54  flexdates[0][1] = g_date->DayInYear(31, 10); // last possible day
55  // Now these are done in pairs, start & end for each operation. If its not used then -1
56  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
57  flexdates[1][1] = g_date->DayInYear(31, 10); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
58 
59  // 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
60  int isSpring = 365;
61  if (StartUpCrop(isSpring, flexdates, int(dk_mv_molluscicide))) break;
62 
63  // End single block date checking code. Please see next line comment as well.
64  // Reinit d1 to first possible starting date.
65  d1 = g_date->OldDays() + g_date->DayInYear(1, 2) + isSpring;
66  if (m_ev->m_forcespring) {
67  int day_num_shift = 365;
68  if (g_date->DayInYear() < 70) day_num_shift = 0;
69  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 2) + day_num_shift, dk_mv_molluscicide, false);
70  break;
71  DK_MV_FORCESPRING = true;
72  }
73  else
74  // OK, let's go.
75  SimpleEvent(d1, dk_mv_molluscicide, false);
76  }
77  break;
78 
79  case dk_mv_molluscicide:
80  if (m_ev->m_lock || m_farm->DoIt_prob(0.10)) { // if issues with snails
81  if (!m_farm->Molluscicide(m_field, 0.0,
82  g_date->DayInYear(15, 3) - g_date->DayInYear())) {
84  break;
85  }
86  }
88  break;
89 
91  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
92  if (!m_farm->SpringPlough(m_field, 0.0,
93  g_date->DayInYear(20, 3) - g_date->DayInYear())) {
95  break;
96  }
97  }
99  break;
100 
101  case dk_mv_strigling1:
102  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
103  if (!m_farm->Strigling(m_field, 0.0,
104  g_date->DayInYear(27, 3) - g_date->DayInYear())) {
105  SimpleEvent(g_date->Date() + 1, dk_mv_strigling1, true);
106  break;
107  }
108  }
109  SimpleEvent(g_date->Date() + 5, dk_mv_strigling2, false);
110  break;
111 
112  case dk_mv_strigling2:
113  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
114  if (!m_farm->Strigling(m_field, 0.0,
115  g_date->DayInYear(4, 4) - g_date->DayInYear())) {
116  SimpleEvent(g_date->Date() + 1, dk_mv_strigling2, true);
117  break;
118  }
119  }
120  SimpleEvent(g_date->Date() + 5, dk_mv_strigling3, false);
121  break;
122 
123  case dk_mv_strigling3:
124  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
125  if (!m_farm->Strigling(m_field, 0.0,
126  g_date->DayInYear(12, 4) - g_date->DayInYear())) {
127  SimpleEvent(g_date->Date() + 1, dk_mv_strigling3, true);
128  break;
129  }
130  }
131  SimpleEvent(g_date->Date() + 5, dk_mv_strigling4, false);
132  break;
133 
134  case dk_mv_strigling4:
135  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
136  if (!m_farm->Strigling(m_field, 0.0,
137  g_date->DayInYear(20, 4) - g_date->DayInYear())) {
138  SimpleEvent(g_date->Date() + 1, dk_mv_strigling4, true);
139  break;
140  }
141  } // suggests 25% of the field (farmers) plant early salat, 25% weeks after, 25% plant summer, 25% plant autumn
142  SimpleEvent(g_date->Date() + 1, dk_mv_herbicide1, false); // planting in week 12-16
143  break;
144 
145  case dk_mv_herbicide1:
146  if (m_ev->m_lock || m_farm->DoIt_prob(0.25)) {
147  if (!m_farm->HerbicideTreat(m_field, 0.0,
148  g_date->DayInYear(24, 4) - g_date->DayInYear())) {
149  SimpleEvent(g_date->Date() + 1, dk_mv_herbicide1, true);
150  break;
151  }
152  SimpleEvent(g_date->Date() + 1, dk_mv_plant1, false); // planting in week 12-16
153  break;
154  }
155  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(30, 4), dk_mv_herbicide2, false); // planting in week 17-21
156  break;
157 
158  case dk_mv_herbicide2:
159  if (m_ev->m_lock || m_farm->DoIt_prob(0.25/0.75)) {
160  if (!m_farm->HerbicideTreat(m_field, 0.0,
161  g_date->DayInYear(24, 5) - g_date->DayInYear())) {
162  SimpleEvent(g_date->Date() + 1, dk_mv_herbicide2, true);
163  break;
164  }
165  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_mv_plant2, false); // planting in week 17-21
166  break;
167  }
168  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(31, 5), dk_mv_herbicide3, false); // planting in week 22-26
169  break;
170 
171  case dk_mv_herbicide3:
172  if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.50)) {
173  if (!m_farm->HerbicideTreat(m_field, 0.0,
174  g_date->DayInYear(24, 6) - g_date->DayInYear())) {
175  SimpleEvent(g_date->Date() + 1, dk_mv_herbicide3, true);
176  break;
177  }
178  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 6), dk_mv_plant3, false); // planting in week 22-26
179  break;
180  }
181  else if (m_ev->m_lock || m_farm->DoIt_prob(0.25 / 0.25)) {
182  SimpleEvent(g_date->OldDays() + g_date->DayInYear(30, 6), dk_mv_herbicide4, false); // planting in week 27-32
183  break;
184  }
185 
186  case dk_mv_herbicide4:
187  if (!m_farm->HerbicideTreat(m_field, 0.0,
188  g_date->DayInYear(9, 8) - g_date->DayInYear())) {
189  SimpleEvent(g_date->Date() + 1, dk_mv_herbicide4, true);
190  break;
191  }
192  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 7), dk_mv_plant4, false); // planting in week 27-32
193  break;
194 
195  case dk_mv_plant1:
196  if (!m_farm->SpringSowWithFerti(m_field, 0.0,
197  g_date->DayInYear(25, 4) - g_date->DayInYear())) {
198  SimpleEvent(g_date->Date() + 1, dk_mv_plant1, true);
199  break;
200  }
202  SimpleEvent(g_date->Date(), dk_mv_water1, false);
203  SimpleEvent(g_date->Date() + 7, dk_mv_fungicide1, false);
204  SimpleEvent(g_date->Date() + 14, dk_mv_ferti_s1, false);
206  SimpleEvent(g_date->Date() + 77, dk_mv_harvest1, false); // main thread
207  break;
208 
209  case dk_mv_plant2:
210  if (!m_farm->SpringSowWithFerti(m_field, 0.0,
211  g_date->DayInYear(25, 5) - g_date->DayInYear())) {
212  SimpleEvent(g_date->Date() + 1, dk_mv_plant2, true);
213  break;
214  }
215  SimpleEvent(g_date->Date(), dk_mv_water1, false);
216  SimpleEvent(g_date->Date() + 7, dk_mv_fungicide1, false);
217  SimpleEvent(g_date->Date() + 14, dk_mv_ferti_s1, false);
219  SimpleEvent(g_date->Date() + 77, dk_mv_harvest2, false); // main thread
220  break;
221 
222  case dk_mv_plant3:
223  if (!m_farm->SpringSowWithFerti(m_field, 0.0,
224  g_date->DayInYear(25, 6) - g_date->DayInYear())) {
225  SimpleEvent(g_date->Date() + 1, dk_mv_plant3, true);
226  break;
227  }
228  SimpleEvent(g_date->Date(), dk_mv_water1, false);
229  SimpleEvent(g_date->Date() + 7, dk_mv_fungicide1, false);
230  SimpleEvent(g_date->Date() + 7, dk_mv_insecticide1, false);
231  SimpleEvent(g_date->Date() + 14, dk_mv_ferti_s1, false);
232  SimpleEvent(g_date->Date() + 42, dk_mv_harvest2, false); // main thread
233  break;
234 
235  case dk_mv_plant4:
236  if (!m_farm->SpringSowWithFerti(m_field, 0.0,
237  g_date->DayInYear(10, 8) - g_date->DayInYear())) {
238  SimpleEvent(g_date->Date() + 1, dk_mv_plant4, true);
239  break;
240  }
241  SimpleEvent(g_date->Date(), dk_mv_water1, false);
242  SimpleEvent(g_date->Date() + 7, dk_mv_fungicide1, false);
243  SimpleEvent(g_date->Date() + 7, dk_mv_insecticide1, false);
244  SimpleEvent(g_date->Date() + 14, dk_mv_ferti_s1, false);
245  SimpleEvent(g_date->Date() + 77, dk_mv_harvest3, false); // main thread
246  break;
247 
248  case dk_mv_cover_on:
249  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
250  if (!m_farm->FiberCovering(m_field, 0.0,
251  g_date->DayInYear(22, 4) - g_date->DayInYear())) {
252  SimpleEvent(g_date->Date() + 1, dk_mv_cover_on, true);
253  break;
254  }
255  }
257  break;
258 
259  case dk_mv_cover_off:
260  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
261  if (!m_farm->FiberRemoval(m_field, 0.0,
262  g_date->DayInYear(15, 5) - g_date->DayInYear())) {
263  SimpleEvent(g_date->Date() + 1, dk_mv_cover_off, true);
264  break;
265  }
266  }
267  break;
268 
269  case dk_mv_water1:
270  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
271  if (!m_farm->Water(m_field, 0.0,
272  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
273  SimpleEvent(g_date->Date() + 1, dk_mv_water1, true);
274  break;
275  }
276  }
277  SimpleEvent(g_date->Date() + 14, dk_mv_water2, false);
278  break;
279 
280  case dk_mv_water2:
281  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
282  if (!m_farm->Water(m_field, 0.0,
283  g_date->DayInYear(7, 9) - g_date->DayInYear())) {
284  SimpleEvent(g_date->Date() + 1, dk_mv_water2, true);
285  break;
286  }
287  }
288  SimpleEvent(g_date->Date() + 14, dk_mv_water3, false);
289  break;
290 
291  case dk_mv_water3:
292  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
293  if (!m_farm->Water(m_field, 0.0,
294  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
295  SimpleEvent(g_date->Date() + 1, dk_mv_water3, true);
296  break;
297  }
298  }
299  break;
300 
301  case dk_mv_fungicide1:
302  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
303  if (!m_farm->FungicideTreat(m_field, 0.0,
304  g_date->DayInYear(18, 8) - g_date->DayInYear())) {
305  SimpleEvent(g_date->Date() + 1, dk_mv_fungicide1, true);
306  break;
307  }
308  }
309  SimpleEvent(g_date->Date() + 7, dk_mv_fungicide2, false);
310  break;
311 
312  case dk_mv_fungicide2:
313  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
314  if (!m_farm->FungicideTreat(m_field, 0.0,
315  g_date->DayInYear(31, 8) - g_date->DayInYear())) {
316  SimpleEvent(g_date->Date() + 1, dk_mv_fungicide2, true);
317  break;
318  }
319  }
320  break;
321 
322  case dk_mv_ferti_s1:
323  if (a_farm->IsStockFarmer()){
324  if (!m_farm->FA_NPKS(m_field, 0.0,
325  g_date->DayInYear(25, 8) - g_date->DayInYear())) {
326  SimpleEvent(g_date->Date() + 1, dk_mv_ferti_s1, true);
327  break;
328  }
329  SimpleEvent(g_date->Date() + 7, dk_mv_ferti_s2, false);
330  break;
331  }
332  else
334  break;
335 
336  case dk_mv_ferti_p1:
337  if (!m_farm->FP_NPKS(m_field, 0.0,
338  g_date->DayInYear(25, 8) - g_date->DayInYear())) {
339  SimpleEvent(g_date->Date() + 1, dk_mv_ferti_p1, true);
340  break;
341  }
342  SimpleEvent(g_date->Date() + 7, dk_mv_ferti_p2, false);
343  break;
344 
345  case dk_mv_ferti_s2:
346  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)
347  {
348  if (!m_farm->FA_NPKS(m_field, 0.0,
349  g_date->DayInYear(7, 9) - g_date->DayInYear())) {
350  SimpleEvent(g_date->Date() + 1, dk_mv_ferti_s2, true);
351  break;
352  }
353  }
355  break;
356 
357  case dk_mv_ferti_p2:
358  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)
359  {
360  if (!m_farm->FP_NPKS(m_field, 0.0,
361  g_date->DayInYear(7, 9) - g_date->DayInYear())) {
362  SimpleEvent(g_date->Date() + 1, dk_mv_ferti_p2, true);
363  break;
364  }
365  }
367  break;
368 
370  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
371  if (!m_farm->RowCultivation(m_field, 0.0,
372  g_date->DayInYear(15, 9) - g_date->DayInYear())) {
374  break;
375  }
376  }
378  break;
379 
381  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
382  if (!m_farm->RowCultivation(m_field, 0.0,
383  g_date->DayInYear(30, 9) - g_date->DayInYear())) {
385  break;
386  }
387  }
388  break;
389 
390  case dk_mv_insecticide1:
391  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
392  // here we check whether we are using ERA pesticide or not
393  d1 = g_date->DayInYear(18, 8) - g_date->DayInYear();
394  if (!cfg_pest_veg_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
395  {
396  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
397  }
398  else {
399  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
400  }
401  if (!flag) {
402  SimpleEvent(g_date->Date() + 1, dk_mv_insecticide1, true);
403  break;
404  }
405  }
406  SimpleEvent(g_date->Date() + 7, dk_mv_insecticide2, false);
407  break;
408 
409  case dk_mv_insecticide2:
410  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
411  // here we check whether we are using ERA pesticide or not
412  d1 = g_date->DayInYear(31, 8) - g_date->DayInYear();
413  if (!cfg_pest_veg_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
414  {
415  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
416  }
417  else {
418  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
419  }
420  if (!flag) {
421  SimpleEvent(g_date->Date() + 1, dk_mv_insecticide2, true);
422  break;
423  }
424  }
425  break;
426 
427  case dk_mv_harvest1: // 25% of all
428  if (!m_farm->Harvest(m_field, 0.0,
429  g_date->DayInYear(15, 7) - g_date->DayInYear())) {
430  SimpleEvent(g_date->Date() + 1, dk_mv_harvest1, true);
431  break;
432  }
433  d1 = g_date->Date();
434  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
435  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 7), dk_mv_wait, false);
436  // Because we are ending harvest before 1.7 so we need to wait until the 1.7
437  break;
438  }
439  else {
440  done = true; // end of plan
441  break;
442  }
443 
444  case dk_mv_harvest2: // 50% of all
445  if (!m_farm->Harvest(m_field, 0.0,
446  g_date->DayInYear(15, 8) - g_date->DayInYear())) {
447  SimpleEvent(g_date->Date() + 1, dk_mv_harvest2, true);
448  break;
449  }
450  d1 = g_date->Date();
451  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
452  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 7), dk_mv_wait, false);
453  // Because we are ending harvest before 1.7 so we need to wait until the 1.7
454  break;
455  }
456  else {
457  done = true; // end of plan
458  break;
459  }
460 
461  case dk_mv_harvest3: // 25% of all
462  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
463  SimpleEvent(g_date->Date() + 1, dk_mv_harvest3, true);
464  break;
465  }
466  done = true;
467  break;
468 
469  case dk_mv_wait:
470  done = true;
471  break;
472 
473  default:
474  g_msg->Warn( WARN_BUG, "DK_MixedVeg::Do(): "
475  "Unknown event type! ", "" );
476  exit( 1 );
477  }
478  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
479  return done;
480 }

References cfg_pest_product_amounts, cfg_pest_veg_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), dk_mv_cover_off, dk_mv_cover_on, dk_mv_ferti_p1, dk_mv_ferti_p2, dk_mv_ferti_s1, dk_mv_ferti_s2, DK_MV_FORCESPRING, dk_mv_fungicide1, dk_mv_fungicide2, dk_mv_harvest1, dk_mv_harvest2, dk_mv_harvest3, dk_mv_herbicide1, dk_mv_herbicide2, dk_mv_herbicide3, dk_mv_herbicide4, dk_mv_insecticide1, dk_mv_insecticide2, dk_mv_molluscicide, dk_mv_plant1, dk_mv_plant2, dk_mv_plant3, dk_mv_plant4, dk_mv_row_cultivation1, dk_mv_row_cultivation2, dk_mv_spring_plough, dk_mv_start, dk_mv_strigling1, dk_mv_strigling2, dk_mv_strigling3, dk_mv_strigling4, dk_mv_wait, dk_mv_water1, dk_mv_water2, dk_mv_water3, Farm::DoIt_prob(), Farm::FA_NPKS(), Farm::FiberCovering(), Farm::FiberRemoval(), Farm::FP_NPKS(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), LE::GetSoilType(), Farm::Harvest(), Farm::HerbicideTreat(), 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, Farm::Molluscicide(), Calendar::OldDays(), ppp_1, Farm::ProductApplication(), Farm::RowCultivation(), Crop::SimpleEvent(), Farm::SpringPlough(), Farm::SpringSowWithFerti(), Crop::StartUpCrop(), Farm::Strigling(), tos_LoamySand, tos_Sand, tos_SandyClayLoam, tos_SandyLoam, tov_DKMixedVeg, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void DK_MixedVeg::SetUpFarmCategoryInformation ( )
inline
93  {
94  const int elements = 2 + (dk_mv_foobar - DK_MV_BASE);
96 
97  FarmManagementCategory catlist[elements] =
98  {
99  fmc_Others, // zero element unused but must be here
100  fmc_Others, // dk_mv_start = 1, // Compulsory, start event must always be 1 (one).
101  fmc_Others, // dk_mv_mollusicicde = DK_MV_BASE,
102  fmc_Cultivation, // dk_mv_spring_plough,
103  fmc_Cultivation, // dk_mv_strigling1,
104  fmc_Cultivation, // dk_mv_strigling2,
105  fmc_Cultivation, // dk_mv_strigling3,
106  fmc_Cultivation, // dk_mv_strigling4,
107  fmc_Herbicide, // dk_mv_herbicide1,
108  fmc_Herbicide, // dk_mv_herbicide2,
109  fmc_Herbicide, // dk_mv_herbicide3,
110  fmc_Herbicide, // dk_mv_herbicide4,
111  fmc_Others, // dk_mv_plant1,
112  fmc_Others, // dk_mv_plant2,
113  fmc_Others, // dk_mv_plant3,
114  fmc_Others, // dk_mv_plant4,
115  fmc_Fertilizer, // dk_mv_ferti_s1,
116  fmc_Fertilizer, // dk_mv_ferti_p1,
117  fmc_Fertilizer, // dk_mv_ferti_s2,
118  fmc_Fertilizer, // dk_mv_ferti_p2,
119  fmc_Fungicide, // dk_mv_fungicide1,
120  fmc_Fungicide, // dk_mv_fungicide2,
121  fmc_Others, // dk_mv_cover_on,
122  fmc_Others, // dk_mv_cover_off,
123  fmc_Watering, // dk_mv_water1,
124  fmc_Watering, // dk_mv_water2,
125  fmc_Watering, // dk_mv_water3,
126  fmc_Cultivation, // dk_mv_row_cultivation1,
127  fmc_Cultivation, // dk_mv_row_cultivation2,
128  fmc_Insecticide, // dk_mv_insecticide1,
129  fmc_Insecticide, // dk_mv_insecticide2,
130  fmc_Harvest, // dk_mv_harvest1,
131  fmc_Harvest, // dk_mv_harvest2,
132  fmc_Harvest, // dk_mv_harvest3,
133  fmc_Others, // dk_mv_wait,
134  // No foobar entry
135  };
136  // Iterate over the catlist elements and copy them to vector
137  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
138  }

References DK_MV_BASE, dk_mv_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_MixedVeg().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
dk_mv_ferti_s2
Definition: DK_MixedVeg.h:62
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
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_mv_ferti_s1
Definition: DK_MixedVeg.h:60
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::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
tov_DKMixedVeg
Definition: LandscapeFarmingEnums.h:384
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
dk_mv_cover_off
Definition: DK_MixedVeg.h:67
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
dk_mv_harvest3
Definition: DK_MixedVeg.h:77
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::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
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
dk_mv_strigling2
Definition: DK_MixedVeg.h:49
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
dk_mv_fungicide2
Definition: DK_MixedVeg.h:65
dk_mv_strigling4
Definition: DK_MixedVeg.h:51
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_mv_ferti_p2
Definition: DK_MixedVeg.h:63
dk_mv_water2
Definition: DK_MixedVeg.h:69
dk_mv_herbicide2
Definition: DK_MixedVeg.h:53
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
dk_mv_herbicide1
Definition: DK_MixedVeg.h:52
DK_MV_BASE
#define DK_MV_BASE
Definition: DK_MixedVeg.h:40
dk_mv_foobar
Definition: DK_MixedVeg.h:79
DK_MixedVeg::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_MixedVeg.h:93
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_mv_ferti_p1
Definition: DK_MixedVeg.h:61
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_mv_start
Definition: DK_MixedVeg.h:45
dk_mv_wait
Definition: DK_MixedVeg.h:78
dk_mv_row_cultivation2
Definition: DK_MixedVeg.h:72
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_mv_herbicide3
Definition: DK_MixedVeg.h:54
dk_mv_water1
Definition: DK_MixedVeg.h:68
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
dk_mv_harvest2
Definition: DK_MixedVeg.h:76
dk_mv_strigling1
Definition: DK_MixedVeg.h:48
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
dk_mv_plant2
Definition: DK_MixedVeg.h:57
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
Farm::FiberCovering
virtual bool FiberCovering(LE *a_field, double a_user, int a_days)
Fiber covering applied on a_field.
Definition: FarmFuncs.cpp:1766
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
dk_mv_strigling3
Definition: DK_MixedVeg.h:50
dk_mv_harvest1
Definition: DK_MixedVeg.h:75
dk_mv_water3
Definition: DK_MixedVeg.h:70
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_mv_cover_on
Definition: DK_MixedVeg.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
tos_Sand
Definition: LandscapeFarmingEnums.h:719
dk_mv_herbicide4
Definition: DK_MixedVeg.h:55
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
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_mv_row_cultivation1
Definition: DK_MixedVeg.h:71
Farm::SpringSowWithFerti
virtual bool SpringSowWithFerti(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 with start fertilizer in the spring on a_field.
Definition: FarmFuncs.cpp:537
dk_mv_fungicide1
Definition: DK_MixedVeg.h:64
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
cfg_pest_veg_on
CfgBool cfg_pest_veg_on
Turn on pesticides for mixed vegetables.
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_mv_plant4
Definition: DK_MixedVeg.h:59
Farm::FiberRemoval
virtual bool FiberRemoval(LE *a_field, double a_user, int a_days)
Fiber covering removed from a_field.
Definition: FarmFuncs.cpp:1780
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_mv_plant1
Definition: DK_MixedVeg.h:56
dk_mv_insecticide2
Definition: DK_MixedVeg.h:74
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
dk_mv_insecticide1
Definition: DK_MixedVeg.h:73
dk_mv_plant3
Definition: DK_MixedVeg.h:58
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_mv_spring_plough
Definition: DK_MixedVeg.h:47
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_MV_FORCESPRING
#define DK_MV_FORCESPRING
Definition: DK_MixedVeg.h:42
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:630
dk_mv_molluscicide
Definition: DK_MixedVeg.h:46