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

NLPotatoes class
. More...

#include <NLPotatoes.h>

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

NLPotatoes class
.

See NLPotatoes.h::NLPotatoesToDo for a complete list of all possible events triggered codes by the potatoes 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

◆ NLPotatoes()

NLPotatoes::NLPotatoes ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
99  : Crop(a_tov, a_toc, a_L)
100  {
101  // When we start it off, the first possible date for a farm operation is 5th November
102  // This information is used by other crops when they decide how much post processing of
103  // the management is allowed after harvest before the next crop starts.
104  m_first_date=g_date->DayInYear( 5,11 );
105  m_forcespringpossible = true;
107  }

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

Member Function Documentation

◆ Do()

bool NLPotatoes::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 potatoes.

Reimplemented from Crop.

65 {
66  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
67  m_farm = a_farm;
68  m_field = a_field;
69  m_ev = a_ev;
70  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).
71  bool flag = false;
72  int d1 = 0;
73  int noDates = 1;
75  int l_nextcropstartdate;
76  /**********************************************To Here *************************************************************************/
77 
78  // Depending what event has occured jump to the correct bit of code
79  switch (m_ev->m_todo)
80  {
81  case nl_pot_start:
82  {
83  NL_POT_HERBI = false;
84  NL_POT_FUNGI1 = false;
85  NL_POT_FUNGI2 = false;
86  NL_POT_FUNGI3 = false;
87  NL_POT_FUNGI4 = false;
88  NL_POT_FUNGI5 = false;
90 
91  m_last_date = g_date->DayInYear(30, 110); // Should match the last flexdate below
92  //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
93  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
94  // Set up the date management stuff
95  // Start and stop dates for all events after harvest
96  flexdates[0][1] = g_date->DayInYear(30, 10); // first possible day of finishing harvest - this is in effect day before the earliest date that a following crop can use
97 
98  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
99  flexdates[1][1] = g_date->DayInYear(30, 10); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) - straw chopping
100 
101  // 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
102  int isSpring = 0;
103  if (StartUpCrop(isSpring, flexdates, int(nl_pot_spring_planting))) break;
104 
105  // End single block date checking code. Please see next line comment as well.
106  // Reinit d1 to first possible starting date.
107  d1 = g_date->OldDays() + g_date->DayInYear(1, 9) + isSpring;
108  // OK, let's go.
109  if (m_ev->m_forcespring) {
110  int day_num_shift = 365;
111  if (g_date->DayInYear() < 70) day_num_shift = 0;
112  if (m_field->GetSoilType() == 2 || m_field->GetSoilType() == 6) { // on sandy soils (NL ZAND & LOSS)
113  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 3) + day_num_shift, nl_pot_spring_plough_sandy, false, m_farm, m_field);
114  }
115  else {
116  if (m_farm->IsStockFarmer()) //Stock Farmer
117  {
118  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4) + day_num_shift, nl_pot_ferti_s2_clay, false, m_farm, m_field);
119  }
120  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4) + day_num_shift, nl_pot_ferti_p2_clay, false, m_farm, m_field);
121  }
122  break;
123  }
124  else {
125  // Here we queue up the first event - this differs depending on whether we have field on sandy or clay soils
127  }
128  break;
129  }
130  break;
131 
132  // This is the first real farm operation
134  if (!m_farm->StubbleHarrowing(m_field, 0.0, g_date->DayInYear(5, 11) - g_date->DayInYear())) {
136  break;
137  }
138  d1 = g_date->Date() + 14;
139  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 10)) {
140  d1 = g_date->OldDays() + g_date->DayInYear(15, 10);
141  }
142  if (m_field->GetSoilType() == 2 || m_field->GetSoilType() == 6) { // on sandy soils (NL ZAND & LOSS)
144  }
146  break;
147 
149  if (!m_farm->FP_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
151  break;
152  }
154  break;
156  if (m_farm->IsStockFarmer())
157  {
158  if (!m_farm->FA_Slurry(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
160  break;
161  }
163  break;
164  }
166  break;
168  if (!m_farm->SpringPlough(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
170  break;
171  }
172  d1 = g_date->Date() + 7;
173  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 4)) {
174  d1 = g_date->OldDays() + g_date->DayInYear(10, 4);
175  }
176  if (m_farm->IsStockFarmer()) //Stock Farmer
177  {
179  }
181  break;
183  if (m_ev->m_lock || m_farm->DoIt_prob(0.50))
184  {
185  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
187  break;
188  }
189  }
191  break;
193  if (m_ev->m_lock || m_farm->DoIt_prob(0.50))
194  {
195  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
197  break;
198  }
199  }
201  break;
203  if (!m_farm->WinterPlough(m_field, 0.0, g_date->DayInYear(1, 12) - g_date->DayInYear())) {
205  break;
206  }
207  if (m_farm->IsStockFarmer()) //Stock Farmer
208  {
210  }
211  else SimpleEvent_(g_date->OldDays() + g_date->DayInYear(10, 4) + 365, nl_pot_ferti_p2_clay, false, m_farm, m_field);
212  break;
214  if (!m_farm->FP_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
216  break;
217  }
219  break;
221  if (!m_farm->FA_NPK(m_field, 0.0, g_date->DayInYear(30, 4) - g_date->DayInYear())) {
223  break;
224  }
226  break;
227  case nl_pot_bed_forming:
228  if (!m_farm->BedForming(m_field, 0.0, g_date->DayInYear(9, 5) - g_date->DayInYear())) {
230  break;
231  }
233  break;
235  if (!m_farm->SpringSow(m_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear())) {
237  break;
238  }
239  // Here is a fork leading to four parallel events
240  SimpleEvent_(g_date->Date() + 14, nl_pot_hilling1, false, m_farm, m_field); // Hilling + herbicides = MAIN THREAD
241  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 6), nl_pot_fungicide1, false, m_farm, m_field); // Fungicide thread
242  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 6) + m_date_modifier, nl_pot_insecticide, false, m_farm, m_field); // Insecticide thread
243  if (m_farm->IsStockFarmer()) //Stock Farmer // N thread
244  {
246  }
248  if (m_farm->IsStockFarmer()) //Stock Farmer // microelements thread
249  {
251  }
253  break;
255  if (m_field->GetSoilType() != 2 && m_field->GetSoilType() != 6)// on clay soils (NL KLEI & VEEN)
256  {
257  if (m_ev->m_lock || m_farm->DoIt_prob(0.25))
258  {
259  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
261  break;
262  }
263  }
264  // End of thread
265  break;
266  }
267  if (m_farm->IsStockFarmer()) //Stock Farmer // N thread
268  {
270  }
272  break;
274  if (m_field->GetSoilType() != 2 && m_field->GetSoilType() != 6)// on clay soils (NL KLEI & VEEN)
275  {
276  if (m_ev->m_lock || m_farm->DoIt_prob(0.25))
277  {
278  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
280  break;
281  }
282  }
283  // End of thread
284  break;
285  }
286  if (m_farm->IsStockFarmer()) //Stock Farmer // N thread
287  {
289  }
291  break;
293  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
295  break;
296  }
297  // End of thread
298  break;
299 
301  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
303  break;
304  }
305  // End of thread
306  break;
307 
308  case nl_pot_ferti_p4:
309  if (m_ev->m_lock || m_farm->DoIt_prob(0.25))
310  {
311  if (!m_farm->FP_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
313  break;
314  }
315  }
316  // End of thread
317  break;
318  case nl_pot_ferti_s4:
319  if (m_ev->m_lock || m_farm->DoIt_prob(0.25))
320  {
321  if (!m_farm->FA_ManganeseSulphate(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
323  break;
324  }
325  }
326  // End of thread
327  break;
328  case nl_pot_hilling1:
329  if (!m_farm->HillingUp(m_field, 0.0, g_date->DayInYear(25, 5) - g_date->DayInYear())) {
331  break;
332  }
334  break;
335  case nl_pot_herbicide1:
336  if (m_ev->m_lock || m_farm->DoIt_prob(0.80))
337  {
338  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 5) - g_date->DayInYear())) {
340  break;
341  }
342  NL_POT_HERBI = true;
343  }
345  break;
346  case nl_pot_herbicide2:
347  if (m_ev->m_lock || (m_farm->DoIt_prob(0.625) && NL_POT_HERBI == 1)) // 50% of all farmers
348  {
349  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
351  break;
352  }
353  }
355  break;
356  case nl_pot_dessication1:
357  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(15, 10) - g_date->DayInYear())) {
359  break;
360  }
362  break;
363 
364  case nl_pot_dessication2:
365  if (m_ev->m_lock || m_farm->DoIt_prob(0.75))
366  {
367  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(20, 10) - g_date->DayInYear())) {
369  break;
370  }
371  }
373  break;
374  case nl_pot_fungicide1:
375  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(7, 6) - g_date->DayInYear())) {
377  break;
378  }
380  break;
381  case nl_pot_fungicide2:
382  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 6) - g_date->DayInYear())) {
384  break;
385  }
387  break;
388  case nl_pot_fungicide3:
389  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(21, 6) - g_date->DayInYear())) {
391  break;
392  }
394  break;
395  case nl_pot_fungicide4:
396  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 6) - g_date->DayInYear())) {
398  break;
399  }
401  break;
402  case nl_pot_fungicide5:
403  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(7, 7) - g_date->DayInYear())) {
405  break;
406  }
408  break;
409  case nl_pot_fungicide6:
410  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 7) - g_date->DayInYear())) {
412  break;
413  }
415  break;
416  case nl_pot_fungicide7:
417  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(21, 7) - g_date->DayInYear())) {
419  break;
420  }
422  break;
423  case nl_pot_fungicide8:
424  if (m_ev->m_lock || m_farm->DoIt_prob(0.80))
425  {
426  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 7) - g_date->DayInYear())) {
428  break;
429  }
430  NL_POT_FUNGI1 = true;
431  }
433  break;
434  case nl_pot_fungicide9:
435  if (m_ev->m_lock || (m_farm->DoIt_prob(1.00) && NL_POT_FUNGI1 == 1))
436  {
437  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(7, 8) - g_date->DayInYear())) {
439  break;
440  }
441  NL_POT_FUNGI2 = true;
442  }
444  break;
445  case nl_pot_fungicide10:
446  if (m_ev->m_lock || (m_farm->DoIt_prob(0.875) && NL_POT_FUNGI2 == 1)) // 70% of all farmers
447  {
448  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 8) - g_date->DayInYear())) {
450  break;
451  }
452  NL_POT_FUNGI3 = true;
453  }
455  break;
456  case nl_pot_fungicide11:
457  if (m_ev->m_lock || (m_farm->DoIt_prob(1.00) && NL_POT_FUNGI3 == 1))
458  {
459  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(21, 8) - g_date->DayInYear())) {
461  break;
462  }
463  NL_POT_FUNGI4 = true;
464  }
466  break;
467  case nl_pot_fungicide12:
468  if (m_ev->m_lock || (m_farm->DoIt_prob(0.857) && NL_POT_FUNGI4 == 1)) // 60% of all farmers
469  {
470  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
472  break;
473  }
474  NL_POT_FUNGI5 = true;
475  }
477  break;
478  case nl_pot_fungicide13:
479  if (m_ev->m_lock || (m_farm->DoIt_prob(1.00) && NL_POT_FUNGI5 == 1))
480  {
481  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(7, 9) - g_date->DayInYear())) {
483  break;
484  }
485  }
487  break;
488  case nl_pot_fungicide14:
489  if (m_ev->m_lock || (m_farm->DoIt_prob(1.00) && NL_POT_FUNGI5 == 1))
490  {
491  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(14, 9) - g_date->DayInYear())) {
493  break;
494  }
495  }
497  break;
498  case nl_pot_fungicide15:
499  if (m_ev->m_lock || (m_farm->DoIt_prob(1.00) && NL_POT_FUNGI5 == 1))
500  {
501  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(21, 9) - g_date->DayInYear())) {
503  break;
504  }
505  }
506  // End of thread
507  break;
508  case nl_pot_insecticide:
509 #ifdef ECOSTACK_BIOPESTICIDE
510  if (m_ev->m_lock || m_farm->DoIt_prob(0.60))
511 #else
512  if (m_ev->m_lock || m_farm->DoIt_prob(0.60))
513 #endif
514  {
515  // here we check whether we are using ERA pesticide or not
516  d1 = g_date->DayInYear(30, 6) - g_date->DayInYear();
517  if (!cfg_pest_potatoes_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
518  {
519 #ifdef ECOSTACK_BIOPESTICIDE
520  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
521 #else
522  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
523 #endif
524  }
525  else {
526  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
527  }
528  if (!flag) {
530  break;
531  }
532 #ifdef ECOSTACK_BIOPESTICIDE
533  SimpleEvent(g_date->Date() + 7, nl_pot_insecticideb, false);
534  break; // end of thread
535 #endif
536  }
537  // End of thread
538  break;
539 
540 #ifdef ECOSTACK_BIOPESTICIDE
541  case nl_pot_insecticideb:
542  if (m_ev->m_lock || m_farm->DoIt_prob(1.00)) {
543  // here we check whether we are using ERA pesticide or not
544  d1 = g_date->DayInYear(37, 6) - g_date->DayInYear();
545  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
546  if (!flag) {
548  break;
549  }
550  }
551  break; // end of thread
552 #endif
553 
554  case nl_pot_harvest:
555  // We don't move harvest days
556  if (!m_farm->Harvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
558  break;
559  }
560  done = true;
561  // So we are done, and somwhere else the farmer will queue up the start event of the next crop
562  // END of MAIN THREAD
563  break;
564  default:
565  g_msg->Warn(WARN_BUG, "NLPotatoes::Do(): "
566  "Unknown event type! ", "");
567  exit(1);
568  }
569  if (done) m_ev->m_forcespring = true; // Here we need to force the next crop to spring operation, so set the ev->forcespring to true
570  return done;
571 }

