ALMaSS Skylark ODDox  1.1
The skylark model description following ODdox protocol
SpringRape Class Reference

#include <SpringRape.h>

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 SpringRape ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop ()
 
int GetFirstDate (void)
 
void ChooseNextCrop (int a_no_dates)
 Chooses the next crop to grow in a field. More...
 
int GetCropClassification ()
 
void SetCropClassification (int a_classification)
 

Private Member Functions

void HerbiZero (void)
 
void RowcolOne (void)
 

Additional Inherited Members

- Protected Member Functions inherited from Crop
void SimpleEvent (long a_date, int a_todo, bool a_lock)
 Adds an event to this crop management. More...
 
void SimpleEvent_ (long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
 Adds an event to this crop management without relying on member variables. More...
 
- Protected Attributes inherited from Crop
Farmm_farm
 
LE * m_field
 
FarmEventm_ev
 
int m_first_date
 
int m_count
 
int m_last_date
 
int m_ddegstoharvest
 
int m_CropClassification
 

Constructor & Destructor Documentation

◆ SpringRape()

SpringRape::SpringRape ( )
inline
87  {
88  m_first_date=g_date->DayInYear(1,3);
89  }

References Crop::m_first_date.

Member Function Documentation

◆ Do()

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

Reimplemented from Crop.

46 {
47  double ins_app_prop=cfg_ins_app_prop1.value();
48  double herbi_app_prop=cfg_herbi_app_prop.value();
49  m_farm = a_farm;
50  m_field = a_field;
51  m_ev = a_ev;
52  int noDates=3;
53  int d1=0;
54  // DEBUG double bio=0;
55 
56  bool done = false;
57 
58  switch ( m_ev->m_todo ) {
59  case sr_start:
60  {
61  SR_DID_RC_CLEAN=false;
62  SR_DID_HERBI_ZERO=false;
64  SR_SWARTH_DATE=-1;
65  SR_HARVEST_DATE=-1;
66  //SR_DECIDE_TO_HERB=1;
67  //SR_DECIDE_TO_FI=1;
68  // Start single block date checking code to be cut-'n-pasted...
69  // Set up the date management stuff
70  m_last_date=g_date->DayInYear(15,10);
71  // Start and stop dates for all events after harvest
72  m_field->SetMDates(0,0,g_date->DayInYear(1,8));
73  // Determined by harvest date - used to see if at all possible
74  m_field->SetMDates(1,0,g_date->DayInYear(1,8));
75  m_field->SetMDates(0,1,g_date->DayInYear(25,7));
76  m_field->SetMDates(1,1,g_date->DayInYear(15,8));
77  m_field->SetMDates(0,2,g_date->DayInYear(1,8));
78  m_field->SetMDates(1,2,g_date->DayInYear(15,10));
79  // Check the next crop for early start, unless it is a spring crop
80  // in which case we ASSUME that no checking is necessary!!!!
81  // So DO NOT implement a crop that runs over the year boundary
82 
83  //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)
84  if(!(m_farm->GetType() == tof_OptimisingFarm && g_date->GetYearNumber()>0)){
85 
86  if (m_ev->m_startday>g_date->DayInYear(1,7))
87  {
88  if (m_field->GetMDates(0,0) >=m_ev->m_startday)
89  {
90  g_msg->Warn( WARN_BUG, "SpringRape::Do(): "
91  "Harvest too late for the next crop to start!!!", "" );
92  exit( 1 );
93  }
94  // Now fix any late finishing problems
95  for (int i=0; i<noDates; i++) {
96  if(m_field->GetMDates(0,i)>=m_ev->m_startday) {
97  m_field->SetMDates(0,i,m_ev->m_startday-1); //move the starting date
98  }
99  if(m_field->GetMDates(1,i)>=m_ev->m_startday){
100  m_field->SetMConstants(i,0);
101  m_field->SetMDates(1,i,m_ev->m_startday-1); //move the finishing date
102  }
103  }
104  }
105  // Now no operations can be timed after the start of the next crop.
106  // Start single block date checking code to be cut-'n-pasted...
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  {
113  // Yes, too early. We assumme this is because the last crop was late
114  g_msg->Warn( WARN_BUG, "SpringRape::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 + 365; // Add 365 for spring crop
121  if (g_date->Date() > d1)
122  {
123 // int rubbish=g_date->Date();
124  // Yes too late - should not happen - raise an error
125  g_msg->Warn( WARN_BUG, "SpringRape::Do(): "
126  "Crop start attempt after last possible start date", "" );
127  exit( 1 );
128  }
129  }
130  }
131  else
132  {
133  // Is the first year so must start in spring like nothing was unusual
134  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5,7 )
135  ,sr_swarth, false );
136  break;
137  }
138  }//if
139  // End single block date checking code. Please see next line
140  // comment as well.
141  // Reinit d1 to first possible starting date.
142  d1 = g_date->OldDays() + g_date->DayInYear( 1,3 ) + 365;
143  if ( g_date->Date() > d1 ) {
144  d1 = g_date->Date();
145  }
146  // OK, let's go.
147  SimpleEvent( d1, sr_ferti_zero, false );
148  }
149 
150  #ifdef __EcoSol_02
151  // THIS CODE IS ONLY NEEDED IF WE ARE TESTING A PRODUCT WITH THE PESTICIDE ENGINE & WR
152  /* */
153  if ( g_landscape_p->SupplyShouldSpray() ) {
154  d1 = g_date->OldDays() + cfg_pest_productapplic_startdate.value();
155  if (g_date->Date() >= d1) d1 += 365;
156  SimpleEvent( d1, sr_productapplic_one, false );
157  }
158  /* */
159  #endif
160 
161  break;
162 
164  if ( m_ev->m_lock || m_farm->DoIt( 100 ))
165  {
167  // We didn't do it today, try again tomorrow.
168  SimpleEvent( g_date->Date() + 1, sr_productapplic_one, true );
169  break;
170  }
171  }
172  break;
173 
174 
175  // NB this is only stock farmers
176  case sr_ferti_zero:
177  if (( m_ev->m_lock || m_farm->DoIt( 10 ))&& (m_farm->IsStockFarmer()))
178  {
179  if (!m_farm->FA_Manure( m_field, 0.0,
180  g_date->DayInYear( 20, 3 ) - g_date->DayInYear())) {
181  // We didn't do it today, try again tomorrow.
182  SimpleEvent( g_date->Date() + 1, sr_ferti_zero, true );
183  break;
184  }
185  }
186  SimpleEvent(g_date->Date() + 1, sr_spring_plough, false );
187  break;
188  case sr_spring_plough:
189  if ( m_ev->m_lock || m_farm->DoIt( 100))
190  {
191  if (!m_farm->SpringPlough( m_field, 0.0,
192  g_date->DayInYear( 25, 3 ) - g_date->DayInYear())) {
193  SimpleEvent( g_date->Date() + 1, sr_spring_plough, true );
194  break;
195  }
196  }
197  SimpleEvent( g_date->Date() + 1, sr_spring_harrow, false );
198  break;
199  case sr_spring_harrow:
200  if (!m_farm->SpringHarrow(m_field, 0.0,
201  g_date->DayInYear( 1, 4 ) - g_date->DayInYear()))
202  {
203  SimpleEvent(g_date->Date() + 1, sr_spring_harrow, false);
204  break;
205  }
206  {
207  long newdate1 = g_date->OldDays() + g_date->DayInYear( 10, 8 );
208  long newdate2 = g_date->Date();
209  if ( newdate2 > newdate1 ) newdate1 = newdate2;
210  SimpleEvent(newdate1, sr_spring_sow, false);
211  }
212  break;
213  case sr_spring_sow:
214  if (!m_farm->SpringSow( m_field, 0.0,
215  g_date->DayInYear( 7, 4 ) - g_date->DayInYear())) {
216  SimpleEvent(g_date->Date() + 1, sr_spring_sow, false);
217  break;
218  }
219  //
220  // Fork off 6 (six!) threads of execution for *next* year...
221  //
222  if (m_farm->IsStockFarmer())
223  SimpleEvent(g_date->OldDays() + g_date->DayInYear(14, 4),
224  sr_ferti_s1, false);
225  else SimpleEvent(g_date->OldDays() + g_date->DayInYear(14, 4),
226  sr_ferti_p1, false);
227 
228  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 4),
229  sr_herbi_one, false);
230  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 5),
231  sr_insect_one, false);
232  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 6),
233  sr_fungi_one, false);
234  SimpleEvent(g_date->OldDays() + g_date->DayInYear(1, 5),
235  sr_rowcol_one, false);
236 
237  // This is the main thread, that will lead to the end (eventually)...
238  SimpleEvent(g_date->OldDays() + g_date->DayInYear(15, 7),
239  sr_swarth, false);
240  break;
241 
242  case sr_ferti_p1:
243  if (!m_farm->FP_NPKS( m_field, 0.0,
244  g_date->DayInYear( 20, 4 ) - g_date->DayInYear())) {
245  SimpleEvent( g_date->Date() + 1, sr_ferti_p1, false );
246  break;
247  }
248  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 4 ),
249  sr_ferti_p2, false );
250  break;
251 
252  case sr_ferti_p2:
253  if ( m_ev->m_lock || m_farm->DoIt( 20 )) {
254  if ( !m_farm->FP_NPKS( m_field, 0.0,
255  g_date->DayInYear( 10, 5 ) - g_date->DayInYear())) {
256  SimpleEvent( g_date->Date() + 1, sr_ferti_p2, true );
257  }
258  }
259  // Execution in this thread stops here. No new events are queued up.
260  break;
261 case sr_ferti_s1:
262  if (!m_farm->FP_NPKS( m_field, 0.0,
263  g_date->DayInYear( 7, 5 ) - g_date->DayInYear())) {
264  SimpleEvent( g_date->Date() + 1, sr_ferti_s1, false );
265  break;
266  }
267  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 17,5 ),
268  sr_ferti_p2, false );
269  break;
270 
271  case sr_ferti_s2:
272  if ( !m_farm->FP_Slurry( m_field, 0.0,
273  g_date->DayInYear( 14,5 ) - g_date->DayInYear())) {
274  SimpleEvent( g_date->Date() + 1, sr_ferti_s2, true );
275  }
276  // Execution in this thread stops here. No new events are queued up.
277  break;
278 
279  case sr_herbi_one:
280  if ( m_ev->m_lock || (m_farm->DoIt( (int)(45*herbi_app_prop * m_farm->Prob_multiplier()) ) && !SR_DID_HERBI_ZERO) ) { //modified probability
281  if ( !m_farm->HerbicideTreat( m_field, 0.0, g_date->DayInYear( 21, 4 ) - g_date->DayInYear())) {
282  SimpleEvent( g_date->Date() + 1, sr_herbi_one, true );
283  }
284  }
285  // Execution in this thread stops here. No new events are queued up.
286  break;
287  case sr_insect_one:
288  if ( m_ev->m_lock || m_farm->DoIt( (int)(21*ins_app_prop * 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(30)) pf->Add_missed_fi_app(); //the 2nd missed application
296  if(m_farm->DoIt(12)) pf->Add_missed_fi_app(); //the 3rd missed application
297  break;
298  } //end of the part for dec. making
299 
300  if ( !m_farm->InsecticideTreat( m_field, 0.0,
301  g_date->DayInYear( 14, 5 ) - g_date->DayInYear()))
302  {
303  SimpleEvent( g_date->Date() + 1, sr_insect_one, true );
304  break;
305  }
306  else
307  {
308  SR_INSECT_DATE = g_date->Date();
309  long newdate1 = g_date->OldDays() + g_date->DayInYear( 15, 5 );
310  long newdate2 = g_date->Date() + 7;
311  if ( newdate2 > newdate1 )
312  {
313  newdate1 = newdate2;
314  }
315  SimpleEvent( newdate1, sr_insect_one_b, false );
316  break;
317  }
318  }
319  break; // End of thread if gets here
320 
321  case sr_insect_one_b:
322  if ( g_date->Date() == SR_FUNGI_DATE )
323  {
324  // try again tomorrow.
325  SimpleEvent( g_date->Date() + 1, sr_insect_one_b, false );
326  break;
327  }
328  if ( m_ev->m_lock || m_farm->DoIt( (int)(30*ins_app_prop * m_farm->Prob_multiplier()) )) { //modified probability
329  if ( !m_farm->InsecticideTreat( m_field, 0.0,
330  g_date->DayInYear( 15, 6 ) - g_date->DayInYear())) {
331  SimpleEvent( g_date->Date() + 1, sr_insect_one_b, true );
332  break;
333  }
334  else
335  {
336  SR_INSECT_DATE = g_date->Date();
337  long newdate1 = g_date->OldDays() + g_date->DayInYear( 20, 6 );
338  long newdate2 = g_date->Date() + 7;
339  if ( newdate2 > newdate1 ) newdate1 = newdate2;
340  SimpleEvent( newdate1, sr_insect_one_c, false );
341  break;
342  }
343  }
344  break; // End of thread if gets to here
345 
346  case sr_insect_one_c:
347  if ( m_ev->m_lock || m_farm->DoIt((int)(12*ins_app_prop * m_farm->Prob_multiplier() ))) //modified probability
348  {
349  if ( g_date->Date() == SR_FUNGI_DATE )
350  {
351  // try again tomorrow.
352  SimpleEvent( g_date->Date() + 1, sr_insect_one_c, false );
353  break;
354  }
355  if ( !m_farm->InsecticideTreat( m_field, 0.0,
356  g_date->DayInYear( 15, 7 ) - g_date->DayInYear())) {
357  SimpleEvent( g_date->Date() + 1, sr_insect_one_c, true );
358  }
359  SR_INSECT_DATE = g_date->Date();
360  }
361  // END_OF_ThREAD
362  break;
363 
364  case sr_fungi_one:
365  if (m_farm->DoIt((int)(34*cfg_fungi_app_prop1.value() * m_farm->Prob_multiplier()) )) //modified probability
366  {
367  if ( g_date->Date() == SR_INSECT_DATE ) //is this ok? yes
368  {
369  // try again tomorrow.
370  SimpleEvent( g_date->Date() + 1, sr_fungi_one, false );
371  break;
372  }
373  if ( m_ev->m_lock || m_farm->DoIt( 10 )) {
374 
375  //new - for decision making
376  TTypesOfVegetation tov = m_field->GetVegType();
377  if(!m_ev->m_lock && !m_farm->Spraying_fungins(tov)){
378  Field * pf = dynamic_cast<Field*>(m_field);
379  pf->Add_missed_fi_app();
380  break;
381  } //end of the part for dec. making
382 
383  if ( !m_farm->FungicideTreat( m_field, 0.0, g_date->DayInYear( 15, 6 ) - g_date->DayInYear())) {
384  SimpleEvent( g_date->Date() + 1, sr_insect_one_c, true );
385  }
386  SR_FUNGI_DATE = g_date->Date();
387  }
388  // END_OF_ThREAD
389  }
390  break;
391 
392  case sr_rowcol_one:
393  RowcolOne();
394  break;
395 
396  case sr_rowcol_one_b:
397  if ( m_ev->m_lock || m_farm->DoIt( 20 ))
398  {
399  if ( !m_farm->RowCultivation( m_field, 0.0,
400  g_date->DayInYear( 15, 5 ) - g_date->DayInYear())) {
401  SimpleEvent( g_date->Date() + 1, sr_rowcol_one_b, true );
402  }
403  }
404  // END_OF_ThREAD
405  break;
406 
407  case sr_swarth:
408  if (m_ev->m_lock || m_farm->DoIt( 75 ))
409  {
410  if ( !m_farm->Swathing( m_field, 0.0,
411  g_date->DayInYear( 30, 7 ) - g_date->DayInYear())) {
412  SimpleEvent( g_date->Date() + 1, sr_swarth, true );
413  break;
414  }
415  else SR_SWARTH_DATE=g_date->DayInYear();
416  }
417  ChooseNextCrop (3);
418  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 7 ),
419  sr_harvest, false );
420  break;
421 
422  case sr_harvest:
423  {
424  if (m_field->GetMConstants(1)==0) {
425  if (!m_farm->Harvest( m_field, 0.0, -1)) { //raise an error
426  g_msg->Warn( WARN_BUG, "SpringRape::Do(): failure in 'Harvest' execution", "" );
427  exit( 1 );
428  }
429  }
430  else {
431  long EndDate;
432  if (SR_SWARTH_DATE!=-1)
433  {
434  EndDate=SR_SWARTH_DATE+14;
435  if (EndDate>m_field->GetMDates(0,1)) EndDate=m_field->GetMDates(0,1);
436  }
437  else EndDate=g_date->DayInYear( 10, 8 );
438  if ( !m_farm->Harvest( m_field, 0.0, EndDate - g_date->DayInYear()))
439  {
440  SimpleEvent( g_date->Date() + 1, sr_harvest, false );
441  break;
442  }
443  }
444  // Must have done harvest so record the fact for Debug
445 /* DEBUG
446  WR_HARVEST_DATE=g_date->DayInYear();
447  bio=m_field->GetVegBiomass();
448  if (bio>1000) {
449  int rubbish=0;
450  }
451 */
452  if ( m_farm->DoIt( 95 )) // was 95
453  {
454  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 20, 7 ),
455  sr_cuttostraw, false );
456  }
457  else SimpleEvent( g_date->OldDays() + g_date->DayInYear( 5, 8 ),
458  sr_compress, false);
459  break;
460  }
461 
462  case sr_cuttostraw:
463  if ( !m_farm->StrawChopping( m_field, 0.0, g_date->DayInYear( 10, 8 ) - g_date->DayInYear())) {
464  SimpleEvent( g_date->Date() + 1, sr_cuttostraw, false );
465  break;
466  }
467  if (g_date->DayInYear()<g_date->DayInYear(15,7))
468  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 7 ), sr_stub_harrow, false );
469  else SimpleEvent( g_date->Date() + 1,sr_stub_harrow, false );
470  break;
471 
472  case sr_compress:
473  if ( !m_farm->HayBailing( m_field, 0.0, g_date->DayInYear( 10, 8 ) - g_date->DayInYear())) {
474  SimpleEvent( g_date->Date() + 1, sr_compress, false );
475  break;
476  }
477  if (g_date->DayInYear()<g_date->DayInYear(25,7))
478  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25, 7 ), sr_stub_harrow, false );
479  else
480  SimpleEvent( g_date->Date(), sr_stub_harrow, false );
481  break;
482 
483  case sr_stub_harrow:
484  if ( m_ev->m_lock || m_farm->DoIt( 75 )) {
485  if (m_field->GetMConstants(1)==0) {
486  if (!m_farm->StubbleHarrowing( m_field, 0.0, -1)) { //raise an error
487  g_msg->Warn( WARN_BUG, "SpringRape::Do(): failure in 'StubbleHarrowing' execution", "" );
488  exit( 1 );
489  }
490  }
491  else {
492  if ( !m_farm->StubbleHarrowing( m_field, 0.0, m_field->GetMDates(1,1) - g_date->DayInYear())) {
493  SimpleEvent( g_date->Date() + 1, sr_stub_harrow, true );
494  break;
495  }
496  }
497  }
498  SimpleEvent( g_date->OldDays() + g_date->DayInYear( 10, 8 ), sr_grubbing, false );
499  break;
500 
501  case sr_grubbing:
502  if ( m_ev->m_lock || m_farm->DoIt( 10 )) {
503  if (m_field->GetMConstants(2)==0) {
504  if (!m_farm->DeepPlough( m_field, 0.0, -1)) { //raise an error
505  g_msg->Warn( WARN_BUG, "SpringRape::Do(): failure in 'DeepPlough' execution", "" );
506  exit( 1 );
507  }
508  }
509  else {
510  if ( !m_farm->DeepPlough( m_field, 0.0, m_field->GetMDates(1,2) - g_date->DayInYear())) {
511  SimpleEvent( g_date->Date() + 1, sr_grubbing, true );
512  }
513  }
514  }
515  //
516  // End of execution tree for this management plan.
517  //
518 /*
519 if (WR_HARVEST_DATE==-1) {
520  int rubbish=0;
521  }
522  bio=m_field->GetVegBiomass();
523  if (bio>1000) {
524  int rubbish=0;
525  }
526 */
527 done = true;
528  break;
529 
530  default:
531  g_msg->Warn( WARN_BUG, "SpringRape::Do(): "
532  "Unknown event type! ", "" );
533  exit( 1 );
534  }
535  return done;
536 }

