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

#include <Carrots.h>

Inheritance diagram for Carrots:
Crop

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 Carrots (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...
 

Constructor & Destructor Documentation

◆ Carrots()

Carrots::Carrots ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
71  : Crop(a_tov, a_toc, a_L)
72  {
75  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

36  {
37  m_farm = a_farm;
38  m_field = a_field;
39  m_ev = a_ev;
40 
41  bool done = false;
42  int today=0;
43  int noDates=0;
44  int d1=0;
45 
46  switch ( m_ev->m_todo ) {
47  case ca_start:
48 
49 
50  CA_SLURRY_DATE = 0;
53  a_field->ClearManagementActionSum();
54 
55  // Set up the date management stuff
56  m_last_date = g_date->DayInYear( 8,9 );
57  // Start and stop dates for all events after harvest
58  noDates = 1;
59  m_field->SetMDates( 0, 0, g_date->DayInYear( 8,9 ) );
60  // 0,0 determined by harvest date - used to see if at all possible
61  m_field->SetMDates( 1, 0, g_date->DayInYear( 30, 11 ) );
62  // Check the next crop for early start, unless it is a spring crop
63  // in which case we ASSUME that no checking is necessary!!!!
64  // So DO NOT implement a crop that runs over the year boundary
65 
66 
67  //new if: do the check only for non-optimising farms and if year>0. (030713 - m_rotation used only in the hidden year, so I modified the condition from >7 to >0)
69 
70  if ( m_ev->m_startday > g_date->DayInYear( 1, 7 ) ) {
71  if ( m_field->GetMDates( 0, 0 ) >= m_ev->m_startday ) {
72  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Harvest too late for the next crop to start!!!", "" );
73  exit( 1 );
74  }
75  // Now fix any late finishing problems
76  for (int i=0; i<noDates; i++) {
77  if(m_field->GetMDates(0,i)>=m_ev->m_startday) {
78  m_field->SetMDates(0,i,m_ev->m_startday-1); //move the starting date
79  }
80  if(m_field->GetMDates(1,i)>=m_ev->m_startday){
81  m_field->SetMConstants(i,0);
82  m_field->SetMDates(1,i,m_ev->m_startday-1); //move the finishing date
83  }
84  }
85  }
86  // Now no operations can be timed after the start of the next crop.
87 
88  if ( !m_ev->m_first_year ) {
89  today = g_date->Date();
90  // Are we before July 1st?
91  d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
92  if ( today < d1 ) {
93  // Yes, too early. We assumme this is because the last crop was late
94  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Crop start attempt between 1st Jan & 1st July", "" );
95  exit( 1 );
96  } else {
97  d1 = g_date->OldDays() + m_first_date + 365; // Add 365 for spring crop
98  if ( today > d1 ) {
99  // Yes too late - should not happen - raise an error
100  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Crop start attempt after last possible start date", "" );
101  exit( 1 );
102  }
103  }
104  } else {
105  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), ca_spring_plough, false );
106  break;
107  }
108  }//if
109 
110  // Reinit d1 to first possible starting date.
111  d1 = g_date->OldDays() + m_first_date +365; // Add 365 for spring crop
112  if ( g_date->Date() > d1 ) {
113  d1 = g_date->Date();
114  }
115  // OK, let's go.
116 
117  if ( m_farm->IsStockFarmer() ) {
118  SimpleEvent( d1, ca_fa_slurry, false );
119  } else {
120  SimpleEvent( d1, ca_fp_slurry, false );
121  }
122  break;
123 
124  case ca_fa_slurry:
125  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
126  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
127  SimpleEvent( g_date->Date() + 1, ca_fa_slurry, true );
128  break;
129  }
131  }
132  {
133  d1 = g_date->OldDays() + g_date->DayInYear( 5, 4 );
134  if ( g_date->Date() > d1 ) {
135  d1 = g_date->Date();
136  }
137  SimpleEvent( d1, ca_spring_plough, false );
138  }
139  break;
140 
141  case ca_fp_slurry:
142  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
143  if ( !m_farm->FP_Slurry( m_field, 0.0, g_date->DayInYear( 30, 3 ) - g_date->DayInYear() ) ) {
144  SimpleEvent( g_date->Date() + 1, ca_fp_slurry, true );
145  break;
146  }
148  }
149  {
150  int d1 = g_date->OldDays() + g_date->DayInYear( 5, 4 );
151  if ( g_date->Date() > d1 ) {
152  d1 = g_date->Date();
153  }
154  SimpleEvent( d1, ca_spring_plough, false );
155  }
156  break;
157 
158  case ca_spring_plough: {
159  int forceday = g_date->DayInYear( 5, 5 );
160  if ( CA_SLURRY_DATE && CA_SLURRY_DATE < forceday - 5 ) { //?AM
161  forceday = CA_SLURRY_DATE + 5;
162  }
163  if ( !m_farm->SpringPlough( m_field, 0.0, forceday - g_date->DayInYear() ) ) {
164  SimpleEvent( g_date->Date() + 1, ca_spring_plough, false );
165  break;
166  }
167  }
168  {
169  int d1 = g_date->OldDays() + g_date->DayInYear( 10, 4 );
170  if ( g_date->Date() > d1 ) {
171  d1 = g_date->Date();
172  }
173  SimpleEvent( d1, ca_spring_harrow_one, false );
174  }
175  break;
176 
178  if ( !m_farm->SpringHarrow( m_field, 0.0, g_date->DayInYear( 6, 5 ) - g_date->DayInYear() ) ) {
179  SimpleEvent( g_date->Date() + 1, ca_spring_harrow_one, false );
180  break;
181  }
182  if ( m_farm->DoIt( 75 ) ) {
183  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 4 );
184  if ( g_date->Date() + 10 > d1 ) {
185  d1 = g_date->Date() + 10;
186  }
187  SimpleEvent( d1, ca_spring_harrow_two, false );
188  } else {
189  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 4 );
190  if ( g_date->Date() + 10 > d1 ) {
191  d1 = g_date->Date() + 10;
192  }
193  if (g_date->DayInYear() >150) {
194  break;
195  }
196  SimpleEvent( d1, ca_herbi_one, false );
197  }
198  break;
199 
201  if ( !m_farm->SpringHarrow( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
202  SimpleEvent( g_date->Date() + 1, ca_spring_harrow_two, false );
203  break;
204  }
205  {
206  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 5 );
207  if ( g_date->Date() > d1 ) {
208  d1 = g_date->Date();
209  }
210  SimpleEvent( d1, ca_spring_sow, false );
211  }
212  break;
213 
214  case ca_herbi_one:
215  if ( m_farm->DoIt( int(0 * cfg_herbi_app_prop.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
216 
217  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
218  SimpleEvent( g_date->Date() + 1, ca_herbi_one, true );
219  break;
220  }
221  }
222  d1 = g_date->OldDays() + g_date->DayInYear( 1, 5 );
223  if ( g_date->Date() > d1 ) {
224  d1 = g_date->Date();
225  }
226  SimpleEvent( d1, ca_spring_sow, false );
227  break;
228 
229  case ca_spring_sow:
230  if ( !m_farm->SpringSow( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
231  SimpleEvent( g_date->Date() + 1, ca_spring_sow, false );
232  break;
233  }
234  // Rowcul one carries the main thread of execution.
235  {
236  int d1 = g_date->OldDays() + g_date->DayInYear( 12, 5 );
237  if ( g_date->Date() > d1 ) {
238  d1 = g_date->Date();
239  }
240  SimpleEvent( d1, ca_rowcul_one, false );
241  }
242 
243  // This is a dead end, eventually.
244  {
245  int d1 = g_date->OldDays() + g_date->DayInYear( 10, 5 );
246  if ( g_date->Date() > d1 ) {
247  d1 = g_date->Date();
248  }
249  SimpleEvent( d1, ca_herbi_two, false );
250  }
251  break;
252 
253  case ca_herbi_two:
254  if ( m_ev->m_lock || m_farm->DoIt( int( 0 * cfg_herbi_app_prop.value()*CA_DECIDE_TO_HERB * m_farm->Prob_multiplier()) ) ) { //modified probability
255  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 30, 5 ) - g_date->DayInYear() ) ) {
256  SimpleEvent( g_date->Date() + 1, ca_herbi_two, true );
257  break;
258  }
259  }
260  {
261  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 5 );
262  if ( g_date->Date() > d1 ) {
263  d1 = g_date->Date();
264  }
265  SimpleEvent( d1, ca_insect_one, false );
266  }
267  {
268  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 5 );
269  if ( g_date->Date() + 10 > d1 ) {
270  d1 = g_date->Date() + 10;
271  }
272  SimpleEvent( d1, ca_herbi_three, false );
273  }
274  break;
275 
276  case ca_insect_one:
277  if ( m_ev->m_lock || m_farm->DoIt(int( 0 * cfg_ins_app_prop1.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
278 
279  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 15, 6 ) - g_date->DayInYear() ) ) {
280  SimpleEvent( g_date->Date() + 1, ca_insect_one, true );
281  break;
282  }
283  }
284  break;
285 
286  case ca_herbi_three:
287  if ( m_ev->m_lock || m_farm->DoIt( int( 0 * cfg_herbi_app_prop.value() *CA_DECIDE_TO_HERB * m_farm->Prob_multiplier())) ) { //modified probability
288  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 20, 6 ) - g_date->DayInYear() ) ) {
289  SimpleEvent( g_date->Date() + 1, ca_herbi_three, false );
290  break;
291  }
292  }
293  if ( m_farm->IsStockFarmer() ) {
294  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
295  if ( g_date->Date() > d1 ) {
296  d1 = g_date->Date();
297  }
298  SimpleEvent( d1, ca_fa_npk_one, false );
299  } else {
300  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
301  if ( g_date->Date() > d1 ) {
302  d1 = g_date->Date();
303  }
304  SimpleEvent( d1, ca_fp_npk_one, false );
305  }
306  {
307  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
308  if ( g_date->Date() + 10 > d1 ) {
309  d1 = g_date->Date() + 10;
310  }
311  SimpleEvent( d1, ca_herbi_four, false );
312  }
313  break;
314 
315  case ca_herbi_four:
316  if ( m_ev->m_lock || m_farm->DoIt(int( 0 * cfg_herbi_app_prop.value()*CA_DECIDE_TO_HERB * m_farm->Prob_multiplier()) ) ) { //modified probability
317  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 1, 7 ) - g_date->DayInYear() ) ) {
318  SimpleEvent( g_date->Date() + 1, ca_herbi_four, true );
319  break;
320  }
321  }
322  break;
323 
324  case ca_fa_npk_one:
325  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 2, 7 ) - g_date->DayInYear() ) ) {
326  SimpleEvent( g_date->Date() + 1, ca_fa_npk_one, false );
327  break;
328  }
329  break;
330 
331  case ca_fp_npk_one:
332  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 2, 7 ) - g_date->DayInYear() ) ) {
333  SimpleEvent( g_date->Date() + 1, ca_fp_npk_one, false );
334  break;
335  }
336  break;
337 
338  case ca_rowcul_one:
339  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 5, 6 ) - g_date->DayInYear() ) ) {
340  SimpleEvent( g_date->Date() + 1, ca_rowcul_one, false );
341  break;
342  }
343  {
344  int d1 = g_date->OldDays() + g_date->DayInYear( 22, 5 );
345  if ( g_date->Date() + 10 > d1 ) {
346  d1 = g_date->Date() + 10;
347  }
348  SimpleEvent( d1, ca_rowcul_two, false );
349  }
350  break;
351 
352  case ca_rowcul_two:
353  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 20, 6 ) - g_date->DayInYear() ) ) {
354  SimpleEvent( g_date->Date() + 1, ca_rowcul_two, false );
355  break;
356  }
357  {
358  int d1 = g_date->OldDays() + g_date->DayInYear( 2, 6 );
359  if ( g_date->Date() + 10 > d1 ) {
360  d1 = g_date->Date() + 10;
361  }
362  SimpleEvent( d1, ca_rowcul_three, false );
363  }
364  break;
365 
366  case ca_rowcul_three:
367  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 10, 7 ) - g_date->DayInYear() ) ) {
368  SimpleEvent( g_date->Date() + 1, ca_rowcul_three, false );
369  break;
370  }
371  {
372  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
373  if ( g_date->Date() + 3 > d1 ) {
374  d1 = g_date->Date() + 3;
375  }
376  SimpleEvent( d1, ca_water_one, false );
377  }
378  break;
379 
380  case ca_water_one:
381  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 20, 7 ) - g_date->DayInYear() ) ) {
382  SimpleEvent( g_date->Date() + 1, ca_water_one, true );
383  break;
384  }
385  {
386  d1 = g_date->OldDays() + g_date->DayInYear( 20, 7 );
387  if ( g_date->Date() > d1 ) {
388  d1 = g_date->Date();
389  }
390  SimpleEvent( d1, ca_insect_two, false );
391  }
392  {
393  d1 = g_date->OldDays() + g_date->DayInYear( 21, 7 );
394  if ( g_date->Date() + 7 > d1 ) {
395  d1 = g_date->Date() + 7;
396  }
397  SimpleEvent( d1, ca_water_two, false );
398  }
399  break;
400 
401  case ca_insect_two:
402  if ( m_ev->m_lock || m_farm->DoIt( int( 0 * cfg_ins_app_prop1.value() *CA_DECIDE_TO_FI * m_farm->Prob_multiplier()) ) ) { //modified probability
403  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 5, 8 ) - g_date->DayInYear() ) ) {
404  SimpleEvent( g_date->Date() + 1, ca_insect_two, true );
405  break;
406  }
407  }
408  break;
409 
410  case ca_water_two:
411  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 10, 8 ) - g_date->DayInYear() ) ) {
412  SimpleEvent( g_date->Date() + 1, ca_water_two, true );
413  break;
414  }
415  {
416  int d1 = g_date->OldDays() + g_date->DayInYear( 11, 8 );
417  if ( g_date->Date() > d1 ) {
418  d1 = g_date->Date();
419  }
420  SimpleEvent( d1, ca_water_three, false );
421  }
422 
423  if ( m_farm->IsStockFarmer() ) {
424  int d1 = g_date->OldDays() + g_date->DayInYear( 25, 8 );
425  if ( g_date->Date() > d1 ) {
426  d1 = g_date->Date();
427  }
428  SimpleEvent( d1, ca_fa_npk_two, false );
429  } else {
430  d1 = g_date->OldDays() + g_date->DayInYear( 25, 8 );
431  if ( g_date->Date() > d1 ) {
432  d1 = g_date->Date();
433  }
434  SimpleEvent( d1, ca_fp_npk_two, false );
435  }
436  break;
437 
438  case ca_fa_npk_two:
439  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
440  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
441  SimpleEvent( g_date->Date() + 1, ca_fa_npk_two, true );
442  break;
443  }
444  }
445  break;
446 
447  case ca_fp_npk_two:
448  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
449  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
450  SimpleEvent( g_date->Date() + 1, ca_fp_npk_two, true );
451  break;
452  }
453  }
454  break;
455 
456  case ca_water_three:
457  if ( m_ev->m_lock || m_farm->DoIt( 70 ) ) {
458  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 6, 9 ) - g_date->DayInYear() ) ) {
459  SimpleEvent( g_date->Date() + 1, ca_water_three, true );
460  break;
461  }
462  }
463  {
464  d1 = g_date->OldDays() + g_date->DayInYear( 20, 8 );
465  if ( g_date->Date() + 7 > d1 ) {
466  d1 = g_date->Date() + 7;
467  }
468 
469  if(d1 > m_field->GetMDates( 1, 0 ) - 2){
470  d1 = m_field->GetMDates( 1, 0 ) - 2;
471  }
472  SimpleEvent( d1, ca_insect_three, false );
473  }
474  break;
475 
476  case ca_insect_three:
477  if ( m_ev->m_lock || m_farm->DoIt( int( 0 * cfg_ins_app_prop1.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
478 
479  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 5, 9 ) - g_date->DayInYear() ) ) {
480  SimpleEvent( g_date->Date() + 1, ca_insect_three, true );
481  break;
482  }
483 
484  }
485  {
486  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 9 );
487  if ( g_date->Date() + 7 > d1 ) {
488  d1 = g_date->Date() + 7;
489  }
490  if(d1 > m_field->GetMDates( 1, 0 ) - 1){
491  d1 = m_field->GetMDates( 1, 0 ) - 1;
492  }
493  ChooseNextCrop (1);
494  SimpleEvent( d1, ca_harvest, false );
495  }
496  break;
497 
498  case ca_harvest:
499  if (m_field->GetMConstants(0)==0) {
500  if (!m_farm->Harvest( m_field, 0.0, -1)) { //raise an error
501  g_msg->Warn( WARN_BUG, "Carrots::Do(): failure in 'Harvest' execution", "" );
502  exit( 1 );
503  }
504  }
505  else {
506  if ( !m_farm->Harvest( m_field, 0.0, m_field->GetMDates( 1, 0 ) - g_date->DayInYear() ) ) { //is this the finishing date for harvest (1, 0 ) and it is 30.11 !!! and it wasnt changed because the startin date is 8.9 - ie before starting date for winter barley
507  SimpleEvent( g_date->Date() + 1, ca_harvest, false );
508  break;
509  }
510  }
511  done = true;
512  break;
513 
514  default:
515  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Unknown event type! ", "" );
516  exit( 1 );
517  }
518 
519  return done;
520 }

