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

BEGrassGrazed1 class
. More...

#include <BEGrassGrazed1.h>

Inheritance diagram for BEGrassGrazed1:
Crop

Public Member Functions

virtual bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 The one and oBEy method for a crop management plan. All farm actions go through here. More...
 
 BEGrassGrazed1 (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
- 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

BEGrassGrazed1 class
.

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

◆ BEGrassGrazed1()

BEGrassGrazed1::BEGrassGrazed1 ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
82  : Crop(a_tov, a_toc, a_L)
83  {
84  // When we start it off, the first possible date for a farm operation is 5th November
85  // This information is used by other crops when they decide how much post processing of
86  // the management is allowed after harvest before the next crop starts.
87  m_first_date=g_date->DayInYear( 30,11 );
88  }

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

Member Function Documentation

◆ Do()

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

The one and oBEy 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 TemporalGrassGrazed1.

Reimplemented from Crop.

55 {
56  /******************** This block can be added to the top of all Crop::Do methods ***********************************************/
57  m_farm = a_farm; // These assignments are necessary, not for this method but for related event calls
58  m_field = a_field;
59  m_ev = a_ev;
60  bool done = false; // The boolean value done indicates when we are totally finished with this plan (i.e. it is set to true).
61  bool flag = false;
62  int d1 = 0;
63  int noDates = 1;
64  TTypesOfVegetation l_tov = tov_BEGrassGrazed1; // The current type - change to match the crop you have
65  /**********************************************To Here *************************************************************************/
66  // Depending what event has occured jump to the correct bit of code
67  switch (a_ev->m_todo)
68  {
69  case BE_gg1_start:
70  {
71  // BE_gg1_start just sets up all the starting conditions and reference dates that are needed to start a BE_pot
73  BE_GG1_CUT_DATE = 0;
75 
76 
77  // Set up the date management stuff
78  // The next bit of code just allows for altering dates after harvest if it is necessary
79  // to allow for a crop which starts its management early.
80 
81  // 1 start and stop dates for all 'movable' events for this crop
82  int noDates = 1;
83  a_field->SetMDates(0, 0, g_date->DayInYear(10, 10)); // last possible day of last cutting
84  a_field->SetMDates(1, 0, g_date->DayInYear(10, 10)); // last possible day of NPK application
85 
86  a_field->SetMConstants(0, 1);
87 
88  // Check the next crop for early start, uBEess it is a spring crop
89  // in which case we ASSUME that no checking is necessary!!!!
90  // So DO NOT implement a crop that runs over the year boundary (i.e. from spring to spring!), at least not without fixing this.
91 
92  //new if: do the check oBEy for non-optimising farms and if year>0. (030713 - m_rotation used oBEy in the hidden year, so I modified the condition from >7 to >0)
93  //optimising farms not used for now so most of related code is removed (but not in 'start' case)
94  if (!(a_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber() > 0)) {
95 
96  if (a_ev->m_startday > g_date->DayInYear(1, 7)) {
97  if (a_field->GetMDates(0, 0) >= a_ev->m_startday)
98  {
99  g_msg->Warn(WARN_BUG, "BEGrassGrazed1::Do(): ", "Harvest too late for the next crop to start!!!");
100  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
101  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
102  }
103  // Now fix any late finishing problems
104  for (int i = 0; i < noDates; i++) {
105  if (a_field->GetMDates(0, i) >= a_ev->m_startday) {
106  a_field->SetMDates(0, i, a_ev->m_startday - 1); //move the starting date
107  }
108  if (a_field->GetMDates(1, i) >= a_ev->m_startday) {
109  a_field->SetMConstants(i, 0); //change the default value of the MConst (=1) to 0 (necessary to correctly execute farm events in case the finishing date (MDate) was moved)
110  a_field->SetMDates(1, i, a_ev->m_startday - 1); //move the finishing date
111  }
112  }
113  }
114  // Now no operations can be timed after the start of the next crop.
115 
116  if (!a_ev->m_first_year) {
117  // Are we before July 1st?
118  d1 = g_date->OldDays() + g_date->DayInYear(1, 7);
119  if (g_date->Date() < d1) {
120  // Yes, too early. We assumme this is because the last crop was late
121  printf("Poly: %d\n", a_field->GetPoly());
122  g_msg->Warn(WARN_BUG, "BEGrassGrazed1::Do(): ", "Crop start attempt between 1st Jan & 1st July");
123  int prev = a_field->GetLandscape()->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousTov(a_field->GetRotIndex()));
124  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
125  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
126  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
127  exit(1);
128  }
129  else {
130  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
131  if (g_date->Date() > d1) {
132  // Yes too late - should not happen - raise an error
133  g_msg->Warn(WARN_BUG, "BEGrassGrazed1::Do(): ", "Crop start attempt after last possible start date");
134  int prev = a_field->GetLandscape()->BackTranslateVegTypes(a_field->GetOwner()->GetPreviousTov(a_field->GetRotIndex()));
135  g_msg->Warn(WARN_BUG, "Previous Crop ", prev);
136  int almassnum = a_field->GetLandscape()->BackTranslateVegTypes(a_ev->m_next_tov);
137  g_msg->Warn("Next Crop ", (double)almassnum); // this causes exit
138  exit(1);
139  }
140  }
141  }
142  else {
143  // Is the first year
144  // Some special code to cope with that first start-up year in ALMaSS - ignore for all practical purposes
145  // Code for first spring treatment used
146  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(1, 3), BE_gg1_spring_sow, false, a_farm, a_field);
147  break;
148  }
149  }//if
150 
151  // End single block date checking code. Please see next line comment as well.
152  // Reinit d1 to first possible starting date.
153  d1 = g_date->OldDays() + g_date->DayInYear(1, 10);
154  // OK, let's go.
155  // Here we queue up the first event - this differs depending on whether we have a
156  // stock or arable farmer
157  SimpleEvent_(d1, BE_gg1_winter_plough, false, a_farm, a_field);
158  }
159  break;
160 
161  // This is the first real farm operation
163  if (!a_farm->WinterPlough(a_field, 0.0, g_date->DayInYear(1, 12) - g_date->DayInYear())) {
164  SimpleEvent_(g_date->Date() + 1, BE_gg1_winter_plough, true, a_farm, a_field);
165  break;
166  }
167  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(20, 2) + 365, BE_gg1_preseeding_cultivator, false, a_farm, a_field);
168  break;
170  if (!a_farm->PreseedingCultivator(a_field, 0.0, g_date->DayInYear(20, 3) - g_date->DayInYear())) {
171  SimpleEvent_(g_date->Date() + 1, BE_gg1_preseeding_cultivator, true, a_farm, a_field);
172  break;
173  }
174  if (a_farm->IsStockFarmer()) //Stock Farmer
175  {
176  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s1, false, a_farm, a_field);
177  }
178  else SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p1, false, a_farm, a_field);
179  break;
180  case BE_gg1_ferti_p1:
181  if (!a_farm->FP_Slurry(a_field, 0.0, g_date->DayInYear(22, 3) - g_date->DayInYear())) {
182  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p1, true, a_farm, a_field);
183  break;
184  }
185  SimpleEvent_(g_date->Date() + 1, BE_gg1_spring_sow, false, a_farm, a_field);
186  break;
187  case BE_gg1_ferti_s1:
188  if (!a_farm->FA_Slurry(a_field, 0.0, g_date->DayInYear(22, 3) - g_date->DayInYear())) {
189  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s1, true, a_farm, a_field);
190  break;
191  }
192  SimpleEvent_(g_date->Date() + 1, BE_gg1_spring_sow, false, a_farm, a_field);
193  break;
194  case BE_gg1_spring_sow:
195  if (!a_farm->SpringSow(a_field, 0.0, g_date->DayInYear(25, 3) - g_date->DayInYear())) {
196  SimpleEvent_(g_date->Date() + 1, BE_gg1_spring_sow, true, a_farm, a_field);
197  break;
198  }
199  if (a_farm->IsStockFarmer()) //Stock Farmer
200  {
201  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s2, false, a_farm, a_field);
202  }
203  else SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p2, false, a_farm, a_field);
204  break;
205  case BE_gg1_ferti_p2:
206  if (a_farm->DoIt_prob(0.90)) {
207  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
208  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p2, true, a_farm, a_field);
209  break;
210  }
211  }
212  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(25, 4), BE_gg1_cut_to_silage1, false, a_farm, a_field);
213  break;
214  case BE_gg1_ferti_s2:
215  if (a_farm->DoIt_prob(0.90)) {
216  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(30, 3) - g_date->DayInYear())) {
217  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s2, true, a_farm, a_field);
218  break;
219  }
220  }
221  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(25, 4), BE_gg1_cut_to_silage1, false, a_farm, a_field);
222  break;
224  // At least 7 days from last watering and 21 from last application of fertilizer.
225  if (g_date->Date() < BE_GG1_WATER_DATE + 7) {
226  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage1, true, a_farm, a_field);
227  break;
228  }
229  else
230  {
231  if (!a_farm->CutToSilage(a_field, 0.0, g_date->DayInYear(10, 5) - g_date->DayInYear())) {
232  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage1, true, a_farm, a_field);
233  break;
234  }
236  if (a_farm->IsStockFarmer()) //Stock Farmer
237  {
238  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s3, false, a_farm, a_field);
239  }
240  else SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p3, false, a_farm, a_field);
241  // Start water thread
242  break;
243  }
244  break;
245  case BE_gg1_ferti_s3:
246  if (!a_farm->FA_Slurry(a_field, 0.0, (BE_GG1_CUT_DATE + 4) - g_date->DayInYear())) {
247  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s3, true, a_farm, a_field);
248  break;
249  }
250  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s4, false, a_farm, a_field);
251  break;
252  case BE_gg1_ferti_p3:
253  if (!a_farm->FP_Slurry(a_field, 0.0, (BE_GG1_CUT_DATE + 4) - g_date->DayInYear())) {
254  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p3, true, a_farm, a_field);
255  break;
256  }
257  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p4, false, a_farm, a_field);
258  break;
259  case BE_gg1_ferti_s4:
260  if (a_ev->m_lock || a_farm->DoIt_prob(0.9))
261  {
262  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
263  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s4, true, a_farm, a_field);
264  break;
265  }
266  }
267  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage2, false, a_farm, a_field);
268  break;
269  case BE_gg1_ferti_p4:
270  if (a_ev->m_lock || a_farm->DoIt_prob(0.9))
271  {
272  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(20, 5) - g_date->DayInYear())) {
273  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p4, true, a_farm, a_field);
274  break;
275  }
276  }
277  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage2, false, a_farm, a_field);
278  break;
280  // At least 7 days from last watering and 21 from last application of fertilizer.
281  if (g_date->Date() < BE_GG1_WATER_DATE + 7) {
282  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage2, true, a_farm, a_field);
283  break;
284  }
285  else
286  {
287  if (!a_farm->CutToSilage(a_field, 0.0, g_date->DayInYear(15, 6) - g_date->DayInYear())) {
288  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage2, true, a_farm, a_field);
289  break;
290  }
292  if (a_farm->IsStockFarmer()) //Stock Farmer
293  {
294  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s5, false, a_farm, a_field);
295  }
296  else SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p5, false, a_farm, a_field);
297  break;
298  }
299  break;
300  case BE_gg1_ferti_s5:
301  if (!a_farm->FA_Slurry(a_field, 0.0, (BE_GG1_CUT_DATE + 4) - g_date->DayInYear())) {
302  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s5, true, a_farm, a_field);
303  break;
304  }
305  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s6, false, a_farm, a_field);
306  break;
307  case BE_gg1_ferti_p5:
308  if (!a_farm->FP_Slurry(a_field, 0.0, (BE_GG1_CUT_DATE + 4) - g_date->DayInYear())) {
309  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p5, true, a_farm, a_field);
310  break;
311  }
312  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p6, false, a_farm, a_field);
313  break;
314  case BE_gg1_ferti_s6:
315  if (a_ev->m_lock || a_farm->DoIt_prob(.9))
316  {
317  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(25, 6) - g_date->DayInYear())) {
318  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s6, true, a_farm, a_field);
319  break;
320  }
321  }
322  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 4), BE_gg1_cattle_out, false, a_farm, a_field);
323  break;
324 
325  case BE_gg1_ferti_p6:
326  if (a_ev->m_lock || a_farm->DoIt_prob(.9))
327  {
328  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(25, 6) - g_date->DayInYear())) {
329  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p6, true, a_farm, a_field);
330  break;
331  }
332  }
333  SimpleEvent_(g_date->OldDays() + g_date->DayInYear(5, 4), BE_gg1_cattle_out, false, a_farm, a_field);
334  break;
335 
337  // At least 7 days from last watering and 21 from last application of fertilizer.
338  if (g_date->Date() < BE_GG1_WATER_DATE + 7) {
339  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage3, true, a_farm, a_field);
340  break;
341  }
342  else
343  {
344  if (!a_farm->CutToSilage(a_field, 0.0, g_date->DayInYear(25, 7) - g_date->DayInYear())) {
345  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage3, true, a_farm, a_field);
346  break;
347  }
349  if (a_farm->IsStockFarmer()) //Stock Farmer
350  {
351  SimpleEvent_(g_date->Date() + 5, BE_gg1_ferti_s7, false, a_farm, a_field);
352  }
353  else SimpleEvent_(g_date->Date() + 5, BE_gg1_ferti_p7, false, a_farm, a_field);
354  break;
355  }
356  break;
357  case BE_gg1_ferti_s7:
358  if (a_ev->m_lock || a_farm->DoIt_prob(.9)) {
359  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(5, 8) - g_date->DayInYear())) {
360  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s7, true, a_farm, a_field);
361  break;
362  }
363  }
364  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage4, false, a_farm, a_field);
365  break;
366  case BE_gg1_ferti_p7:
367  if (a_ev->m_lock || a_farm->DoIt_prob(.9)) {
368  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(5, 8) - g_date->DayInYear())) {
369  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p7, true, a_farm, a_field);
370  break;
371  }
372  }
373  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage4, false, a_farm, a_field);
374  break;
376  // At least 7 days from last watering and 21 from last application of fertilizer.
377  if (g_date->Date() < BE_GG1_WATER_DATE + 7) {
378  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage4, true, a_farm, a_field);
379  break;
380  }
381  else
382  {
383  if (!a_farm->CutToSilage(a_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear())) {
384  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage4, true, a_farm, a_field);
385  break;
386  }
388  if (a_farm->IsStockFarmer()) //Stock Farmer
389  {
390  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s8, false, a_farm, a_field);
391  }
392  else SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p8, false, a_farm, a_field);
393  break;
394  }
395  break;
396  case BE_gg1_ferti_s8:
397  if (a_ev->m_lock || a_farm->DoIt_prob(0.90))
398  {
399  if (!a_farm->FA_NPK(a_field, 0.0, g_date->DayInYear(10, 9) - g_date->DayInYear())) {
400  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_s8, true, a_farm, a_field);
401  break;
402  }
403  }
404  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage5, false, a_farm, a_field);
405  break;
406  case BE_gg1_ferti_p8:
407  if (a_ev->m_lock || a_farm->DoIt_prob(0.90))
408  {
409  if (!a_farm->FP_NPK(a_field, 0.0, g_date->DayInYear(10, 9) - g_date->DayInYear())) {
410  SimpleEvent_(g_date->Date() + 1, BE_gg1_ferti_p8, true, a_farm, a_field);
411  break;
412  }
413  }
414  SimpleEvent_(g_date->Date() + 5, BE_gg1_cut_to_silage5, false, a_farm, a_field);
415  break;
417  // At least 7 days from last watering and 21 from last application of fertilizer.
418  if (g_date->Date() < BE_GG1_WATER_DATE + 7) {
419  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage5, true, a_farm, a_field);
420  break;
421  }
422  else
423  {
424  if (a_ev->m_lock || a_farm->DoIt_prob(0.40))
425  {
426  if (!a_farm->CutToSilage(a_field, 0.0, g_date->DayInYear(9, 10) - g_date->DayInYear())) {
427  SimpleEvent_(g_date->Date() + 1, BE_gg1_cut_to_silage5, true, a_farm, a_field);
428  break;
429  }
430  done = true;
431  break;
432  }
433  }
434  done = true;
435  break;
436 
437  case BE_gg1_cattle_out:
438  if (a_ev->m_lock || a_farm->DoIt_prob(.5)) {
439  if (!a_farm->CattleOut(a_field, 0.0, g_date->DayInYear(26, 6) - g_date->DayInYear())) {
440  SimpleEvent_(g_date->Date() + 1, BE_gg1_cattle_out, true, a_farm, a_field);
441  break;
442  }
443  // Keep them out there
444  SimpleEvent_(g_date->Date() + 1, BE_gg1_cattle_is_out, false, a_farm, a_field);
445  break;
446  }
447  SimpleEvent_(g_date->Date() + 21, BE_gg1_cut_to_silage3, false, a_farm, a_field);
448  break;
449  case BE_gg1_cattle_is_out: // Keep the cattle out there
450  // CattleIsOut() returns false if it is not time to stop grazing
451  if (!a_farm->CattleIsOut(a_field, 0.0, g_date->DayInYear(31, 8) - g_date->DayInYear(), g_date->DayInYear(31, 8))) {
452  SimpleEvent_(g_date->Date() + 1, BE_gg1_cattle_is_out, false, a_farm, a_field);
453  break;
454  }
455  done = true;
456  break;
457  // End of thread
458  default:
459  g_msg->Warn(WARN_BUG, "BEGrassGrazed1::Do(): "
460  "Unknown event type! ", "");
461  exit(1);
462  }
463  return done;
464 }

