ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
WinterWheatStriglingSingle.cpp
Go to the documentation of this file.
1 //
2 // winterwheatStriglingSingle.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/WinterWheatStriglingSingle.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_SingleStriglingTime;
38 
39 bool WinterWheatStriglingSingle::Do( Farm * a_farm, LE * a_field, FarmEvent * a_ev ) {
40  m_farm = a_farm;
41  m_field = a_field;
42  m_ev = a_ev;
43 
44  bool done = false;
45 
46  switch ( m_ev->m_todo ) {
47  case wwss_start: {
50 
51  // Set up the date management stuff
52 
53  // Could save the start day in case it is needed later
54  // m_field->m_startday = m_ev->m_startday;
55 
56  // Start and stop dates for all events after harvest
57  int noDates = 5;
58  m_field->SetMDates( 0, 0, g_date->DayInYear( 20, 8 ) );
59 
60  // Determined by harvest date - used to see if at all possible
61  m_field->SetMDates( 1, 0, g_date->DayInYear( 20, 8 ) );
62  m_field->SetMDates( 0, 1, 0 ); // Subbleharrow start
63  m_field->SetMDates( 1, 1, g_date->DayInYear( 20, 8 ) );
64  m_field->SetMDates( 0, 2, g_date->DayInYear( 5, 8 ) );
65  m_field->SetMDates( 1, 2, g_date->DayInYear( 25, 8 ) );
66  m_field->SetMDates( 0, 3, g_date->DayInYear( 10, 8 ) );
67  m_field->SetMDates( 1, 3, g_date->DayInYear( 15, 9 ) );
68  m_field->SetMDates( 0, 4, g_date->DayInYear( 15, 8 ) );
69  m_field->SetMDates( 1, 4, g_date->DayInYear( 15, 10 ) );
70  // Can be up to 10 of these. If the shortening code is triggered
71  // then these will be reduced in value to 0
72  m_field->SetMConstants( 0, 1 );
73 
74  // Check the next crop for early start, unless it is a spring crop
75  // in which case we ASSUME that no checking is necessary!!!!
76  // So DO NOT implement a crop that runs over the year boundary
77  if ( m_ev->m_startday > g_date->DayInYear( 1, 7 ) ) {
78  if ( m_field->GetMDates( 0, 0 ) >= m_ev->m_startday ) {
79  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): ""Harvest too late for the next crop to start!!!", "" );
80  exit( 1 );
81  }
82  // Now fix any late finishing problems
83  bool toggle = false;
84  for ( int i = 0; i < noDates; i++ ) {
85  if ( m_field->GetMDates( 0, i ) >= m_ev->m_startday ) {
86  toggle = true;
87  m_field->SetMDates( 0, i, m_ev->m_startday - 1 );
88  }
89  if ( m_field->GetMDates( 1, i ) >= m_ev->m_startday ) {
90  toggle = true;
91  m_field->SetMDates( 1, i, m_ev->m_startday - 1 );
92  }
93  }
94  if ( toggle )
95  for ( int i = 0; i < 10; i++ ) m_field->SetMConstants( i, 0 );
96  }
97  // Now no operations can be timed after the start of the next crop.
98 
99  // CJT note:
100  // Start single block date checking code to be cut-'n-pasted...
101  int d1;
102  if ( !m_ev->m_first_year ) {
103 
104  // Are we before July 1st?
105  d1 = g_date->OldDays() + g_date->DayInYear( 1, 7 );
106  if ( g_date->Date() < d1 ) {
107  // Yes, too early. We assumme this is because the last crop was late
108  printf( "Poly: %d\n", m_field->GetPoly() );
109  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): ""Crop start attempt between 1st Jan & 1st July", "" );
110  exit( 1 );
111  } else {
112  d1 = g_date->OldDays() + m_first_date; // Add 365 for spring crop
113  if ( g_date->Date() > d1 ) {
114  // Yes too late - should not happen - raise an error
115  g_msg->Warn( WARN_BUG, "WinterWheatStrigling::Do(): ""Crop start attempt after last possible start date", "" );
116  exit( 1 );
117  }
118  }
119  } else {
120  // Is the first year
121  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ), wwss_spring_roll, false );
122  break;
123  }
124  // End single block date checking code. Please see next line
125  // comment as well.
126  // Reinit d1 to first possible starting date.
127  d1 = g_date->OldDays() + g_date->DayInYear( 21, 8 );
128  // OK, let's go.
129  if ( m_farm->IsStockFarmer() ) // StockFarmer
130  {
131  SimpleEvent( d1, wwss_ferti_s1, false );
132  } else
133  SimpleEvent( d1, wwss_ferti_p1, false );
134  }
135  break;
136 
137  case wwss_ferti_p1:
138  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
139  if ( !m_farm->FP_Slurry( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
140  SimpleEvent( g_date->Date() + 1, wwss_ferti_p1, true );
141  break;
142  }
143  }
144  SimpleEvent( g_date->Date(), wwss_autumn_plough, false );
145  break;
146 
147  case wwss_ferti_s1:
148  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
149  SimpleEvent( g_date->Date() + 1, wwss_ferti_s1, true );
150  break;
151  }
152  // This may cause two applications of fertilizer in one day...
153  // --FN--
154  SimpleEvent( g_date->Date(), wwss_ferti_s2, false );
155  // --FN--
156  break;
157 
158  case wwss_ferti_s2:
159  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
160  if ( !m_farm->FA_Manure( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
161  SimpleEvent( g_date->Date() + 1, wwss_ferti_s2, true );
162  break;
163  }
164  }
165  SimpleEvent( g_date->Date(), wwss_autumn_plough, false );
166  break;
167 
168  case wwss_autumn_plough:
169  if ( m_ev->m_lock || m_farm->DoIt( 95 ) ) {
170  if ( !m_farm->AutumnPlough( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
171  SimpleEvent( g_date->Date() + 1, wwss_autumn_plough, true );
172  break;
173  } else {
175  SimpleEvent( g_date->Date() + 1, wwss_autumn_harrow, false );
176  break;
177  }
178  }
179  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow1, false );
180  break;
181 
182  case wwss_autumn_harrow:
183  if ( !m_farm->AutumnHarrow( m_field, 0.0, g_date->DayInYear( 10, 10 ) - g_date->DayInYear() ) ) {
184  SimpleEvent( g_date->Date() + 1, wwss_autumn_harrow, true );
185  break;
186  }
187  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 9 ), wwss_autumn_sow, false );
188  break;
189 
191  if ( !m_farm->StubbleHarrowing( m_field, 0.0, g_date->DayInYear( 10, 10 ) - g_date->DayInYear() ) ) {
192  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow1, true );
193  break;
194  }
195  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 9 ), wwss_autumn_sow, false );
196  break;
197 
198  case wwss_autumn_sow:
199  if ( !m_farm->AutumnSow( m_field, 0.0, g_date->DayInYear( 20, 10 ) - g_date->DayInYear() ) ) {
200  SimpleEvent( g_date->Date() + 1, wwss_autumn_sow, true );
201  break;
202  }
203  SimpleEvent( g_date->Date() + 1, wwss_autumn_roll, false );
204  break;
205 
206  case wwss_autumn_roll:
207  if ( ( m_ev->m_lock || m_farm->DoIt( 5 ) ) && ( WWStriglingSingle_AUTUMN_PLOUGH ) ) {
208  if ( !m_farm->AutumnRoll( m_field, 0.0, g_date->DayInYear( 27, 10 ) - g_date->DayInYear() ) ) {
209  SimpleEvent( g_date->Date() + 1, wwss_autumn_roll, true );
210  break;
211  }
212  }
213  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 9 ), wwss_ferti_p2, false );
214  break;
215 
216  case wwss_ferti_p2:
217  if ( ( m_ev->m_lock || m_farm->DoIt( 20 ) ) && ( !m_farm->IsStockFarmer() ) ) {
218  if ( m_field->GetVegBiomass() > 0 )
219  //only when there has been a bit of growth
220  {
221  if ( !m_farm->FP_ManganeseSulphate( m_field, 0.0, g_date->DayInYear( 30, 10 ) - g_date->DayInYear() ) ) {
222  SimpleEvent( g_date->Date() + 1, wwss_ferti_p2, true );
223  break;
224  }
225  }
226  }
227  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 10 ), wwss_strigling0a, false );
228  break;
229 
230  case wwss_strigling0a:
231  if ( cfg_SingleStriglingTime.value() == 1 ) {
232  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 1, 10 ) - g_date->DayInYear() ) ) {
233  SimpleEvent( g_date->Date() + 1, wwss_strigling0a, true );
234  break;
235  }
236  }
237  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ) + 365, wwss_spring_roll, false );
238  break;
239 
240  case wwss_spring_roll:
241  if ( m_ev->m_lock || m_farm->DoIt( 5 ) ) {
242  if ( !m_farm->SpringRoll( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
243  SimpleEvent( g_date->Date() + 1, wwss_spring_roll, true );
244  break;
245  }
246  }
247  if ( m_farm->IsStockFarmer() ) // StockFarmer
248  {
249  SimpleEvent( g_date->Date() + 1, wwss_ferti_s3, false );
250  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 4 ), wwss_ferti_s4, false );
251  } else
252  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 3 ), wwss_ferti_p3, false );
253  // All need the next threads
254  if ( cfg_SingleStriglingTime.value() == 2 ) {
255  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 4 ), wwss_strigling0b, true );
256  }
257  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_GR, false );
258  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20, 4 ), wwss_fungicide, false );
259  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 5 ), wwss_insecticide1, false );
260  if ( cfg_SingleStriglingTime.value() == 3 ) {
261  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_strigling1, true );
262  }
263  if ( cfg_SingleStriglingTime.value() == 4 ) {
264  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 5 ), wwss_strigling2, true );
265  }
266  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 5 ), wwss_water1, false );
267  break;
268 
269  case wwss_strigling0b:
270  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 15, 4 ) - g_date->DayInYear() ) ) {
271  SimpleEvent( g_date->Date() + 1, wwss_strigling0a, true );
272  break;
273  }
274  // End of thread
275  break;
276 
277  case wwss_GR:
278  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 15 * cfg_greg_app_prop.value()) ) ) {
279  // --FN--
280  if ( !m_farm->GrowthRegulator( m_field, 0.0, g_date->DayInYear( 10, 5 ) - g_date->DayInYear() ) ) {
281  SimpleEvent( g_date->Date() + 1, wwss_GR, true );
282  break;
283  }
284  }
285  // End of thread
286  break;
287 
288  case wwss_fungicide:
289  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 70 * cfg_fungi_app_prop1.value() ))) {
290  if ( !m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 10, 5 ) - g_date->DayInYear() ) ) {
291  SimpleEvent( g_date->Date() + 1, wwss_fungicide, true );
292  break;
293  }
294  }
295  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20, 5 ), wwss_fungicide2, false );
296  break;
297 
298  case wwss_fungicide2:
299  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 50 * cfg_fungi_app_prop1.value() ) )) {
300  if ( !m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
301  SimpleEvent( g_date->Date() + 1, wwss_fungicide2, true );
302  break;
303  }
304  }
305  // End of thread
306  break;
307 
308  case wwss_insecticide1:
309  if ( m_ev->m_lock || m_farm->DoIt( (int) ( (int) ( 16 * cfg_ins_app_prop1.value() ))) ) {
310  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
311  SimpleEvent( g_date->Date() + 1, wwss_insecticide1, true );
312  break;
313  } else {
314  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 6 ), wwss_insecticide2, false );
315  break;
316  }
317  }
318  break;
319 
320  case wwss_insecticide2:
321  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 33 * cfg_ins_app_prop1.value() )) ) {
322  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 10, 6 ) - g_date->DayInYear() ) ) {
323  SimpleEvent( g_date->Date() + 1, wwss_insecticide2, true );
324  break;
325  } else {
326  if ( ( g_date->Date() + 7 ) < ( g_date->OldDays() + g_date->DayInYear( 15, 6 ) ) )
327  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 6 ), wwss_insecticide3, false ); else
328  SimpleEvent( g_date->Date() + 7, wwss_insecticide3, false );
329  break;
330  }
331  }
332  break;
333 
334  case wwss_insecticide3:
335  if ( m_ev->m_lock || m_farm->DoIt( (int) ( 67 * cfg_ins_app_prop1.value() ) )) {
336  if ( !m_farm->InsecticideTreat( m_field, 0.0, g_date->DayInYear( 30, 6 ) - g_date->DayInYear() ) ) {
337  SimpleEvent( g_date->Date() + 1, wwss_insecticide3, true );
338  break;
339  }
340  }
341  // End of thread
342  break;
343 
344  case wwss_strigling1:
345  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 25, 4 ) - g_date->DayInYear() ) ) {
346  SimpleEvent( g_date->Date() + 1, wwss_strigling1, true );
347  break;
348  }
349  break;
350 
351  case wwss_strigling2:
352  if ( !m_farm->Strigling( m_field, 0.0, g_date->DayInYear( 5, 5 ) - g_date->DayInYear() ) ) {
353  SimpleEvent( g_date->Date() + 1, wwss_strigling2, true );
354  break;
355  }
356  // End of thread
357  break;
358 
359  case wwss_water1:
360  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) // **CJT** Soil type 1-4 only
361  {
362  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
363  SimpleEvent( g_date->Date() + 1, wwss_water1, true );
364  break;
365  } else if ( ( g_date->Date() + 5 ) < ( g_date->OldDays() + g_date->DayInYear( 2, 5 ) ) )
366  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 2, 5 ), wwss_water2, false ); else
367  SimpleEvent( g_date->Date() + 5, wwss_water2, false );
368  }
369  break;
370 
371  case wwss_water2:
372  if ( !m_farm->Water( m_field, 0.0, g_date->DayInYear( 1, 6 ) - g_date->DayInYear() ) ) {
373  SimpleEvent( g_date->Date() + 1, wwss_water2, true );
374  break;
375  }
376  // End of thread
377  break;
378 
379  case wwss_ferti_p3:
380  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 15, 4 ) - g_date->DayInYear() ) ) {
381  SimpleEvent( g_date->Date() + 1, wwss_ferti_p3, true );
382  break;
383  }
384 
385  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ), wwss_ferti_p4, false );
386  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1, 4 ), wwss_ferti_p5, false );
387  break;
388 
389  case wwss_ferti_p4:
390  if ( m_ev->m_lock || m_farm->DoIt( 50 ) ) {
391  if ( !m_farm->FP_NPK( m_field, 0.0, g_date->DayInYear( 15, 5 ) - g_date->DayInYear() ) ) {
392  SimpleEvent( g_date->Date() + 1, wwss_ferti_p4, true );
393  break;
394  }
395  }
396  // The Main thread
397  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 8 ), wwss_harvest, false );
398  break;
399 
400  case wwss_ferti_p5:
401  if ( m_ev->m_lock || m_farm->DoIt( 20 ) ) {
402  if ( !m_farm->FP_ManganeseSulphate( m_field, 0.0, g_date->DayInYear( 5, 5 ) - g_date->DayInYear() ) ) {
403  SimpleEvent( g_date->Date() + 1, wwss_ferti_p5, true );
404  break;
405  }
406  }
407  break;
408 
409  case wwss_ferti_s3:
410  if ( !m_farm->FA_Slurry( m_field, 0.0, g_date->DayInYear( 30, 4 ) - g_date->DayInYear() ) ) {
411  SimpleEvent( g_date->Date() + 1, wwss_ferti_s3, true );
412  break;
413  }
414  // The Main thread
415  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 8 ), wwss_harvest, false );
416  break;
417 
418  case wwss_ferti_s4:
419  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
420  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 20, 4 ) - g_date->DayInYear() ) ) {
421  SimpleEvent( g_date->Date() + 1, wwss_ferti_s4, true );
422  break;
423  }
424  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 21, 4 ), wwss_ferti_s5, false );
425  }
426  break;
427 
428  case wwss_ferti_s5:
429  if ( m_ev->m_lock || m_farm->DoIt( 40 ) ) {
430  if ( !m_farm->FA_NPK( m_field, 0.0, g_date->DayInYear( 1, 5 ) - g_date->DayInYear() ) ) {
431  SimpleEvent( g_date->Date() + 1, wwss_ferti_s5, true );
432  break;
433  }
434  }
435  break;
436 
437  case wwss_harvest:
438  if ( !m_farm->Harvest( m_field, 0.0, g_date->DayInYear( 20, 8 ) - g_date->DayInYear() ) ) {
439  SimpleEvent( g_date->Date() + 1, wwss_harvest, true );
440  break;
441  }
442  SimpleEvent( g_date->Date(), wwss_straw_chopping, false );
443  break;
444 
445  case wwss_straw_chopping:
446  if ( m_ev->m_lock || m_farm->DoIt( 75 ) ) {
447  if ( !m_farm->StrawChopping( m_field, 0.0, m_field->GetMDates( 1, 0 ) - g_date->DayInYear() ) ) {
448  SimpleEvent( g_date->Date() + 1, wwss_straw_chopping, true );
449  break;
450  } else {
451  SimpleEvent( g_date->Date() + m_field->GetMConstants( 0 ), wwss_stubble_harrow2, false );
452  }
453  } else {
454  SimpleEvent( g_date->Date() + m_field->GetMConstants( 0 ), wwss_hay_turning, false );
455  }
456  break;
457 
458  case wwss_hay_turning:
459  if ( m_ev->m_lock || m_farm->DoIt( 5 ) ) {
460  if ( !m_farm->HayTurning( m_field, 0.0, m_field->GetMDates( 1, 1 ) - g_date->DayInYear() ) ) {
461  SimpleEvent( g_date->Date() + 1, wwss_hay_turning, true );
462  break;
463  }
464  }
465  SimpleEvent( g_date->OldDays() + m_field->GetMDates( 0, 2 ), wwss_hay_baling, false );
466  break;
467 
468  case wwss_hay_baling:
469  if ( !m_farm->HayBailing( m_field, 0.0, m_field->GetMDates( 1, 2 ) - g_date->DayInYear() ) ) {
470  SimpleEvent( g_date->Date() + 1, wwss_hay_baling, true );
471  break;
472  }
473  SimpleEvent( g_date->OldDays() + m_field->GetMDates( 0, 3 ), wwss_stubble_harrow2, false );
474  break;
475 
477  if ( m_ev->m_lock || m_farm->DoIt( 65 ) ) {
478  if ( !m_farm->StubbleHarrowing( m_field, 0.0, m_field->GetMDates( 1, 3 ) - g_date->DayInYear() ) ) {
479  SimpleEvent( g_date->Date() + 1, wwss_stubble_harrow2, true );
480  break;
481  }
482  }
483  SimpleEvent( g_date->OldDays() + m_field->GetMDates( 0, 4 ), wwss_grubning, false );
484  break;
485 
486  case wwss_grubning:
487  if ( m_ev->m_lock || m_farm->DoIt( 10 ) ) {
488  if ( !m_farm->DeepPlough( m_field, 0.0, m_field->GetMDates( 1, 4 ) - g_date->DayInYear() ) ) {
489  SimpleEvent( g_date->Date() + 1, wwss_grubning, true );
490  break;
491  }
492  }
493  done = true;
494  // END OF MAIN THREAD
495  break;
496 
497  default:
498  g_msg->Warn( WARN_BUG, "WinterWheat::Do(): ""Unknown event type! ", "" );
499  exit( 1 );
500  }
501  return done;
502 }
503 
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
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
wwss_autumn_roll
Definition: WinterWheatStriglingSingle.h:54
wwss_grubning
Definition: WinterWheatStriglingSingle.h:80
wwss_fungicide
Definition: WinterWheatStriglingSingle.h:60
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: farm.h:905
wwss_straw_chopping
Definition: WinterWheatStriglingSingle.h:76
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
wwss_insecticide2
Definition: WinterWheatStriglingSingle.h:63
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
wwss_insecticide3
Definition: WinterWheatStriglingSingle.h:64
wwss_strigling0b
Definition: WinterWheatStriglingSingle.h:58
wwss_ferti_s3
Definition: WinterWheatStriglingSingle.h:72
wwss_ferti_s4
Definition: WinterWheatStriglingSingle.h:73
wwss_ferti_s2
Definition: WinterWheatStriglingSingle.h:49
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
wwss_ferti_p3
Definition: WinterWheatStriglingSingle.h:69
cfg_SingleStriglingTime
CfgInt cfg_SingleStriglingTime
wwss_insecticide1
Definition: WinterWheatStriglingSingle.h:62
WinterWheatStriglingSingle::Do
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterWheatStriglingSingle.cpp:39
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
wwss_strigling1
Definition: WinterWheatStriglingSingle.h:65
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: farmfuncs.cpp:1279
wwss_GR
Definition: WinterWheatStriglingSingle.h:59
wwss_spring_roll
Definition: WinterWheatStriglingSingle.h:57
cfg_strigling_prop
CfgFloat cfg_strigling_prop
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: farm.cpp:307
wwss_fungicide2
Definition: WinterWheatStriglingSingle.h:61
wwss_ferti_p5
Definition: WinterWheatStriglingSingle.h:71
wwss_water2
Definition: WinterWheatStriglingSingle.h:68
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
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
wwss_strigling0a
Definition: WinterWheatStriglingSingle.h:56
wwss_autumn_harrow
Definition: WinterWheatStriglingSingle.h:51
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
wwss_ferti_p2
Definition: WinterWheatStriglingSingle.h:55
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
wwss_ferti_p4
Definition: WinterWheatStriglingSingle.h:70
wwss_ferti_s1
Definition: WinterWheatStriglingSingle.h:48
wwss_ferti_s5
Definition: WinterWheatStriglingSingle.h:74
wwss_hay_baling
Definition: WinterWheatStriglingSingle.h:78
wwss_stubble_harrow1
Definition: WinterWheatStriglingSingle.h:52
wwss_water1
Definition: WinterWheatStriglingSingle.h:67
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
Crop::m_field
LE * m_field
Definition: farm.h:538
wwss_autumn_sow
Definition: WinterWheatStriglingSingle.h:53
WWStriglingSingle_WAIT_FOR_PLOUGH
#define WWStriglingSingle_WAIT_FOR_PLOUGH
Definition: WinterWheatStriglingSingle.h:41
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
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_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::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
wwss_ferti_p1
Definition: WinterWheatStriglingSingle.h:47
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: farmfuncs.cpp:1250
wwss_start
Definition: WinterWheatStriglingSingle.h:45
wwss_stubble_harrow2
Definition: WinterWheatStriglingSingle.h:79
wwss_hay_turning
Definition: WinterWheatStriglingSingle.h:77
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
WWStriglingSingle_AUTUMN_PLOUGH
#define WWStriglingSingle_AUTUMN_PLOUGH
Definition: WinterWheatStriglingSingle.h:42
wwss_strigling2
Definition: WinterWheatStriglingSingle.h:66
wwss_autumn_plough
Definition: WinterWheatStriglingSingle.h:50
wwss_harvest
Definition: WinterWheatStriglingSingle.h:75
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
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop