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

#include <SpringBarleyPTreatment.h>

Inheritance diagram for SpringBarleyPTreatment:
Crop

Public Member Functions

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

◆ SpringBarleyPTreatment()

SpringBarleyPTreatment::SpringBarleyPTreatment ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
81  : Crop(a_tov, a_toc, a_L)
82  {
85  }

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

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

42 {
43  double herbi_app_prop=cfg_herbi_app_prop.value();
44  m_farm = a_farm;
45  m_field = a_field;
46  m_ev = a_ev;
47 
48  bool done = false;
49 
50  switch ( m_ev->m_todo )
51  {
52  case sbpt_start:
53  {
54  a_field->ClearManagementActionSum();
55 
56  // Set up the date management stuff
57  // Could save the start day in case it is needed later
58  // m_field->m_startday = m_ev->m_startday;
60  // Start and stop dates for all events after harvest
61  int noDates=2;
62  m_field->SetMDates(0,0,g_date->DayInYear(20,8));
63  // Determined by harvest date - used to see if at all possible
64  m_field->SetMDates(1,0,g_date->DayInYear(10,8));
65  m_field->SetMDates(0,1,g_date->DayInYear(10,8));
66  m_field->SetMDates(1,1,g_date->DayInYear(30,8));
67  // Check the next crop for early start, unless it is a spring crop
68  // in which case we ASSUME that no checking is necessary!!!!
69  // So DO NOT implement a crop that runs over the year boundary
70  if (m_ev->m_startday>g_date->DayInYear(1,7))
71  {
72  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
73  {
74  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
75  "Harvest too late for the next crop to start!!!", "" );
76  exit( 1 );
77  }
78  // Now fix any late finishing problems
79  for (int i=0; i<noDates; i++)
80  {
81  if (m_field->GetMDates(0,i)>=m_ev->m_startday)
83  if (m_field->GetMDates(1,i)>=m_ev->m_startday)
85  }
86  }
87  // Now no operations can be timed after the start of the next crop.
88 
89  int d1;
90  if ( ! m_ev->m_first_year )
91  {
92  int today=g_date->Date();
93  // Are we before July 1st?
94  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
95  if (today < d1)
96  {
97  // Yes, too early. We assumme this is because the last crop was late
98  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
99  "Crop start attempt between 1st Jan & 1st July", "" );
100  exit( 1 );
101  }
102  else
103  {
104  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
105  if (today > d1)
106  {
107  // Yes too late - should not happen - raise an error
108  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
109  "Crop start attempt after last possible start date", "" );
110  exit( 1 );
111  }
112  }
113  }
114  else
115  {
116  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
117  sbpt_spring_plough, false );
118  break;
119  }
120  // End single block date checking code. Please see next line
121  // comment as well.
122  // Reinit d1 to first possible starting date.
123  d1 = g_date->OldDays() + g_date->DayInYear( 2,11 );
124  if ( g_date->Date() > d1 ) {
125  d1 = g_date->Date();
126  }
127 
128  // OK, let's go.
129  SimpleEvent( d1, sbpt_autumn_plough, false );
130  SBPT_SLURRY_DONE=false;
131  SBPT_MANURE_DONE=false;
132  SBPT_SLURRY_EXEC=false;
133  SBPT_MANURE_EXEC=false;
134  SBPT_DID_AUTUMN_PLOUGH = false;
135  }
136  break;
137 
138  case sbpt_autumn_plough:
139  if ( m_ev->m_lock || m_farm->DoIt( 70 )) // was 70
140  {
141  if (!m_farm->AutumnPlough( m_field, 0.0,
142  g_date->DayInYear( 30,11 ) - g_date->DayInYear())) {
143  SimpleEvent( g_date->Date() + 1, sbpt_autumn_plough, true );
144  break;
145  }
146  SBPT_DID_AUTUMN_PLOUGH = true;
147  }
148  // +365 for next year
149  if (m_farm->IsStockFarmer()) // StockFarmer
150  {
151  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365, // was 15,3
152  sbpt_fertslurry_stock, false );
153  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365, // was 15,3
154  sbpt_fertmanure_stock_one, false );
155  }
156  else { // PlantFarmer
157  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 )+365, // was 20/3
158  sbpt_spring_plough, false );
159  }
160  break;
161 
162  //*** The stock farmers thread
164  if ( m_ev->m_lock || m_farm->DoIt( 90 ))
165  {
166  if (!m_farm->FA_Slurry( m_field, 0.0,
167  g_date->DayInYear( 15,4 ) - g_date->DayInYear())) { // Was 15/4
168  SimpleEvent( g_date->Date() + 1, sbpt_fertslurry_stock, true );
169  break;
170  }
171  SBPT_SLURRY_EXEC=true;
172  }
173  SBPT_SLURRY_DONE = true;
174  if ( SBPT_MANURE_DONE ) {
175  // We are the last thread, so queue up spring plough.
177  }
178  break;
179 
181  if ( m_ev->m_lock || m_farm->DoIt( 67 ))
182  {
183  if (!m_farm->FA_Manure( m_field, 0.0,
184  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) { // Was 15/5
186  break;
187  }
188  SBPT_MANURE_EXEC=true;
189  }
190  SBPT_MANURE_DONE = true;
191  if ( SBPT_SLURRY_DONE ) {
193  }
194  break;
195 
196  case sbpt_spring_plough:
197  if ( ! SBPT_DID_AUTUMN_PLOUGH )
198  {
199  if (!m_farm->SpringPlough( m_field, 0.0,
200  g_date->DayInYear( 10,4 ) - // was 10,4
201  g_date->DayInYear())) {
202  SimpleEvent( g_date->Date()+1, sbpt_spring_plough, true );
203  break;
204  }
205  }
206  {
207  int d1 = g_date->Date();
208  if ( d1 < g_date->OldDays() + g_date->DayInYear( 20,3 )) {
209  d1 = g_date->OldDays() + g_date->DayInYear( 20,3 );
210  }
211  SimpleEvent( d1, sbpt_spring_harrow, false );
212  }
213  break;
214 
215  case sbpt_spring_harrow:
216  if (!m_farm->SpringHarrow( m_field, 0.0,
217  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
218  SimpleEvent( g_date->Date() + 1, sbpt_spring_harrow, true );
219  break;
220  }
221  if (m_farm->IsStockFarmer()) {
222  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ), // was 5,4
223  sbpt_fertmanure_stock_two, false );
224  } else {
225  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 ),
226  sbpt_fertmanure_plant, false );
227  }
228  break;
229 
231  if ( m_ev->m_lock || m_farm->DoIt( 65 ) ||
233  {
234  if (!m_farm->FA_NPK( m_field, 0.0,
235  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // was 10,4
237  break;
238  }
239  }
240  {
241  int d1 = g_date->Date();
242  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) {
243  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 );
244  }
245  SimpleEvent( d1, sbpt_spring_sow, false );
246  }
247  break;
248 
250  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
251  {
252  if (!m_farm->FP_NPK( m_field, 0.0,
253  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) { // WAS 10,4
254  SimpleEvent( g_date->Date() + 1, sbpt_fertmanure_plant, true );
255  break;
256  }
257  // Did FP_NPK so go directly to spring sow.
258  {
259  int d1 = g_date->Date();
260  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
261  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
262  }
263  SimpleEvent( d1, sbpt_spring_sow, false );
264  }
265  break;
266  }
268  break;
269 
270  case sbpt_fertlnh3_plant:
271  if (!m_farm->FP_LiquidNH3( m_field, 0.0,
272  g_date->DayInYear( 10, 4 ) - // WAS 10,4
273  g_date->DayInYear())) {
274  SimpleEvent( g_date->Date() + 1, sbpt_fertlnh3_plant, true );
275  break;
276  }
278  break;
279 
280  case sbpt_fertpk_plant:
281  if (!m_farm->FP_PK( m_field, 0.0,
282  g_date->DayInYear( 10, 4 ) - // WAS 10,4
283  g_date->DayInYear())) {
284  SimpleEvent( g_date->Date() + 1, sbpt_fertpk_plant, true );
285  break;
286  }
287  {
288  int d1 = g_date->Date();
289  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
290  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
291  }
292  SimpleEvent( d1, sbpt_spring_sow, false );
293  }
294  break;
295 
296  case sbpt_spring_sow:
297  if (!m_farm->SpringSow( m_field, 0.0,
298  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
299  SimpleEvent( g_date->Date() + 1, sbpt_spring_sow, true );
300  break;
301  }
302  {
303  int d1 = g_date->Date();
304  if ( d1 < g_date->OldDays() + g_date->DayInYear( 5,4 )) {
305  d1 = g_date->OldDays() + g_date->DayInYear( 5,4 );
306  }
307  SimpleEvent( d1, sbpt_spring_roll, false );
308  }
309  break;
310 
311  case sbpt_spring_roll:
312  if ( m_ev->m_lock || m_farm->DoIt( 0 )) // was 30
313  {
314  if (!m_farm->SpringRoll( m_field, 0.0,
315  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
316  SimpleEvent( g_date->Date() + 1, sbpt_spring_roll, true );
317  break;
318  }
319  }
320  SBPT_HERBI_DATE = 0;
321  SBPT_GR_DATE = 0;
322  SBPT_FUNGI_DATE = 0;
323  SBPT_WATER_DATE = 0;
324  SBPT_INSECT_DATE = 0;
325  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,5 ),
326  sbpt_herbicide_one, false );
327  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
328  sbpt_fungicide_one, false ); // Main.
329  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
330  sbpt_GR, false );
331  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
332  sbpt_water_one, false );
333  if (( a_field->GetLandscape()->SupplyYearNumber() >= cfg_productapplicstartyear.value() ) && (a_field->GetLandscape()->SupplyYearNumber() <= cfg_productapplicendyear.value())) {
335  }
336  break;
337 
338  // Herbicide thread
339  case sbpt_herbicide_one:
340  if ( g_date->Date() < SBPT_GR_DATE + 1 ) {
342  break;
343  }
344  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+80*herbi_app_prop)))
345  {
346  if (!m_farm->HerbicideTreat( m_field, 0.0,
347  g_date->DayInYear( 15,5 ) - g_date->DayInYear()))
348  {
349  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_one, true );
350  break;
351  }
353  // Did first spray so see if should do another, 14 days later (min)
354  {
355  int d1 = g_date->Date() + 10;
356  if ( d1 < g_date->OldDays() + g_date->DayInYear( 16,5 )) {
357  d1 = g_date->OldDays() + g_date->DayInYear( 16,5 );
358  }
359  SimpleEvent( d1, sbpt_herbicide_two, false );
360  }
361  }
362  break;
363 
364  case sbpt_herbicide_two:
365  if ( g_date->Date() < SBPT_GR_DATE + 1 ) {
367  break;
368  }
369  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+50*herbi_app_prop)))
370  {
371  if (!m_farm->HerbicideTreat( m_field, 0.0,
372  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
373  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_two, true );
374  break;
375  }
377  }
378  break;
379 
380  // GReg thread
381  case sbpt_GR:
382  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
383  g_date->Date() < SBPT_FUNGI_DATE + 1 ) {
384  SimpleEvent( g_date->Date() + 1, sbpt_GR, m_ev->m_lock );
385  break;
386  }
387  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+5*cfg_greg_app_prop.value())))
388  {
389  if (!m_farm->GrowthRegulator( m_field, 0.0,
390  g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
391  SimpleEvent( g_date->Date() + 1, sbpt_GR, true );
392  break;
393  }
394  SBPT_GR_DATE = g_date->Date();
395  }
396  break;
397 
398  // Fungicide thread & MAIN THREAD
399  case sbpt_fungicide_one:
400  {
401  if ( g_date->Date() < SBPT_HERBI_DATE + 1 || g_date->Date() < SBPT_GR_DATE + 1 ) {
403  break;
404  }
405  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+30*cfg_fungi_app_prop1.value())))
406  {
407  if (!m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
408  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_one, true );
409  break;
410  }
412  int d1 = g_date->Date() + 10;
413  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,5 )) {
414  d1 = g_date->OldDays() + g_date->DayInYear( 25,5 );
415  }
416  SimpleEvent( d1, sbpt_fungicide_two, false );
417  }
418  int d1 = g_date->Date();
419  if ( d1 < g_date->OldDays() + g_date->DayInYear( 16,5 )) {
420  d1 = g_date->OldDays() + g_date->DayInYear( 16,5 );
421  }
422  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,8 ),sbpt_harvest, false );
423  }
424  break;
425 
426  case sbpt_fungicide_two:
427  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
428  g_date->Date() < SBPT_GR_DATE + 1 ) {
430  break;
431  }
432  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+33*cfg_fungi_app_prop1.value()) ))
433  {
434  if (!m_farm->FungicideTreat( m_field, 0.0,
435  g_date->DayInYear( 10,6 ) - g_date->DayInYear())) {
436  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_two, true );
437  break;
438  }
440  }
441  break;
442 
443  // Water thread
444  case sbpt_water_one:
445  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
446  g_date->Date() < SBPT_FUNGI_DATE + 1 ) {
448  break;
449  }
450  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
451  {
452  if (!m_farm->Water( m_field, 0.0,
453  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
454  SimpleEvent( g_date->Date() + 1, sbpt_water_one, true );
455  break;
456  }
458  }
459  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
460  sbpt_water_two, false );
461  break;
462 
463  case sbpt_water_two:
464  if ( g_date->Date() < SBPT_INSECT_DATE + 1 ) {
466  break;
467  }
468  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
469  {
470  if (!m_farm->Water( m_field, 0.0,
471  g_date->DayInYear( 1,7 ) - g_date->DayInYear())) {
472  SimpleEvent( g_date->Date() + 1, sbpt_water_two, true );
473  break;
474  }
476  }
477  break;
478 
479  // Insecticide thread & MAIN THREAD
480 
481  case sbpt_insecticide1:
482 /* // NB this version use crop growth stage
483  if (!m_farm->Trial_PesticideTreat_GS( m_field, 0.0, 0 )) {
484  SimpleEvent( g_date->Date() + 1, sbpt_insecticide1, false );
485  }
486  g_pest->DailyQueueAdd( m_field, l_pest_insecticide_amount.value() );
487  SimpleEvent( g_date->Date() + 7, sbpt_insecticide3, false ); // use sbpt_insecticde3 if you only want two applications
488  SBPT_INSECT_DATE = g_date->Date();
489  break;
490 */
491  // NB this version forces date based spraying - no weather constraints or probabilities
493  SimpleEvent(g_date->Date() + 14, sbpt_insecticide3, false); // use sbpt_insecticde3 if you only want two applications
495  break;
496 
497  case sbpt_insecticide2:
498  // NB this version forces date based spraying - no weather constraints or probabilities
500  SimpleEvent( g_date->Date() + 14, sbpt_insecticide3, false );
501  break;
502 
503  case sbpt_insecticide3:
504  // NB this version forces date based spraying - no weather constraints or probabilities
506  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,8 ),sbpt_harvest, false );
507  break;
508 
509  case sbpt_harvest:
510  if (!m_farm->Harvest( m_field, 0.0,
511  g_date->DayInYear( 20,8 ) - g_date->DayInYear())) {
512  SimpleEvent( g_date->Date() + 1, sbpt_harvest, true );
513  break;
514  }
516  break;
517 
518  case sbpt_straw_chopping:
519  if ( m_ev->m_lock || m_farm->DoIt( 50 )) // was 50
520  {
521  // Force straw chopping to happen on the same day as harvest.
522  if (!m_farm->StrawChopping( m_field, 0.0, 0 )) {
523  // Shouldn't happen.
525  break;
526  }
527  // Did chop, so go directly to stubble harrowing.
529  sbpt_stubble_harrow, false );
530  break;
531  }
532  // Do hay baling first.
533  SimpleEvent( g_date->Date(), sbpt_hay_baling, false );
534  break;
535 
536  case sbpt_hay_baling:
537  if (!m_farm->HayBailing( m_field, 0.0,
538  m_field->GetMDates(1,0) - g_date->DayInYear())) {
539  SimpleEvent( g_date->Date() + 1, sbpt_hay_baling, true );
540  break;
541  }
543  sbpt_stubble_harrow, false );
544  break;
545 
546  case sbpt_stubble_harrow:
547  if ( m_ev->m_lock || m_farm->DoIt( 60 )) // WAS 60
548  {
549  if (!m_farm->StubbleHarrowing( m_field, 0.0,
550  m_field->GetMDates(1,1) - g_date->DayInYear())) {
551  SimpleEvent( g_date->Date() + 1, sbpt_stubble_harrow, true );
552  break;
553  }
554  }
555  // END MAIN THREAD
556  done=true;
557  break;
558 
559  default:
560  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
561  "Unknown event type! ", "" );
562  exit( 1 );
563  }
564  return done;
565 }