References BE_gg1_cattle_is_out, BE_gg1_cattle_out, BE_GG1_CUT_DATE, BE_gg1_cut_to_silage1, BE_gg1_cut_to_silage2, BE_gg1_cut_to_silage3, BE_gg1_cut_to_silage4, BE_gg1_cut_to_silage5, BE_GG1_FERTI_DATE, BE_gg1_ferti_p1, BE_gg1_ferti_p2, BE_gg1_ferti_p3, BE_gg1_ferti_p4, BE_gg1_ferti_p5, BE_gg1_ferti_p6, BE_gg1_ferti_p7, BE_gg1_ferti_p8, BE_gg1_ferti_s1, BE_gg1_ferti_s2, BE_gg1_ferti_s3, BE_gg1_ferti_s4, BE_gg1_ferti_s5, BE_gg1_ferti_s6, BE_gg1_ferti_s7, BE_gg1_ferti_s8, BE_gg1_preseeding_cultivator, BE_gg1_spring_sow, BE_gg1_start, BE_GG1_WATER_DATE, BE_gg1_winter_plough, Calendar::Date(), Calendar::DayInYear(), g_date, g_msg, LE::GetMDates(), LE::GetOwner(), LE::GetPoly(), Farm::GetPreviousTov(), LE::GetRotIndex(), Farm::GetType(), Calendar::GetYearNumber(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, FarmEvent::m_lock, FarmEvent::m_next_tov, FarmEvent::m_startday, FarmEvent::m_todo, Calendar::OldDays(), LE::SetMConstants(), LE::SetMDates(), Crop::SimpleEvent_(), tof_OptimisingFarm, tov_BEGrassGrazed1, MapErrorMsg::Warn(), WARN_BUG, and Farm::WinterPlough().


The documentation for this class was generated from the following files:
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
BE_gg1_ferti_p6
Definition: BEGrassGrazed1.h:59
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
BE_gg1_ferti_p4
Definition: BEGrassGrazed1.h:55
BE_GG1_WATER_DATE
#define BE_GG1_WATER_DATE
Definition: BEGrassGrazed1.h:30
BE_gg1_ferti_p8
Definition: BEGrassGrazed1.h:63
BE_gg1_ferti_p1
Definition: BEGrassGrazed1.h:42
BE_gg1_cattle_out
Definition: BEGrassGrazed1.h:65
BE_gg1_ferti_p7
Definition: BEGrassGrazed1.h:61
BE_GG1_CUT_DATE
#define BE_GG1_CUT_DATE
Definition: BEGrassGrazed1.h:29
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
BE_gg1_preseeding_cultivator
Definition: BEGrassGrazed1.h:44
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
BE_gg1_winter_plough
Definition: BEGrassGrazed1.h:41
BE_gg1_ferti_s6
Definition: BEGrassGrazed1.h:60
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
BE_GG1_FERTI_DATE
#define BE_GG1_FERTI_DATE
A flag used to indicate autumn ploughing status.
Definition: BEGrassGrazed1.h:28
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
BE_gg1_spring_sow
Definition: BEGrassGrazed1.h:45
BE_gg1_ferti_s4
Definition: BEGrassGrazed1.h:56
BE_gg1_cut_to_silage5
Definition: BEGrassGrazed1.h:52
Calendar::Date
long Date(void)
Definition: Calendar.h:57
BE_gg1_ferti_s8
Definition: BEGrassGrazed1.h:64
BE_gg1_ferti_s5
Definition: BEGrassGrazed1.h:58
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
BE_gg1_ferti_s7
Definition: BEGrassGrazed1.h:62
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
tov_BEGrassGrazed1
Definition: LandscapeFarmingEnums.h:292
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
BE_gg1_ferti_s3
Definition: BEGrassGrazed1.h:54
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
BE_gg1_ferti_p2
Definition: BEGrassGrazed1.h:46
BE_gg1_start
Definition: BEGrassGrazed1.h:39
BE_gg1_cut_to_silage1
Definition: BEGrassGrazed1.h:48
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Farm::WinterPlough
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
Definition: FarmFuncs.cpp:395
BE_gg1_cut_to_silage4
Definition: BEGrassGrazed1.h:51
BE_gg1_cut_to_silage3
Definition: BEGrassGrazed1.h:50
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
BE_gg1_ferti_s1
Definition: BEGrassGrazed1.h:43
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
BE_gg1_ferti_p3
Definition: BEGrassGrazed1.h:53
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
BE_gg1_ferti_s2
Definition: BEGrassGrazed1.h:47
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
BE_gg1_cut_to_silage2
Definition: BEGrassGrazed1.h:49
BE_gg1_ferti_p5
Definition: BEGrassGrazed1.h:57
BE_gg1_cattle_is_out
Definition: BEGrassGrazed1.h:66
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