Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NLTulips Class Reference

NLTulips class
. More...

#include <NLTulips.h>

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

NLTulips class
.

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

◆ NLTulips()

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

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

Member Function Documentation

◆ Do()

bool NLTulips::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 tulips.

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_tu_start:
82  {
83  NL_TU_AUTUMN_PLOUGH = false;
84  NL_TU_FERTI_DONE = false;
85  NL_TU_STRAW_REMOVED = false;
88 
89  m_last_date = g_date->DayInYear(20, 7); // Should match the last flexdate below
90  //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
91  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
92  // Set up the date management stuff
93  // Start and stop dates for all events after harvest
94  flexdates[0][1] = g_date->DayInYear(20, 7); // first possible day of finishing harvest - this is in effect day before the earliest date that a following crop can use
95 
96  flexdates[1][0] = -1; // This date will be moved back as far as necessary and potentially to flexdates 1 (start op 1)
97  flexdates[1][1] = g_date->DayInYear(20, 7); // This date will be moved back as far as necessary and potentially to flexdates 1 (end op 1) - straw chopping
98 
99  // 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
100  int isSpring = 0;
101  if (StartUpCrop(isSpring, flexdates, int(nl_tu_fungicide1))) break;
102 
103  // End single block date checking code. Please see next line comment as well.
104  // Reinit d1 to first possible starting date.
105  d1 = g_date->OldDays() + g_date->DayInYear(1, 9) + isSpring;
106  // OK, let's go.
107  // Here we queue up the first event - this differs depending on whether we have field on snady or clay soils
108  if (m_farm->IsStockFarmer()) //Stock Farmer
109  {
111  }
112  else SimpleEvent_(d1, nl_tu_ferti_p1, false, m_farm, m_field);
113  break;
114  }
115  break;
116 
117  // This is the first real farm operation
118  case nl_tu_ferti_p1:
119  if (m_ev->m_lock || m_farm->DoIt_prob(0.90))
120  {
121  if (!m_farm->FP_Manure(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
123  break;
124  }
125  }
126  d1 = g_date->Date() + 1;
127  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 9)) {
128  d1 = g_date->OldDays() + g_date->DayInYear(15, 9);
129  }
131  break;
132  case nl_tu_ferti_s1:
133  if (m_ev->m_lock || m_farm->DoIt_prob(0.90))
134  {
135  if (!m_farm->FA_Manure(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
137  break;
138  }
139  }
140  d1 = g_date->Date() + 1;
141  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 9)) {
142  d1 = g_date->OldDays() + g_date->DayInYear(15, 9);
143  }
145  break;
146  case nl_tu_autumn_plough:
147  if (m_ev->m_lock || m_farm->DoIt_prob(0.80))
148  {
149  if (!m_farm->AutumnPlough(m_field, 0.0, g_date->DayInYear(31, 10) - g_date->DayInYear())) {
151  break;
152  }
154  break;
155  }
157  break;
161  break;
162  }
164  break;
165  case nl_tu_bed_forming:
166  if (!m_farm->BedForming(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
168  break;
169  }
171  break;
172  case nl_tu_fungicide0:
173  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 11) - g_date->DayInYear())) {
175  break;
176  }
178  break;
179  case nl_tu_planting:
180  if (!m_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
182  break;
183  }
184  // Here is a fork leading to four parallel events
185  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 1) + 365, nl_tu_herbicide1, false, m_farm, m_field); // Herbicide thread
186  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(15, 3) + 365 + m_date_modifier, nl_tu_insecticide1, false, m_farm, m_field); // Insecticide thread
187  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3) + 365, nl_tu_fungicide1, false, m_farm, m_field); // Fungicide thread = MAIN THREAD
188  SimpleEvent_(g_date->Date() + 10, nl_tu_straw_covering, false, m_farm, m_field); // Flower management
189  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(25, 4) + 365, nl_tu_irrigation, false, m_farm, m_field); // Flower management
190  if (m_farm->IsStockFarmer()) //Stock Farmer
191  {
192  SimpleEvent_(g_date->Date() + 5, nl_tu_ferti_s2, false, m_farm, m_field); // Fertilizers thread
193  }
194  else SimpleEvent_(g_date->Date() + 5, nl_tu_ferti_p2, false, m_farm, m_field);
195  break;
196  case nl_tu_ferti_p2:
197  if (m_ev->m_lock || m_farm->DoIt_prob(0.40))
198  {
199  if (!m_farm->FP_PK(m_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
201  break;
202  }
203  }
204  NL_TU_FERTI_DONE = true;
205  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 1) + 365, nl_tu_ferti_p3, false, m_farm, m_field);
206  break;
207  case nl_tu_ferti_s2:
208  if (m_ev->m_lock || m_farm->DoIt_prob(0.40))
209  {
210  if (!m_farm->FA_PK(m_field, 0.0, g_date->DayInYear(30, 11) - g_date->DayInYear())) {
212  break;
213  }
214  }
215  NL_TU_FERTI_DONE = true;
216  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 1) + 365, nl_tu_ferti_s3, false, m_farm, m_field);
217  break;
218  case nl_tu_ferti_p3:
219  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(20, 2) - g_date->DayInYear())) {
221  break;
222  }
224  break;
225  case nl_tu_ferti_s3:
226  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(20, 2) - g_date->DayInYear())) {
228  break;
229  }
231  break;
232  case nl_tu_ferti_p4:
233  if (m_ev->m_lock || m_farm->DoIt_prob(0.60))
234  {
235  if (!m_farm->FP_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
237  break;
238  }
239  }
240  // End of thread
241  break;
242  case nl_tu_ferti_s4:
243  if (m_ev->m_lock || m_farm->DoIt_prob(0.60))
244  {
245  if (!m_farm->FA_AmmoniumSulphate(m_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
247  break;
248  }
249  }
250  // End of thread
251  break;
253  if (NL_TU_FERTI_DONE == 0) {
255  }
256  else
257  {
258  if (!m_farm->StrawCovering(m_field, 0.0, g_date->DayInYear(20, 12) - g_date->DayInYear())) {
260  break;
261  }
263  break;
264  }
265  break;
266  case nl_tu_straw_removal:
267  if (!m_farm->StrawRemoval(m_field, 0.0, g_date->DayInYear(20, 2) - g_date->DayInYear())) {
269  break;
270  }
271  NL_TU_STRAW_REMOVED = true;
273  break;
275  if (!m_farm->FlowerCutting(m_field, 0.0, g_date->DayInYear(15, 5) - g_date->DayInYear())) {
277  break;
278  }
279  // End of thread
280  break;
281  case nl_tu_herbicide1: // The first of the pesticide managements.
282  // Here comes the herbicide thread
283  if (NL_TU_STRAW_REMOVED == 0) {
285  }
286  else
287  {
288  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(20, 2) - g_date->DayInYear())) {
290  break;
291  }
293  break;
294  }
295  break;
296  case nl_tu_herbicide2:
297  if (!m_farm->HerbicideTreat(m_field, 0.0, g_date->DayInYear(30, 2) - g_date->DayInYear())) {
299  break;
300  }
301  // End of thread
302  break;
303  case nl_tu_fungicide1:
304  // Here comes the fungicide thread
305  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
307  break;
308  }
311  break;
313  // here we check whether we are using ERA pesticide or not
314  d1 = g_date->DayInYear(30, 3) - g_date->DayInYear();
315  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
316  {
317  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
318  }
319  else {
320  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
321  }
322  if (!flag) {
324  break;
325  }
327  break;
328  case nl_tu_fungicide2:
329  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
331  break;
332  }
335  break;
337  // here we check whether we are using ERA pesticide or not
338  d1 = g_date->DayInYear(30, 3) - g_date->DayInYear();
339  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
340  {
341  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
342  }
343  else {
344  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
345  }
346  if (!flag) {
348  break;
349  }
351  break;
352  case nl_tu_fungicide3:
353  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
355  break;
356  }
359  break;
361  // here we check whether we are using ERA pesticide or not
362  d1 = g_date->DayInYear(30, 3) - g_date->DayInYear();
363  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
364  {
365  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
366  }
367  else {
368  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
369  }
370  if (!flag) {
372  break;
373  }
374  d1 = g_date->Date() + 3;
375  if (d1 < g_date->OldDays() + g_date->DayInYear(15, 3)) {
376  d1 = g_date->OldDays() + g_date->DayInYear(15, 3);
377  }
379  break;
380  case nl_tu_fungicide4:
381  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(5, 5) - g_date->DayInYear())) {
383  break;
384  }
387  break;
389  // here we check whether we are using ERA pesticide or not
390  d1 = g_date->DayInYear(5, 5) - g_date->DayInYear();
391  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
392  {
393  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
394  }
395  else {
396  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
397  }
398  if (!flag) {
400  break;
401  }
403  break;
404  case nl_tu_fungicide5:
405  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(5, 5) - g_date->DayInYear())) {
407  break;
408  }
411  break;
413  // here we check whether we are using ERA pesticide or not
414  d1 = g_date->DayInYear(5, 5) - g_date->DayInYear();
415  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
416  {
417  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
418  }
419  else {
420  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
421  }
422  if (!flag) {
424  break;
425  }
427  break;
428  case nl_tu_fungicide6:
429  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(5, 5) - g_date->DayInYear())) {
431  break;
432  }
435  break;
437  // here we check whether we are using ERA pesticide or not
438  d1 = g_date->DayInYear(5, 5) - g_date->DayInYear();
439  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
440  {
441  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
442  }
443  else {
444  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
445  }
446  if (!flag) {
448  break;
449  }
450  d1 = g_date->Date() + 3;
451  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 4)) {
452  d1 = g_date->OldDays() + g_date->DayInYear(20, 4);
453  }
455  break;
456  case nl_tu_fungicide7:
457  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
459  break;
460  }
463  break;
465  // here we check whether we are using ERA pesticide or not
466  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
467  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
468  {
469  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
470  }
471  else {
472  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
473  }
474  if (!flag) {
476  break;
477  }
479  break;
480  case nl_tu_fungicide8:
481  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
483  break;
484  }
487  break;
489  // here we check whether we are using ERA pesticide or not
490  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
491  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
492  {
493  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
494  }
495  else {
496  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
497  }
498  if (!flag) {
500  break;
501  }
503  break;
504  case nl_tu_fungicide9:
505  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
507  break;
508  }
511  break;
513  // here we check whether we are using ERA pesticide or not
514  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
515  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
516  {
517  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
518  }
519  else {
520  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
521  }
522  if (!flag) {
524  break;
525  }
527  break;
528  case nl_tu_fungicide10:
529  if (!m_farm->FungicideTreat(m_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
531  break;
532  }
535  break;
537  // here we check whether we are using ERA pesticide or not
538  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
539  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
540  {
541  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
542  }
543  else {
544  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
545  }
546  if (!flag) {
548  break;
549  }
550  d1 = g_date->Date() + 7;
551  if (d1 < g_date->OldDays() + g_date->DayInYear(10, 6)) {
552  d1 = g_date->OldDays() + g_date->DayInYear(10, 6);
553  }
554  SimpleEvent_(d1, nl_tu_harvest, false, m_farm, m_field); break;
555 
556  case nl_tu_insecticide1:
557  if (NL_TU_FUNGI_SPRAY_DATE >= g_date->Date() - 2) { // Should by at least 3 days after fungicide + insecticide
559  }
560  else
561  {
562  if (m_ev->m_lock || m_farm->DoIt_prob(0.90))
563  {
564  // here we check whether we are using ERA pesticide or not
565  d1 = g_date->DayInYear(20, 4) - g_date->DayInYear();
566  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
567  {
568  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
569  }
570  else {
571  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
572  }
573  if (!flag) {
575  break;
576  }
577  }
578  d1 = g_date->Date() + 7;
579  if (d1 < g_date->OldDays() + g_date->DayInYear(20, 4)) {
580  d1 = g_date->OldDays() + g_date->DayInYear(20, 4);
581  }
583  break;
584  }
585  break;
586  case nl_tu_insecticide2:
587  if (NL_TU_FUNGI_SPRAY_DATE >= g_date->Date() - 2) { // Should by at least 3 days after fungicide + insecticide
589  }
590  else
591  {
592  // here we check whether we are using ERA pesticide or not
593  d1 = g_date->DayInYear(15, 5) - g_date->DayInYear();
594  if (!cfg_pest_tulips_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
595  {
596  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
597  }
598  else {
599  flag = m_farm->ProductApplication(m_field, 0.0, d1, cfg_pest_product_amounts.value(0), ppp_1, false, 3);
600  }
601  if (!flag) {
603  break;
604  }
605  }
606  // End of thread
607  break;
608  case nl_tu_irrigation:
609  if (m_ev->m_lock || m_farm->DoIt_prob(0.25))
610  {
611  if (!m_farm->Water(m_field, 0.0, g_date->DayInYear(25, 4) - g_date->DayInYear())) {
613  break;
614  }
615  }
616  // End of thread
617  break;
618  case nl_tu_harvest:
619  // Here the MAIN thread continues
620  // We don't move harvest days
621  if (!m_farm->BulbHarvest(m_field, 0.0, m_field->GetMDates(1, 0) - g_date->DayInYear())) {
623  break;
624  }
625  d1 = g_date->Date();
626  if (d1 <= g_date->OldDays() + g_date->DayInYear(1, 7)) {
628  break;
629  }
630  else {
631  done = true;
632  break;
633  }
634  break;
635  case nl_tu_sleep_all_day:
636  if (!m_farm->SleepAllDay(m_field, 0.0, g_date->DayInYear(5, 7) - g_date->DayInYear())) {
638  break;
639  }
640  done = true;
641  break;
642  default:
643  g_msg->Warn(WARN_BUG, "NLTulips::Do(): "
644  "Unknown event type! ", "");
645  exit(1);
646  }
647  return done;
648 }

References Farm::AutumnPlough(), Farm::AutumnSow(), Farm::BedForming(), Farm::BulbHarvest(), cfg_pest_product_amounts, cfg_pest_tulips_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt_prob(), Farm::FA_AmmoniumSulphate(), Farm::FA_Manure(), Farm::FA_PK(), Farm::FlowerCutting(), Farm::FP_AmmoniumSulphate(), Farm::FP_Manure(), Farm::FP_PK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, nl_tu_added_insecticide1, nl_tu_added_insecticide10, nl_tu_added_insecticide2, nl_tu_added_insecticide3, nl_tu_added_insecticide4, nl_tu_added_insecticide5, nl_tu_added_insecticide6, nl_tu_added_insecticide7, nl_tu_added_insecticide8, nl_tu_added_insecticide9, nl_tu_autumn_heavy_stubble_cultivator, NL_TU_AUTUMN_PLOUGH, nl_tu_autumn_plough, nl_tu_bed_forming, NL_TU_FERTI_DONE, nl_tu_ferti_p1, nl_tu_ferti_p2, nl_tu_ferti_p3, nl_tu_ferti_p4, nl_tu_ferti_s1, nl_tu_ferti_s2, nl_tu_ferti_s3, nl_tu_ferti_s4, nl_tu_flower_cutting, NL_TU_FUNGI_SPRAY_DATE, nl_tu_fungicide0, nl_tu_fungicide1, nl_tu_fungicide10, nl_tu_fungicide2, nl_tu_fungicide3, nl_tu_fungicide4, nl_tu_fungicide5, nl_tu_fungicide6, nl_tu_fungicide7, nl_tu_fungicide8, nl_tu_fungicide9, nl_tu_harvest, nl_tu_herbicide1, nl_tu_herbicide2, nl_tu_insecticide1, nl_tu_insecticide2, nl_tu_irrigation, nl_tu_planting, nl_tu_sleep_all_day, nl_tu_start, nl_tu_straw_covering, nl_tu_straw_removal, NL_TU_STRAW_REMOVED, Calendar::OldDays(), ppp_1, Farm::ProductApplication(), Crop::SimpleEvent_(), Farm::SleepAllDay(), Crop::StartUpCrop(), Farm::StrawCovering(), Farm::StrawRemoval(), Farm::StubbleCultivatorHeavy(), tov_NLTulips, CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void NLTulips::SetUpFarmCategoryInformation ( )
inline
108  {
109  const int elements = 2 + (nl_tu_foobar - NLTULIPS_BASE);
111 
112  FarmManagementCategory catlist[elements] =
113  {
114  fmc_Others, // zero element unused but must be here
115  fmc_Others,//nl_tu_start = 1, // Compulsory, must always be 1 (one).
116  fmc_Others,//nl_tu_sleep_all_day = NLTULIPS_BASE,
117  fmc_Fertilizer,//nl_tu_manure,
118  fmc_Cultivation,//nl_tu_autumn_plough,
119  fmc_Cultivation,//nl_tu_autumn_heavy_stubble_cultivator,
120  fmc_Others,//nl_tu_bed_forming,
121  fmc_Fungicide,//nl_tu_fungicide0,
122  fmc_Others,//nl_tu_planting,
123  fmc_Fertilizer,//nl_tu_ferti_p1,
124  fmc_Fertilizer,//nl_tu_ferti_s1,
125  fmc_Others,//nl_tu_straw_covering,
126  fmc_Others,//nl_tu_straw_removal,
127  fmc_Herbicide,//nl_tu_herbicide1,
128  fmc_Herbicide,//nl_tu_herbicide2,
129  fmc_Fungicide,//nl_tu_fungicide1,
130  fmc_Fungicide,//nl_tu_fungicide2,
131  fmc_Fungicide,//nl_tu_fungicide3,
132  fmc_Fungicide,//nl_tu_fungicide4,
133  fmc_Fungicide,//nl_tu_fungicide5,
134  fmc_Fungicide,//nl_tu_fungicide6,
135  fmc_Fungicide,//nl_tu_fungicide7,
136  fmc_Fungicide,//nl_tu_fungicide8,
137  fmc_Fungicide,//nl_tu_fungicide9,
138  fmc_Fungicide,//nl_tu_fungicide10,
139  fmc_Insecticide,//nl_tu_added_insecticide1,
140  fmc_Insecticide,//nl_tu_added_insecticide2,
141  fmc_Insecticide,//nl_tu_added_insecticide3,
142  fmc_Insecticide,//nl_tu_added_insecticide4,
143  fmc_Insecticide,//nl_tu_added_insecticide5,
144  fmc_Insecticide,//nl_tu_added_insecticide6,
145  fmc_Insecticide,//nl_tu_added_insecticide7,
146  fmc_Insecticide,//nl_tu_added_insecticide8,
147  fmc_Insecticide,//nl_tu_added_insecticide9,
148  fmc_Insecticide,//nl_tu_added_insecticide10,
149  fmc_Insecticide,//nl_tu_insecticide1,
150  fmc_Insecticide,//nl_tu_insecticide2,
151  fmc_Fertilizer,//nl_tu_ferti_p2,
152  fmc_Fertilizer,//nl_tu_ferti_s2,
153  fmc_Fertilizer,//nl_tu_ferti_p3,
154  fmc_Fertilizer,//nl_tu_ferti_s3,
155  fmc_Fertilizer,//nl_tu_ferti_p4,
156  fmc_Fertilizer,//nl_tu_ferti_s4,
157  fmc_Others,//nl_tu_flower_cutting,
158  fmc_Watering,//nl_tu_irrigation,
159  fmc_Harvest//nl_tu_harvest,
160 
161  // no foobar entry
162 
163  };
164  // Iterate over the catlist elements and copy them to vector
165  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
166 
167  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, Crop::m_ManagementCategories, nl_tu_foobar, and NLTULIPS_BASE.

Referenced by NLTulips().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
NL_TU_AUTUMN_PLOUGH
#define NL_TU_AUTUMN_PLOUGH
A flag used to indicate autumn ploughing status.
Definition: NLTulips.h:28
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
nl_tu_added_insecticide10
Definition: NLTulips.h:72
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_tu_ferti_p2
Definition: NLTulips.h:75
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
nl_tu_ferti_s2
Definition: NLTulips.h:76
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
Farm::StubbleCultivatorHeavy
virtual bool StubbleCultivatorHeavy(LE *a_field, double a_user, int a_days)
Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can...
Definition: FarmFuncs.cpp:245
nl_tu_foobar
Definition: NLTulips.h:84
nl_tu_added_insecticide8
Definition: NLTulips.h:70
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
NL_TU_FUNGI_SPRAY_DATE
#define NL_TU_FUNGI_SPRAY_DATE
Definition: NLTulips.h:31
Farm::StrawRemoval
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1752
nl_tu_added_insecticide6
Definition: NLTulips.h:68
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
nl_tu_herbicide1
Definition: NLTulips.h:51
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.
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
nl_tu_start
Definition: NLTulips.h:39
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
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
nl_tu_fungicide7
Definition: NLTulips.h:59
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::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
NLTULIPS_BASE
#define NLTULIPS_BASE
Definition: NLTulips.h:24
nl_tu_flower_cutting
Definition: NLTulips.h:81
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
NL_TU_FERTI_DONE
#define NL_TU_FERTI_DONE
Definition: NLTulips.h:29
nl_tu_ferti_s1
Definition: NLTulips.h:48
CfgBool::value
bool value() const
Definition: Configurator.h:164
nl_tu_autumn_heavy_stubble_cultivator
Definition: NLTulips.h:43
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
nl_tu_fungicide0
Definition: NLTulips.h:45
nl_tu_fungicide8
Definition: NLTulips.h:60
NL_TU_STRAW_REMOVED
#define NL_TU_STRAW_REMOVED
Definition: NLTulips.h:30
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
nl_tu_fungicide5
Definition: NLTulips.h:57
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
nl_tu_straw_removal
Definition: NLTulips.h:50
nl_tu_insecticide2
Definition: NLTulips.h:74
nl_tu_added_insecticide7
Definition: NLTulips.h:69
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
nl_tu_sleep_all_day
Definition: NLTulips.h:40
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
nl_tu_added_insecticide2
Definition: NLTulips.h:64
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::FlowerCutting
virtual bool FlowerCutting(LE *a_field, double a_user, int a_days)
Flower cutting applied on a_field.
Definition: FarmFuncs.cpp:1688
nl_tu_ferti_p3
Definition: NLTulips.h:77
nl_tu_bed_forming
Definition: NLTulips.h:44
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_tu_fungicide1
Definition: NLTulips.h:53
nl_tu_herbicide2
Definition: NLTulips.h:52
nl_tu_fungicide9
Definition: NLTulips.h:61
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
nl_tu_autumn_plough
Definition: NLTulips.h:42
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_tu_added_insecticide4
Definition: NLTulips.h:66
nl_tu_fungicide3
Definition: NLTulips.h:55
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
NLTulips::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLTulips.h:108
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
nl_tu_harvest
Definition: NLTulips.h:83
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
nl_tu_added_insecticide9
Definition: NLTulips.h:71
nl_tu_irrigation
Definition: NLTulips.h:82
nl_tu_added_insecticide1
Definition: NLTulips.h:63
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
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
nl_tu_ferti_s3
Definition: NLTulips.h:78
nl_tu_fungicide2
Definition: NLTulips.h:54
nl_tu_insecticide1
Definition: NLTulips.h:73
nl_tu_straw_covering
Definition: NLTulips.h:49
nl_tu_planting
Definition: NLTulips.h:46
nl_tu_added_insecticide5
Definition: NLTulips.h:67
nl_tu_ferti_p4
Definition: NLTulips.h:79
Farm::StrawCovering
virtual bool StrawCovering(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1738
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
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
nl_tu_ferti_p1
Definition: NLTulips.h:47
Farm::BulbHarvest
virtual bool BulbHarvest(LE *a_field, double a_user, int a_days)
Carry out a bulb harvest on a_field.
Definition: FarmFuncs.cpp:1706
cfg_pest_tulips_on
CfgBool cfg_pest_tulips_on
Turn on pesticides for tulips.
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
nl_tu_ferti_s4
Definition: NLTulips.h:80
nl_tu_fungicide4
Definition: NLTulips.h:56
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
nl_tu_added_insecticide3
Definition: NLTulips.h:65
tov_NLTulips
Definition: LandscapeFarmingEnums.h:258
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
nl_tu_fungicide10
Definition: NLTulips.h:62
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
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
nl_tu_fungicide6
Definition: NLTulips.h:58