References cfg_fungi_app_prop1, cfg_herbi_app_prop, cfg_ins_app_prop1, cfg_pest_product_1_amount, cfg_pest_productapplic_period, cfg_pest_productapplic_startdate, Crop::ChooseNextCrop(), Farm::DeepPlough(), Farm::DoIt(), Farm::FA_Manure(), Farm::FP_NPKS(), Farm::FP_Slurry(), Farm::FungicideTreat(), g_landscape_p, Farm::GetType(), Farm::Harvest(), Farm::HayBailing(), Farm::HerbicideTreat(), Farm::InsecticideTreat(), Farm::IsStockFarmer(), Crop::m_ev, Crop::m_farm, Crop::m_field, Crop::m_first_date, FarmEvent::m_first_year, Crop::m_last_date, FarmEvent::m_lock, FarmEvent::m_startday, FarmEvent::m_todo, ppp_1, Farm::Prob_multiplier(), Farm::ProductApplication(), RowcolOne(), Farm::RowCultivation(), Crop::SimpleEvent(), Farm::Spraying_fungins(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringSow(), sr_compress, sr_cuttostraw, SR_DID_HERBI_ZERO, SR_DID_RC_CLEAN, sr_ferti_p1, sr_ferti_p2, sr_ferti_s1, sr_ferti_s2, sr_ferti_zero, SR_FUNGI_DATE, sr_fungi_one, sr_grubbing, sr_harvest, SR_HARVEST_DATE, sr_herbi_one, SR_INSECT_DATE, sr_insect_one, sr_insect_one_b, sr_insect_one_c, sr_productapplic_one, sr_rowcol_one, sr_rowcol_one_b, sr_spring_harrow, sr_spring_plough, sr_spring_sow, sr_start, sr_stub_harrow, sr_swarth, SR_SWARTH_DATE, Farm::StrawChopping(), Farm::StubbleHarrowing(), Landscape::SupplyShouldSpray(), Farm::Swathing(), and tof_OptimisingFarm.

◆ HerbiZero()

void SpringRape::HerbiZero ( void  )
private

◆ RowcolOne()

void SpringRape::RowcolOne ( void  )
private
540 {
541  if ( g_date->Date() == SR_INSECT_DATE )
542  {
543  SimpleEvent( g_date->Date() + 1, sr_rowcol_one, m_ev->m_lock );
544  return;
545  }
546  if ( m_ev->m_lock || m_farm->DoIt( 25 )) {
547  if ( !m_farm->RowCultivation( m_field, 0.0,
548  g_date->DayInYear( 25, 4 ) - g_date->DayInYear())) {
549  SimpleEvent( g_date->Date() + 1, sr_rowcol_one, true );
550  return;
551  }
552  else
553  {
554  long newdate1 = g_date->OldDays() + g_date->DayInYear( 25, 4 );
555  long newdate2 = g_date->Date() + 5;
556  if ( newdate2 > newdate1 )
557  newdate1 = newdate2;
558  SimpleEvent( newdate1, sr_rowcol_one_b, false );
559  return;
560  }
561  }
562  return; // End of thread
563 }

References Farm::DoIt(), Crop::m_ev, Crop::m_farm, Crop::m_field, FarmEvent::m_lock, Farm::RowCultivation(), Crop::SimpleEvent(), SR_INSECT_DATE, sr_rowcol_one, and sr_rowcol_one_b.

Referenced by Do().


The documentation for this class was generated from the following files:
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
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
sr_ferti_zero
Definition: SpringRape.h:49
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
sr_harvest
Definition: SpringRape.h:67
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
Landscape::SupplyShouldSpray
bool SupplyShouldSpray()
Definition: Landscape.h:357
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
tof_OptimisingFarm
Definition: farm.h:273
SR_DID_HERBI_ZERO
#define SR_DID_HERBI_ZERO
Definition: SpringRape.h:37
SR_DID_RC_CLEAN
#define SR_DID_RC_CLEAN
Definition: SpringRape.h:36
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
Farm::GetType
TTypesOfFarm GetType(void)
Definition: farm.h:901
sr_spring_plough
Definition: SpringRape.h:50
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Crop::m_first_date
int m_first_date
Definition: farm.h:540
FarmEvent::m_startday
int m_startday
Definition: farm.h:466
sr_herbi_one
Definition: SpringRape.h:59
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: farmfuncs.cpp:1279
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
sr_ferti_s1
Definition: SpringRape.h:57
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: farm.cpp:307
sr_spring_harrow
Definition: SpringRape.h:51
sr_stub_harrow
Definition: SpringRape.h:70
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: farm.h:786
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
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
cfg_pest_product_1_amount
CfgFloat cfg_pest_product_1_amount
SpringRape::RowcolOne
void RowcolOne(void)
Definition: SpringRape.cpp:539
sr_ferti_p1
Definition: SpringRape.h:55
SR_FUNGI_DATE
#define SR_FUNGI_DATE
Definition: SpringRape.h:39
sr_cuttostraw
Definition: SpringRape.h:68
Crop::m_farm
Farm * m_farm
Definition: farm.h:537
Crop::m_field
LE * m_field
Definition: farm.h:538
sr_grubbing
Definition: SpringRape.h:71
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::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
sr_insect_one_c
Definition: SpringRape.h:65
ppp_1
Definition: farm.h:422
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
sr_compress
Definition: SpringRape.h:69
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
sr_ferti_p2
Definition: SpringRape.h:56
sr_insect_one
Definition: SpringRape.h:63
sr_start
Definition: SpringRape.h:48
sr_rowcol_one
Definition: SpringRape.h:61
sr_fungi_one
Definition: SpringRape.h:60
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
cfg_pest_productapplic_startdate
CfgInt cfg_pest_productapplic_startdate
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
sr_swarth
Definition: SpringRape.h:66
sr_insect_one_b
Definition: SpringRape.h:64
SR_INSECT_DATE
#define SR_INSECT_DATE
Definition: SpringRape.h:38
SR_HARVEST_DATE
#define SR_HARVEST_DATE
Definition: SpringRape.h:41
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: farmfuncs.cpp:1744
SR_SWARTH_DATE
#define SR_SWARTH_DATE
Definition: SpringRape.h:40
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
cfg_pest_productapplic_period
CfgInt cfg_pest_productapplic_period
sr_spring_sow
Definition: SpringRape.h:52
sr_productapplic_one
Definition: SpringRape.h:72
Farm::Spraying_fungins
virtual bool Spraying_fungins(TTypesOfVegetation)
Definition: farm.h:785
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
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:602
sr_ferti_s2
Definition: SpringRape.h:58
sr_rowcol_one_b
Definition: SpringRape.h:62