References Farm::BedForming(), Farm::BiocideTreat(), cfg_pest_potatoes_on, cfg_pest_product_amounts, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_ManganeseSulphate(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_AmmoniumSulphate(), Farm::FP_ManganeseSulphate(), Farm::FP_NPK(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), LE::GetSoilType(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::HillingUp(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, FarmEvent::m_forcespring, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, nl_pot_bed_forming, nl_pot_dessication1, nl_pot_dessication2, nl_pot_ferti_p1_sandy, nl_pot_ferti_p2_clay, nl_pot_ferti_p2_sandy, nl_pot_ferti_p3_clay, nl_pot_ferti_p3_sandy, nl_pot_ferti_p4, nl_pot_ferti_s1_sandy, nl_pot_ferti_s2_clay, nl_pot_ferti_s2_sandy, nl_pot_ferti_s3_clay, nl_pot_ferti_s3_sandy, nl_pot_ferti_s4, NL_POT_FUNGI1, NL_POT_FUNGI2, NL_POT_FUNGI3, NL_POT_FUNGI4, NL_POT_FUNGI5, nl_pot_fungicide1, nl_pot_fungicide10, nl_pot_fungicide11, nl_pot_fungicide12, nl_pot_fungicide13, nl_pot_fungicide14, nl_pot_fungicide15, nl_pot_fungicide2, nl_pot_fungicide3, nl_pot_fungicide4, nl_pot_fungicide5, nl_pot_fungicide6, nl_pot_fungicide7, nl_pot_fungicide8, nl_pot_fungicide9, nl_pot_harvest, NL_POT_HERBI, nl_pot_herbicide1, nl_pot_herbicide2, nl_pot_hilling1, nl_pot_insecticide, nl_pot_insecticideb, nl_pot_spring_planting, nl_pot_spring_plough_sandy, nl_pot_start, nl_pot_stubble_harrow, nl_pot_winter_plough_clay, Calendar::OldDays(), ppp_1, Farm::ProductApplication(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Farm::SpringPlough(), Farm::SpringSow(), Crop::StartUpCrop(), Farm::StubbleHarrowing(), tov_NLPotatoes, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::WinterPlough().

◆ SetUpFarmCategoryInformation()

void NLPotatoes::SetUpFarmCategoryInformation ( )
inline
108  {
109  const int elements = 2 + (nl_pot_foobar - NLPOTATOES_BASE);
111 
112  FarmManagementCategory catlist[elements] =
113  {
114  fmc_Others, // zero element unused but must be here
115  fmc_Others,//nl_pot_start = 1, // Compulsory, must always be 1 (one).
116  fmc_Others,//nl_pot_sleep_all_day = NLPOTATOES_BASE,
117  fmc_Cultivation,//nl_pot_stubble_harrow,
118  fmc_Cultivation,//nl_pot_winter_plough_clay,
119  fmc_Fertilizer,//nl_pot_ferti_p2_clay,
120  fmc_Fertilizer,//nl_pot_ferti_s2_clay,
121  fmc_Fertilizer,//nl_pot_ferti_p1_sandy,
122  fmc_Fertilizer,//nl_pot_ferti_s1_sandy,
123  fmc_Cultivation,//nl_pot_spring_plough_sandy,
124  fmc_Fertilizer,//nl_pot_ferti_p2_sandy,
125  fmc_Fertilizer,//nl_pot_ferti_s2_sandy,
126  fmc_Others,//nl_pot_bed_forming,
127  fmc_Others,//nl_pot_spring_planting,
128  fmc_Others,//nl_pot_hilling1,
129  fmc_Fertilizer,//nl_pot_ferti_p3_clay,
130  fmc_Fertilizer,//nl_pot_ferti_s3_clay,
131  fmc_Fertilizer,//nl_pot_ferti_p3_sandy,
132  fmc_Fertilizer,//nl_pot_ferti_s3_sandy,
133  fmc_Fertilizer,//nl_pot_ferti_p4,
134  fmc_Fertilizer,//nl_pot_ferti_s4,
135  fmc_Herbicide,//nl_pot_herbicide1,
136  fmc_Herbicide,//nl_pot_herbicide2,
137  fmc_Fungicide,//nl_pot_fungicide1,
138  fmc_Fungicide,//nl_pot_fungicide2,
139  fmc_Fungicide,//nl_pot_fungicide3,
140  fmc_Fungicide,//nl_pot_fungicide4,
141  fmc_Fungicide,//nl_pot_fungicide5,
142  fmc_Fungicide,//nl_pot_fungicide6,
143  fmc_Fungicide,//nl_pot_fungicide7,
144  fmc_Fungicide,//nl_pot_fungicide8,
145  fmc_Fungicide,//nl_pot_fungicide9,
146  fmc_Fungicide,//nl_pot_fungicide10,
147  fmc_Fungicide,//nl_pot_fungicide11,
148  fmc_Fungicide,//nl_pot_fungicide12,
149  fmc_Fungicide,//nl_pot_fungicide13,
150  fmc_Fungicide,//nl_pot_fungicide14,
151  fmc_Fungicide,//nl_pot_fungicide15,
152  fmc_Insecticide,//nl_pot_insecticide,
153  fmc_Others,//nl_pot_dessication1,
154  fmc_Others,//nl_pot_dessication2,
155  fmc_Harvest//nl_pot_harvest,
156 
157  // no foobar entry
158 
159  };
160  // Iterate over the catlist elements and copy them to vector
161  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
162 
163  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, Crop::m_base_elements_no, Crop::m_ManagementCategories, nl_pot_foobar, and NLPOTATOES_BASE.

Referenced by NLPotatoes().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
nl_pot_ferti_p4
Definition: NLPotatoes.h:59
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
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
nl_pot_ferti_s3_clay
Definition: NLPotatoes.h:56
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
nl_pot_foobar
Definition: NLPotatoes.h:83
nl_pot_stubble_harrow
Definition: NLPotatoes.h:43
nl_pot_herbicide2
Definition: NLPotatoes.h:62
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
nl_pot_fungicide8
Definition: NLPotatoes.h:70
nl_pot_ferti_p2_sandy
Definition: NLPotatoes.h:50
nl_pot_fungicide1
Definition: NLPotatoes.h:63
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
nl_pot_harvest
Definition: NLPotatoes.h:82
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
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
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
nl_pot_fungicide9
Definition: NLPotatoes.h:71
NL_POT_FUNGI1
#define NL_POT_FUNGI1
Definition: NLPotatoes.h:29
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
Farm::BedForming
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
Definition: FarmFuncs.cpp:1316
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
NL_POT_FUNGI3
#define NL_POT_FUNGI3
Definition: NLPotatoes.h:31
Farm::SpringSow
virtual bool SpringSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the spring on a_field.
Definition: FarmFuncs.cpp:501
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
nl_pot_ferti_s4
Definition: NLPotatoes.h:60
nl_pot_ferti_s2_clay
Definition: NLPotatoes.h:46
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
nl_pot_herbicide1
Definition: NLPotatoes.h:61
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
Farm::HillingUp
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
Definition: FarmFuncs.cpp:1302
NLPotatoes::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLPotatoes.h:108
nl_pot_ferti_p3_clay
Definition: NLPotatoes.h:55
nl_pot_ferti_s2_sandy
Definition: NLPotatoes.h:51
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
nl_pot_fungicide3
Definition: NLPotatoes.h:65
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
nl_pot_winter_plough_clay
Definition: NLPotatoes.h:44
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
Calendar::Date
long Date(void)
Definition: Calendar.h:57
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
NL_POT_FUNGI2
#define NL_POT_FUNGI2
Definition: NLPotatoes.h:30
nl_pot_ferti_s1_sandy
Definition: NLPotatoes.h:48
nl_pot_ferti_p3_sandy
Definition: NLPotatoes.h:57
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
nl_pot_dessication2
Definition: NLPotatoes.h:81
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
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.
nl_pot_hilling1
Definition: NLPotatoes.h:54
NL_POT_FUNGI5
#define NL_POT_FUNGI5
Definition: NLPotatoes.h:33
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
nl_pot_fungicide4
Definition: NLPotatoes.h:66
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
nl_pot_bed_forming
Definition: NLPotatoes.h:52
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
nl_pot_spring_plough_sandy
Definition: NLPotatoes.h:49
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::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
nl_pot_start
Definition: NLPotatoes.h:41
nl_pot_fungicide12
Definition: NLPotatoes.h:74
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
nl_pot_fungicide13
Definition: NLPotatoes.h:75
NLPOTATOES_BASE
#define NLPOTATOES_BASE
Definition: NLPotatoes.h:24
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
nl_pot_spring_planting
Definition: NLPotatoes.h:53
nl_pot_fungicide7
Definition: NLPotatoes.h:69
nl_pot_fungicide10
Definition: NLPotatoes.h:72
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
nl_pot_ferti_p1_sandy
Definition: NLPotatoes.h:47
nl_pot_dessication1
Definition: NLPotatoes.h:80
nl_pot_fungicide11
Definition: NLPotatoes.h:73
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::WinterPlough
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
Definition: FarmFuncs.cpp:395
nl_pot_insecticide
Definition: NLPotatoes.h:78
nl_pot_insecticideb
Definition: NLPotatoes.h:79
nl_pot_fungicide15
Definition: NLPotatoes.h:77
nl_pot_fungicide6
Definition: NLPotatoes.h:68
nl_pot_fungicide14
Definition: NLPotatoes.h:76
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
NL_POT_HERBI
#define NL_POT_HERBI
A flag used to indicate autumn ploughing status.
Definition: NLPotatoes.h:28
nl_pot_ferti_s3_sandy
Definition: NLPotatoes.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
nl_pot_ferti_p2_clay
Definition: NLPotatoes.h:45
Crop::m_forcespringpossible
bool m_forcespringpossible
Used to signal that the crop can be forced to start in spring.
Definition: Farm.h:508
nl_pot_fungicide5
Definition: NLPotatoes.h:67
NL_POT_FUNGI4
#define NL_POT_FUNGI4
Definition: NLPotatoes.h:32
nl_pot_fungicide2
Definition: NLPotatoes.h:64
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tov_NLPotatoes
Definition: LandscapeFarmingEnums.h:254
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
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