ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
Carrots.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2011, Christopher John Topping, University of Aarhus
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 ********************************************************************************************************
23 */
24 
25 
26 #define _CRT_SECURE_NO_DEPRECATE
27 //#include "ALMaSS_Setup.h"
28 #include "../../Landscape/ls.h"
29 #include "../../Landscape/cropprogs/Carrots.h"
30 
31 
32 extern CfgFloat cfg_ins_app_prop1;
33 extern CfgFloat cfg_herbi_app_prop;
34 extern CfgFloat cfg_fungi_app_prop1;
35 
36 bool Carrots::Do( Farm * a_farm, LE * a_field, FarmEvent * a_ev ) {
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 
54  // Set up the date management stuff
55  m_last_date = g_date->DayInYear( 8,9 );
56  // Start and stop dates for all events after harvest
57  noDates = 1;
58  m_field->SetMDates( 0, 0, g_date->DayInYear( 8,9 ) );
59  // 0,0 determined by harvest date - used to see if at all possible
60  m_field->SetMDates( 1, 0, g_date->DayInYear( 30, 11 ) );
61  // Check the next crop for early start, unless it is a spring crop
62  // in which case we ASSUME that no checking is necessary!!!!
63  // So DO NOT implement a crop that runs over the year boundary
64 
65 
66  //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)
67  if(!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber()>0)){
68 
69  if ( m_ev->m_startday > g_date->DayInYear( 1, 7 ) ) {
70  if ( m_field->GetMDates( 0, 0 ) >= m_ev->m_startday ) {
71  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Harvest too late for the next crop to start!!!", "" );
72  exit( 1 );
73  }
74  // Now fix any late finishing problems
75  for (int i=0; i<noDates; i++) {
76  if(m_field->GetMDates(0,i)>=m_ev->m_startday) {
77  m_field->SetMDates(0,i,m_ev->m_startday-1); //move the starting date
78  }
79  if(m_field->GetMDates(1,i)>=m_ev->m_startday){
80  m_field->SetMConstants(i,0);
81  m_field->SetMDates(1,i,m_ev->m_startday-1); //move the finishing date
82  }
83  }
84  }
85  // Now no operations can be timed after the start of the next crop.
86 
87  if ( !m_ev->m_first_year ) {
88  today = g_date->Date();
89  // Are we before July 1st?
90  d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
91  if ( today < d1 ) {
92  // Yes, too early. We assumme this is because the last crop was late
93  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Crop start attempt between 1st Jan & 1st July", "" );
94  exit( 1 );
95  } else {
96  d1 = g_date->OldDays() + m_first_date + 365; // Add 365 for spring crop
97  if ( today > d1 ) {
98  // Yes too late - should not happen - raise an error
99  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Crop start attempt after last possible start date", "" );
100  exit( 1 );
101  }
102  }
103  } else {
104  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), ca_spring_plough, false );
105  break;
106  }
107  }//if
108 
109  // Reinit d1 to first possible starting date.
110  d1 = g_date->OldDays() + m_first_date +365; // Add 365 for spring crop
111  if ( g_date->Date() > d1 ) {
112  d1 = g_date->Date();
113  }
114  // OK, let's go.
115 
116  if ( m_farm->IsStockFarmer() ) {
117  SimpleEvent( d1, ca_fa_slurry, false );
118  } else {
119  SimpleEvent( d1, ca_fp_slurry, false );
120  }
121  break;
122 
123  case ca_fa_slurry:
124  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
125  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
126  SimpleEvent( g_date->Date() + 1, ca_fa_slurry, true );
127  break;
128  }
129  CA_SLURRY_DATE = g_date->DayInYear();
130  }
131  {
132  d1 = g_date->OldDays() + g_date->DayInYear( 5, 4 );
133  if ( g_date->Date() > d1 ) {
134  d1 = g_date->Date();
135  }
136  SimpleEvent( d1, ca_spring_plough, false );
137  }
138  break;
139 
140  case ca_fp_slurry:
141  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
142  if ( !m_farm->FP_Slurry( m_field, 0.0, g_date->DayInYear( 30, 3 ) - g_date->DayInYear() ) ) {
143  SimpleEvent( g_date->Date() + 1, ca_fp_slurry, true );
144  break;
145  }
146  CA_SLURRY_DATE = g_date->DayInYear();
147  }
148  {
149  int d1 = g_date->OldDays() + g_date->DayInYear( 5, 4 );
150  if ( g_date->Date() > d1 ) {
151  d1 = g_date->Date();
152  }
153  SimpleEvent( d1, ca_spring_plough, false );
154  }
155  break;
156 
157  case ca_spring_plough: {
158  int forceday = g_date->DayInYear( 5, 5 );
159  if ( CA_SLURRY_DATE && CA_SLURRY_DATE < forceday - 5 ) { //?AM
160  forceday = CA_SLURRY_DATE + 5;
161  }
162  if ( !m_farm->SpringPlough( m_field, 0.0, forceday - g_date->DayInYear() ) ) {
163  SimpleEvent( g_date->Date() + 1, ca_spring_plough, false );
164  break;
165  }
166  }
167  {
168  int d1 = g_date->OldDays() + g_date->DayInYear( 10, 4 );
169  if ( g_date->Date() > d1 ) {
170  d1 = g_date->Date();
171  }
172  SimpleEvent( d1, ca_spring_harrow_one, false );
173  }
174  break;
175 
177  if ( !m_farm->SpringHarrow( m_field, 0.0, g_date->DayInYear( 6, 5 ) - g_date->DayInYear() ) ) {
178  SimpleEvent( g_date->Date() + 1, ca_spring_harrow_one, false );
179  break;
180  }
181  if ( m_farm->DoIt( 75 ) ) {
182  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 4 );
183  if ( g_date->Date() + 10 > d1 ) {
184  d1 = g_date->Date() + 10;
185  }
186  SimpleEvent( d1, ca_spring_harrow_two, false );
187  } else {
188  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 4 );
189  if ( g_date->Date() + 10 > d1 ) {
190  d1 = g_date->Date() + 10;
191  }
192  if (g_date->DayInYear() >150) {
193  break;
194  }
195  SimpleEvent( d1, ca_herbi_one, false );
196  }
197  break;
198 
200  if ( !m_farm->SpringHarrow( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
201  SimpleEvent( g_date->Date() + 1, ca_spring_harrow_two, false );
202  break;
203  }
204  {
205  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 5 );
206  if ( g_date->Date() > d1 ) {
207  d1 = g_date->Date();
208  }
209  SimpleEvent( d1, ca_spring_sow, false );
210  }
211  break;
212 
213  case ca_herbi_one:
214  if ( m_farm->DoIt( int(0 * cfg_herbi_app_prop.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
215 
216  //new - for decision making
217  TTypesOfVegetation tov = m_field->GetVegType();
218  if(!m_ev->m_lock && !m_farm->Spraying_herbicides(tov)){
219  Field * pf = dynamic_cast<Field*>(m_field);
220  pf->Add_missed_herb_app();
221  if(m_farm->DoIt(50)) pf->Add_missed_herb_app(); //the 2nd missed application
222  if(m_farm->DoIt(50)) pf->Add_missed_herb_app(); //the 3rd missed application
223  if(m_farm->DoIt(50)) pf->Add_missed_herb_app(); //the 4th missed application
225  } //end of the part for dec. making
226  else{
227  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
228  SimpleEvent( g_date->Date() + 1, ca_herbi_one, true );
229  break;
230  }
231  }
232  }
233  d1 = g_date->OldDays() + g_date->DayInYear( 1, 5 );
234  if ( g_date->Date() > d1 ) {
235  d1 = g_date->Date();
236  }
237  SimpleEvent( d1, ca_spring_sow, false );
238  break;
239 
240  case ca_spring_sow:
241  if ( !m_farm->SpringSow( m_field, 0.0, g_date->DayInYear( 20, 5 ) - g_date->DayInYear() ) ) {
242  SimpleEvent( g_date->Date() + 1, ca_spring_sow, false );
243  break;
244  }
245  // Rowcul one carries the main thread of execution.
246  {
247  int d1 = g_date->OldDays() + g_date->DayInYear( 12, 5 );
248  if ( g_date->Date() > d1 ) {
249  d1 = g_date->Date();
250  }
251  SimpleEvent( d1, ca_rowcul_one, false );
252  }
253 
254  // This is a dead end, eventually.
255  {
256  int d1 = g_date->OldDays() + g_date->DayInYear( 10, 5 );
257  if ( g_date->Date() > d1 ) {
258  d1 = g_date->Date();
259  }
260  SimpleEvent( d1, ca_herbi_two, false );
261  }
262  break;
263 
264  case ca_herbi_two:
265  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
266  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 30, 5 ) - g_date->DayInYear() ) ) {
267  SimpleEvent( g_date->Date() + 1, ca_herbi_two, true );
268  break;
269  }
270  }
271  {
272  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 5 );
273  if ( g_date->Date() > d1 ) {
274  d1 = g_date->Date();
275  }
276  SimpleEvent( d1, ca_insect_one, false );
277  }
278  {
279  int d1 = g_date->OldDays() + g_date->DayInYear( 20, 5 );
280  if ( g_date->Date() + 10 > d1 ) {
281  d1 = g_date->Date() + 10;
282  }
283  SimpleEvent( d1, ca_herbi_three, false );
284  }
285  break;
286 
287  case ca_insect_one:
288  if ( m_ev->m_lock || m_farm->DoIt(int( 0 * cfg_ins_app_prop1.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
289 
290  //new - for decision making
291  TTypesOfVegetation tov = m_field->GetVegType();
292  if(!m_ev->m_lock && !m_farm->Spraying_fungins(tov)){
293  Field * pf = dynamic_cast<Field*>(m_field);
294  pf->Add_missed_fi_app();
295  if(m_farm->DoIt(0)) pf->Add_missed_fi_app(); //the 2nd missed application
296  if(m_farm->DoIt(0)) pf->Add_missed_fi_app(); //the 3rd missed application
297  break; //here ok cause there's nothing else lined up
298  } //end of the part for dec. making
299 
300  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 15, 6 ) - g_date->DayInYear() ) ) {
301  SimpleEvent( g_date->Date() + 1, ca_insect_one, true );
302  break;
303  }
304  }
305  break;
306 
307  case ca_herbi_three:
308  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
309  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 20, 6 ) - g_date->DayInYear() ) ) {
310  SimpleEvent( g_date->Date() + 1, ca_herbi_three, false );
311  break;
312  }
313  }
314  if ( m_farm->IsStockFarmer() ) {
315  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
316  if ( g_date->Date() > d1 ) {
317  d1 = g_date->Date();
318  }
319  SimpleEvent( d1, ca_fa_npk_one, false );
320  } else {
321  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
322  if ( g_date->Date() > d1 ) {
323  d1 = g_date->Date();
324  }
325  SimpleEvent( d1, ca_fp_npk_one, false );
326  }
327  {
328  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 6 );
329  if ( g_date->Date() + 10 > d1 ) {
330  d1 = g_date->Date() + 10;
331  }
332  SimpleEvent( d1, ca_herbi_four, false );
333  }
334  break;
335 
336  case ca_herbi_four:
337  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
338  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 1, 7 ) - g_date->DayInYear() ) ) {
339  SimpleEvent( g_date->Date() + 1, ca_herbi_four, true );
340  break;
341  }
342  }
343  break;
344 
345  case ca_fa_npk_one:
346  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 2, 7 ) - g_date->DayInYear() ) ) {
347  SimpleEvent( g_date->Date() + 1, ca_fa_npk_one, false );
348  break;
349  }
350  break;
351 
352  case ca_fp_npk_one:
353  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 2, 7 ) - g_date->DayInYear() ) ) {
354  SimpleEvent( g_date->Date() + 1, ca_fp_npk_one, false );
355  break;
356  }
357  break;
358 
359  case ca_rowcul_one:
360  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 5, 6 ) - g_date->DayInYear() ) ) {
361  SimpleEvent( g_date->Date() + 1, ca_rowcul_one, false );
362  break;
363  }
364  {
365  int d1 = g_date->OldDays() + g_date->DayInYear( 22, 5 );
366  if ( g_date->Date() + 10 > d1 ) {
367  d1 = g_date->Date() + 10;
368  }
369  SimpleEvent( d1, ca_rowcul_two, false );
370  }
371  break;
372 
373  case ca_rowcul_two:
374  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 20, 6 ) - g_date->DayInYear() ) ) {
375  SimpleEvent( g_date->Date() + 1, ca_rowcul_two, false );
376  break;
377  }
378  {
379  int d1 = g_date->OldDays() + g_date->DayInYear( 2, 6 );
380  if ( g_date->Date() + 10 > d1 ) {
381  d1 = g_date->Date() + 10;
382  }
383  SimpleEvent( d1, ca_rowcul_three, false );
384  }
385  break;
386 
387  case ca_rowcul_three:
388  if ( !m_farm->RowCultivation( m_field, 0.0, g_date->DayInYear( 10, 7 ) - g_date->DayInYear() ) ) {
389  SimpleEvent( g_date->Date() + 1, ca_rowcul_three, false );
390  break;
391  }
392  {
393  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
394  if ( g_date->Date() + 3 > d1 ) {
395  d1 = g_date->Date() + 3;
396  }
397  SimpleEvent( d1, ca_water_one, false );
398  }
399  break;
400 
401  case ca_water_one:
402  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 20, 7 ) - g_date->DayInYear() ) ) {
403  SimpleEvent( g_date->Date() + 1, ca_water_one, true );
404  break;
405  }
406  {
407  d1 = g_date->OldDays() + g_date->DayInYear( 20, 7 );
408  if ( g_date->Date() > d1 ) {
409  d1 = g_date->Date();
410  }
411  SimpleEvent( d1, ca_insect_two, false );
412  }
413  {
414  d1 = g_date->OldDays() + g_date->DayInYear( 21, 7 );
415  if ( g_date->Date() + 7 > d1 ) {
416  d1 = g_date->Date() + 7;
417  }
418  SimpleEvent( d1, ca_water_two, false );
419  }
420  break;
421 
422  case ca_insect_two:
423  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
424  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 5, 8 ) - g_date->DayInYear() ) ) {
425  SimpleEvent( g_date->Date() + 1, ca_insect_two, true );
426  break;
427  }
428  }
429  break;
430 
431  case ca_water_two:
432  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 10, 8 ) - g_date->DayInYear() ) ) {
433  SimpleEvent( g_date->Date() + 1, ca_water_two, true );
434  break;
435  }
436  {
437  int d1 = g_date->OldDays() + g_date->DayInYear( 11, 8 );
438  if ( g_date->Date() > d1 ) {
439  d1 = g_date->Date();
440  }
441  SimpleEvent( d1, ca_water_three, false );
442  }
443 
444  if ( m_farm->IsStockFarmer() ) {
445  int d1 = g_date->OldDays() + g_date->DayInYear( 25, 8 );
446  if ( g_date->Date() > d1 ) {
447  d1 = g_date->Date();
448  }
449  SimpleEvent( d1, ca_fa_npk_two, false );
450  } else {
451  d1 = g_date->OldDays() + g_date->DayInYear( 25, 8 );
452  if ( g_date->Date() > d1 ) {
453  d1 = g_date->Date();
454  }
455  SimpleEvent( d1, ca_fp_npk_two, false );
456  }
457  break;
458 
459  case ca_fa_npk_two:
460  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
461  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
462  SimpleEvent( g_date->Date() + 1, ca_fa_npk_two, true );
463  break;
464  }
465  }
466  break;
467 
468  case ca_fp_npk_two:
469  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
470  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
471  SimpleEvent( g_date->Date() + 1, ca_fp_npk_two, true );
472  break;
473  }
474  }
475  break;
476 
477  case ca_water_three:
478  if ( m_ev->m_lock || m_farm->DoIt( 70 ) ) {
479  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 6, 9 ) - g_date->DayInYear() ) ) {
480  SimpleEvent( g_date->Date() + 1, ca_water_three, true );
481  break;
482  }
483  }
484  {
485  d1 = g_date->OldDays() + g_date->DayInYear( 20, 8 );
486  if ( g_date->Date() + 7 > d1 ) {
487  d1 = g_date->Date() + 7;
488  }
489 
490  if(d1 > m_field->GetMDates( 1, 0 ) - 2){
491  d1 = m_field->GetMDates( 1, 0 ) - 2;
492  }
493  SimpleEvent( d1, ca_insect_three, false );
494  }
495  break;
496 
497  case ca_insect_three:
498  if ( m_ev->m_lock || m_farm->DoIt( int( 0 * cfg_ins_app_prop1.value() * m_farm->Prob_multiplier()) ) ) { //modified probability
499 
500  //new - for decision making
501  TTypesOfVegetation tov = m_field->GetVegType();
502  if(!m_ev->m_lock && !m_farm->Spraying_fungins(tov)){
503  Field * pf = dynamic_cast<Field*>(m_field);
504  pf->Add_missed_fi_app();
505  } //end of the part for dec. making
506  else{
507  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 5, 9 ) - g_date->DayInYear() ) ) {
508  SimpleEvent( g_date->Date() + 1, ca_insect_three, true );
509  break;
510  }
511  }
512  }
513  {
514  int d1 = g_date->OldDays() + g_date->DayInYear( 1, 9 );
515  if ( g_date->Date() + 7 > d1 ) {
516  d1 = g_date->Date() + 7;
517  }
518  if(d1 > m_field->GetMDates( 1, 0 ) - 1){
519  d1 = m_field->GetMDates( 1, 0 ) - 1;
520  }
521  ChooseNextCrop (1);
522  SimpleEvent( d1, ca_harvest, false );
523  }
524  break;
525 
526  case ca_harvest:
527  if (m_field->GetMConstants(0)==0) {
528  if (!m_farm->Harvest( m_field, 0.0, -1)) { //raise an error
529  g_msg->Warn( WARN_BUG, "Carrots::Do(): failure in 'Harvest' execution", "" );
530  exit( 1 );
531  }
532  }
533  else {
534  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
535  SimpleEvent( g_date->Date() + 1, ca_harvest, false );
536  break;
537  }
538  }
539  done = true;
540  break;
541 
542  default:
543  g_msg->Warn( WARN_BUG, "Carrots::Do(): ""Unknown event type! ", "" );
544  exit( 1 );
545  }
546 
547  return done;
548 }
549 
550 
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:965
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:444
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: farmfuncs.cpp:1156
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: farm.h:905
Carrots::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: Carrots.cpp:36
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: farmfuncs.cpp:1769
FarmEvent::m_lock
bool m_lock
Definition: farm.h:465
ca_herbi_two
Definition: Carrots.h:47
CA_SLURRY_DATE
#define CA_SLURRY_DATE
Definition: Carrots.h:32
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: farm.h:463
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:629
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: farm.cpp:800
ca_herbi_one
Definition: Carrots.h:46
FarmEvent::m_first_year
bool m_first_year
Definition: farm.h:467
tof_OptimisingFarm
Definition: farm.h:273
CA_DECIDE_TO_HERB
#define CA_DECIDE_TO_HERB
Definition: Carrots.h:33
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
Farm::GetType
TTypesOfFarm GetType(void)
Definition: farm.h:901
ca_fa_npk_two
Definition: Carrots.h:62
Crop::m_first_date
int m_first_date
Definition: farm.h:540
FarmEvent::m_startday
int m_startday
Definition: farm.h:466
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:917
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:307
ca_harvest
Definition: Carrots.h:63
ca_spring_sow
Definition: Carrots.h:45
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: farm.h:786
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
ca_fp_npk_two
Definition: Carrots.h:60
ca_herbi_three
Definition: Carrots.h:48
Farm::Spraying_herbicides
virtual bool Spraying_herbicides(TTypesOfVegetation)
Definition: farm.h:784
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
Crop::m_field
LE * m_field
Definition: farm.h:538
ca_spring_harrow_two
Definition: Carrots.h:44
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
CA_DECIDE_TO_FI
#define CA_DECIDE_TO_FI
Definition: Carrots.h:34
FarmEvent::m_todo
int m_todo
Definition: farm.h:469
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:1348
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:701
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:1510
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:1717
Crop::m_last_date
int m_last_date
Definition: farm.h:542
Farm::SpringSow
virtual bool SpringSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the spring on a_field.
Definition: farmfuncs.cpp:546
ca_fp_slurry
Definition: Carrots.h:41
Farm
The base class for all farm types.
Definition: farm.h:767
ca_water_two
Definition: Carrots.h:57
ca_start
Definition: Carrots.h:39
ca_fp_npk_one
Definition: Carrots.h:59
ca_fa_slurry
Definition: Carrots.h:40
ca_rowcul_three
Definition: Carrots.h:52
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:318
Crop::m_ev
FarmEvent * m_ev
Definition: farm.h:539
ca_water_one
Definition: Carrots.h:56
ca_insect_one
Definition: Carrots.h:53
ca_insect_two
Definition: Carrots.h:54
Farm::Spraying_fungins
virtual bool Spraying_fungins(TTypesOfVegetation)
Definition: farm.h:785
ca_water_three
Definition: Carrots.h:58
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:471