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

DE_BushFruitPerm class
. More...

#include <DE_BushFruitPerm.h>

Inheritance diagram for DE_BushFruitPerm:
Crop

Public Member Functions

virtual bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 The one and only method for a crop management plan. All farm actions go through here. More...
 
 DE_BushFruitPerm (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
void SetUpFarmCategoryInformation ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
int GetFirstDate (void)
 
void ChooseNextCrop (int a_no_dates)
 Chooses the next crop to grow in a field. More...
 
int GetCropClassification ()
 
void SetCropClassification (int a_classification)
 
void GetCropType (TTypesOfCrops a_toc)
 
TTypesOfCrops GetCropType ()
 
FarmManagementCategory LookUpManagementCategory (int a_todo)
 
bool GetForceSpringOK ()
 

Additional Inherited Members

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

Detailed Description

DE_BushFruitPerm class
.

See DE_BushFruitPerm.h::DE_BushFruitPermToDo for a complete list of all possible events triggered codes by the management plan. When triggered these events are handled by Farm and are available as information for other objects such as animal and bird models.

Constructor & Destructor Documentation

◆ DE_BushFruitPerm()

DE_BushFruitPerm::DE_BushFruitPerm ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
93  : Crop(a_tov, a_toc, a_L)
94  {
95  // When we start it off, the first possible date for a farm operation is ...
96  // This information is used by other crops when they decide how much post processing of
97  // the management is allowed after harvest before the next crop starts.
98  m_first_date=g_date->DayInYear( 31,3 );
100  }

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

Member Function Documentation

◆ Do()

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

The one and only method for a crop management plan. All farm actions go through here.

Called every time something is done to the crop by the farmer in the first instance it is always called with a_ev->todo set to start, but susequently will be called whenever the farmer wants to carry out a new operation.
This method details all the management and relationships between operations necessary to grow and ALMaSS crop.

Reimplemented from Crop.

62 {
63  m_farm = a_farm;
64  m_field = a_field;
65  m_ev = a_ev;
66  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).
67  bool flag = false;
68  int d1 = 0;
69  int noDates = 1;
70  int today = g_date->Date();
72  // Depending what event has occured jump to the correct bit of code
73  switch (m_ev->m_todo)
74  {
75  case de_bfp_start:
76  {
77  // de_bfp_start just sets up all the starting conditions and reference dates that are needed to start a dk_bfp1
78  DE_BFP_EARLY_HARVEST = false;
79 
80  m_last_date = g_date->DayInYear(30, 12); // Should match the last flexdate below
81  //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
82  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
83  // Set up the date management stuff
84  // Start and stop dates for all events after harvest
85  flexdates[0][1] = g_date->DayInYear(30, 12); // last possible day of harvest - this is in effect day before the earliest date that a following crop can use - NO harvest here - this is herbicide2 instead
86  // Now these are done in pairs, start & end for each operation. If its not used then -1
87  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
88  flexdates[1][1] = g_date->DayInYear(30, 12); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) - water2
89 
90  // 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
91  int isSpring = 365;
92  if (StartUpCrop(isSpring, flexdates, int(de_bfp_herbicide1))) break;
93 
94  // End single block date checking code. Please see next line comment as well.
95  // Reinit d1 to first possible starting date.
96  d1 = g_date->OldDays() + g_date->DayInYear(1, 3) + isSpring;
97  // OK, let's go.
98  // LKM: Here we queue up the first event
99  SimpleEvent(d1, de_bfp_herbicide1, false);
100  break;
101  }
102  break;
103 
104  // LKM: This is the first real farm operation
105  case de_bfp_herbicide1:
106  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
107  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide1, true);
108  break;
109  }
110  d1 = g_date->Date() + 14;
111  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 4)) {
112  d1 = g_date->OldDays() + g_date->DayInYear(1, 4);
113  }
114  // fork of events
115  SimpleEvent(d1, de_bfp_herbicide2, false); // herbi thread
116  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4), de_bfp_fungicide1, false); // fungi/insecti thread - main thread
117  if (a_farm->IsStockFarmer()) {
119  break;
120  }
122  break;
123 
124  case de_bfp_herbicide2:
125  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
126  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide2, true);
127  break;
128  }
129  break;
130 
131  case de_bfp_fertilizer1_s:
132  if (m_farm->IsStockFarmer()) {
133  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
134  {
135  if (!a_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
137  break;
138  }
139  }
140  }
141  break;
142 
143  case de_bfp_fertilizer1_p:
144  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
145  {
146  if (!a_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
148  break;
149  }
150  }
151  break;
152 
153  case de_bfp_fungicide1:
154  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
155  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide1, true);
156  break;
157  }
159  break;
160 
161  case de_bfp_insecticide1:
163  {
164  if (m_field->GetGreenBiomass() <= 0) {
166  }
167  else
168  {
169  // here we check wheter we are using ERA pesticide or not
170  d1 = g_date->DayInYear(15, 4) - g_date->DayInYear();
171  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
172  {
173  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
174  }
175  else {
176  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
177  }
178  if (!flag) {
180  break;
181  }
182  }
183  }
184  SimpleEvent(g_date->Date()+14, de_bfp_fungicide2, false);
185  break;
186 
187  case de_bfp_fungicide2:
188  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
189  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide2, true);
190  break;
191  }
193  break;
194 
195  case de_bfp_insecticide2:
197  {
198  if (m_field->GetGreenBiomass() <= 0) {
200  }
201  else
202  {
203  // here we check wheter we are using ERA pesticide or not
204  d1 = g_date->DayInYear(30, 4) - g_date->DayInYear();
205  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
206  {
207  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
208  }
209  else {
210  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
211  }
212  if (!flag) {
214  break;
215  }
216  }
217  }
219  //SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), de_bfp_mow_margin1, false);
222  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 6), de_bfp_harvest, false); // main thread
223  break;
224 
226  if (!a_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
228  break;
229  }
231  break;
232 
234  if (!a_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear())) {
236  break;
237  }
238  break;
239 
240  case de_bfp_cover_on: // could be straw or fiber
241  if (!m_farm->StrawCovering(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
242  SimpleEvent(g_date->Date() + 1, de_bfp_cover_on, true);
243  break;
244  }
246  break;
247 
248  //case de_bfp_mow_margin1:
249  //if (!m_farm->CutWeeds(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
250  // SimpleEvent(g_date->Date() + 1, de_bfp_mow_margin1, true);
251  // break;
252  //}
253  //SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 8), de_bfp_mow_margin2, false);
254  //break;
255 
256  //case de_bfp_mow_margin2:
257  //if (!m_farm->CutWeeds(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
258  // SimpleEvent(g_date->Date() + 1, de_bfp_mow_margin2, true);
259  // break;
260  //}
261  //SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 9), de_bfp_manual_weeding2, false);
262  //break;
263 
264  //case de_bfp_mow_margin3:
265  //if (!m_farm->CutWeeds(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear())) {
266  // SimpleEvent(g_date->Date() + 1, de_bfp_mow_margin3, true);
267  // break;
268  //}
269  //break;
270 
271  case de_bfp_fungicide3:
272  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(7, 5) - g_date->DayInYear())) {
273  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide3, true);
274  break;
275  }
277  break;
278 
279  case de_bfp_insecticide3:
281  {
282  if (m_field->GetGreenBiomass() <= 0) {
284  }
285  else
286  {
287  // here we check wheter we are using ERA pesticide or not
288  d1 = g_date->DayInYear(7, 5) - g_date->DayInYear();
289  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
290  {
291  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
292  }
293  else {
294  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
295  }
296  if (!flag) {
298  break;
299  }
300  }
301  }
302  SimpleEvent(g_date->Date() + 7, de_bfp_fungicide4, false);
303  break;
304 
305  case de_bfp_fungicide4:
306  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
307  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide4, true);
308  break;
309  }
311  break;
312 
313  case de_bfp_insecticide4:
315  {
316  if (m_field->GetGreenBiomass() <= 0) {
318  }
319  else
320  {
321  // here we check wheter we are using ERA pesticide or not
322  d1 = g_date->DayInYear(15, 5) - g_date->DayInYear();
323  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
324  {
325  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
326  }
327  else {
328  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
329  }
330  if (!flag) {
332  break;
333  }
334  }
335  }
337  break;
338 
339 
340  case de_bfp_fungicide5:
341  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(23, 5) - g_date->DayInYear())) {
342  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide5, true);
343  break;
344  }
346  break;
347 
348  case de_bfp_insecticide5:
350  {
351  if (m_field->GetGreenBiomass() <= 0) {
353  }
354  else
355  {
356  // here we check wheter we are using ERA pesticide or not
357  d1 = g_date->DayInYear(23, 5) - g_date->DayInYear();
358  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
359  {
360  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
361  }
362  else {
363  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
364  }
365  if (!flag) {
367  break;
368  }
369  }
370  }
371  SimpleEvent(g_date->Date() + 7, de_bfp_fungicide6, false);
372  break;
373 
374  case de_bfp_fungicide6:
375  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
376  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide6, true);
377  break;
378  }
380  break;
381 
382  case de_bfp_insecticide6:
384  {
385  if (m_field->GetGreenBiomass() <= 0) {
387  }
388  else
389  {
390  // here we check wheter we are using ERA pesticide or not
391  d1 = g_date->DayInYear(15, 5) - g_date->DayInYear();
392  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
393  {
394  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
395  }
396  else {
397  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
398  }
399  if (!flag) {
401  break;
402  }
403  }
404  }
406  break;
407 
408  case de_bfp_fungicide7:
409  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
410  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide7, true);
411  break;
412  }
414  break;
415 
416  case de_bfp_fungicide8:
417  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
418  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide8, true);
419  break;
420  }
422  break;
423 
424  case de_bfp_insecticide7:
426  {
427  if (m_field->GetGreenBiomass() <= 0) {
429  }
430  else
431  {
432  // here we check wheter we are using ERA pesticide or not
433  d1 = g_date->DayInYear(15, 9) - g_date->DayInYear();
434  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
435  {
436  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
437  }
438  else {
439  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
440  }
441  if (!flag) {
443  break;
444  }
445  }
446  }
447  SimpleEvent(g_date->Date() +14, de_bfp_fungicide9, false);
448  break;
449 
450  case de_bfp_fungicide9:
451  if (!a_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear())) {
452  SimpleEvent(g_date->Date() + 1, de_bfp_fungicide9, true);
453  break;
454  }
456  break;
457 
458  case de_bfp_insecticide8:
460  {
461  if (m_field->GetGreenBiomass() <= 0) {
463  }
464  else
465  {
466  // here we check wheter we are using ERA pesticide or not
467  d1 = g_date->DayInYear(30, 9) - g_date->DayInYear();
468  if (!cfg_pest_bushfruit_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
469  {
470  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
471  }
472  else {
473  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 4);
474  }
475  if (!flag) {
477  break;
478  }
479  }
480  }
481  break;
482 
483  case de_bfp_water1:
484  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
485  SimpleEvent(g_date->Date() + 1, de_bfp_water1, true);
486  break;
487  }
488  SimpleEvent(g_date->Date()+14, de_bfp_water2, false);
489  break;
490 
491  case de_bfp_water2:
492  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
493  SimpleEvent(g_date->Date() + 1, de_bfp_water2, true);
494  break;
495  }
496  break;
497 
498  case de_bfp_harvest:
499  // continuous harvesting till 31 July, every 3rd day
500  m_farm->FruitHarvest(m_field, 0.0, 0);
501  if (today < g_date->OldDays() + g_date->DayInYear(31, 7)) {
503  break;
504  }
505  //fork of events:
508  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 8), de_bfp_herbicide3, false, m_farm, m_field); // main thread
509  if (a_farm->IsStockFarmer()) {
511  break;
512  }
514  break;
515 
516  case de_bfp_mowing_fruit:
517  if (!a_farm->Swathing(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
519  break;
520  }
521  break;
522 
523  case de_bfp_water3:
524  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
525  SimpleEvent(g_date->Date() + 1, de_bfp_water3, true);
526  break;
527  }
528  SimpleEvent(g_date->Date() + 14, de_bfp_water4, false);
529  break;
530 
531  case de_bfp_water4:
532  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear())) {
533  SimpleEvent(g_date->Date() + 1, de_bfp_water4, true);
534  break;
535  }
536  d1 = g_date->Date() + 14;
537  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 10)) {
538  d1 = g_date->OldDays() + g_date->DayInYear(1, 10);
539  }
540  SimpleEvent(d1, de_bfp_water5, false);
541  break;
542 
543  case de_bfp_water5:
544  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
545  SimpleEvent(g_date->Date() + 1, de_bfp_water5, true);
546  break;
547  }
548  break;
549 
550  case de_bfp_fertilizer2_s:
551  if (m_farm->IsStockFarmer()) {
552  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
553  {
554  if (!a_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
556  break;
557  }
558  }
559  }
560  break;
561 
563  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
564  {
565  if (!a_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
567  break;
568  }
569  }
570  break;
571 
572  case de_bfp_herbicide3:
573  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
574  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide3, true);
575  break;
576  }
577  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 10), de_bfp_herbicide4, false, m_farm, m_field); // main thread
578  break;
579 
580  case de_bfp_herbicide4:
581  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
582  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide4, true);
583  break;
584  }
585  d1 = g_date->Date() + 14;
586  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 11)) {
587  d1 = g_date->OldDays() + g_date->DayInYear(1, 11);
588  }
589  SimpleEvent_(d1, de_bfp_herbicide5, false, m_farm, m_field); // main thread
590  break;
591 
592  case de_bfp_herbicide5:
593  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
594  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide5, true);
595  break;
596  }
597  d1 = g_date->Date() + 14;
598  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 12)) {
599  d1 = g_date->OldDays() + g_date->DayInYear(1, 12);
600  }
601  SimpleEvent_(d1, de_bfp_herbicide6, false, m_farm, m_field); // main thread
602  break;
603 
604  case de_bfp_herbicide6:
605  if (!a_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 12) - g_date->DayInYear())) {
606  SimpleEvent(g_date->Date() + 1, de_bfp_herbicide6, true);
607  break;
608  }
609  done = true;
610  break;
611  // So we are done, and somewhere else the farmer will queue up the start event of the next crop (DE_BushFruitPerm)
612  // END of MAIN THREAD
613  break;
614  default:
615  g_msg->Warn(WARN_BUG, "DE_BushFruitPerm::Do(): "
616  "Unknown event type! ", "");
617  exit(1);
618  }
619  return done;
620 }

