Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WinterWheat.h
Go to the documentation of this file.
1 
15 //
16 // WinterWheat.h
17 //
18 /*
19 
20 Copyright (c) 2003, National Environmental Research Institute, Denmark (NERI)
21 
22 All rights reserved.
23 
24 
25 Redistribution and use in source and binary forms, with or without
26 modification, are permitted provided that the following conditions are met:
27 
28 *) Redistributions of source code must retain the above copyright notice, this
29 list of conditions and the following disclaimer.
30 *) Redistributions in binary form must reproduce the above copyright notice,
31 this list of conditions and the following disclaimer in the documentation
32 and/or other materials provided with the distribution.
33 *) Neither the name of the NERI nor the names of its contributors
34 may be used to endorse or promote products derived from this software without
35 specific prior written permission.
36 
37 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
41 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47 POSSIBILITY OF SUCH DAMAGE.
48 
49 */
50 
51 #ifndef WINTERWHEAT_H
52 #define WINTERWHEAT_H
53 
54 #define WINTERWHEAT_BASE 8200
55 
58 #define WW_AUTUMN_PLOUGH a_field->m_user[1]
59 #define WW_DECIDE_TO_HERB a_field->m_user[2]
60 #define WW_DECIDE_TO_FI a_field->m_user[3]
61 
62 
68 typedef enum {
69  ww_start = 1, // Compulsory, must always be 1 (one).
107 
108 
117 class WinterWheat: public Crop
118 {
119  public:
120  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
121  WinterWheat(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
122  {
123  // When we start it off, the first possible date for a farm operation is 1st October
124  // This information is used by other crops when they decide how much post processing of
125  // the management is allowed after harvest before the next crop starts.
126  m_first_date=g_date->DayInYear( 1,10 );
128  }
130  const int elements = 2 + (ww_foobar - WINTERWHEAT_BASE);
132 
133  FarmManagementCategory catlist[elements] =
134  {
135  fmc_Others, // zero element unused but must be here
136  fmc_Others,//ww_start = 1, // Compulsory, must always be 1 (one).
137  fmc_Others,//ww_sleep_all_day = WINTERWHEAT_BASE,
138  fmc_Fertilizer,//ww_ferti_p1,
139  fmc_Fertilizer,//ww_ferti_s1,
140  fmc_Fertilizer,//ww_ferti_s2,
141  fmc_Cultivation,//ww_autumn_plough,
142  fmc_Cultivation,//ww_autumn_harrow,
143  fmc_Cultivation,//ww_stubble_harrow1,
144  fmc_Others,//ww_autumn_sow,
145  fmc_Others,//ww_autumn_roll,
146  fmc_Fertilizer,//ww_ferti_p2,
147  fmc_Herbicide,//ww_herbicide1,
148  fmc_Others,//ww_spring_roll,
149  fmc_Herbicide,//ww_herbicide2,
150  fmc_Others,//ww_GR,
151  fmc_Fungicide,//ww_fungicide,
152  fmc_Fungicide,//ww_fungicide2,
153  fmc_Insecticide,//ww_insecticide1,
154  fmc_Insecticide,//ww_insecticide2,
155  fmc_Insecticide,//ww_insecticide3,
156  fmc_Cultivation,//ww_strigling1,
157  fmc_Cultivation,//ww_strigling2,
158  fmc_Watering,//ww_water1,
159  fmc_Watering,//ww_water2,
160  fmc_Fertilizer,//ww_ferti_p3,
161  fmc_Fertilizer,//ww_ferti_p4,
162  fmc_Fertilizer,//ww_ferti_p5,
163  fmc_Fertilizer,//ww_ferti_s3,
164  fmc_Fertilizer,//ww_ferti_s4,
165  fmc_Fertilizer,//ww_ferti_s5,
166  fmc_Harvest,//ww_harvest,
167  fmc_Others,//ww_straw_chopping,
168  fmc_Others,//ww_hay_turning,
169  fmc_Others,//ww_hay_baling,
170  fmc_Cultivation,//ww_stubble_harrow2,
171  fmc_Cultivation//ww_grubning,
172 
173  // no foobar entry
174 
175  };
176  // Iterate over the catlist elements and copy them to vector
177  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
178 
179  }
180 };
181 
182 #endif // WINTERWHEAT_H
183 
ww_hay_baling
Definition: WinterWheat.h:102
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
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:487
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:1067
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
WW_DECIDE_TO_FI
#define WW_DECIDE_TO_FI
Definition: WinterWheat.h:60
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
ww_ferti_p1
Definition: WinterWheat.h:71
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:1206
ww_start
Definition: WinterWheat.h:69
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
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:840
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
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:645
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
ww_herbicide2
Definition: WinterWheat.h:82
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
WinterWheat
WinterWheat class .
Definition: WinterWheat.h:117
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
ww_stubble_harrow2
Definition: WinterWheat.h:103
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
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:1110
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
ww_foobar
Definition: WinterWheat.h:105
CfgFloat::value
double value() const
Definition: Configurator.h:142
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
cfg_pest_winterwheat_on
CfgBool cfg_pest_winterwheat_on
Turn on pesticides for winter wheat.
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
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:982
ww_harvest
Definition: WinterWheat.h:99
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
LE::GetVegBiomass
virtual double GetVegBiomass(void)
Definition: Elements.h:164
WinterWheat::WinterWheat
WinterWheat(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: WinterWheat.h:121
cfg_pest_product_amounts
CfgArray_Double cfg_pest_product_amounts
Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.
ww_grubning
Definition: WinterWheat.h:104
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
Crop
The base class for all crops.
Definition: Farm.h:495
ww_insecticide3
Definition: WinterWheat.h:88
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
CfgBool::value
bool value() const
Definition: Configurator.h:164
ww_ferti_s1
Definition: WinterWheat.h:72
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: Farm.h:778
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
ww_fungicide2
Definition: WinterWheat.h:85
ww_hay_turning
Definition: WinterWheat.h:101
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
cfg_seedcoating_product_amounts
CfgArray_Double cfg_seedcoating_product_amounts
Amount of seed coating pesticide applied in grams of active substance per hectare for each of the 10 ...
WinterWheat::Do
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
The one and only method for a crop management plan. All farm actions go through here.
Definition: WinterWheat.cpp:103
ww_ferti_s5
Definition: WinterWheat.h:98
LE::m_skylarkscrapes
bool m_skylarkscrapes
For management testing of skylark scrapes.
Definition: Elements.h:95
Calendar::Date
long Date(void)
Definition: Calendar.h:57
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
ww_strigling1
Definition: WinterWheat.h:89
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: FarmFuncs.cpp:1507
ww_spring_roll
Definition: WinterWheat.h:81
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
ww_insecticide2
Definition: WinterWheat.h:87
ww_GR
Definition: WinterWheat.h:83
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
ww_ferti_p3
Definition: WinterWheat.h:93
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
WW_AUTUMN_PLOUGH
#define WW_AUTUMN_PLOUGH
A flag used to indicate autumn ploughing status.
Definition: WinterWheat.h:58
ww_sleep_all_day
Definition: WinterWheat.h:70
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
WinterWheatToDo
WinterWheatToDo
Definition: WinterWheat.h:68
CfgArray_Double
Definition: Configurator.h:208
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
WINTERWHEAT_BASE
#define WINTERWHEAT_BASE
Definition: WinterWheat.h:54
ww_ferti_p2
Definition: WinterWheat.h:79
ww_autumn_roll
Definition: WinterWheat.h:78
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
ww_herbicide1
Definition: WinterWheat.h:80
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
CfgInt::value
int value() const
Definition: Configurator.h:116
WinterWheat::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterWheat.h:129
Crop::m_ManagementCategories
vector< FarmManagementCategory > m_ManagementCategories
Holds the translation between the farm operation enum for each crop and the farm management category ...
Definition: Farm.h:530
ww_autumn_sow
Definition: WinterWheat.h:77
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
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:299
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:823
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
cfg_seedcoating_winterwheat_on
CfgBool cfg_seedcoating_winterwheat_on
Turn on seed coating for winter wheat.
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
ww_fungicide
Definition: WinterWheat.h:84
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
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:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
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:285
ww_stubble_harrow1
Definition: WinterWheat.h:76
ww_ferti_s4
Definition: WinterWheat.h:97
ww_insecticide1
Definition: WinterWheat.h:86
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
CfgInt
Integer configurator entry class.
Definition: Configurator.h:102
Farm
The base class for all farm types.
Definition: Farm.h:755
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:408
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the autumn on a_field.
Definition: FarmFuncs.cpp:360
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
ww_strigling2
Definition: WinterWheat.h:90
ww_ferti_p4
Definition: WinterWheat.h:94
WW_DECIDE_TO_HERB
#define WW_DECIDE_TO_HERB
Definition: WinterWheat.h:59
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
CFG_CUSTOM
Definition: Configurator.h:70
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
ww_autumn_plough
Definition: WinterWheat.h:74
ww_water1
Definition: WinterWheat.h:91
cfg_fungi_app_prop2
CfgFloat cfg_fungi_app_prop2
ww_ferti_s2
Definition: WinterWheat.h:73
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
ww_ferti_p5
Definition: WinterWheat.h:95
Crop::ChooseNextCrop
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
Definition: Farm.cpp:756
Farm::HayTurning
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
Definition: FarmFuncs.cpp:1491
ww_straw_chopping
Definition: WinterWheat.h:100
ww_ferti_s3
Definition: WinterWheat.h:96
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
ww_autumn_harrow
Definition: WinterWheat.h:75
WARN_BUG
Definition: MapErrorMsg.h:34
ww_water2
Definition: WinterWheat.h:92
ppp_1
Definition: LandscapeFarmingEnums.h:1079
cfg_WinterWheat_SkScrapes
CfgBool cfg_WinterWheat_SkScrapes("CROP_WW_SK_SCRAPES", CFG_CUSTOM, false)
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523