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

FR_WinterRape class
. More...

#include <FR_WinterRape.h>

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

FR_WinterRape class
.

See FR_WinterRape.h::FR_WinterRapeToDo for a complete list of all possible events triggered codes by the winter rape 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

◆ FR_WinterRape()

FR_WinterRape::FR_WinterRape ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
113  : Crop(a_tov, a_toc, a_L)
114  {
115  // When we start it off, the first possible date for a farm operation is 1st October
116  // This information is used by other crops when they decide how much post processing of
117  // the management is allowed after harvest before the next crop starts.
118  m_first_date=g_date->DayInYear( 6,8 );
120  }

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

Member Function Documentation

◆ Do()

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

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

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

Reimplemented from Crop.

101 {
102  m_field = a_field; // this is needed because of possible calls to other methods and currently we do not pass parameters.
103  m_farm = a_farm; // this is needed because of possible calls to other methods and currently we do not pass parameters.
104  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
105  bool flag = false;
106  int d1;
107  m_ev = a_ev; // Depending what event has occured jump to the correct bit of code e.g. for ww_start jump to line 67 below
108  switch (a_ev->m_todo)
109  {
110  case fr_wr_start:
111  {
112  // This is just to hold a local variable in scope and prevent compiler errors
113  // ww_start just sets up all the starting conditions and reference dates that are needed to start a ww
114  // crop off
115  FR_WR_EVERY_5_YEAR = 0;
116 
117  a_field->ClearManagementActionSum();
118 
119  m_last_date = g_date->DayInYear(31, 7); // Should match the last flexdate below
120  //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
121  std::vector<std::vector<int>> flexdates(1 + 1, std::vector<int>(2, 0));
122  // Set up the date management stuff
123  // Start and stop dates for all events after harvest
124  flexdates[0][1] = g_date->DayInYear(31, 7); // last possible day (swathing)
125 
126 
127 
128  // Below if this is a spring crop use 365, otherwise first parameter is always 0, second parameter is fixed, and the third is the start up operation in the first year
129  int isSpring = 0;
130  if (StartUpCrop(isSpring, flexdates, int(fr_wr_ammonium_sulphate1))) break;
131 
132  // End single block date checking code. Please see next line comment as well.
133  // Reinit d1 to first possible starting date // calcium + mg is only used every 5-6 years and those years are w/o slurry
134  if ((FR_WR_EVERY_5_YEAR + g_date->GetYearNumber()) % 5 == 0)
135  {
136  d1 = g_date->OldDays() + g_date->DayInYear(17, 6);
137  SimpleEvent(d1, fr_wr_plough1_y2, false);
138  }
139  else if ((FR_WR_EVERY_5_YEAR + g_date->GetYearNumber()) % 5 == 1)
140  {
141  d1 = g_date->OldDays() + g_date->DayInYear(16, 6);
142  SimpleEvent(d1, fr_wr_fertilizer1, false);
143  }
144  else if ((FR_WR_EVERY_5_YEAR + g_date->GetYearNumber()) % 5 == 2)
145  {
146  d1 = g_date->OldDays() + g_date->DayInYear(16, 6);
147  SimpleEvent(d1, fr_wr_fertilizer1, false);
148  }
149  else if ((FR_WR_EVERY_5_YEAR + g_date->GetYearNumber()) % 5 == 3)
150  {
151  d1 = g_date->OldDays() + g_date->DayInYear(16, 6);
152  SimpleEvent(d1, fr_wr_fertilizer1, false);
153  }
154  else if ((FR_WR_EVERY_5_YEAR + g_date->GetYearNumber()) % 5 == 4)
155  {
156  d1 = g_date->OldDays() + g_date->DayInYear(16, 6);
157  SimpleEvent(d1, fr_wr_fertilizer1, false);
158  }
159  break;
160 
161  }
162  break;
163 
164  case fr_wr_fertilizer1:
165  if (a_ev->m_lock || a_farm->DoIt(30)) {
166  if (!a_farm->FP_Slurry(a_field, 0.0, g_date->DayInYear(2, 8) - g_date->DayInYear())) {
167  SimpleEvent(g_date->Date() + 1, fr_wr_fertilizer1, true);
168  break;
169  }
170  }
171  SimpleEvent(g_date->Date(), fr_wr_plough1, false);
172  break;
173 
174  case fr_wr_plough1_y2:
175  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
176  if (!a_farm->StubblePlough(a_field, 0.0, g_date->DayInYear(6, 8) - g_date->DayInYear())) {
177  SimpleEvent(g_date->Date() + 1, fr_wr_plough1_y2, true);
178  break;
179  }
180  SimpleEvent(g_date->Date() + 1, fr_wr_harrow_y2, false);
181  break;
182  }
184  break;
185 
187  if (!a_farm->StubbleHarrowing(a_field, 0.0,
188  g_date->DayInYear(6, 8) - g_date->DayInYear())) {
190  break;
191  }
192  SimpleEvent(g_date->Date() + 2, fr_wr_calc_mg, false);
193  break;
194 
195  case fr_wr_harrow_y2:
196  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
197  if (!a_farm->AutumnHarrow(a_field, 0.0,
198  g_date->DayInYear(7, 8) - g_date->DayInYear())) {
199  SimpleEvent(g_date->Date() + 1, fr_wr_harrow_y2, true);
200  break;
201  }
202  }
203  SimpleEvent(g_date->Date() + 1, fr_wr_calc_mg, false);
204  break;
205 
206  case fr_wr_calc_mg:
207  if (a_ev->m_lock || a_farm->DoIt(20)) {
208  if (!a_farm->FP_Calcium(a_field, 0.0, g_date->DayInYear(8, 8) - g_date->DayInYear())) {
209  SimpleEvent(g_date->Date() + 1, fr_wr_calc_mg, true);
210  break;
211  }
212  }
213 
214  d1 = g_date->Date();
215  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
216  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7), fr_wr_plough2, false);
217  break;
218  }
219  else {
221  break;
222  }
223 
224  case fr_wr_plough1:
225  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
226  if (!a_farm->StubblePlough(a_field, 0.0, g_date->DayInYear(6, 8) - g_date->DayInYear())) {
227  SimpleEvent(g_date->Date() + 1, fr_wr_plough1, true);
228  break;
229  }
230  SimpleEvent(g_date->Date()+1, fr_wr_harrow, false);
231  break;
232  }
233  else SimpleEvent(g_date->Date(), fr_wr_stubble_harrow1, false);
234  break;
235 
237  if (!a_farm->StubbleHarrowing(a_field, 0.0,
238  g_date->DayInYear(6, 8) - g_date->DayInYear())) {
240  break;
241  }
242 
243  d1 = g_date->Date();
244  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
245  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7), fr_wr_plough2, false);
246  break;
247  }
248  else {
250  break;
251  }
252 
253  case fr_wr_harrow:
254  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
255  if (!a_farm->AutumnHarrow(a_field, 0.0,
256  g_date->DayInYear(7, 8) - g_date->DayInYear())) {
257  SimpleEvent(g_date->Date() + 1, fr_wr_harrow, true);
258  break;
259  }
260  }
261 
262  d1 = g_date->Date();
263  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 8)) {
264  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7), fr_wr_plough2, false);
265  break;
266  }
267  else {
269  break;
270  }
271 
272  case fr_wr_plough2:
273  if (a_ev->m_lock || a_farm->DoIt_prob(.20)) {
274  if (!a_farm->AutumnPlough(a_field, 0.0, g_date->DayInYear(1, 9) - g_date->DayInYear())) {
275  SimpleEvent(g_date->Date() + 1, fr_wr_plough2, true);
276  break;
277  }
279  break;
280  }
281  else if (a_ev->m_lock || a_farm->DoIt_prob(.70 / .80)) {
283  break;
284  }
286  break;
287 
289  if (!a_farm->StubbleHarrowing(a_field, 0.0,
290  g_date->DayInYear(1, 9) - g_date->DayInYear())) {
292  break;
293  }
295  break;
296 
298  if (!a_farm->PreseedingCultivator(a_field, 0.0,
299  g_date->DayInYear(15, 9) - g_date->DayInYear())) {
301  break;
302  }
303 
304  SimpleEvent(g_date->Date() < 2, fr_wr_sow, false);
305  break;
306 
307  case fr_wr_sow:
308  if (!a_farm->AutumnSow(m_field, 0.0, g_date->DayInYear(15, 9) - g_date->DayInYear())) {
309  SimpleEvent(g_date->Date() + 1, fr_wr_sow, true);
310  break;
311  }
312  SimpleEvent(g_date->Date() + 1, fr_wr_herbicide1, false);
313  SimpleEvent(g_date->Date() + 2, fr_wr_n_fertilizer, false);
314  SimpleEvent(g_date->Date() + 30, fr_wr_herbicide2, false);
315  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 10) + m_date_modifier, fr_wr_insecticide1, false); // main thread
317  break;
318 
319  case fr_wr_herbicide1:
320  if (a_ev->m_lock || a_farm->DoIt_prob(.80)) {
321  if (!a_farm->HerbicideTreat(a_field, 0.0,
322  g_date->DayInYear(18, 9) - g_date->DayInYear())) {
323  SimpleEvent(g_date->Date() + 1, fr_wr_herbicide1, true);
324  break;
325  }
326  }
327  break;
328 
329  case fr_wr_n_fertilizer:
330  if (a_ev->m_lock || a_farm->DoIt_prob(.20)) {
331  if (!a_farm->FP_N(a_field, 0.0,
332  g_date->DayInYear(21, 9) - g_date->DayInYear())) {
333  SimpleEvent(g_date->Date() + 1, fr_wr_n_fertilizer, true);
334  break;
335  }
336  }
337  break;
338 
339  case fr_wr_herbicide2:
340  if (a_ev->m_lock || a_farm->DoIt_prob(.80)) {
341  if (!a_farm->HerbicideTreat(a_field, 0.0,
342  g_date->DayInYear(15, 10) - g_date->DayInYear())) {
343  SimpleEvent(g_date->Date() + 1, fr_wr_herbicide2, true);
344  break;
345  }
346  }
347  break;
348 
349  case fr_wr_p_fertilizer:
350  if (a_ev->m_lock || a_farm->DoIt_prob(.20)) {
351  if (!a_farm->FP_P(a_field, 0.0,
352  g_date->DayInYear(15, 11) - g_date->DayInYear())) {
353  SimpleEvent(g_date->Date() + 1, fr_wr_p_fertilizer, true);
354  break;
355  }
356  }
357  break;
358 
359  case fr_wr_insecticide1:
360 #ifdef ECOSTACK_BIOPESTICIDE
361  if (a_ev->m_lock || a_farm->DoIt_prob(.60)) {
362 #else
363  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
364 #endif
365  // here we check whether we are using ERA pesticide or not
366  d1 = g_date->DayInYear(30, 11) - g_date->DayInYear();
367  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
368  {
369 #ifdef ECOSTACK_BIOPESTICIDE
370  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
371 #else
372  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
373 #endif
374  }
375  else {
377  }
378  if (!flag) {
380  break;
381  }
382  }
384  break;
385 
387  if (a_ev->m_lock || a_farm->DoIt_prob(1.00)) {
388  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0,
389  g_date->DayInYear(15, 3) - g_date->DayInYear())) {
391  break;
392  }
393  }
396  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 4) + m_date_modifier, fr_wr_insecticide2, false); // main thread
397  break;
398 
399  case fr_wr_microelements:
400  if (a_ev->m_lock || a_farm->DoIt_prob(.70)) {
401  if (!a_farm->FA_PK(a_field, 0.0,
402  g_date->DayInYear(15, 3) - g_date->DayInYear())) {
404  break;
405  }
406  }
408  break;
409  case fr_wr_fungicide1:
410  if (a_ev->m_lock || a_farm->DoIt_prob(.90)) {
411  if (!a_farm->FungicideTreat(a_field, 0.0,
412  g_date->DayInYear(15, 3) - g_date->DayInYear())) {
413  SimpleEvent(g_date->Date() + 1, fr_wr_fungicide1, true);
414  break;
415  }
416  d1 = g_date->Date();
417  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 3)) {
418  SimpleEvent(g_date->Date()+14, fr_wr_fungicide2, false);
419  break;
420  }
421  else {
423  break;
424  }
425  }
426  break;
427 
428  case fr_wr_fungicide2:
429  if (a_ev->m_lock || a_farm->DoIt_prob(.30)) {
430  if (!a_farm->FungicideTreat(a_field, 0.0,
431  g_date->DayInYear(15, 4) - g_date->DayInYear())) {
432  SimpleEvent(g_date->Date() + 1, fr_wr_fungicide2, true);
433  break;
434  }
435  }
436  break;
437 
439  if (a_ev->m_lock || a_farm->DoIt_prob(1.00)) {
440  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0,
441  g_date->DayInYear(15, 4) - g_date->DayInYear())) {
443  break;
444  }
445  }
447  break;
449  if (a_ev->m_lock || a_farm->DoIt_prob(0.2)) {
450  if (!a_farm->FP_AmmoniumSulphate(a_field, 0.0,
451  g_date->DayInYear(30, 4) - g_date->DayInYear())) {
453  break;
454  }
455  }
456  break;
457 
458  case fr_wr_insecticide2:
459 #ifdef ECOSTACK_BIOPESTICIDE
460  if (a_ev->m_lock || a_farm->DoIt_prob(.80)) {
461 #else
462  if (a_ev->m_lock || a_farm->DoIt_prob(.80)) {
463 #endif
464  // here we check whether we are using ERA pesticide or not
465  d1 = g_date->DayInYear(30, 4) - g_date->DayInYear();
466  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
467  {
468 #ifdef ECOSTACK_BIOPESTICIDE
469  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
470 #else
471  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
472 #endif
473  }
474  else {
476  }
477  if (!flag) {
479  break;
480  }
481 #ifdef ECOSTACK_BIOPESTICIDE
482  SimpleEvent(g_date->Date() + 7, fr_wr_insecticide2b, false);
483  SimpleEvent(g_date->Date() + 30, fr_wr_insecticide3, false);
484  break;
485 #endif
486  }
487  SimpleEvent(g_date->Date() + 30, fr_wr_insecticide3, false);
488  break;
489 
490 #ifdef ECOSTACK_BIOPESTICIDE
491  case fr_wr_insecticide2b:
492  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
493  // here we check whether we are using ERA pesticide or not
494  d1 = g_date->DayInYear(7, 5) - g_date->DayInYear();
495  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
496  if (!flag) {
498  break;
499  }
500  }
501  break; // end of thread
502 #endif
503 
504  case fr_wr_insecticide3:
505 #ifdef ECOSTACK_BIOPESTICIDE
506  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
507 #else
508  if (a_ev->m_lock || a_farm->DoIt_prob(1.0)) {
509 #endif
510  // here we check whether we are using ERA pesticide or not
511  d1 = g_date->DayInYear(30, 5) - g_date->DayInYear();
512  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
513  {
514 #ifdef ECOSTACK_BIOPESTICIDE
515  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
516 #else
517  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
518 #endif
519  }
520  else {
522  }
523  if (!flag) {
525  break;
526  }
527 #ifdef ECOSTACK_BIOPESTICIDE
528  SimpleEvent(g_date->Date() + 7, fr_wr_insecticide3b, false);
529  SimpleEvent(g_date->Date() + 30, fr_wr_insecticide4, false);
530  break;
531 #endif
532  }
533  SimpleEvent(g_date->Date() > 14, fr_wr_insecticide4, false);
534  break;
535 
536 #ifdef ECOSTACK_BIOPESTICIDE
537  case fr_wr_insecticide3b:
538  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
539  // here we check whether we are using ERA pesticide or not
540  d1 = g_date->DayInYear(6, 6) - g_date->DayInYear();
541  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
542  if (!flag) {
544  break;
545  }
546  }
547  break; // end of thread
548 #endif
549  case fr_wr_insecticide4:
550 #ifdef ECOSTACK_BIOPESTICIDE
551  if (a_ev->m_lock || a_farm->DoIt_prob(0.8)) {
552 #else
553  if (a_ev->m_lock || a_farm->DoIt_prob(0.8)) {
554 #endif
555  // here we check whether we are using ERA pesticide or not
556  d1 = g_date->DayInYear(15, 6) - g_date->DayInYear();
557  if (!cfg_pest_winterrape_on.value() || !m_field->GetLandscape()->SupplyShouldSpray()) // Not using pesticide spray
558  {
559 #ifdef ECOSTACK_BIOPESTICIDE
560  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
561 #else
562  flag = m_farm->InsecticideTreat(m_field, 0.0, d1);
563 #endif
564  }
565  else {
567  }
568  if (!flag) {
570  break;
571  }
572 #ifdef ECOSTACK_BIOPESTICIDE
573  SimpleEvent(g_date->Date() + 7, fr_wr_insecticide4b, false);
574  break;
575 #endif
576  }
577 
579  break;
580 
581 #ifdef ECOSTACK_BIOPESTICIDE
582  case fr_wr_insecticide4b:
583  if (m_ev->m_lock || m_farm->DoIt_prob(1.0)) {
584  // here we check whether we are using ERA pesticide or not
585  d1 = g_date->DayInYear(22, 6) - g_date->DayInYear();
586  flag = m_farm->BiocideTreat(m_field, 0.0, d1);
587  if (!flag) {
589  break;
590  }
591  }
593  break;
594 #endif
595  case fr_wr_harvest:
596  // We don't move harvest days
597  if (!a_farm->Harvest(a_field, 0.0, a_field->GetMDates(1, 0) - g_date->DayInYear())) {
598  SimpleEvent(g_date->Date() + 1, fr_wr_harvest, true);
599  break;
600  }
601 
602  d1 = g_date->Date();
603  if (d1 < g_date->OldDays() + g_date->DayInYear(1, 7)) {
604  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 7), fr_wr_wait, false);
605  // Because we are ending harvest before 1.7 so we need to wait until the 1.7
606  break;
607  }
608  else {
609  done = true; // end of plan
610  }
611  case fr_wr_wait:
612  done = true;
613  break;
614 
615  done = true;
616  // So we are done, and somewhere else the farmer will queue up the start event of the next crop
617  // END OF MAIN THREAD
618  break;
619 
620  default:
621  g_msg->Warn(WARN_BUG, "FR_WinterRape::Do(): "
622  "Unknown event type! ", "");
623  exit(1);
624  }
625  return done;
626 }

References Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnSow(), Farm::BiocideTreat(), cfg_pest_product_amounts, cfg_pest_winterrape_on, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::DoIt_prob(), Farm::FA_PK(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_N(), Farm::FP_P(), Farm::FP_Slurry(), fr_wr_ammonium_sulphate1, fr_wr_ammonium_sulphate2, fr_wr_ammonium_sulphate3, fr_wr_calc_mg, FR_WR_EVERY_5_YEAR, fr_wr_fertilizer1, fr_wr_fungicide1, fr_wr_fungicide2, fr_wr_harrow, fr_wr_harrow_y2, fr_wr_harvest, fr_wr_herbicide1, fr_wr_herbicide2, fr_wr_insecticide1, fr_wr_insecticide2, fr_wr_insecticide2b, fr_wr_insecticide3, fr_wr_insecticide3b, fr_wr_insecticide4, fr_wr_insecticide4b, fr_wr_microelements, fr_wr_n_fertilizer, fr_wr_p_fertilizer, fr_wr_plough1, fr_wr_plough1_y2, fr_wr_plough2, fr_wr_preseed_cultivation, fr_wr_sow, fr_wr_start, fr_wr_stubble_harrow1, fr_wr_stubble_harrow1_y2, fr_wr_stubble_harrow2, fr_wr_wait, Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Calendar::GetYearNumber(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Crop::m_date_modifier, Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_todo, Calendar::OldDays(), ppp_1, Farm::PreseedingCultivator(), Farm::ProductApplication(), Crop::SimpleEvent(), Crop::SimpleEvent_(), Crop::StartUpCrop(), Farm::StubbleHarrowing(), Farm::StubblePlough(), CfgBool::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void FR_WinterRape::SetUpFarmCategoryInformation ( )
inline
121  {
122  const int elements = 2 + (fr_wr_foobar - FR_WR_BASE);
124 
125  FarmManagementCategory catlist[elements] =
126  {
127  fmc_Others, // zero element unused but must be here
128  fmc_Others, //fr_wr_start = 1, // Compulsory, must always be 1 (one).
129  fmc_Others, // fr_wr_sleep_all_day = FR_WR_BASE,
130  fmc_Fertilizer, // fr_wr_fertilizer1,
131  fmc_Cultivation, // fr_wr_plough1,
132  fmc_Cultivation, // fr_wr_plough1_y2,
133  fmc_Cultivation, // fr_wr_stubble_harrow1_y2,
134  fmc_Cultivation, // fr_wr_harrow_y2,
135  fmc_Fertilizer, // fr_wr_calc_mg,
136  fmc_Cultivation, // fr_wr_stubble_harrow1,
137  fmc_Cultivation, // fr_wr_harrow,
138  fmc_Cultivation, // fr_wr_plough2,
139  fmc_Cultivation, // fr_wr_stubble_harrow2,
140  fmc_Cultivation, // fr_wr_preseed_cultivation,
141  fmc_Others, // fr_wr_sow,
142  fmc_Herbicide, // fr_wr_herbicide1,
143  fmc_Fertilizer, //fr_wr_n_fertilizer,
144  fmc_Herbicide, //fr_wr_herbicide2,
145  fmc_Insecticide, //fr_wr_insecticide1,
146  fmc_Fertilizer, //fr_wr_p_fertilizer,
147  fmc_Fertilizer, //fr_wr_ammonium_sulphate1,
148  fmc_Fertilizer, //fr_wr_microelements,
149  fmc_Fertilizer, //fr_wr_ammonium_sulphate2,
150  fmc_Fertilizer, //fr_wr_ammonium_sulphate3,
151  fmc_Fungicide, //fr_wr_fungicide1,
152  fmc_Fungicide, //fr_wr_fungicide2,
153  fmc_Insecticide, // fr_wr_insecticide2,
154  fmc_Insecticide, //fr_wr_insecticide3,
155  fmc_Insecticide, //fr_wr_insecticide4,
156  fmc_Insecticide, // fr_wr_insecticide2b,
157  fmc_Insecticide, //fr_wr_insecticide3b,
158  fmc_Insecticide, //fr_wr_insecticide4b,
159  fmc_Harvest, //fr_wr_harvest,
160  fmc_Others, // fr_ww_wait
161 
162  // no foobar entry
163 
164  };
165  // Iterate over the catlist elements and copy them to vector
166  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
167 
168  }

References fmc_Cultivation, fmc_Fertilizer, fmc_Fungicide, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, FR_WR_BASE, fr_wr_foobar, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by FR_WinterRape().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: FarmFuncs.cpp:312
fr_wr_harvest
Definition: FR_WinterRape.h:95
fr_wr_sow
Definition: FR_WinterRape.h:77
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
fr_wr_stubble_harrow1
Definition: FR_WinterRape.h:72
fr_wr_fertilizer1
Definition: FR_WinterRape.h:66
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
fr_wr_insecticide4
Definition: FR_WinterRape.h:93
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::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
fr_wr_microelements
Definition: FR_WinterRape.h:84
fr_wr_foobar
Definition: FR_WinterRape.h:97
cfg_pest_winterrape_on
CfgBool cfg_pest_winterrape_on
Turn on pesticides for winter rape.
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: FarmFuncs.cpp:232
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
fr_wr_preseed_cultivation
Definition: FR_WinterRape.h:76
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
fr_wr_plough1
Definition: FR_WinterRape.h:67
fr_wr_fungicide2
Definition: FR_WinterRape.h:88
fr_wr_wait
Definition: FR_WinterRape.h:96
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
fr_wr_insecticide2b
Definition: FR_WinterRape.h:90
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
fr_wr_calc_mg
Definition: FR_WinterRape.h:71
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
fr_wr_harrow_y2
Definition: FR_WinterRape.h:70
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
fr_wr_start
Definition: FR_WinterRape.h:64
CfgBool::value
bool value() const
Definition: Configurator.h:164
FR_WinterRape::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: FR_WinterRape.h:121
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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.
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
Farm::FP_N
virtual bool FP_N(LE *a_field, double a_user, int a_days)
Apply N fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:700
fr_wr_ammonium_sulphate2
Definition: FR_WinterRape.h:85
fr_wr_insecticide4b
Definition: FR_WinterRape.h:94
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fr_wr_fungicide1
Definition: FR_WinterRape.h:87
fr_wr_herbicide1
Definition: FR_WinterRape.h:78
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
fr_wr_ammonium_sulphate3
Definition: FR_WinterRape.h:86
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
fr_wr_n_fertilizer
Definition: FR_WinterRape.h:79
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
fr_wr_harrow
Definition: FR_WinterRape.h:73
FR_WR_EVERY_5_YEAR
#define FR_WR_EVERY_5_YEAR
Definition: FR_WinterRape.h:53
fr_wr_plough2
Definition: FR_WinterRape.h:74
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
fr_wr_stubble_harrow2
Definition: FR_WinterRape.h:75
fr_wr_plough1_y2
Definition: FR_WinterRape.h:68
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
Farm::FP_P
virtual bool FP_P(LE *a_field, double a_user, int a_days)
Apply P fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:687
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
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
fr_wr_p_fertilizer
Definition: FR_WinterRape.h:82
fr_wr_ammonium_sulphate1
Definition: FR_WinterRape.h:83
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
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
fr_wr_insecticide3
Definition: FR_WinterRape.h:91
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
fr_wr_insecticide2
Definition: FR_WinterRape.h:89
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
fr_wr_insecticide1
Definition: FR_WinterRape.h:81
FR_WR_BASE
#define FR_WR_BASE
Definition: FR_WinterRape.h:55
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fr_wr_insecticide3b
Definition: FR_WinterRape.h:92
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
fr_wr_herbicide2
Definition: FR_WinterRape.h:80
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
fr_wr_stubble_harrow1_y2
Definition: FR_WinterRape.h:69