References cfg_pest_bushfruit_on, cfg_pest_product_amounts, Calendar::Date(), Calendar::DayInYear(), de_bfp_cover_on, DE_BFP_EARLY_HARVEST, de_bfp_fertilizer1_p, de_bfp_fertilizer1_s, de_bfp_fertilizer2_p, de_bfp_fertilizer2_s, de_bfp_fungicide1, de_bfp_fungicide2, de_bfp_fungicide3, de_bfp_fungicide4, de_bfp_fungicide5, de_bfp_fungicide6, de_bfp_fungicide7, de_bfp_fungicide8, de_bfp_fungicide9, de_bfp_harvest, de_bfp_herbicide1, de_bfp_herbicide2, de_bfp_herbicide3, de_bfp_herbicide4, de_bfp_herbicide5, de_bfp_herbicide6, de_bfp_insecticide1, de_bfp_insecticide2, de_bfp_insecticide3, de_bfp_insecticide4, de_bfp_insecticide5, de_bfp_insecticide6, de_bfp_insecticide7, de_bfp_insecticide8, de_bfp_manual_weeding1, de_bfp_manual_weeding2, de_bfp_mowing_fruit, de_bfp_start, de_bfp_water1, de_bfp_water2, de_bfp_water3, de_bfp_water4, de_bfp_water5, Farm::DoIt_prob(), Farm::FA_NPK(), Farm::FP_NPK(), Farm::FruitHarvest(), Farm::FungicideTreat(), g_date, g_landscape_ptr, g_msg, LE::GetGreenBiomass(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Farm::ManualWeeding(), Calendar::OldDays(), ppp_1, Farm::ProductApplication(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Crop::StartUpCrop(), Farm::StrawCovering(), Landscape::SupplyPestIncidenceFactor(), Farm::Swathing(), tov_DEBushFruitPerm, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void DE_BushFruitPerm::SetUpFarmCategoryInformation ( )
inline
101  {
102  const int elements = 2 + (de_bfp_foobar - DE_BFP_BASE);
104 
105  FarmManagementCategory catlist[elements] =
106  {
107  fmc_Others, // zero element unused but must be here
108  fmc_Others, // de_bfp_start = 1, // Compulsory, must always be 1 (one).
109  fmc_Others, // de_bfp_sleep_all_day = DK_BFP2_BASE,
110  fmc_Others, // de_bfp_cover_on,
111  fmc_Fertilizer, // de_bfp_fertilizer1_s,
112  fmc_Fertilizer, // de_bfp_fertilizer1_p,
113  fmc_Cutting, // de_bfp_mow_margin1,
114  fmc_Cutting, // de_bfp_mow_margin2,
115  fmc_Cutting, // de_bfp_mow_margin3,
116  fmc_Watering, // de_bfp_water1,
117  fmc_Herbicide, // de_bfp_herbicide1,
118  fmc_Cultivation, // de_bfp_manual_weeding1,
119  fmc_Cultivation, // de_bfp_manual_weeding2,
120  fmc_Insecticide, // de_bfp_insecticide,
121  fmc_Insecticide, // de_bfp_insecticide,
122  fmc_Insecticide, // de_bfp_insecticide,
123  fmc_Insecticide, // de_bfp_insecticide,
124  fmc_Insecticide, // de_bfp_insecticide,
125  fmc_Insecticide, // de_bfp_insecticide,
126  fmc_Insecticide, // de_bfp_insecticide,
127  fmc_Insecticide, // de_bfp_insecticide,
128  fmc_Fungicide, // de_bfp_fungicide,
129  fmc_Fungicide, // de_bfp_fungicide,
130  fmc_Fungicide, // de_bfp_fungicide,
131  fmc_Fungicide, // de_bfp_fungicide,
132  fmc_Fungicide, // de_bfp_fungicide,
133  fmc_Fungicide, // de_bfp_fungicide,
134  fmc_Fungicide, // de_bfp_fungicide,
135  fmc_Fungicide, // de_bfp_fungicide,
136  fmc_Fungicide, // de_bfp_fungicide,
137  fmc_Watering, // de_bfp_water2,
138  fmc_Harvest, // de_bfp_harvest,
139  fmc_Cutting, // de_bfp_mowing_fruit,
140  fmc_Herbicide, // de_bfp_herbicide2,
141  fmc_Fertilizer, // de_bfp_fertilizer2_s,
142  fmc_Fertilizer, // de_bfp_fertilizer2_p,
143  fmc_Watering, // de_bfp_water3,
144  fmc_Herbicide, // de_bfp_herbicide3,
145  fmc_Herbicide, // de_bfp_herbicide4,
146  fmc_Herbicide, // de_bfp_herbicide5,
147  fmc_Herbicide, // de_bfp_herbicide6,
148  fmc_Watering, // de_bfp_water4,
149  fmc_Watering, // de_bfp_water5,
150 
151  // no foobar entry
152 
153  };
154  // Iterate over the catlist elements and copy them to vector
155  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
156  }

References DE_BFP_BASE, de_bfp_foobar, fmc_Cultivation, fmc_Cutting, 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 DE_BushFruitPerm().


The documentation for this class was generated from the following files:
de_bfp_fungicide7
Definition: DE_BushFruitPerm.h:62
de_bfp_insecticide4
Definition: DE_BushFruitPerm.h:51
de_bfp_fungicide3
Definition: DE_BushFruitPerm.h:58
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
g_landscape_ptr
Landscape * g_landscape_ptr
Definition: Landscape.cpp:352
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
de_bfp_cover_on
Definition: DE_BushFruitPerm.h:38
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
DE_BFP_BASE
#define DE_BFP_BASE
Definition: DE_BushFruitPerm.h:25
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
de_bfp_fungicide1
Definition: DE_BushFruitPerm.h:56
de_bfp_fungicide2
Definition: DE_BushFruitPerm.h:57
de_bfp_manual_weeding1
Definition: DE_BushFruitPerm.h:46
de_bfp_fungicide9
Definition: DE_BushFruitPerm.h:64
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
de_bfp_herbicide4
Definition: DE_BushFruitPerm.h:73
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
de_bfp_foobar
Definition: DE_BushFruitPerm.h:78
de_bfp_water1
Definition: DE_BushFruitPerm.h:44
de_bfp_mowing_fruit
Definition: DE_BushFruitPerm.h:67
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
de_bfp_fungicide5
Definition: DE_BushFruitPerm.h:60
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
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.
de_bfp_insecticide6
Definition: DE_BushFruitPerm.h:53
de_bfp_fertilizer1_s
Definition: DE_BushFruitPerm.h:39
de_bfp_insecticide1
Definition: DE_BushFruitPerm.h:48
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
de_bfp_manual_weeding2
Definition: DE_BushFruitPerm.h:47
de_bfp_harvest
Definition: DE_BushFruitPerm.h:66
CfgBool::value
bool value() const
Definition: Configurator.h:164
de_bfp_insecticide7
Definition: DE_BushFruitPerm.h:54
de_bfp_water2
Definition: DE_BushFruitPerm.h:65
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
de_bfp_fertilizer1_p
Definition: DE_BushFruitPerm.h:40
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
de_bfp_herbicide2
Definition: DE_BushFruitPerm.h:68
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
de_bfp_insecticide2
Definition: DE_BushFruitPerm.h:49
tov_DEBushFruitPerm
Definition: LandscapeFarmingEnums.h:520
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
de_bfp_water3
Definition: DE_BushFruitPerm.h:71
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
de_bfp_insecticide5
Definition: DE_BushFruitPerm.h:52
cfg_pest_bushfruit_on
CfgBool cfg_pest_bushfruit_on
Turn on pesticides for bush fruit.
de_bfp_insecticide8
Definition: DE_BushFruitPerm.h:55
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
Landscape::SupplyPestIncidenceFactor
double SupplyPestIncidenceFactor()
Returns Landscape::m_pestincidencefactor.
Definition: Landscape.h:325
Farm::ManualWeeding
virtual bool ManualWeeding(LE *a_field, double a_user, int a_days)
Manual weeding on a_field - no tramlines since weeding by hand, the bush stays on field with same veg...
Definition: FarmFuncs.cpp:2002
DE_BushFruitPerm::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_BushFruitPerm.h:101
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
de_bfp_water4
Definition: DE_BushFruitPerm.h:76
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
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
de_bfp_water5
Definition: DE_BushFruitPerm.h:77
DE_BFP_EARLY_HARVEST
#define DE_BFP_EARLY_HARVEST
Definition: DE_BushFruitPerm.h:23
de_bfp_insecticide3
Definition: DE_BushFruitPerm.h:50
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
de_bfp_fungicide4
Definition: DE_BushFruitPerm.h:59
Farm::StrawCovering
virtual bool StrawCovering(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1738
de_bfp_herbicide5
Definition: DE_BushFruitPerm.h:74
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::FruitHarvest
virtual bool FruitHarvest(LE *a_field, double a_user, int a_days)
FruitHarvest (harvest of the mature fruits, e.g., grapes) applied on a_field.
Definition: FarmFuncs.cpp:1959
de_bfp_fertilizer2_s
Definition: DE_BushFruitPerm.h:69
de_bfp_start
Definition: DE_BushFruitPerm.h:36
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
de_bfp_herbicide6
Definition: DE_BushFruitPerm.h:75
de_bfp_fungicide6
Definition: DE_BushFruitPerm.h:61
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
de_bfp_fertilizer2_p
Definition: DE_BushFruitPerm.h:70
de_bfp_fungicide8
Definition: DE_BushFruitPerm.h:63
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: FarmFuncs.cpp:1350
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
de_bfp_herbicide3
Definition: DE_BushFruitPerm.h:72
de_bfp_herbicide1
Definition: DE_BushFruitPerm.h:45
Crop::SimpleEvent_
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.
Definition: Farm.cpp:751