ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
SpringBarleyPTreatment.cpp
Go to the documentation of this file.
1 //
2 // SpringBarleyPTreatment.cpp
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2011, Christopher John Topping, Aarhus University
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without modification, are permitted provided
10 that the following conditions are met:
11 
12 Redistributions of source code must retain the above copyright notice, this list of conditions and the
13 following disclaimer.
14 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 the following disclaimer in the documentation and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ********************************************************************************************************
26 */
27 
28 #include "../../Landscape/ls.h"
29 #include "../../Landscape/cropprogs/SpringBarleyPTreatment.h"
30 #include "math.h"
31 
32 extern CfgFloat cfg_ins_app_prop1;
33 extern CfgFloat cfg_herbi_app_prop;
34 extern CfgFloat cfg_fungi_app_prop1;
35 extern CfgFloat cfg_greg_app_prop;
36 extern CfgInt cfg_productapplicstartyear;
37 extern CfgInt cfg_productapplicendyear;
38 extern CfgFloat cfg_pest_product_1_amount;
39 
40 
41 bool SpringBarleyPTreatment::Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev )
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  // Set up the date management stuff
55  // Could save the start day in case it is needed later
56  // m_field->m_startday = m_ev->m_startday;
57  m_last_date=g_date->DayInYear(30,8);
58  // Start and stop dates for all events after harvest
59  int noDates=2;
60  m_field->SetMDates(0,0,g_date->DayInYear(20,8));
61  // Determined by harvest date - used to see if at all possible
62  m_field->SetMDates(1,0,g_date->DayInYear(10,8));
63  m_field->SetMDates(0,1,g_date->DayInYear(10,8));
64  m_field->SetMDates(1,1,g_date->DayInYear(30,8));
65  // Check the next crop for early start, unless it is a spring crop
66  // in which case we ASSUME that no checking is necessary!!!!
67  // So DO NOT implement a crop that runs over the year boundary
68  if (m_ev->m_startday>g_date->DayInYear(1,7))
69  {
70  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
71  {
72  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
73  "Harvest too late for the next crop to start!!!", "" );
74  exit( 1 );
75  }
76  // Now fix any late finishing problems
77  for (int i=0; i<noDates; i++)
78  {
79  if (m_field->GetMDates(0,i)>=m_ev->m_startday)
80  m_field->SetMDates(0,i,m_ev->m_startday-1);
81  if (m_field->GetMDates(1,i)>=m_ev->m_startday)
82  m_field->SetMDates(1,i,m_ev->m_startday-1);
83  }
84  }
85  // Now no operations can be timed after the start of the next crop.
86 
87  int d1;
88  if ( ! m_ev->m_first_year )
89  {
90  int today=g_date->Date();
91  // Are we before July 1st?
92  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
93  if (today < d1)
94  {
95  // Yes, too early. We assumme this is because the last crop was late
96  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
97  "Crop start attempt between 1st Jan & 1st July", "" );
98  exit( 1 );
99  }
100  else
101  {
102  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
103  if (today > d1)
104  {
105  // Yes too late - should not happen - raise an error
106  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
107  "Crop start attempt after last possible start date", "" );
108  exit( 1 );
109  }
110  }
111  }
112  else
113  {
114  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
115  sbpt_spring_plough, false );
116  break;
117  }
118  // End single block date checking code. Please see next line
119  // comment as well.
120  // Reinit d1 to first possible starting date.
121  d1 = g_date->OldDays() + g_date->DayInYear( 2,11 );
122  if ( g_date->Date() > d1 ) {
123  d1 = g_date->Date();
124  }
125 
126  // OK, let's go.
127  SimpleEvent( d1, sbpt_autumn_plough, false );
128  SBPT_SLURRY_DONE=false;
129  SBPT_MANURE_DONE=false;
130  SBPT_SLURRY_EXEC=false;
131  SBPT_MANURE_EXEC=false;
132  SBPT_DID_AUTUMN_PLOUGH = false;
133  }
134  break;
135 
136  case sbpt_autumn_plough:
137  if ( m_ev->m_lock || m_farm->DoIt( 70 )) // was 70
138  {
139  if (!m_farm->AutumnPlough( m_field, 0.0,
140  g_date->DayInYear( 30,11 ) - g_date->DayInYear())) {
141  SimpleEvent( g_date->Date() + 1, sbpt_autumn_plough, true );
142  break;
143  }
144  SBPT_DID_AUTUMN_PLOUGH = true;
145  }
146  // +365 for next year
147  if (m_farm->IsStockFarmer()) // StockFarmer
148  {
149  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365, // was 15,3
150  sbpt_fertslurry_stock, false );
151  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,3 )+365, // was 15,3
152  sbpt_fertmanure_stock_one, false );
153  }
154  else { // PlantFarmer
155  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 )+365, // was 20/3
156  sbpt_spring_plough, false );
157  }
158  break;
159 
160  //*** The stock farmers thread
162  if ( m_ev->m_lock || m_farm->DoIt( 90 ))
163  {
164  if (!m_farm->FA_Slurry( m_field, 0.0,
165  g_date->DayInYear( 15,4 ) - g_date->DayInYear())) { // Was 15/4
166  SimpleEvent( g_date->Date() + 1, sbpt_fertslurry_stock, true );
167  break;
168  }
169  SBPT_SLURRY_EXEC=true;
170  }
171  SBPT_SLURRY_DONE = true;
172  if ( SBPT_MANURE_DONE ) {
173  // We are the last thread, so queue up spring plough.
174  SimpleEvent( g_date->Date(), sbpt_spring_plough, false );
175  }
176  break;
177 
179  if ( m_ev->m_lock || m_farm->DoIt( 67 ))
180  {
181  if (!m_farm->FA_Manure( m_field, 0.0,
182  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) { // Was 15/5
183  SimpleEvent( g_date->Date() + 1, sbpt_fertmanure_stock_one, true );
184  break;
185  }
186  SBPT_MANURE_EXEC=true;
187  }
188  SBPT_MANURE_DONE = true;
189  if ( SBPT_SLURRY_DONE ) {
190  SimpleEvent( g_date->Date(), sbpt_spring_plough, false );
191  }
192  break;
193 
194  case sbpt_spring_plough:
195  if ( ! SBPT_DID_AUTUMN_PLOUGH )
196  {
197  if (!m_farm->SpringPlough( m_field, 0.0,
198  g_date->DayInYear( 10,4 ) - // was 10,4
199  g_date->DayInYear())) {
200  SimpleEvent( g_date->Date()+1, sbpt_spring_plough, true );
201  break;
202  }
203  }
204  {
205  int d1 = g_date->Date();
206  if ( d1 < g_date->OldDays() + g_date->DayInYear( 20,3 )) {
207  d1 = g_date->OldDays() + g_date->DayInYear( 20,3 );
208  }
209  SimpleEvent( d1, sbpt_spring_harrow, false );
210  }
211  break;
212 
213  case sbpt_spring_harrow:
214  if (!m_farm->SpringHarrow( m_field, 0.0,
215  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
216  SimpleEvent( g_date->Date() + 1, sbpt_spring_harrow, true );
217  break;
218  }
219  if (m_farm->IsStockFarmer()) {
220  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,4 ), // was 5,4
221  sbpt_fertmanure_stock_two, false );
222  } else {
223  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,3 ),
224  sbpt_fertmanure_plant, false );
225  }
226  break;
227 
229  if ( m_ev->m_lock || m_farm->DoIt( 65 ) ||
231  {
232  if (!m_farm->FA_NPK( m_field, 0.0,
233  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // was 10,4
234  SimpleEvent( g_date->Date() + 1, sbpt_fertmanure_stock_two, true );
235  break;
236  }
237  }
238  {
239  int d1 = g_date->Date();
240  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) {
241  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 );
242  }
243  SimpleEvent( d1, sbpt_spring_sow, false );
244  }
245  break;
246 
248  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
249  {
250  if (!m_farm->FP_NPK( m_field, 0.0,
251  g_date->DayInYear( 10, 4 ) - g_date->DayInYear())) { // WAS 10,4
252  SimpleEvent( g_date->Date() + 1, sbpt_fertmanure_plant, true );
253  break;
254  }
255  // Did FP_NPK so go directly to spring sow.
256  {
257  int d1 = g_date->Date();
258  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
259  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
260  }
261  SimpleEvent( d1, sbpt_spring_sow, false );
262  }
263  break;
264  }
265  SimpleEvent( g_date->Date(), sbpt_fertlnh3_plant, false );
266  break;
267 
268  case sbpt_fertlnh3_plant:
269  if (!m_farm->FP_LiquidNH3( m_field, 0.0,
270  g_date->DayInYear( 10, 4 ) - // WAS 10,4
271  g_date->DayInYear())) {
272  SimpleEvent( g_date->Date() + 1, sbpt_fertlnh3_plant, true );
273  break;
274  }
275  SimpleEvent( g_date->Date(), sbpt_fertpk_plant, false );
276  break;
277 
278  case sbpt_fertpk_plant:
279  if (!m_farm->FP_PK( m_field, 0.0,
280  g_date->DayInYear( 10, 4 ) - // WAS 10,4
281  g_date->DayInYear())) {
282  SimpleEvent( g_date->Date() + 1, sbpt_fertpk_plant, true );
283  break;
284  }
285  {
286  int d1 = g_date->Date();
287  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,3 )) { // was 25,3
288  d1 = g_date->OldDays() + g_date->DayInYear( 25,3 ); // was 25,3
289  }
290  SimpleEvent( d1, sbpt_spring_sow, false );
291  }
292  break;
293 
294  case sbpt_spring_sow:
295  if (!m_farm->SpringSow( m_field, 0.0,
296  g_date->DayInYear( 10,4 ) - g_date->DayInYear())) { // WAS 10,4
297  SimpleEvent( g_date->Date() + 1, sbpt_spring_sow, true );
298  break;
299  }
300  {
301  int d1 = g_date->Date();
302  if ( d1 < g_date->OldDays() + g_date->DayInYear( 5,4 )) {
303  d1 = g_date->OldDays() + g_date->DayInYear( 5,4 );
304  }
305  SimpleEvent( d1, sbpt_spring_roll, false );
306  }
307  break;
308 
309  case sbpt_spring_roll:
310  if ( m_ev->m_lock || m_farm->DoIt( 0 )) // was 30
311  {
312  if (!m_farm->SpringRoll( m_field, 0.0,
313  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
314  SimpleEvent( g_date->Date() + 1, sbpt_spring_roll, true );
315  break;
316  }
317  }
318  SBPT_HERBI_DATE = 0;
319  SBPT_GR_DATE = 0;
320  SBPT_FUNGI_DATE = 0;
321  SBPT_WATER_DATE = 0;
322  SBPT_INSECT_DATE = 0;
323  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,5 ),
324  sbpt_herbicide_one, false );
325  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
326  sbpt_fungicide_one, false ); // Main.
327  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,5 ),
328  sbpt_GR, false );
329  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,5 ),
330  sbpt_water_one, false );
332  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ), sbpt_insecticide1, false );
333  }
334  break;
335 
336  // Herbicide thread
337  case sbpt_herbicide_one:
338  if ( g_date->Date() < SBPT_GR_DATE + 1 ) {
339  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_one, m_ev->m_lock );
340  break;
341  }
342  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+80*herbi_app_prop)))
343  {
344  if (!m_farm->HerbicideTreat( m_field, 0.0,
345  g_date->DayInYear( 15,5 ) - g_date->DayInYear()))
346  {
347  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_one, true );
348  break;
349  }
350  SBPT_HERBI_DATE = g_date->Date();
351  // Did first spray so see if should do another, 14 days later (min)
352  {
353  int d1 = g_date->Date() + 10;
354  if ( d1 < g_date->OldDays() + g_date->DayInYear( 16,5 )) {
355  d1 = g_date->OldDays() + g_date->DayInYear( 16,5 );
356  }
357  SimpleEvent( d1, sbpt_herbicide_two, false );
358  }
359  }
360  break;
361 
362  case sbpt_herbicide_two:
363  if ( g_date->Date() < SBPT_GR_DATE + 1 ) {
364  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_two, m_ev->m_lock );
365  break;
366  }
367  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+50*herbi_app_prop)))
368  {
369  if (!m_farm->HerbicideTreat( m_field, 0.0,
370  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
371  SimpleEvent( g_date->Date() + 1, sbpt_herbicide_two, true );
372  break;
373  }
374  SBPT_HERBI_DATE = g_date->Date();
375  }
376  break;
377 
378  // GReg thread
379  case sbpt_GR:
380  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
381  g_date->Date() < SBPT_FUNGI_DATE + 1 ) {
382  SimpleEvent( g_date->Date() + 1, sbpt_GR, m_ev->m_lock );
383  break;
384  }
385  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+5*cfg_greg_app_prop.value())))
386  {
387  if (!m_farm->GrowthRegulator( m_field, 0.0,
388  g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
389  SimpleEvent( g_date->Date() + 1, sbpt_GR, true );
390  break;
391  }
392  SBPT_GR_DATE = g_date->Date();
393  }
394  break;
395 
396  // Fungicide thread & MAIN THREAD
397  case sbpt_fungicide_one:
398  {
399  if ( g_date->Date() < SBPT_HERBI_DATE + 1 || g_date->Date() < SBPT_GR_DATE + 1 ) {
400  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_one, m_ev->m_lock );
401  break;
402  }
403  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+30*cfg_fungi_app_prop1.value())))
404  {
405  if (!m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 25,5 ) - g_date->DayInYear())) {
406  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_one, true );
407  break;
408  }
409  SBPT_FUNGI_DATE = g_date->Date();
410  int d1 = g_date->Date() + 10;
411  if ( d1 < g_date->OldDays() + g_date->DayInYear( 25,5 )) {
412  d1 = g_date->OldDays() + g_date->DayInYear( 25,5 );
413  }
414  SimpleEvent( d1, sbpt_fungicide_two, false );
415  }
416  int d1 = g_date->Date();
417  if ( d1 < g_date->OldDays() + g_date->DayInYear( 16,5 )) {
418  d1 = g_date->OldDays() + g_date->DayInYear( 16,5 );
419  }
420  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,8 ),sbpt_harvest, false );
421  }
422  break;
423 
424  case sbpt_fungicide_two:
425  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
426  g_date->Date() < SBPT_GR_DATE + 1 ) {
427  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_two, m_ev->m_lock );
428  break;
429  }
430  if ( m_ev->m_lock || m_farm->DoIt( (int) floor(0.5+33*cfg_fungi_app_prop1.value()) ))
431  {
432  if (!m_farm->FungicideTreat( m_field, 0.0,
433  g_date->DayInYear( 10,6 ) - g_date->DayInYear())) {
434  SimpleEvent( g_date->Date() + 1, sbpt_fungicide_two, true );
435  break;
436  }
437  SBPT_FUNGI_DATE = g_date->Date();
438  }
439  break;
440 
441  // Water thread
442  case sbpt_water_one:
443  if ( g_date->Date() < SBPT_HERBI_DATE + 1 ||
444  g_date->Date() < SBPT_FUNGI_DATE + 1 ) {
445  SimpleEvent( g_date->Date() + 1, sbpt_water_one, m_ev->m_lock );
446  break;
447  }
448  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
449  {
450  if (!m_farm->Water( m_field, 0.0,
451  g_date->DayInYear( 30,5 ) - g_date->DayInYear())) {
452  SimpleEvent( g_date->Date() + 1, sbpt_water_one, true );
453  break;
454  }
455  SBPT_WATER_DATE = g_date->Date();
456  }
457  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
458  sbpt_water_two, false );
459  break;
460 
461  case sbpt_water_two:
462  if ( g_date->Date() < SBPT_INSECT_DATE + 1 ) {
463  SimpleEvent( g_date->Date() + 1, sbpt_water_two, m_ev->m_lock );
464  break;
465  }
466  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
467  {
468  if (!m_farm->Water( m_field, 0.0,
469  g_date->DayInYear( 1,7 ) - g_date->DayInYear())) {
470  SimpleEvent( g_date->Date() + 1, sbpt_water_two, true );
471  break;
472  }
473  SBPT_WATER_DATE = g_date->Date();
474  }
475  break;
476 
477  // Insecticide thread & MAIN THREAD
478 
479  case sbpt_insecticide1:
480 /* // NB this version use crop growth stage
481  if (!m_farm->Trial_PesticideTreat_GS( m_field, 0.0, 0 )) {
482  SimpleEvent( g_date->Date() + 1, sbpt_insecticide1, false );
483  }
484  g_pest->DailyQueueAdd( m_field, l_pest_insecticide_amount.value() );
485  SimpleEvent( g_date->Date() + 7, sbpt_insecticide3, false ); // use sbpt_insecticde3 if you only want two applications
486  SBPT_INSECT_DATE = g_date->Date();
487  break;
488 */
489  // NB this version forces date based spraying - no weather constraints or probabilities
491  SimpleEvent(g_date->Date() + 14, sbpt_insecticide3, false); // use sbpt_insecticde3 if you only want two applications
492  SBPT_INSECT_DATE = g_date->Date();
493  break;
494 
495  case sbpt_insecticide2:
496  // NB this version forces date based spraying - no weather constraints or probabilities
498  SimpleEvent( g_date->Date() + 14, sbpt_insecticide3, false );
499  break;
500 
501  case sbpt_insecticide3:
502  // NB this version forces date based spraying - no weather constraints or probabilities
504  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,8 ),sbpt_harvest, false );
505  break;
506 
507  case sbpt_harvest:
508  if (!m_farm->Harvest( m_field, 0.0,
509  g_date->DayInYear( 20,8 ) - g_date->DayInYear())) {
510  SimpleEvent( g_date->Date() + 1, sbpt_harvest, true );
511  break;
512  }
513  SimpleEvent( g_date->Date(), sbpt_straw_chopping, false );
514  break;
515 
516  case sbpt_straw_chopping:
517  if ( m_ev->m_lock || m_farm->DoIt( 50 )) // was 50
518  {
519  // Force straw chopping to happen on the same day as harvest.
520  if (!m_farm->StrawChopping( m_field, 0.0, 0 )) {
521  // Shouldn't happen.
522  SimpleEvent( g_date->Date(), sbpt_straw_chopping, true );
523  break;
524  }
525  // Did chop, so go directly to stubble harrowing.
526  SimpleEvent( g_date->OldDays() + m_field->GetMDates(0,1),
527  sbpt_stubble_harrow, false );
528  break;
529  }
530  // Do hay baling first.
531  SimpleEvent( g_date->Date(), sbpt_hay_baling, false );
532  break;
533 
534  case sbpt_hay_baling:
535  if (!m_farm->HayBailing( m_field, 0.0,
536  m_field->GetMDates(1,0) - g_date->DayInYear())) {
537  SimpleEvent( g_date->Date() + 1, sbpt_hay_baling, true );
538  break;
539  }
540  SimpleEvent( g_date->OldDays() + m_field->GetMDates(0,1),
541  sbpt_stubble_harrow, false );
542  break;
543 
544  case sbpt_stubble_harrow:
545  if ( m_ev->m_lock || m_farm->DoIt( 60 )) // WAS 60
546  {
547  if (!m_farm->StubbleHarrowing( m_field, 0.0,
548  m_field->GetMDates(1,1) - g_date->DayInYear())) {
549  SimpleEvent( g_date->Date() + 1, sbpt_stubble_harrow, true );
550  break;
551  }
552  }
553  // END MAIN THREAD
554  done=true;
555  break;
556 
557  default:
558  g_msg->Warn( WARN_BUG, "SpringBarleyPTreatment::Do(): "
559  "Unknown event type! ", "" );
560  exit( 1 );
561  }
562  return done;
563 }
564 
565 
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:525
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
sbpt_insecticide2
Definition: SpringBarleyPTreatment.h:63
sbpt_stubble_harrow
Definition: SpringBarleyPTreatment.h:71
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
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
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)
Apply test pesticide to a_field.
Definition: farmfuncs.cpp:1445
sbpt_spring_sow
Definition: SpringBarleyPTreatment.h:56
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
FarmEvent::m_first_year
bool m_first_year
Definition: farm.h:467
SBPT_GR_DATE
#define SBPT_GR_DATE
Definition: SpringBarleyPTreatment.h:39
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
sbpt_fertmanure_stock_one
Definition: SpringBarleyPTreatment.h:48
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:1036
Crop::m_first_date
int m_first_date
Definition: farm.h:540
FarmEvent::m_startday
int m_startday
Definition: farm.h:466
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
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: farmfuncs.cpp:1279
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:653
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:307
sbpt_insecticide3
Definition: SpringBarleyPTreatment.h:64
SBPT_WATER_DATE
#define SBPT_WATER_DATE
Definition: SpringBarleyPTreatment.h:41
sbpt_GR
Definition: SpringBarleyPTreatment.h:60
SBPT_DID_AUTUMN_PLOUGH
#define SBPT_DID_AUTUMN_PLOUGH
Definition: SpringBarleyPTreatment.h:36
SBPT_INSECT_DATE
#define SBPT_INSECT_DATE
Definition: SpringBarleyPTreatment.h:42
sbpt_water_one
Definition: SpringBarleyPTreatment.h:66
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: farmfuncs.cpp:2184
sbpt_water_two
Definition: SpringBarleyPTreatment.h:67
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:2132
sbpt_spring_plough
Definition: SpringBarleyPTreatment.h:49
sbpt_harvest
Definition: SpringBarleyPTreatment.h:68
sbpt_spring_harrow
Definition: SpringBarleyPTreatment.h:50
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: Landscape.h:1616
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
Crop::m_field
LE * m_field
Definition: farm.h:538
SpringBarleyPTreatment::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: SpringBarleyPTreatment.cpp:41
FarmEvent::m_todo
int m_todo
Definition: farm.h:469
ppp_1
Definition: farm.h:422
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:1717
Crop::m_last_date
int m_last_date
Definition: farm.h:542
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:132
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
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:677
Farm
The base class for all farm types.
Definition: farm.h:767
cfg_pest_product_1_amount
CfgFloat cfg_pest_product_1_amount
cfg_productapplicendyear
CfgInt cfg_productapplicendyear
sbpt_insecticide1
Definition: SpringBarleyPTreatment.h:62
sbpt_fertmanure_stock_two
Definition: SpringBarleyPTreatment.h:54
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:1250
sbpt_fertpk_plant
Definition: SpringBarleyPTreatment.h:53
sbpt_start
Definition: SpringBarleyPTreatment.h:45
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
sbpt_spring_roll
Definition: SpringBarleyPTreatment.h:57
SBPT_MANURE_EXEC
#define SBPT_MANURE_EXEC
Definition: SpringBarleyPTreatment.h:35
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:539
sbpt_autumn_plough
Definition: SpringBarleyPTreatment.h:46
SBPT_SLURRY_EXEC
#define SBPT_SLURRY_EXEC
Definition: SpringBarleyPTreatment.h:34
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: farmfuncs.cpp:2209
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
sbpt_fertmanure_plant
Definition: SpringBarleyPTreatment.h:51
SBPT_SLURRY_DONE
#define SBPT_SLURRY_DONE
Definition: SpringBarleyPTreatment.h:32