References CA_DECIDE_TO_FI, CA_DECIDE_TO_HERB, ca_fa_npk_one, ca_fa_npk_two, ca_fa_slurry, ca_fp_npk_one, ca_fp_npk_two, ca_fp_slurry, ca_harvest, ca_herbi_four, ca_herbi_one, ca_herbi_three, ca_herbi_two, ca_insect_one, ca_insect_three, ca_insect_two, ca_rowcul_one, ca_rowcul_three, ca_rowcul_two, CA_SLURRY_DATE, ca_spring_harrow_one, ca_spring_harrow_two, ca_spring_plough, ca_spring_sow, ca_start, ca_water_one, ca_water_three, ca_water_two, cfg_herbi_app_prop, cfg_ins_app_prop1, Crop::ChooseNextCrop(), LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_NPK(), Farm::FP_Slurry(), g_date, g_msg, LE::GetMConstants(), LE::GetMDates(), Farm::GetType(), Calendar::GetYearNumber(), Farm::Harvest(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), Farm::Prob_multiplier(), Farm::RowCultivation(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringSow(), tof_OptimisingFarm, CfgFloat::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void Carrots::SetUpFarmCategoryInformation ( )
inline
76  {
77  const int elements = 2 + (ca_foobar - CARROTS_BASE);
79 
80  FarmManagementCategory catlist[elements] =
81  {
82  fmc_Others, // zero element unused but must be here
83  fmc_Others, // ca_start = 1, // Compulsory, start event must always be 1 (one).
84  fmc_Fertilizer, // ca_fa_slurry = CARROTS_BASE,
85  fmc_Fertilizer, // ca_fp_slurry,
86  fmc_Cultivation, // ca_spring_plough,
87  fmc_Cultivation, // ca_spring_harrow_one,
88  fmc_Cultivation, // ca_spring_harrow_two,
89  fmc_Cultivation, // ca_spring_sow,
90  fmc_Herbicide, // ca_herbi_one,
91  fmc_Herbicide, // ca_herbi_two,
92  fmc_Herbicide, // ca_herbi_three,
93  fmc_Herbicide, // ca_herbi_four,
94  fmc_Cultivation, // ca_rowcul_one,
95  fmc_Cultivation, // ca_rowcul_two,
96  fmc_Cultivation, // ca_rowcul_three,
97  fmc_Insecticide, // ca_insect_one,
98  fmc_Insecticide, // ca_insect_two,
99  fmc_Insecticide, // ca_insect_three,
100  fmc_Watering, // ca_water_one,
101  fmc_Watering, // ca_water_two,
102  fmc_Watering, // ca_water_three,
103  fmc_Fertilizer, // ca_fp_npk_one,
104  fmc_Fertilizer, // ca_fp_npk_two,
105  fmc_Fertilizer, // ca_fa_npk_one,
106  fmc_Fertilizer, // ca_fa_npk_two,
107  fmc_Harvest // ca_harvest,
108 
109 
110  // no foobar entry
111 
112  };
113  // Iterate over the catlist elements and copy them to vector
114  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
115 
116  }

References ca_foobar, CARROTS_BASE, fmc_Cultivation, fmc_Fertilizer, fmc_Harvest, fmc_Herbicide, fmc_Insecticide, fmc_Others, fmc_Watering, Crop::m_base_elements_no, and Crop::m_ManagementCategories.

Referenced by Carrots().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
ca_spring_harrow_one
Definition: Carrots.h:43
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
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
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
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
ca_herbi_two
Definition: Carrots.h:47
CA_SLURRY_DATE
#define CA_SLURRY_DATE
Definition: Carrots.h:32
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
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
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
ca_herbi_one
Definition: Carrots.h:46
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
CA_DECIDE_TO_HERB
#define CA_DECIDE_TO_HERB
Definition: Carrots.h:33
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
ca_foobar
Definition: Carrots.h:64
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
CfgFloat::value
double value() const
Definition: Configurator.h:142
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
ca_fa_npk_two
Definition: Carrots.h:62
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
ca_rowcul_one
Definition: Carrots.h:50
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
CARROTS_BASE
#define CARROTS_BASE
Definition: Carrots.h:31
ca_fa_npk_one
Definition: Carrots.h:61
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
ca_harvest
Definition: Carrots.h:63
ca_spring_sow
Definition: Carrots.h:45
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: Farm.h:778
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
ca_fp_npk_two
Definition: Carrots.h:60
Calendar::Date
long Date(void)
Definition: Calendar.h:57
ca_herbi_three
Definition: Carrots.h:48
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Carrots::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: Carrots.h:76
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
ca_spring_harrow_two
Definition: Carrots.h:44
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
CA_DECIDE_TO_FI
#define CA_DECIDE_TO_FI
Definition: Carrots.h:34
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
ca_herbi_four
Definition: Carrots.h:49
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
ca_spring_plough
Definition: Carrots.h:42
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::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
ca_insect_three
Definition: Carrots.h:55
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
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
ca_fp_slurry
Definition: Carrots.h:41
ca_water_two
Definition: Carrots.h:57
ca_start
Definition: Carrots.h:39
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
ca_fp_npk_one
Definition: Carrots.h:59
ca_fa_slurry
Definition: Carrots.h:40
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
ca_rowcul_three
Definition: Carrots.h:52
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
ca_rowcul_two
Definition: Carrots.h:51
Crop::ChooseNextCrop
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
Definition: Farm.cpp:756
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
ca_water_one
Definition: Carrots.h:56
ca_insect_one
Definition: Carrots.h:53
WARN_BUG
Definition: MapErrorMsg.h:34
ca_insect_two
Definition: Carrots.h:54
ca_water_three
Definition: Carrots.h:58
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: FarmFuncs.cpp:459