ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
WinterWheatStriglingCulm.cpp
Go to the documentation of this file.
1 //
2 // winterwheatStriglingCulm.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/WinterWheatStriglingCulm.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 extern CfgFloat cfg_greg_app_prop;
36 extern CfgFloat cfg_strigling_prop;
37 extern CfgInt cfg_CulmLastStriglingTime;
38 
39 bool WinterWheatStriglingCulm::Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev )
40 {
41  m_farm = a_farm;
42  m_field = a_field;
43  m_ev = a_ev;
44 
45  bool done = false;
46 
47  switch ( m_ev->m_todo )
48  {
49  case wwsc_start:
50  {
53 
54  // Set up the date management stuff
55 
56  // Could save the start day in case it is needed later
57  // m_field->m_startday = m_ev->m_startday;
58 
59  // Start and stop dates for all events after harvest
60  int noDates=5;
61  m_field->SetMDates(0,0,g_date->DayInYear(20,8));
62 
63  // Determined by harvest date - used to see if at all possible
64  m_field->SetMDates(1,0,g_date->DayInYear(20,8));
65  m_field->SetMDates(0,1,0); // Subbleharrow start
66  m_field->SetMDates(1,1,g_date->DayInYear(20,8));
67  m_field->SetMDates(0,2,g_date->DayInYear(5,8));
68  m_field->SetMDates(1,2,g_date->DayInYear(25,8));
69  m_field->SetMDates(0,3,g_date->DayInYear(10,8));
70  m_field->SetMDates(1,3,g_date->DayInYear(15,9));
71  m_field->SetMDates(0,4,g_date->DayInYear(15,8));
72  m_field->SetMDates(1,4,g_date->DayInYear(15,10));
73  // Can be up to 10 of these. If the shortening code is triggered
74  // then these will be reduced in value to 0
75  m_field->SetMConstants(0,1);
76 
77  // Check the next crop for early start, unless it is a spring crop
78  // in which case we ASSUME that no checking is necessary!!!!
79  // So DO NOT implement a crop that runs over the year boundary
80  if (m_ev->m_startday>g_date->DayInYear(1,7))
81  {
82  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
83  {
84  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): "
85  "Harvest too late for the next crop to start!!!", "" );
86  exit( 1 );
87  }
88  // Now fix any late finishing problems
89  bool toggle=false;
90  for (int i=0; i<noDates; i++) {
91  if (m_field->GetMDates(0,i)>=m_ev->m_startday) {
92  toggle=true;
93  m_field->SetMDates(0,i,m_ev->m_startday-1);
94  }
95  if (m_field->GetMDates(1,i)>=m_ev->m_startday){
96  toggle=true;
97  m_field->SetMDates(1,i,m_ev->m_startday-1);
98  }
99  }
100  if (toggle) for (int i=0; i<10; i++) m_field->SetMConstants(i,0);
101  }
102  // Now no operations can be timed after the start of the next crop.
103 
104  // CJT note:
105  // Start single block date checking code to be cut-'n-pasted...
106  int d1;
107  if ( ! m_ev->m_first_year ) {
108 
109  // Are we before July 1st?
110  d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
111  if (g_date->Date() < d1 ) {
112  // Yes, too early. We assumme this is because the last crop was late
113  printf ("Poly: %d\n", m_field->GetPoly());
114  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): "
115  "Crop start attempt between 1st Jan & 1st July", "" );
116  exit( 1 );
117  }
118  else
119  {
120  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
121  if (g_date->Date() > d1)
122  {
123  // Yes too late - should not happen - raise an error
124  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): "
125  "Crop start attempt after last possible start date", "" );
126  exit( 1 );
127  }
128  }
129  }
130  else
131  {
132  // Is the first year
133  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
134  wwsc_spring_roll, false );
135  break;
136  }
137  // End single block date checking code. Please see next line
138  // comment as well.
139  // Reinit d1 to first possible starting date.
140  d1 = g_date->OldDays() + g_date->DayInYear( 21,8 );
141  // OK, let's go.
142  if (m_farm->IsStockFarmer()) // StockFarmer
143  {
144  SimpleEvent( d1, wwsc_ferti_s1, false );
145  }
146  else SimpleEvent( d1, wwsc_ferti_p1, false );
147  }
148  break;
149 
150  case wwsc_ferti_p1:
151  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
152  {
153  if (!m_farm->FP_Slurry( m_field, 0.0,
154  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
155  SimpleEvent( g_date->Date() + 1, wwsc_ferti_p1, true );
156  break;
157  }
158  }
159  SimpleEvent( g_date->Date(),wwsc_autumn_plough, false );
160  break;
161 
162  case wwsc_ferti_s1:
163  if (!m_farm->FA_Slurry( m_field, 0.0,
164  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
165  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s1, true );
166  break;
167  }
168  // This may cause two applications of fertilizer in one day...
169  // --FN--
170  SimpleEvent( g_date->Date(),wwsc_ferti_s2, false );
171  // --FN--
172  break;
173 
174  case wwsc_ferti_s2:
175  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
176  {
177  if (!m_farm->FA_Manure( m_field, 0.0,
178  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
179  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s2, true );
180  break;
181  }
182  }
183  SimpleEvent( g_date->Date(),wwsc_autumn_plough, false );
184  break;
185 
186  case wwsc_autumn_plough:
187  if ( m_ev->m_lock || m_farm->DoIt( 95 ))
188  {
189  if (!m_farm->AutumnPlough( m_field, 0.0,
190  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
191  SimpleEvent( g_date->Date() + 1, wwsc_autumn_plough, true );
192  break;
193  }
194  else
195  {
197  SimpleEvent( g_date->Date()+1,wwsc_autumn_harrow, false );
198  break;
199  }
200  }
201  SimpleEvent( g_date->Date()+1,wwsc_stubble_harrow1, false );
202  break;
203 
204  case wwsc_autumn_harrow:
205  if (!m_farm->AutumnHarrow( m_field, 0.0,
206  g_date->DayInYear( 10,10 ) - g_date->DayInYear())) {
207  SimpleEvent( g_date->Date() + 1, wwsc_autumn_harrow, true );
208  break;
209  }
210  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,9 ),
211  wwsc_autumn_sow, false );
212  break;
213 
215  if (!m_farm->StubbleHarrowing( m_field, 0.0,
216  g_date->DayInYear( 10,10 ) - g_date->DayInYear())) {
217  SimpleEvent( g_date->Date() + 1, wwsc_stubble_harrow1, true );
218  break;
219  }
220  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,9 ),
221  wwsc_autumn_sow, false );
222  break;
223 
224  case wwsc_autumn_sow:
225  if (!m_farm->AutumnSow( m_field, 0.0,
226  g_date->DayInYear( 20,10 ) - g_date->DayInYear())) {
227  SimpleEvent( g_date->Date() + 1, wwsc_autumn_sow, true );
228  break;
229  }
230  SimpleEvent( g_date->Date() + 1, wwsc_autumn_roll, false );
231  break;
232 
233  case wwsc_autumn_roll:
234  if (( m_ev->m_lock || m_farm->DoIt( 5 ))&& (WWStriglingCulm_AUTUMN_PLOUGH))
235  {
236  if (!m_farm->AutumnRoll( m_field, 0.0,
237  g_date->DayInYear( 27,10 ) - g_date->DayInYear())) {
238  SimpleEvent( g_date->Date() + 1, wwsc_autumn_roll, true );
239  break;
240  }
241  }
242  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,9 ),
243  wwsc_ferti_p2, false );
244  break;
245 
246  case wwsc_ferti_p2:
247  if (( m_ev->m_lock || m_farm->DoIt( 20 )) && (!m_farm->IsStockFarmer()))
248  {
249  if ( m_field->GetVegBiomass()>0)
250  //only when there has been a bit of growth
251  {
252  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
253  g_date->DayInYear( 30,10 ) - g_date->DayInYear()))
254  {
255  SimpleEvent( g_date->Date() + 1, wwsc_ferti_p2, true );
256  break;
257  }
258  }
259  }
260  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,10 ),
261  wwsc_strigling0a, false );
262  break;
263 
264  case wwsc_strigling0a:
265  if (!m_farm->Strigling( m_field, 0.0,
266  g_date->DayInYear( 1,10 ) - g_date->DayInYear())) {
267  SimpleEvent( g_date->Date() + 1, wwsc_strigling0a, true );
268  break;
269  }
270  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 )+365,
271  wwsc_spring_roll, false );
272  break;
273 
274  case wwsc_spring_roll:
275  if ( m_ev->m_lock || m_farm->DoIt( 5 ))
276  {
277  if (!m_farm->SpringRoll( m_field, 0.0,
278  g_date->DayInYear( 30,4 ) - g_date->DayInYear())) {
279  SimpleEvent( g_date->Date() + 1, wwsc_spring_roll, true );
280  break;
281  }
282  }
283  if (m_farm->IsStockFarmer()) // StockFarmer
284  {
285  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s3, false );
286  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10,4 ),
287  wwsc_ferti_s4, false );
288  }
289  else
290  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,3 ),
291  wwsc_ferti_p3, false );
292  // All need the next threads
293  if (cfg_CulmLastStriglingTime.value()>1) {
294  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,4),
295  wwsc_strigling0b, false );
296  }
297  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4 ),
298  wwsc_GR, false );
299  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,4 ),
300  wwsc_fungicide, false );
301  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
302  wwsc_insecticide1, false );
303  if (cfg_CulmLastStriglingTime.value()>2) {
304  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4 ),
305  wwsc_strigling1, false );
306  }
307  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
308  wwsc_water1, false );
309  break;
310 
311  case wwsc_strigling0b:
312  if (!m_farm->Strigling( m_field, 0.0,
313  g_date->DayInYear( 15,4 ) - g_date->DayInYear())) {
314  SimpleEvent( g_date->Date() + 1, wwsc_strigling0a, true );
315  break;
316  }
317  // End of thread
318  break;
319 
320  case wwsc_GR:
321  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 15*cfg_greg_app_prop.value() )))
322  {
323  // --FN--
324  if (!m_farm->GrowthRegulator( m_field, 0.0,
325  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
326  SimpleEvent( g_date->Date() + 1, wwsc_GR, true );
327  break;
328  }
329  }
330  // End of thread
331  break;
332 
333  case wwsc_fungicide:
334  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 70*cfg_fungi_app_prop1.value() )))
335  {
336  if (!m_farm->FungicideTreat( m_field, 0.0,
337  g_date->DayInYear( 10,5 ) - g_date->DayInYear())) {
338  SimpleEvent( g_date->Date() + 1, wwsc_fungicide, true );
339  break;
340  }
341  }
342  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20,5 ),
343  wwsc_fungicide2, false );
344  break;
345 
346  case wwsc_fungicide2:
347  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 50*cfg_fungi_app_prop1.value() )))
348  {
349  if (!m_farm->FungicideTreat( m_field, 0.0,
350  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
351  SimpleEvent( g_date->Date() + 1, wwsc_fungicide2, true );
352  break;
353  }
354  }
355  // End of thread
356  break;
357 
358  case wwsc_insecticide1:
359  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 16*cfg_ins_app_prop1.value() )))
360  {
361  if (!m_farm->InsecticideTreat( m_field, 0.0,
362  g_date->DayInYear( 15,5 ) - g_date->DayInYear()))
363  {
364  SimpleEvent( g_date->Date() + 1, wwsc_insecticide1, true );
365  break;
366  }
367  else
368  {
369  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,6 ),
370  wwsc_insecticide2, false );
371  break;
372  }
373  }
374  break;
375 
376  case wwsc_insecticide2:
377  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 33*cfg_ins_app_prop1.value() )))
378  {
379  if (!m_farm->InsecticideTreat( m_field, 0.0,
380  g_date->DayInYear( 10,6 ) - g_date->DayInYear())) {
381  SimpleEvent( g_date->Date() + 1, wwsc_insecticide2, true );
382  break;
383  }
384  else
385  {
386  if ((g_date->Date()+7)<( g_date->OldDays() + g_date->DayInYear( 15,6 )))
387  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15,6 ),
388  wwsc_insecticide3, false );
389  else
390  SimpleEvent( g_date->Date()+7, wwsc_insecticide3, false );
391  break;
392  }
393  }
394  break;
395 
396  case wwsc_insecticide3:
397  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 67*cfg_ins_app_prop1.value() )))
398  {
399  if (!m_farm->InsecticideTreat( m_field, 0.0,
400  g_date->DayInYear( 30,6 ) - g_date->DayInYear())) {
401  SimpleEvent( g_date->Date() + 1, wwsc_insecticide3, true );
402  break;
403  }
404  }
405  // End of thread
406  break;
407 
408  case wwsc_strigling1:
409  if (!m_farm->Strigling( m_field, 0.0,
410  g_date->DayInYear( 25,4 ) - g_date->DayInYear())) {
411  SimpleEvent( g_date->Date() + 1, wwsc_strigling1, true );
412  break;
413  }
414  else
415  {
416  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,5),
417  wwsc_strigling2, true );
418  }
419  break;
420 
421  case wwsc_strigling2:
422  if (cfg_CulmLastStriglingTime.value()==4) {
423  if (!m_farm->Strigling( m_field, 0.0,
424  g_date->DayInYear( 5,5 ) - g_date->DayInYear())) {
425  SimpleEvent( g_date->Date() + 1, wwsc_strigling2, true );
426  break;
427  }
428  }
429  // End of thread
430  break;
431 
432  case wwsc_water1:
433  if ( m_ev->m_lock || m_farm->DoIt( 10 )) // **CJT** Soil type 1-4 only
434  {
435  if (!m_farm->Water( m_field, 0.0,
436  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
437  SimpleEvent( g_date->Date() + 1, wwsc_water1, true );
438  break;
439  }
440  else
441  if ((g_date->Date()+5)<( g_date->OldDays() + g_date->DayInYear( 2,5 )))
442  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 2,5 ),
443  wwsc_water2, false );
444  else
445  SimpleEvent( g_date->Date()+5, wwsc_water2, false );
446  }
447  break;
448 
449  case wwsc_water2:
450  if (!m_farm->Water( m_field, 0.0,
451  g_date->DayInYear( 1,6 ) - g_date->DayInYear())) {
452  SimpleEvent( g_date->Date() + 1, wwsc_water2, true );
453  break;
454  }
455  // End of thread
456  break;
457 
458  case wwsc_ferti_p3:
459  if (!m_farm->FP_NPK( m_field, 0.0,
460  g_date->DayInYear( 15,4 ) - g_date->DayInYear())) {
461  SimpleEvent( g_date->Date() + 1, wwsc_ferti_p3, true );
462  break;
463  }
464 
465  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,4 ),
466  wwsc_ferti_p4, false );
467  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,4 ),
468  wwsc_ferti_p5, false );
469  break;
470 
471  case wwsc_ferti_p4:
472  if ( m_ev->m_lock || m_farm->DoIt( 50 ))
473  {
474  if (!m_farm->FP_NPK( m_field, 0.0,
475  g_date->DayInYear( 15,5 ) - g_date->DayInYear())) {
476  SimpleEvent( g_date->Date() + 1, wwsc_ferti_p4, true );
477  break;
478  }
479  }
480 
481  // The Main thread
482  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,8 ),
483  wwsc_harvest, false );
484  break;
485 
486  case wwsc_ferti_p5:
487  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
488  {
489  if (!m_farm->FP_ManganeseSulphate( m_field, 0.0,
490  g_date->DayInYear( 5,5 ) - g_date->DayInYear())) {
491  SimpleEvent( g_date->Date() + 1, wwsc_ferti_p5, true );
492  break;
493  }
494  }
495  break;
496 
497  case wwsc_ferti_s3:
498  if (!m_farm->FA_Slurry(m_field, 0.0,
499  g_date->DayInYear( 30,4 ) - g_date->DayInYear())) {
500  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s3, true );
501  break;
502  }
503  // The Main thread
504  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,8 ),
505  wwsc_harvest, false );
506  break;
507 
508  case wwsc_ferti_s4:
509  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
510  {
511  if (!m_farm->FA_NPK( m_field, 0.0,
512  g_date->DayInYear( 20,4 ) - g_date->DayInYear())) {
513  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s4, true );
514  break;
515  }
516  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 21,4 ),
517  wwsc_ferti_s5, false );
518  }
519  break;
520 
521  case wwsc_ferti_s5:
522  if ( m_ev->m_lock || m_farm->DoIt( 40 ))
523  {
524  if (!m_farm->FA_NPK( m_field, 0.0,
525  g_date->DayInYear( 1,5 ) - g_date->DayInYear())) {
526  SimpleEvent( g_date->Date() + 1, wwsc_ferti_s5, true );
527  break;
528  }
529  }
530  break;
531 
532  case wwsc_harvest:
533  if (!m_farm->Harvest( m_field, 0.0,
534  g_date->DayInYear( 20,8 ) - g_date->DayInYear()))
535  {
536  SimpleEvent( g_date->Date() + 1, wwsc_harvest, true );
537  break;
538  }
539  SimpleEvent( g_date->Date(), wwsc_straw_chopping, false );
540  break;
541 
542  case wwsc_straw_chopping:
543  if ( m_ev->m_lock || m_farm->DoIt( 75 ))
544  {
545  if (!m_farm->StrawChopping( m_field, 0.0,
546  m_field->GetMDates(1,0) - g_date->DayInYear())) {
547  SimpleEvent( g_date->Date() + 1, wwsc_straw_chopping, true );
548  break;
549  }
550  else
551  {
552  SimpleEvent( g_date->Date()+m_field->GetMConstants(0), wwsc_stubble_harrow2, false );
553  }
554  }
555  else
556  {
557  SimpleEvent( g_date->Date()+m_field->GetMConstants(0), wwsc_hay_turning, false );
558  }
559  break;
560 
561  case wwsc_hay_turning:
562  if ( m_ev->m_lock || m_farm->DoIt( 5 ))
563  {
564  if (!m_farm->HayTurning( m_field, 0.0,
565  m_field->GetMDates(1,1) - g_date->DayInYear())) {
566  SimpleEvent( g_date->Date() + 1, wwsc_hay_turning, true );
567  break;
568  }
569  }
570  SimpleEvent( g_date->OldDays() + m_field->GetMDates(0,2),
571  wwsc_hay_baling, false );
572  break;
573 
574  case wwsc_hay_baling:
575  if (!m_farm->HayBailing( m_field, 0.0,
576  m_field->GetMDates(1,2) - g_date->DayInYear())) {
577  SimpleEvent( g_date->Date() + 1, wwsc_hay_baling, true );
578  break;
579  }
580  SimpleEvent( g_date->OldDays() + m_field->GetMDates(0,3),
581  wwsc_stubble_harrow2, false );
582  break;
583 
585  if ( m_ev->m_lock || m_farm->DoIt( 65 ))
586  {
587  if (!m_farm->StubbleHarrowing( m_field, 0.0,
588  m_field->GetMDates(1,3) - g_date->DayInYear())) {
589  SimpleEvent( g_date->Date() + 1, wwsc_stubble_harrow2, true );
590  break;
591  }
592  }
593  SimpleEvent( g_date->OldDays() + m_field->GetMDates(0,4),
594  wwsc_grubning, false );
595  break;
596 
597  case wwsc_grubning:
598  if ( m_ev->m_lock || m_farm->DoIt( 10 ))
599  {
600  if (!m_farm->DeepPlough( m_field, 0.0,
601  m_field->GetMDates(1,4) - g_date->DayInYear())) {
602  SimpleEvent( g_date->Date() + 1, wwsc_grubning, true );
603  break;
604  }
605  }
606  done=true;
607  // END OF MAIN THREAD
608  break;
609 
610  default:
611  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): "
612  "Unknown event type! ", "" );
613  exit( 1 );
614  }
615  return done;
616 }
617 
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
wwsc_stubble_harrow2
Definition: WinterWheatStriglingCulm.h:79
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
wwsc_autumn_sow
Definition: WinterWheatStriglingCulm.h:53
wwsc_fungicide
Definition: WinterWheatStriglingCulm.h:60
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: farm.h:905
wwsc_water2
Definition: WinterWheatStriglingCulm.h:68
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: farmfuncs.cpp:1545
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
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: farmfuncs.cpp:727
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: farm.h:463
wwsc_strigling0b
Definition: WinterWheatStriglingCulm.h:58
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
wwsc_ferti_s1
Definition: WinterWheatStriglingCulm.h:48
FarmEvent::m_first_year
bool m_first_year
Definition: farm.h:467
wwsc_strigling1
Definition: WinterWheatStriglingCulm.h:65
wwsc_ferti_p5
Definition: WinterWheatStriglingCulm.h:71
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
wwsc_spring_roll
Definition: WinterWheatStriglingCulm.h:57
wwsc_insecticide3
Definition: WinterWheatStriglingCulm.h:64
wwsc_strigling0a
Definition: WinterWheatStriglingCulm.h:56
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
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: farm.cpp:307
cfg_CulmLastStriglingTime
CfgInt cfg_CulmLastStriglingTime
wwsc_insecticide1
Definition: WinterWheatStriglingCulm.h:62
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
wwsc_start
Definition: WinterWheatStriglingCulm.h:45
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the autumn on a_field.
Definition: farmfuncs.cpp:364
wwsc_ferti_p3
Definition: WinterWheatStriglingCulm.h:69
wwsc_ferti_s5
Definition: WinterWheatStriglingCulm.h:74
wwsc_autumn_harrow
Definition: WinterWheatStriglingCulm.h:51
wwsc_hay_baling
Definition: WinterWheatStriglingCulm.h:78
WinterWheatStriglingCulm::Do
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterWheatStriglingCulm.cpp:39
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
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
wwsc_harvest
Definition: WinterWheatStriglingCulm.h:75
wwsc_hay_turning
Definition: WinterWheatStriglingCulm.h:77
wwsc_ferti_p2
Definition: WinterWheatStriglingCulm.h:55
wwsc_grubning
Definition: WinterWheatStriglingCulm.h:80
wwsc_insecticide2
Definition: WinterWheatStriglingCulm.h:63
wwsc_autumn_plough
Definition: WinterWheatStriglingCulm.h:50
WWStriglingCulm_WAIT_FOR_PLOUGH
#define WWStriglingCulm_WAIT_FOR_PLOUGH
Definition: WinterWheatStriglingCulm.h:41
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
Crop::m_field
LE * m_field
Definition: farm.h:538
FarmEvent::m_todo
int m_todo
Definition: farm.h:469
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: farmfuncs.cpp:1348
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: farmfuncs.cpp:288
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
wwsc_water1
Definition: WinterWheatStriglingCulm.h:67
wwsc_ferti_p1
Definition: WinterWheatStriglingCulm.h:47
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
cfg_strigling_prop
CfgFloat cfg_strigling_prop
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
wwsc_GR
Definition: WinterWheatStriglingCulm.h:59
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: farmfuncs.cpp:261
Farm
The base class for all farm types.
Definition: farm.h:767
Farm::DeepPlough
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
Definition: farmfuncs.cpp:417
wwsc_strigling2
Definition: WinterWheatStriglingCulm.h:66
wwsc_stubble_harrow1
Definition: WinterWheatStriglingCulm.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
wwsc_ferti_s4
Definition: WinterWheatStriglingCulm.h:73
wwsc_straw_chopping
Definition: WinterWheatStriglingCulm.h:76
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
wwsc_ferti_p4
Definition: WinterWheatStriglingCulm.h:70
wwsc_fungicide2
Definition: WinterWheatStriglingCulm.h:61
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
WWStriglingCulm_AUTUMN_PLOUGH
#define WWStriglingCulm_AUTUMN_PLOUGH
Definition: WinterWheatStriglingCulm.h:42
Farm::HayTurning
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
Definition: farmfuncs.cpp:2159
Crop::m_ev
FarmEvent * m_ev
Definition: farm.h:539
wwsc_autumn_roll
Definition: WinterWheatStriglingCulm.h:54
wwsc_ferti_s2
Definition: WinterWheatStriglingCulm.h:49
wwsc_ferti_s3
Definition: WinterWheatStriglingCulm.h:72
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