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

DE_OOrchard class
. More...

#include <DE_OOrchard.h>

Inheritance diagram for DE_OOrchard:
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_OOrchard (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_OOrchard class
.

See DE_OOrchard.h::DE_OOrchardToDo for a complete list of all possible events triggered codes by the Spring Rye 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_OOrchard()

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

When we start it off, the first possible date for a farm operation is 15th September This information is used by other crops when they decide how much post processing of the management is allowed after harvest before the next crop starts.

146  : Crop(a_tov, a_toc, a_L)
147  {
153  m_first_date = g_date->DayInYear(30, 3);
155  }

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

Member Function Documentation

◆ Do()

bool DE_OOrchard::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 m_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 - in this case conventional winter wheat.

Reimplemented from Crop.

88 {
89  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
90  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
91  m_field = a_field;
92  m_ev = a_ev;
93  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
94  bool flag = false;
95  int d1 = 0;
96  int noDates = 1;
97  TTypesOfVegetation l_tov = tov_DEOOrchard; // The current type - change to match the crop you have
98 /**********************************************To Here *************************************************************************/
99  // Depending what event has occured jump to the correct bit of code
100  switch (m_ev->m_todo)
101  {
102  case de_oorch_start:
103  {
104  DE_OORCH_RC_DATE = 1;
106 
107  m_last_date = g_date->DayInYear(1, 11); // Should match the last flexdate below
108  //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
109  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
110  // Set up the date management stuff
111  // Start and stop dates for all events after harvest
112  flexdates[0][1] = g_date->DayInYear(1, 11); // last possible day of harvest - this is in effect day before the earliest date that a following crop can use
113 
114  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
115  flexdates[1][1] = g_date->DayInYear(1, 11); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1)
116 
117  // Below if this is a spring crop use 365, otherwise set this to 0, second parameter is fixed, and the third is the start up operation in the first year
118  int isSpring = 365;
119  if (StartUpCrop(isSpring, flexdates, int(de_oorch_ferti_s1))) break;
120 
121  // End single block date checking code. Please see next line comment as well.
122  // Reinit d1 to first possible starting date.
123  d1 = g_date->OldDays() + g_date->DayInYear(1, 3) + isSpring;
124  // OK, let's go.
125  // Here we queue up the first event - this differs depending on whether we have field on sandy (2) or clay (1) soils
126  if (a_farm->IsStockFarmer()) //Stock Farmer
127  {
129  break;
130  }
131  else SimpleEvent_(d1, de_oorch_ferti_p1, false, m_farm, m_field);
132  break;
133  }
134  break;
135 
136  // This is the first real farm operation
137  case de_oorch_ferti_p1:
138  if (!m_farm->FP_Manure(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
140  break;
141  }
143  break;
144 
145  case de_oorch_ferti_s1:
146  if (a_farm->IsStockFarmer()) //Stock Farmer
147  {
148  if (!m_farm->FA_Manure(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
150  break;
151  }
152  }
154  break;
155 
156  case de_oorch_fungicide1:
157  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
158  {
159  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(31, 3) - g_date->DayInYear())) {
161  break;
162  }
163  }
164  d1 = g_date->Date() + 5;
165  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 4)) {
166  d1 = g_date->OldDays() + g_date->DayInYear(1, 4);
167  }
168  // fork of events:
169  SimpleEvent_(d1, de_oorch_fungicide2, false, m_farm, m_field); // fungi+ferti // main thread
170  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 4), de_oorch_row_cultivation1, false, m_farm, m_field); //mechanical weeding thread
171  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 4), de_oorch_manual_weeding1, false, m_farm, m_field); //manual weeding thread
172  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 5), de_oorch_pheromone, false, m_farm, m_field); // pheromone thread
173  break;
174 
175  case de_oorch_fungicide2:
176  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
177  {
178  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(5, 4) - g_date->DayInYear())) {
180  break;
181  }
182  }
184  break;
185 
186  //mechanical weeding thread
188  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
189  {
190  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
192  break;
193  }
194  }
195  d1 = g_date->Date() + 14;
196  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 5)) {
197  d1 = g_date->OldDays() + g_date->DayInYear(1, 5);
198  }
200  break;
201 
203  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
204  {
205  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
207  break;
208  }
209  }
210  d1 = g_date->Date() + 14;
211  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 6)) {
212  d1 = g_date->OldDays() + g_date->DayInYear(1, 6);
213  }
215  break;
216 
218  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
219  {
220  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
222  break;
223  }
224  }
225  d1 = g_date->Date() + 14;
226  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
227  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
228  }
230  break;
231 
233  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
234  {
235  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
237  break;
238  }
239  }
240  d1 = g_date->Date() + 14;
241  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
242  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
243  }
245  break;
246 
248  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
249  {
250  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
252  break;
253  }
254  }
255  DE_OORCH_RC_DATE = g_date->Date(); // remember this date
256  break;
257 
258  //manual weeding thread
260  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
261  {
262  if (!m_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
264  break;
265  }
266  }
268  break;
269 
271  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
272  {
273  if (!m_farm->ManualWeeding(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
275  break;
276  }
277  }
278  break;
279 
280  case de_oorch_fungicide3:
281  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
282  {
283  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(10, 4) - g_date->DayInYear())) {
285  break;
286  }
287  }
289  break;
290 
291  case de_oorch_fungicide4:
292  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
293  {
294  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(15, 4) - g_date->DayInYear())) {
296  break;
297  }
298  }
300  break;
301 
302  case de_oorch_fungicide5:
303  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
304  {
305  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
307  break;
308  }
309  }
310  if (a_farm->IsStockFarmer()) //Stock Farmer
311  {
313  break;
314  }
315  else SimpleEvent(g_date->Date(), de_oorch_ferti_p2, false);
316  break;
317 
318  case de_oorch_ferti_p2:
319  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
320  {
321  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
323  break;
324  }
325  }
327  break;
328 
329  case de_oorch_ferti_s2:
330  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
331  {
332  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(20, 4) - g_date->DayInYear())) {
334  break;
335  }
336  }
338  break;
339 
340  case de_oorch_fungicide6:
341  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
342  {
343  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
345  break;
346  }
347  }
349  break;
350 
352  // here we have organic insecticides applied
353  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
354  {
355  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
357  break;
358  }
359  }
361  break;
362 
363  case de_oorch_fungicide7:
364  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
365  {
366  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
368  break;
369  }
370  }
372  break;
373 
375  // here we have organic insecticides applied
376  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
377  {
378  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
380  break;
381  }
382  }
383  d1 = g_date->Date() + 7;
384  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 5)) {
385  d1 = g_date->OldDays() + g_date->DayInYear(1, 5);
386  }
387  SimpleEvent_(d1, de_oorch_insecticide3, false, m_farm, m_field); //insecti thread
388  SimpleEvent_(d1, de_oorch_fungicide8, false, m_farm, m_field); // main thread
389  break;
390 
391  //pheromone thread
392 
393  case de_oorch_pheromone:
394  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
395  {
396  if (!m_farm->Pheromone(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
398  break;
399  }
400  }
401  break;
402 
404  // here we have organic insecticides applied
405  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
406  {
407  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(7, 5) - g_date->DayInYear())) {
409  break;
410  }
411  }
413  break;
414 
416  // here we have organic insecticides applied
417  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
418  {
419  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(14, 5) - g_date->DayInYear())) {
421  break;
422  }
423  }
425  break;
426 
428  // here we have organic insecticides applied
429  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
430  {
431  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(21, 5) - g_date->DayInYear())) {
433  break;
434  }
435  }
437  break;
438 
440  // here we have organic insecticides applied
441  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
442  {
443  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
445  break;
446  }
447  }
448  break;
449 
450  case de_oorch_fungicide8:
451  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
452  {
453  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(7, 5) - g_date->DayInYear())) {
455  break;
456  }
457  }
459  break;
460 
461  case de_oorch_fungicide9:
462  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
463  {
464  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(14, 5) - g_date->DayInYear())) {
466  break;
467  }
468  }
470  break;
471 
473  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
474  {
475  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(21, 5) - g_date->DayInYear())) {
477  break;
478  }
479  }
481  break;
482 
484  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
485  {
486  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
488  break;
489  }
490  }
491  if (a_farm->IsStockFarmer()) //Stock Farmer
492  {
494  break;
495  }
496  else SimpleEvent(g_date->Date(), de_oorch_ferti_p3, false);
497  break;
498 
499  case de_oorch_ferti_p3:
500  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
501  {
502  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
504  break;
505  }
506  }
507  d1 = g_date->Date() + 7;
508  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 6)) {
509  d1 = g_date->OldDays() + g_date->DayInYear(1, 6);
510  }
512  break;
513 
514  case de_oorch_ferti_s3:
515  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
516  {
517  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(31, 5) - g_date->DayInYear())) {
519  break;
520  }
521  }
522  d1 = g_date->Date() + 7;
523  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 6)) {
524  d1 = g_date->OldDays() + g_date->DayInYear(1, 6);
525  }
527  break;
528 
530  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
531  {
532  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(7, 6) - g_date->DayInYear())) {
534  break;
535  }
536  }
538  break;
539 
541  // here we have organic insecticides applied
542  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
543  {
544  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(7, 6) - g_date->DayInYear())) {
546  break;
547  }
548  }
550  break;
551 
553  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
554  {
555  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(14, 6) - g_date->DayInYear())) {
557  break;
558  }
559  }
561  break;
562 
564  // here we have organic insecticides applied
565  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
566  {
567  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(14, 6) - g_date->DayInYear())) {
569  break;
570  }
571  }
573  break;
574 
576  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
577  {
578  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(21, 6) - g_date->DayInYear())) {
580  break;
581  }
582  }
584  break;
585 
587  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
588  {
589  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
591  break;
592  }
593  }
594  if (a_farm->IsStockFarmer()) //Stock Farmer
595  {
597  break;
598  }
599  else SimpleEvent(g_date->Date(), de_oorch_ferti_p4, false);
600  break;
601 
602  case de_oorch_ferti_p4:
603  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
604  {
605  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
607  break;
608  }
609  }
610  d1 = g_date->Date() + 7;
611  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
612  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
613  }
615  break;
616 
617  case de_oorch_ferti_s4:
618  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
619  {
620  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
622  break;
623  }
624  }
625  d1 = g_date->Date() + 7;
626  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
627  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
628  }
630  break;
631 
633  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
634  {
635  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(7, 7) - g_date->DayInYear())) {
637  break;
638  }
639  }
640  if (a_farm->IsStockFarmer()) //Stock Farmer
641  {
643  break;
644  }
645  else SimpleEvent(g_date->Date(), de_oorch_ferti_p5, false);
646  break;
647 
648  case de_oorch_ferti_p5:
649  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
650  {
651  if (!m_farm->FP_Calcium(m_field, 0.0, g_date->DayInYear(7, 7) - g_date->DayInYear())) {
653  break;
654  }
655  }
657  break;
658 
659  case de_oorch_ferti_s5:
660  if (a_farm->IsStockFarmer()) { //Stock Farmer
661  if (!m_farm->FA_Calcium(m_field, 0.0, g_date->DayInYear(7, 7) - g_date->DayInYear())) {
663  break;
664  }
665  }
667  break;
668 
670  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
671  {
672  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
674  break;
675  }
676  }
677  if (a_farm->IsStockFarmer()) //Stock Farmer
678  {
680  break;
681  }
682  else SimpleEvent(g_date->Date(), de_oorch_ferti_p6, false);
683  break;
684 
685  case de_oorch_ferti_p6:
686  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
687  {
688  if (!m_farm->FP_Calcium(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
690  break;
691  }
692  }
694  break;
695 
696  case de_oorch_ferti_s6:
697  if (a_farm->IsStockFarmer()) {//Stock Farmer
698  if (!m_farm->FA_Calcium(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
700  break;
701  }
702  }
704  break;
705 
707  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
708  {
709  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(21, 7) - g_date->DayInYear())) {
711  break;
712  }
713  }
714  if (a_farm->IsStockFarmer()) //Stock Farmer
715  {
717  break;
718  }
719  else SimpleEvent(g_date->Date(), de_oorch_ferti_p7, false);
720  break;
721 
722  case de_oorch_ferti_p7:
723  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
724  {
725  if (!m_farm->FP_Calcium(m_field, 0.0, g_date->DayInYear(21, 7) - g_date->DayInYear())) {
727  break;
728  }
729  }
731  break;
732 
733  case de_oorch_ferti_s7:
734  if (a_farm->IsStockFarmer()) //Stock Farmer
735  {
736  if (!m_farm->FA_Calcium(m_field, 0.0, g_date->DayInYear(21, 7) - g_date->DayInYear())) {
738  break;
739  }
740  }
742  break;
743 
745  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
746  {
747  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
749  break;
750  }
751  }
753  break;
754 
756  // here we have organic insecticides applied
757  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
758  {
759  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
761  break;
762  }
763  }
764  d1 = g_date->Date() + 7;
765  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
766  d1 = g_date->OldDays() + g_date->DayInYear(1, 8);
767  }
769  break;
770 
772  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
773  {
774  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(10, 8) - g_date->DayInYear())) {
776  break;
777  }
778  }
780  break;
781 
783  // here we have organic insecticides applied
784  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
785  {
786  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(10, 8) - g_date->DayInYear())) {
788  break;
789  }
790  }
791  SimpleEvent_(g_date->Date() + 7, de_oorch_fungicide21, false, m_farm, m_field); // mian thread
793  break;
794 
796  // here we have organic insecticides applied
797  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
798  {
799  if (!m_farm->OrganicInsecticide(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
801  break;
802  }
803  }
804  break;
805 
807  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
808  {
809  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
811  break;
812  }
813  }
814  if (a_farm->IsStockFarmer()) //Stock Farmer
815  {
817  break;
818  }
819  else SimpleEvent(g_date->Date(), de_oorch_ferti_p8, false);
820  break;
821 
822  case de_oorch_ferti_p8:
823  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
824  {
825  if (!m_farm->FP_Calcium(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
827  break;
828  }
829  }
831  break;
832 
833  case de_oorch_ferti_s8:
834  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
835  {
836  if (!m_farm->FA_Calcium(m_field, 0.0, g_date->DayInYear(20, 8) - g_date->DayInYear())) {
838  break;
839  }
840  }
842  break;
843 
845  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
846  {
847  if (!m_farm->OrganicFungicide(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
849  break;
850  }
851  }
852  if (a_farm->IsStockFarmer()) //Stock Farmer
853  {
855  break;
856  }
857  else SimpleEvent(g_date->Date(), de_oorch_ferti_p9, false);
858  break;
859 
860  case de_oorch_ferti_p9:
861  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
862  {
863  if (!m_farm->FP_Calcium(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
865  break;
866  }
867  }
869  break;
870 
871  case de_oorch_ferti_s9:
872  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
873  {
874  if (!m_farm->FA_Calcium(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
876  break;
877  }
878  }
880  break;
881 
883  if (m_ev->m_lock || m_farm->DoIt_prob(1.0))
884  {
885  if (!m_farm->RowCultivation(m_field, 0.0, g_date->DayInYear(30, 9) - g_date->DayInYear())) {
887  break;
888  }
889  }
891  break;
892 
893  case de_oorch_harvest:
894  if (!a_farm->FruitHarvest(m_field, 0.0, g_date->DayInYear(1, 11) - g_date->DayInYear())) {
895  SimpleEvent(g_date->Date() + 1, de_oorch_harvest, true);
896  break;
897  }
898  done = true;
899  break;
900 
901  default:
902  g_msg->Warn(WARN_BUG, "DE_OORCHARD::Do(): "
903  "Unknown event type! ", "");
904  exit(1);
905  }
906  return done;
907 }

References LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), de_oorch_ferti_p1, de_oorch_ferti_p2, de_oorch_ferti_p3, de_oorch_ferti_p4, de_oorch_ferti_p5, de_oorch_ferti_p6, de_oorch_ferti_p7, de_oorch_ferti_p8, de_oorch_ferti_p9, de_oorch_ferti_s1, de_oorch_ferti_s2, de_oorch_ferti_s3, de_oorch_ferti_s4, de_oorch_ferti_s5, de_oorch_ferti_s6, de_oorch_ferti_s7, de_oorch_ferti_s8, de_oorch_ferti_s9, de_oorch_fungicide1, de_oorch_fungicide10, de_oorch_fungicide11, de_oorch_fungicide12, de_oorch_fungicide13, de_oorch_fungicide14, de_oorch_fungicide15, de_oorch_fungicide16, de_oorch_fungicide17, de_oorch_fungicide18, de_oorch_fungicide19, de_oorch_fungicide2, de_oorch_fungicide20, de_oorch_fungicide21, de_oorch_fungicide22, de_oorch_fungicide3, de_oorch_fungicide4, de_oorch_fungicide5, de_oorch_fungicide6, de_oorch_fungicide7, de_oorch_fungicide8, de_oorch_fungicide9, de_oorch_harvest, de_oorch_insecticide1, de_oorch_insecticide10, de_oorch_insecticide11, de_oorch_insecticide2, de_oorch_insecticide3, de_oorch_insecticide4, de_oorch_insecticide5, de_oorch_insecticide6, de_oorch_insecticide7, de_oorch_insecticide8, de_oorch_insecticide9, de_oorch_manual_weeding1, de_oorch_manual_weeding2, de_oorch_pheromone, DE_OORCH_RC_DATE, de_oorch_row_cultivation1, de_oorch_row_cultivation2, de_oorch_row_cultivation3, de_oorch_row_cultivation4, de_oorch_row_cultivation5, de_oorch_row_cultivation6, de_oorch_start, Farm::DoIt_prob(), Farm::FA_Calcium(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FP_Calcium(), Farm::FP_Manure(), Farm::FP_NPK(), Farm::FruitHarvest(), g_date, g_msg, 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(), Farm::OrganicFungicide(), Farm::OrganicInsecticide(), Farm::Pheromone(), Farm::RowCultivation(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Crop::StartUpCrop(), tov_DEOOrchard, MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void DE_OOrchard::SetUpFarmCategoryInformation ( )
inline
156  {
157  const int elements = 2 + (de_oorch_foobar - DE_OORCH_BASE);
159 
160  FarmManagementCategory catlist[elements] =
161  {
162  fmc_Others, // zero element unused but must be here
163  // ALL THE NECESSARY ENTRIES HERE
164  fmc_Others, // de_oorch_start = 1, // Compulsory, must always be 1 (one).
165  fmc_Harvest, // de_oorch_harvest
166  fmc_Fertilizer, // de_oorch_ferti_p1,
167  fmc_Fertilizer, // de_oorch_ferti_s1,
168  fmc_Fertilizer, // de_oorch_ferti_p2,
169  fmc_Fertilizer, // de_oorch_ferti_s2,
170  fmc_Fertilizer, // de_oorch_ferti_p3,
171  fmc_Fertilizer, // de_oorch_ferti_s3,
172  fmc_Fertilizer, // de_oorch_ferti_p4,
173  fmc_Fertilizer, // de_oorch_ferti_s4,
174  fmc_Fertilizer, // de_oorch_ferti_p5,
175  fmc_Fertilizer, // de_oorch_ferti_s5,
176  fmc_Fertilizer, // de_oorch_ferti_p,
177  fmc_Fertilizer, // de_oorch_ferti_s,
178  fmc_Fertilizer, // de_oorch_ferti_p,
179  fmc_Fertilizer, // de_oorch_ferti_s,
180  fmc_Fertilizer, // de_oorch_ferti_p,
181  fmc_Fertilizer, // de_oorch_ferti_s,
182  fmc_Fertilizer, // de_oorch_ferti_p,
183  fmc_Fertilizer, // de_oorch_ferti_s,
184  fmc_Others, // de_oorch_fungicide,
185  fmc_Others, // de_oorch_fungicide,
186  fmc_Others, // de_oorch_fungicide,
187  fmc_Others, // de_oorch_fungicide,
188  fmc_Others, // de_oorch_fungicide,
189  fmc_Others, // de_oorch_fungicide,
190  fmc_Others, // de_oorch_fungicide,
191  fmc_Others, // de_oorch_fungicide,
192  fmc_Others, // de_oorch_fungicide,
193  fmc_Others, // de_oorch_fungicide,
194  fmc_Others, // de_oorch_fungicide,
195  fmc_Others, // de_oorch_fungicide,
196  fmc_Others, // de_oorch_fungicide,
197  fmc_Others, // de_oorch_fungicide,
198  fmc_Others, // de_oorch_fungicide,
199  fmc_Others, // de_oorch_fungicide,
200  fmc_Others, // de_oorch_fungicide,
201  fmc_Others, // de_oorch_fungicide,
202  fmc_Others, // de_oorch_fungicide,
203  fmc_Others, // de_oorch_fungicide,
204  fmc_Others, // de_oorch_fungicide,
205  fmc_Others, // de_oorch_fungicide,
206  fmc_Others, // de_oorch_pheromone,
207  fmc_Others, // de_oorch_insecticide,
208  fmc_Others, // de_oorch_insecticide,
209  fmc_Others, // de_oorch_insecticide,
210  fmc_Others, // de_oorch_insecticide,
211  fmc_Others, // de_oorch_insecticide,
212  fmc_Others, // de_oorch_insecticide,
213  fmc_Others, // de_oorch_insecticide,
214  fmc_Others, // de_oorch_insecticide,
215  fmc_Others, // de_oorch_insecticide,
216  fmc_Others, // de_oorch_insecticide,
217  fmc_Others, // de_oorch_insecticide,
218  fmc_Cultivation, // de_oorch_row_cultivation,
219  fmc_Cultivation, // de_oorch_row_cultivation,
220  fmc_Cultivation, // de_oorch_row_cultivation,
221  fmc_Cultivation, // de_oorch_row_cultivation,
222  fmc_Cultivation, // de_oorch_row_cultivation,
223  fmc_Cultivation, // de_oorch_row_cultivation,
224  fmc_Cultivation, // de_oorch_manual_weeding,
225  fmc_Cultivation, // de_oorch_manual_weeding,
226 
227  // no foobar entry
228 
229  };
230  // Iterate over the catlist elements and copy them to vector
231  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
232 
233  }

References DE_OORCH_BASE, de_oorch_foobar, fmc_Cultivation, fmc_Fertilizer, fmc_Harvest, fmc_Others, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by DE_OOrchard().


The documentation for this class was generated from the following files:
de_oorch_ferti_s5
Definition: DE_OOrchard.h:79
de_oorch_pheromone
Definition: DE_OOrchard.h:110
de_oorch_insecticide9
Definition: DE_OOrchard.h:119
Farm::OrganicInsecticide
virtual bool OrganicInsecticide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
Definition: FarmFuncs.cpp:2195
de_oorch_fungicide5
Definition: DE_OOrchard.h:92
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
de_oorch_fungicide11
Definition: DE_OOrchard.h:98
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
de_oorch_fungicide12
Definition: DE_OOrchard.h:99
de_oorch_ferti_p2
Definition: DE_OOrchard.h:72
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
Farm::FP_NPK
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:645
de_oorch_row_cultivation3
Definition: DE_OOrchard.h:124
de_oorch_ferti_p7
Definition: DE_OOrchard.h:82
de_oorch_fungicide18
Definition: DE_OOrchard.h:105
de_oorch_fungicide20
Definition: DE_OOrchard.h:107
de_oorch_fungicide8
Definition: DE_OOrchard.h:95
de_oorch_ferti_s3
Definition: DE_OOrchard.h:75
de_oorch_row_cultivation1
Definition: DE_OOrchard.h:122
de_oorch_ferti_s8
Definition: DE_OOrchard.h:85
de_oorch_fungicide21
Definition: DE_OOrchard.h:108
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
de_oorch_insecticide8
Definition: DE_OOrchard.h:118
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
de_oorch_ferti_s7
Definition: DE_OOrchard.h:83
de_oorch_fungicide1
Definition: DE_OOrchard.h:88
de_oorch_fungicide22
Definition: DE_OOrchard.h:109
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
de_oorch_insecticide11
Definition: DE_OOrchard.h:121
de_oorch_ferti_s1
Definition: DE_OOrchard.h:71
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_oorch_fungicide19
Definition: DE_OOrchard.h:106
de_oorch_ferti_s9
Definition: DE_OOrchard.h:87
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
de_oorch_insecticide7
Definition: DE_OOrchard.h:117
de_oorch_ferti_p6
Definition: DE_OOrchard.h:80
de_oorch_manual_weeding1
Definition: DE_OOrchard.h:128
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
de_oorch_insecticide6
Definition: DE_OOrchard.h:116
de_oorch_insecticide3
Definition: DE_OOrchard.h:113
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
de_oorch_fungicide15
Definition: DE_OOrchard.h:102
de_oorch_ferti_s6
Definition: DE_OOrchard.h:81
de_oorch_manual_weeding2
Definition: DE_OOrchard.h:129
de_oorch_harvest
Definition: DE_OOrchard.h:69
de_oorch_fungicide2
Definition: DE_OOrchard.h:89
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
de_oorch_fungicide13
Definition: DE_OOrchard.h:100
tov_DEOOrchard
Definition: LandscapeFarmingEnums.h:519
de_oorch_foobar
Definition: DE_OOrchard.h:130
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
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
de_oorch_fungicide4
Definition: DE_OOrchard.h:91
de_oorch_fungicide16
Definition: DE_OOrchard.h:103
de_oorch_ferti_p8
Definition: DE_OOrchard.h:84
de_oorch_ferti_p5
Definition: DE_OOrchard.h:78
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_oorch_fungicide3
Definition: DE_OOrchard.h:90
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
Farm::Pheromone
virtual bool Pheromone(LE *a_field, double a_user, int a_days)
Pheromone applied on a_field - same as with org. pesticides for now.
Definition: FarmFuncs.cpp:2249
de_oorch_ferti_s2
Definition: DE_OOrchard.h:73
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
DE_OORCH_BASE
#define DE_OORCH_BASE
Definition: DE_OOrchard.h:55
de_oorch_ferti_p1
Definition: DE_OOrchard.h:70
de_oorch_fungicide7
Definition: DE_OOrchard.h:94
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
de_oorch_insecticide2
Definition: DE_OOrchard.h:112
de_oorch_row_cultivation6
Definition: DE_OOrchard.h:127
de_oorch_fungicide17
Definition: DE_OOrchard.h:104
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
de_oorch_ferti_p3
Definition: DE_OOrchard.h:74
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
de_oorch_insecticide1
Definition: DE_OOrchard.h:111
de_oorch_start
Definition: DE_OOrchard.h:68
de_oorch_fungicide6
Definition: DE_OOrchard.h:93
DE_OORCH_RC_DATE
#define DE_OORCH_RC_DATE
Definition: DE_OOrchard.h:53
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
de_oorch_row_cultivation4
Definition: DE_OOrchard.h:125
de_oorch_insecticide4
Definition: DE_OOrchard.h:114
de_oorch_ferti_p4
Definition: DE_OOrchard.h:76
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_oorch_fungicide9
Definition: DE_OOrchard.h:96
de_oorch_fungicide10
Definition: DE_OOrchard.h:97
de_oorch_ferti_s4
Definition: DE_OOrchard.h:77
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Farm::OrganicFungicide
virtual bool OrganicFungicide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
Definition: FarmFuncs.cpp:2231
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
de_oorch_row_cultivation2
Definition: DE_OOrchard.h:123
de_oorch_row_cultivation5
Definition: DE_OOrchard.h:126
de_oorch_fungicide14
Definition: DE_OOrchard.h:101
DE_OOrchard::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_OOrchard.h:156
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
de_oorch_ferti_p9
Definition: DE_OOrchard.h:86
WARN_BUG
Definition: MapErrorMsg.h:34
de_oorch_insecticide5
Definition: DE_OOrchard.h:115
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
de_oorch_insecticide10
Definition: DE_OOrchard.h:120
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