References Farm::AutumnPlough(), cfg_fungi_app_prop1, cfg_greg_app_prop, cfg_herbi_app_prop, cfg_pest_product_amounts, cfg_productapplicendyear, cfg_productapplicstartyear, LE::ClearManagementActionSum(), Calendar::Date(), Calendar::DayInYear(), Farm::DoIt(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_Slurry(), Farm::FP_LiquidNH3(), Farm::FP_NPK(), Farm::FP_PK(), Farm::FungicideTreat(), g_date, g_msg, LE::GetMDates(), Farm::GrowthRegulator(), Farm::Harvest(), Farm::HayBailing(), Farm::HerbicideTreat(), 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(), ppp_1, Farm::ProductApplication(), sbpt_autumn_plough, SBPT_DID_AUTUMN_PLOUGH, sbpt_fertlnh3_plant, sbpt_fertmanure_plant, sbpt_fertmanure_stock_one, sbpt_fertmanure_stock_two, sbpt_fertpk_plant, sbpt_fertslurry_stock, SBPT_FUNGI_DATE, sbpt_fungicide_one, sbpt_fungicide_two, sbpt_GR, SBPT_GR_DATE, sbpt_harvest, sbpt_hay_baling, SBPT_HERBI_DATE, sbpt_herbicide_one, sbpt_herbicide_two, SBPT_INSECT_DATE, sbpt_insecticide1, sbpt_insecticide2, sbpt_insecticide3, SBPT_MANURE_DONE, SBPT_MANURE_EXEC, SBPT_SLURRY_DONE, SBPT_SLURRY_EXEC, sbpt_spring_harrow, sbpt_spring_plough, sbpt_spring_roll, sbpt_spring_sow, sbpt_start, sbpt_straw_chopping, sbpt_stubble_harrow, SBPT_WATER_DATE, sbpt_water_one, sbpt_water_two, LE::SetMDates(), Crop::SimpleEvent(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::StrawChopping(), Farm::StubbleHarrowing(), CfgInt::value(), CfgFloat::value(), CfgArray_Double::value(), MapErrorMsg::Warn(), WARN_BUG, and Farm::Water().

◆ SetUpFarmCategoryInformation()

void SpringBarleyPTreatment::SetUpFarmCategoryInformation ( )
inline
86  {
87  const int elements = 2 + (sbpt_foobar - SBARLEYPTREATMENT_BASE);
89 
90  FarmManagementCategory catlist[elements] =
91  {
92  fmc_Others, // zero element unused but must be here
93  fmc_Others,//sbpt_start = 1, // Compulsory, start event must always be 1 (one).
94  fmc_Cultivation,//sbpt_autumn_plough = SBARLEYPTREATMENT_BASE,
95  fmc_Fertilizer,//sbpt_fertslurry_stock,
96  fmc_Fertilizer,//sbpt_fertmanure_stock_one,
97  fmc_Cultivation,//sbpt_spring_plough,
98  fmc_Cultivation,//sbpt_spring_harrow,
99  fmc_Fertilizer,//sbpt_fertmanure_plant,
100  fmc_Fertilizer,//sbpt_fertlnh3_plant,
101  fmc_Fertilizer,//sbpt_fertpk_plant,
102  fmc_Fertilizer,//sbpt_fertmanure_stock_two,
103  fmc_Fertilizer,//sbpt_fertnpk_stock,
104  fmc_Others,//sbpt_spring_sow,
105  fmc_Others,//sbpt_spring_roll,
106  fmc_Herbicide,//sbpt_herbicide_one,
107  fmc_Herbicide,//sbpt_herbicide_two,
108  fmc_Others,//sbpt_GR,
109  fmc_Fungicide,//sbpt_fungicide_one,
110  fmc_Insecticide,//sbpt_insecticide1,
111  fmc_Insecticide,//sbpt_insecticide2,
112  fmc_Insecticide,//sbpt_insecticide3,
113  fmc_Fungicide,//sbpt_fungicide_two,
114  fmc_Watering,//sbpt_water_one,
115  fmc_Watering,//sbpt_water_two,
116  fmc_Harvest,//sbpt_harvest,
117  fmc_Others,//sbpt_straw_chopping,
118  fmc_Others,//sbpt_hay_baling,
119  fmc_Cultivation//sbpt_stubble_harrow
120 
121  // no foobar entry
122 
123  };
124  // Iterate over the catlist elements and copy them to vector
125  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
126 
127  }

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, SBARLEYPTREATMENT_BASE, and sbpt_foobar.

Referenced by SpringBarleyPTreatment().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::SpringRoll
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
Definition: FarmFuncs.cpp:487
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
sbpt_insecticide2
Definition: SpringBarleyPTreatment.h:63
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
sbpt_stubble_harrow
Definition: SpringBarleyPTreatment.h:71
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
SBPT_HERBI_DATE
#define SBPT_HERBI_DATE
Definition: SpringBarleyPTreatment.h:38
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
sbpt_spring_sow
Definition: SpringBarleyPTreatment.h:56
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
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
SBPT_GR_DATE
#define SBPT_GR_DATE
Definition: SpringBarleyPTreatment.h:39
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
sbpt_fertmanure_stock_one
Definition: SpringBarleyPTreatment.h:48
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
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
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
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
sbpt_hay_baling
Definition: SpringBarleyPTreatment.h:70
sbpt_straw_chopping
Definition: SpringBarleyPTreatment.h:69
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
sbpt_fungicide_two
Definition: SpringBarleyPTreatment.h:65
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
sbpt_insecticide3
Definition: SpringBarleyPTreatment.h:64
SBPT_WATER_DATE
#define SBPT_WATER_DATE
Definition: SpringBarleyPTreatment.h:41
SBARLEYPTREATMENT_BASE
#define SBARLEYPTREATMENT_BASE
Definition: SpringBarleyPTreatment.h:31
sbpt_GR
Definition: SpringBarleyPTreatment.h:60
SBPT_DID_AUTUMN_PLOUGH
#define SBPT_DID_AUTUMN_PLOUGH
Definition: SpringBarleyPTreatment.h:36
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
SBPT_INSECT_DATE
#define SBPT_INSECT_DATE
Definition: SpringBarleyPTreatment.h:42
SpringBarleyPTreatment::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: SpringBarleyPTreatment.h:86
sbpt_water_one
Definition: SpringBarleyPTreatment.h:66
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: FarmFuncs.cpp:1507
sbpt_water_two
Definition: SpringBarleyPTreatment.h:67
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
cfg_productapplicstartyear
CfgInt cfg_productapplicstartyear
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
sbpt_spring_plough
Definition: SpringBarleyPTreatment.h:49
sbpt_harvest
Definition: SpringBarleyPTreatment.h:68
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
sbpt_spring_harrow
Definition: SpringBarleyPTreatment.h:50
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
CfgInt::value
int value() const
Definition: Configurator.h:116
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
sbpt_foobar
Definition: SpringBarleyPTreatment.h:72
sbpt_herbicide_one
Definition: SpringBarleyPTreatment.h:58
sbpt_herbicide_two
Definition: SpringBarleyPTreatment.h:59
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
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
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
SBPT_MANURE_DONE
#define SBPT_MANURE_DONE
Definition: SpringBarleyPTreatment.h:33
sbpt_fungicide_one
Definition: SpringBarleyPTreatment.h:61
Farm::FP_LiquidNH3
virtual bool FP_LiquidNH3(LE *a_field, double a_user, int a_days)
Apply liquid ammonia fertilizer to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:808
cfg_productapplicendyear
CfgInt cfg_productapplicendyear
sbpt_insecticide1
Definition: SpringBarleyPTreatment.h:62
sbpt_fertmanure_stock_two
Definition: SpringBarleyPTreatment.h:54
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
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.
sbpt_fertlnh3_plant
Definition: SpringBarleyPTreatment.h:52
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
sbpt_fertpk_plant
Definition: SpringBarleyPTreatment.h:53
sbpt_start
Definition: SpringBarleyPTreatment.h:45
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
sbpt_spring_roll
Definition: SpringBarleyPTreatment.h:57
SBPT_MANURE_EXEC
#define SBPT_MANURE_EXEC
Definition: SpringBarleyPTreatment.h:35
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
sbpt_fertslurry_stock
Definition: SpringBarleyPTreatment.h:47
SBPT_FUNGI_DATE
#define SBPT_FUNGI_DATE
Definition: SpringBarleyPTreatment.h:40
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
sbpt_autumn_plough
Definition: SpringBarleyPTreatment.h:46
SBPT_SLURRY_EXEC
#define SBPT_SLURRY_EXEC
Definition: SpringBarleyPTreatment.h:34
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
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
sbpt_fertmanure_plant
Definition: SpringBarleyPTreatment.h:51
SBPT_SLURRY_DONE
#define SBPT_SLURRY_DONE
Definition: SpringBarleyPTreatment.h:32