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

DK_OBushFruit_Perm2 class
. More...

#include <DK_OBushFruit_Perm2.h>

Inheritance diagram for DK_OBushFruit_Perm2:
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...
 
 DK_OBushFruit_Perm2 (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

DK_OBushFruit_Perm2 class
.

See DK_OBushFruit_Perm2.h::DK_OBushFruit_Perm2ToDo 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

◆ DK_OBushFruit_Perm2()

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

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

Member Function Documentation

◆ Do()

bool DK_OBushFruit_Perm2::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.

58 {
59  m_farm = a_farm;
60  m_field = a_field;
61  m_ev = a_ev;
62  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).
63  bool flag = false;
64  int d1 = 0;
65  int noDates = 1;
67  // Depending what event has occured jump to the correct bit of code
68  switch (m_ev->m_todo)
69  {
70  case dk_obfp2_start:
71  {
72  // dk_obfp2_start just sets up all the starting conditions and reference dates that are needed to start a dk_bfp1
73  DK_OBFP2_AFTER_EST = false;
74 
75  m_last_date = g_date->DayInYear(31, 10); // Should match the last flexdate below
76  //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
77  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
78  // Set up the date management stuff
79  // Start and stop dates for all events after harvest
80  flexdates[0][1] = g_date->DayInYear(31, 12); // last possible day of cutting orch
81  // Now these are done in pairs, start & end for each operation. If its not used then -1
82  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
83  flexdates[1][1] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
84 
85  // 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
86  if (StartUpCrop(365, flexdates, int(dk_obfp2_sleep_all_day))) break;
87 
88  // End single block date checking code. Please see next line comment as well.
89  // Reinit d1 to first possible starting date.
90  // Here we queue up the first event
91  //Each field has assign randomly a DK_och_YEARS_AFTER_PLANT
92 
93  if ((DK_OBFP2_AFTER_EST + g_date->GetYearNumber()) % 10 == 0) // establishment
94  {
95  d1 = g_date->OldDays() + g_date->DayInYear(1, 3) + 365;
97  }
98  else if ((DK_OBFP2_AFTER_EST + g_date->GetYearNumber()) % 10 == 1) // 1st year after est - no harvest
99  {
100  d1 = g_date->OldDays() + g_date->DayInYear(1, 3) + 365;
102  }
103  else
104  {
105  d1 = g_date->OldDays() + g_date->DayInYear(1, 3) + 365; // harvest years
107  }
108  break;
109 
110  }
111  break;
112 
113 
114  // LKM: This is the first real farm operation - wait
116  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
117  if (!m_farm->SleepAllDay(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
119  break;
120  }
121  }
123  break;
124 
126  if (m_ev->m_lock || m_farm->DoIt_prob(0.1)) { // suggests 10%
127  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(26, 11) - g_date->DayInYear())) {
129  break;
130  }
131  }
133  break;
134 
136  if (!m_farm->AutumnPlough(m_field, 0.0, g_date->DayInYear(27, 11) - g_date->DayInYear())) {
138  break;
139  }
141  break;
142 
144  if (!m_farm->AutumnHarrow(m_field, 0.0, g_date->DayInYear(28, 11) - g_date->DayInYear())) {
146  break;
147  }
148  if (a_farm->IsStockFarmer()) {
149  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s1, false);
150  break;
151  }
152  else SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p1, false);
153  break;
154 
155  case dk_obfp2_ferti_s1:
156  if (!m_farm->FA_Manure(m_field, 0.0, g_date->DayInYear(29, 11) - g_date->DayInYear())) {
157  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s1, true);
158  break;
159  }
160  SimpleEvent(g_date->Date() + 1, dk_obfp2_plant, false);
161  break;
162 
163  case dk_obfp2_ferti_p1:
164  if (!m_farm->FP_Manure(m_field, 0.0, g_date->DayInYear(29, 11) - g_date->DayInYear())) {
165  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p1, true);
166  break;
167  }
168  SimpleEvent(g_date->Date() + 1, dk_obfp2_plant, false);
169  break;
170 
171  case dk_obfp2_plant: // plant 1-year bushes
172  if (!m_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
173  SimpleEvent(g_date->Date() + 1, dk_obfp2_plant, true);
174  break;
175  }
176  done = true; // end of est autumn
177  break;
178 
179  case dk_obfp2_molluscicide2: // start of 1st year after est - no harvest
180  if (m_ev->m_lock || m_farm->DoIt_prob(0.1)) { // suggests 10%
181  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
183  break;
184  }
185  }
186  //fork of events:
187  if (a_farm->IsStockFarmer()) { // ferti thread
188  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s2, false);
189  SimpleEvent(g_date->Date() + 14, dk_obfp2_row_cultivation1, false); // weeding thread
190  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_molluscicide3, false); // mollusci thread
191  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_water1, false); // water thread - main
192  break;
193  }
194  else SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p2, false);
195  SimpleEvent(g_date->Date() + 14, dk_obfp2_row_cultivation1, false); // weeding thread
196  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_molluscicide3, false); // mollusci thread
197  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_water1, false); // water thread - main
198  break;
199 
200  case dk_obfp2_ferti_s2:
201  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
202  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s2, true);
203  break;
204  }
205  SimpleEvent(g_date->Date() + 30, dk_obfp2_ferti_s3, false);
206  break;
207 
208  case dk_obfp2_ferti_p2:
209  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
210  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p2, true);
211  break;
212  }
213  SimpleEvent(g_date->Date() + 30, dk_obfp2_ferti_p3, false);
214  break;
215 
216  case dk_obfp2_ferti_s3:
217  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
218  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s3, true);
219  break;
220  }
221  break; // end of thread
222 
223  case dk_obfp2_ferti_p3:
224  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
225  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p3, true);
226  break;
227  }
228  break; // end of thread
229 
231  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
233  break;
234  }
236  break;
237 
239  if (!m_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(16, 5) - g_date->DayInYear())) {
241  break;
242  }
244  break;
245 
247  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
249  break;
250  }
252  break;
253 
255  if (!m_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(1, 6) - g_date->DayInYear())) {
257  break;
258  }
260  break;
261 
263  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(16, 6) - g_date->DayInYear())) {
265  break;
266  }
268  break;
269 
271  if (!m_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(17, 6) - g_date->DayInYear())) {
273  break;
274  }
275  break; // end of thread
276 
278  if (m_ev->m_lock || m_farm->DoIt_prob(0.1)) { // suggests 10%
279  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
281  break;
282  }
283  }
284  break; // end of thread
285 
286  case dk_obfp2_water1: // 100% of sandy soils
287  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)
288  {
289  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
290  SimpleEvent(g_date->Date() + 1, dk_obfp2_water1, true);
291  break;
292  }
294  break;
295  }
296  else
298  break;
299 
300  case dk_obfp2_water1_clay: // suggests 50% of clay soils
301  if (m_ev->m_lock || m_farm->DoIt_prob(0.5)) {
302  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
304  break;
305  }
306  }
308  break;
309 
310  case dk_obfp2_water2: // 100% of sandy soils,
311  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
312  SimpleEvent(g_date->Date() + 1, dk_obfp2_water2, true);
313  break;
314  }
315  done = true; // end of 1st year after est
316  break;
317 
318  case dk_obfp2_water2_clay: // 50% of clay
319  if (m_ev->m_lock || m_farm->DoIt_prob(0.5)) {
320  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
322  break;
323  }
324  }
325  done = true; // end of 1st year after est
326  break;
327 
328  case dk_obfp2_wait: // 50% of clay
329  if (!m_farm->SleepAllDay(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
330  SimpleEvent(g_date->Date() + 1, dk_obfp2_wait, true);
331  break;
332  }
333  done = true; // end of 1st year after est
334  break;
335 
336  case dk_obfp2_molluscicide4: // start of harvest years
337  if (m_ev->m_lock || m_farm->DoIt_prob(0.1)) { // suggests 10%
338  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
340  break;
341  }
342  }
343  //fork of events:
344  if (a_farm->IsStockFarmer()) { // ferti thread
345  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s4, false);
346  SimpleEvent(g_date->Date() + 14, dk_obfp2_cutting1, false); // weeding / cutting thread
347  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_molluscicide5, false); // mollusci thread
348  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_water3, false); // water thread
349  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7), dk_obfp2_harvest, false); // harvest - main thread
350  break;
351  }
352  else SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p4, false);
353  SimpleEvent(g_date->Date() + 14, dk_obfp2_cutting1, false); // weeding / cutting thread
354  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_molluscicide5, false); // mollusci thread
355  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5), dk_obfp2_water3, false); // water thread
356  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7), dk_obfp2_harvest, false); // harvest - main thread
357  break;
358 
359  case dk_obfp2_ferti_s4:
360  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
361  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s4, true);
362  break;
363  }
364  break;
365 
366  case dk_obfp2_ferti_p4:
367  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
368  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p4, true);
369  break;
370  }
371  break; // end of thread
372 
373  case dk_obfp2_cutting1: // cutting grass between rows
374  if (!m_farm->CutOrch(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
375  SimpleEvent(g_date->Date() + 1, dk_obfp2_cutting1, true);
376  break;
377  }
378  SimpleEvent(g_date->Date() + 14, dk_obfp2_cutting2, false);
379  break;
380 
381  case dk_obfp2_cutting2:
382  if (!m_farm->CutOrch(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
383  SimpleEvent(g_date->Date() + 1, dk_obfp2_cutting2, true);
384  break;
385  }
386  SimpleEvent(g_date->Date() + 14, dk_obfp2_cutting3, false);
387  break;
388 
389  case dk_obfp2_cutting3:
390  if (!m_farm->CutOrch(m_field, 0.0, g_date->DayInYear(16, 6) - g_date->DayInYear())) {
391  SimpleEvent(g_date->Date() + 1, dk_obfp2_cutting3, true);
392  break;
393  }
394  break; // end of thread
395 
397  if (m_ev->m_lock || m_farm->DoIt_prob(0.1)) { // suggests 10%
398  if (!m_farm->Molluscicide(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
400  break;
401  }
402  }
403  break; // end of thread
404 
405  case dk_obfp2_water3: // 100% of sandy soils
406  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)
407  {
408  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
409  SimpleEvent(g_date->Date() + 1, dk_obfp2_water3, true);
410  break;
411  }
413  break;
414  }
415  else
417  break;
418 
419  case dk_obfp2_water3_clay: // suggests 50% of clay soils
420  if (m_ev->m_lock || m_farm->DoIt_prob(0.5)) {
421  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
423  break;
424  }
425  }
427  break;
428 
429  case dk_obfp2_water4: // 100% of sandy soils
430  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
431  SimpleEvent(g_date->Date() + 1, dk_obfp2_water4, true);
432  break;
433  }
434  break;
435 
436  case dk_obfp2_water4_clay: // 50% of clay
437  if (m_ev->m_lock || m_farm->DoIt_prob(0.5)) {
438  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
440  break;
441  }
442  }
443  break;
444 
445  case dk_obfp2_harvest:
446  if (!m_farm->HarvestBF_Machine(m_field, 0.0, g_date->DayInYear(1, 8) - g_date->DayInYear())) {
447  SimpleEvent(g_date->Date() + 1, dk_obfp2_harvest, true);
448  break;
449  }
450  if (a_farm->IsStockFarmer()) { // ferti thread
451  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s5, false);
452  break;
453  }
454  else SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p5, false);
455  break;
456  case dk_obfp2_ferti_s5:
457  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(2, 8) - g_date->DayInYear())) {
458  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_s5, true);
459  break;
460  }
461  SimpleEvent(g_date->Date() + 1, dk_obfp2_pruning, false);
462  break;
463 
464  case dk_obfp2_ferti_p5:
465  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(2, 8) - g_date->DayInYear())) {
466  SimpleEvent(g_date->Date() + 1, dk_obfp2_ferti_p5, true);
467  break;
468  }
469  SimpleEvent(g_date->Date() + 1, dk_obfp2_pruning, false);
470  break;
471 
472  case dk_obfp2_pruning:
473  if (!m_farm->Pruning(m_field, 0.0, g_date->DayInYear(3, 8) - g_date->DayInYear())) {
474  SimpleEvent(g_date->Date() + 1, dk_obfp2_pruning, true);
475  break;
476  }
477  done = true; // end of harvest year
478  break;
479  // So we are done, and somewhere else the farmer will queue up the start event of the next crop
480  // END of MAIN THREAD
481  break;
482  default:
483  g_msg->Warn(WARN_BUG, "DK_OBushFruit_Perm2::Do(): "
484  "Unknown event type! ", "");
485  exit(1);
486  }
487  return done;
488 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnSow(), Farm::CutOrch(), Calendar::Date(), Calendar::DayInYear(), DK_OBFP2_AFTER_EST, dk_obfp2_autumn_harrow, dk_obfp2_autumn_plough, dk_obfp2_cutting1, dk_obfp2_cutting2, dk_obfp2_cutting3, dk_obfp2_ferti_p1, dk_obfp2_ferti_p2, dk_obfp2_ferti_p3, dk_obfp2_ferti_p4, dk_obfp2_ferti_p5, dk_obfp2_ferti_s1, dk_obfp2_ferti_s2, dk_obfp2_ferti_s3, dk_obfp2_ferti_s4, dk_obfp2_ferti_s5, dk_obfp2_harvest, dk_obfp2_manual_weeding1, dk_obfp2_manual_weeding2, dk_obfp2_manual_weeding3, dk_obfp2_molluscicide1, dk_obfp2_molluscicide2, dk_obfp2_molluscicide3, dk_obfp2_molluscicide4, dk_obfp2_molluscicide5, dk_obfp2_plant, dk_obfp2_pruning, dk_obfp2_row_cultivation1, dk_obfp2_row_cultivation2, dk_obfp2_row_cultivation3, dk_obfp2_sleep_all_day, dk_obfp2_start, dk_obfp2_wait, dk_obfp2_water1, dk_obfp2_water1_clay, dk_obfp2_water2, dk_obfp2_water2_clay, dk_obfp2_water3, dk_obfp2_water3_clay, dk_obfp2_water4, dk_obfp2_water4_clay, Farm::DoIt_prob(), Farm::FA_Manure(), Farm::FA_Slurry(), Farm::FP_Manure(), Farm::FP_Slurry(), g_date, g_msg, LE::GetSoilType(), Calendar::GetYearNumber(), Farm::HarvestBF_Machine(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Farm::ManualWeeding(), Farm::Molluscicide(), Calendar::OldDays(), Farm::Pruning(), Farm::RowCultivation(), Crop::SimpleEvent(), Farm::SleepAllDay(), Crop::StartUpCrop(), tos_LoamySand, tos_Sand, tos_SandyClayLoam, tos_SandyLoam, tov_DKOBushFruit_Perm2, MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void DK_OBushFruit_Perm2::SetUpFarmCategoryInformation ( )
inline
95  {
96  const int elements = 2 + (dk_obfp2_foobar - DK_OBFP2_BASE);
98 
99  FarmManagementCategory catlist[elements] =
100  {
101  fmc_Others, // zero element unused but must be here
102  fmc_Others, // dk_obfp2_start = 1, // Compulsory, must always be 1 (one).
103  fmc_Others, // dk_obfp2_sleep_all_day = DK_OBFP2_BASE,
104  fmc_Others, // dk_obfp2_mollucicide1, //est autumn
105  fmc_Cultivation, // dk_obfp2_autumn_plough,
106  fmc_Cultivation, // dk_obfp2_autumn_harrow,
107  fmc_Fertilizer, // dk_obfp2_ferti_s1,
108  fmc_Fertilizer, // dk_obfp2_ferti_p1,
109  fmc_Others, // dk_obfp2_plant,
110  fmc_Others, // dk_obfp2_molluscicide2, // 1st year after est autumn
111  fmc_Fertilizer, // dk_obfp2_ferti_s2,
112  fmc_Fertilizer, // dk_obfp2_ferti_p2,
113  fmc_Fertilizer, // dk_obfp2_ferti_s3,
114  fmc_Fertilizer, // dk_obfp2_ferti_p3,
115  fmc_Cultivation, // dk_obfp2_row_cultivation1,
116  fmc_Cultivation, // dk_obfp2_manual_weeding1,
117  fmc_Cultivation, // dk_obfp2_row_cultivation2,
118  fmc_Cultivation, // dk_obfp2_manual_weeding2,
119  fmc_Cultivation, // dk_obfp2_row_cultivation3,
120  fmc_Cultivation, // dk_obfp2_manual_weeding3,
121  fmc_Others, // dk_obfp2_mollusicide3,
122  fmc_Watering, // dk_obfp2_water1,
123  fmc_Watering, // dk_obfp2_water1_clay,
124  fmc_Watering, // dk_obfp2_water2,
125  fmc_Watering, // dk_obfp2_water2,
126  fmc_Others, // dk_obfp2_molluscicide4, // harvest years (+10 years)
127  fmc_Fertilizer, // dk_obfp2_ferti_s4,
128  fmc_Fertilizer, // dk_obfp2_ferti_p4,
129  fmc_Cutting, // dk_obfp2_cutting1,
130  fmc_Cutting, // dk_obfp2_cutting2,
131  fmc_Cutting, // dk_obfp2_cutting3,
132  fmc_Others, // dk_obfp2_mollusicide5,
133  fmc_Watering, // dk_obfp2_water3,
134  fmc_Watering, // dk_obfp2_water3_clay,
135  fmc_Watering, // dk_obfp2_water4,
136  fmc_Watering, // dk_obfp2_water4,
137  fmc_Harvest, // dk_obfp2_harvest,
138  fmc_Fertilizer, // dk_obfp2_ferti_s5,
139  fmc_Fertilizer, // dk_obfp2_ferti_p5,
140  fmc_Cutting, // dk_obfp2_pruning,
141  fmc_Others, // dk_obfp2_wait,
142 
143  // no foobar entry
144 
145  };
146  // Iterate over the catlist elements and copy them to vector
147  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
148  }

References DK_OBFP2_BASE, dk_obfp2_foobar, fmc_Cultivation, fmc_Cutting, fmc_Fertilizer, fmc_Harvest, fmc_Others, fmc_Watering, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DK_OBushFruit_Perm2().


The documentation for this class was generated from the following files:
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1067
dk_obfp2_cutting2
Definition: DK_OBushFruit_Perm2.h:60
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
dk_obfp2_ferti_p5
Definition: DK_OBushFruit_Perm2.h:69
dk_obfp2_water2
Definition: DK_OBushFruit_Perm2.h:54
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
dk_obfp2_water1_clay
Definition: DK_OBushFruit_Perm2.h:53
dk_obfp2_molluscicide2
Definition: DK_OBushFruit_Perm2.h:40
dk_obfp2_pruning
Definition: DK_OBushFruit_Perm2.h:70
dk_obfp2_ferti_p1
Definition: DK_OBushFruit_Perm2.h:38
dk_obfp2_foobar
Definition: DK_OBushFruit_Perm2.h:72
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
dk_obfp2_molluscicide1
Definition: DK_OBushFruit_Perm2.h:34
dk_obfp2_ferti_p4
Definition: DK_OBushFruit_Perm2.h:58
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
dk_obfp2_sleep_all_day
Definition: DK_OBushFruit_Perm2.h:33
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
dk_obfp2_start
Definition: DK_OBushFruit_Perm2.h:32
Farm::FA_Manure
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1110
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
dk_obfp2_molluscicide3
Definition: DK_OBushFruit_Perm2.h:51
dk_obfp2_harvest
Definition: DK_OBushFruit_Perm2.h:67
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
dk_obfp2_wait
Definition: DK_OBushFruit_Perm2.h:71
dk_obfp2_ferti_p2
Definition: DK_OBushFruit_Perm2.h:42
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
dk_obfp2_water3
Definition: DK_OBushFruit_Perm2.h:63
dk_obfp2_water4
Definition: DK_OBushFruit_Perm2.h:65
dk_obfp2_row_cultivation1
Definition: DK_OBushFruit_Perm2.h:45
Farm::FP_Manure
virtual bool FP_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:896
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
dk_obfp2_cutting3
Definition: DK_OBushFruit_Perm2.h:61
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_obfp2_ferti_s2
Definition: DK_OBushFruit_Perm2.h:41
DK_OBFP2_AFTER_EST
#define DK_OBFP2_AFTER_EST
Definition: DK_OBushFruit_Perm2.h:23
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_obfp2_molluscicide4
Definition: DK_OBushFruit_Perm2.h:56
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
dk_obfp2_row_cultivation3
Definition: DK_OBushFruit_Perm2.h:49
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
DK_OBushFruit_Perm2::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_OBushFruit_Perm2.h:95
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
dk_obfp2_ferti_s5
Definition: DK_OBushFruit_Perm2.h:68
dk_obfp2_molluscicide5
Definition: DK_OBushFruit_Perm2.h:62
dk_obfp2_water4_clay
Definition: DK_OBushFruit_Perm2.h:66
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
dk_obfp2_ferti_s3
Definition: DK_OBushFruit_Perm2.h:43
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::CutOrch
virtual bool CutOrch(LE *a_field, double a_user, int a_days)
Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard.
Definition: FarmFuncs.cpp:1666
dk_obfp2_water1
Definition: DK_OBushFruit_Perm2.h:52
dk_obfp2_manual_weeding3
Definition: DK_OBushFruit_Perm2.h:50
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::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
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
DK_OBFP2_BASE
#define DK_OBFP2_BASE
Definition: DK_OBushFruit_Perm2.h:25
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
dk_obfp2_plant
Definition: DK_OBushFruit_Perm2.h:39
tos_Sand
Definition: LandscapeFarmingEnums.h:719
dk_obfp2_water2_clay
Definition: DK_OBushFruit_Perm2.h:55
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: FarmFuncs.cpp:272
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
dk_obfp2_autumn_plough
Definition: DK_OBushFruit_Perm2.h:35
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
dk_obfp2_ferti_s1
Definition: DK_OBushFruit_Perm2.h:37
Farm::HarvestBF_Machine
virtual bool HarvestBF_Machine(LE *a_field, double a_user, int a_days)
Harvest bush fruit on a_field - tramlines since fruits are picked by machine, the bush stays on field...
Definition: FarmFuncs.cpp:1814
dk_obfp2_cutting1
Definition: DK_OBushFruit_Perm2.h:59
Farm::AutumnSow
virtual bool AutumnSow(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 autumn on a_field.
Definition: FarmFuncs.cpp:360
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::Pruning
virtual bool Pruning(LE *a_field, double a_user, int a_days)
Pruning applied on a_field - details needs to be added (e.g., impact on biomass, influence/impacts in...
Definition: FarmFuncs.cpp:1897
dk_obfp2_row_cultivation2
Definition: DK_OBushFruit_Perm2.h:47
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_obfp2_ferti_s4
Definition: DK_OBushFruit_Perm2.h:57
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
dk_obfp2_autumn_harrow
Definition: DK_OBushFruit_Perm2.h:36
dk_obfp2_manual_weeding2
Definition: DK_OBushFruit_Perm2.h:48
dk_obfp2_manual_weeding1
Definition: DK_OBushFruit_Perm2.h:46
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_obfp2_ferti_p3
Definition: DK_OBushFruit_Perm2.h:44
WARN_BUG
Definition: MapErrorMsg.h:34
dk_obfp2_water3_clay
Definition: DK_OBushFruit_Perm2.h:64
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
tov_DKOBushFruit_Perm2
Definition: LandscapeFarmingEnums.h:445