ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
PLWinterWheat.h
Go to the documentation of this file.
1 
16 //
17 // PLWinterWheat.h
18 //
19 
20 
21 #ifndef PLWINTERWHEAT_H
22 #define PLWINTERWHEAT_H
23 
24 #define PLWINTERWHEAT_BASE 26600
25 
28 #define PL_WW_FERTI_P1 a_field->m_user[1]
29 #define PL_WW_FERTI_S1 a_field->m_user[2]
30 #define PL_WW_STUBBLE_PLOUGH a_field->m_user[3]
31 #define PL_WW_DECIDE_TO_GR a_field->m_user[4]
32 
38 typedef enum {
39  pl_ww_start = 1, // Compulsory, must always be 1 (one).
87  pl_ww_foobar // this should always be the last in the list of operations
89 
90 
99 class PLWinterWheat: public Crop
100 {
101  public:
102  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
103  PLWinterWheat(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
104  {
105  // When we start it off, the first possible date for a farm operation is 20th September
106  // This information is used by other crops when they decide how much post processing of
107  // the management is allowed after harvest before the next crop starts.
108  m_first_date=g_date->DayInYear( 20,9 );
109  // Create the farm operation to farm management category translation
111  }
113  const int elements = 2 + (pl_ww_foobar - PLWINTERWHEAT_BASE);
115 
116  FarmManagementCategory catlist[elements] =
117  {
118  fmc_Others, // this needs to be at the zero line
119  fmc_Others, // pl_ww_start = 1,
120  fmc_Others, // pl_ww_sleep_all_day = PLWINTERWHEAT_BASE,
121  fmc_Fertilizer, // pl_ww_ferti_p1,
122  fmc_Fertilizer, // pl_ww_ferti_s1,
123  fmc_Cultivation, // pl_ww_stubble_plough,
124  fmc_Cultivation, // pl_ww_autumn_harrow1,
125  fmc_Cultivation, // pl_ww_autumn_harrow2,
126  fmc_Cultivation, // pl_ww_stubble_harrow,
127  fmc_Fertilizer, //pl_ww_ferti_p2,
128  fmc_Fertilizer, //pl_ww_ferti_s2,
129  fmc_Cultivation, // pl_ww_autumn_plough,
130  fmc_Others, // pl_ww_autumn_roll,
131  fmc_Cultivation, // pl_ww_stubble_cultivator_heavy,
132  fmc_Fertilizer, //pl_ww_ferti_p3,
133  fmc_Fertilizer, // pl_ww_ferti_s3,
134  fmc_Cultivation, // pl_ww_preseeding_cultivator,
135  fmc_Cultivation, // pl_ww_preseeding_cultivator_sow,
136  fmc_Others, // pl_ww_autumn_sow,
137  fmc_Herbicide, // pl_ww_herbicide1,
138  fmc_Fungicide, // pl_ww_fungicide1,
139  fmc_Insecticide, // pl_ww_insecticide1,
140  fmc_Fertilizer, //pl_ww_ferti_p4,
141  fmc_Fertilizer, //pl_ww_ferti_s4,
142  fmc_Fertilizer, //pl_ww_ferti_p5,
143  fmc_Fertilizer, //pl_ww_ferti_s5,
144  fmc_Fertilizer, //pl_ww_ferti_p6,
145  fmc_Fertilizer, //pl_ww_ferti_s6,
146  fmc_Fertilizer, //pl_ww_ferti_p7,
147  fmc_Fertilizer, //pl_ww_ferti_s7,
148  fmc_Fertilizer, //pl_ww_ferti_p8,
149  fmc_Fertilizer, //pl_ww_ferti_s8,
150  fmc_Fertilizer, //pl_ww_ferti_p9,
151  fmc_Fertilizer, //pl_ww_ferti_s9,
152  fmc_Herbicide, // pl_ww_herbicide2,
153  fmc_Fungicide, // pl_ww_fungicide2,
154  fmc_Fungicide, // pl_ww_fungicide3,
155  fmc_Fungicide, // pl_ww_fungicide4,
156  fmc_Insecticide, // pl_ww_insecticide2,
157  fmc_Insecticide, // pl_ww_insecticide3,
158  fmc_Others, // pl_ww_growth_regulator1,
159  fmc_Others, // pl_ww_growth_regulator2,
160  fmc_Harvest, //pl_ww_harvest,
161  fmc_Others, // pl_ww_straw_chopping,
162  fmc_Others, // pl_ww_hay_bailing,
163  fmc_Fertilizer, // pl_ww_ferti_p10,
164  fmc_Fertilizer, // pl_ww_ferti_s10,
165  fmc_Fertilizer, // pl_ww_ferti_p11,
166  fmc_Fertilizer // pl_ww_ferti_s11,
167  };
168  // Iterate over the catlist elements and copy them to vector
169  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
170  }
171 };
172 
173 #endif // PLWINTERWHEAT_H
174 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pl_ww_ferti_s2
Definition: PLWinterWheat.h:48
cfg_pest_winterwheat_on
CfgBool cfg_pest_winterwheat_on
Turn on pesticides for winter wheat.
pl_ww_hay_bailing
Definition: PLWinterWheat.h:82
pl_ww_ferti_p6
Definition: PLWinterWheat.h:64
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
pl_ww_ferti_p2
Definition: PLWinterWheat.h:47
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: FarmFuncs.cpp:312
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
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 ...
PLWinterWheat::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: PLWinterWheat.cpp:72
pl_ww_autumn_plough
Definition: PLWinterWheat.h:49
pl_ww_ferti_s8
Definition: PLWinterWheat.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
pl_ww_herbicide2
Definition: PLWinterWheat.h:72
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
Farm::StubbleCultivatorHeavy
virtual bool StubbleCultivatorHeavy(LE *a_field, double a_user, int a_days)
Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can...
Definition: FarmFuncs.cpp:245
PL_WW_STUBBLE_PLOUGH
#define PL_WW_STUBBLE_PLOUGH
Definition: PLWinterWheat.h:30
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
pl_ww_ferti_s7
Definition: PLWinterWheat.h:67
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
pl_ww_ferti_s10
Definition: PLWinterWheat.h:84
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
pl_ww_ferti_p11
Definition: PLWinterWheat.h:85
pl_ww_ferti_p4
Definition: PLWinterWheat.h:60
pl_ww_ferti_s6
Definition: PLWinterWheat.h:65
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: FarmFuncs.cpp:232
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
pl_ww_fungicide3
Definition: PLWinterWheat.h:74
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
cfg_WW_NINV_tillage_prop2
CfgFloat cfg_WW_NINV_tillage_prop2
Provided to allow configuration control of the proportion of farmers doing second non-inversion tilla...
pl_ww_autumn_harrow2
Definition: PLWinterWheat.h:45
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
CfgFloat::value
double value() const
Definition: Configurator.h:142
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_ww_preseeding_cultivator_sow
Definition: PLWinterWheat.h:55
pl_ww_ferti_p9
Definition: PLWinterWheat.h:70
pl_ww_ferti_s5
Definition: PLWinterWheat.h:63
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
pl_ww_ferti_p3
Definition: PLWinterWheat.h:52
pl_ww_ferti_p10
Definition: PLWinterWheat.h:83
pl_ww_insecticide2
Definition: PLWinterWheat.h:76
Crop
The base class for all crops.
Definition: Farm.h:495
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
pl_ww_insecticide3
Definition: PLWinterWheat.h:77
pl_ww_ferti_s4
Definition: PLWinterWheat.h:61
CfgBool::value
bool value() const
Definition: Configurator.h:164
pl_ww_autumn_harrow1
Definition: PLWinterWheat.h:44
cfg_WW_isecticide_prop1
CfgFloat cfg_WW_isecticide_prop1
Provided to allow configuration control of the proportion of farmers doing first insecticide spray in...
cfg_WW_conv_tillage_prop2
CfgFloat cfg_WW_conv_tillage_prop2
Provided to allow configuration control of the proportion of farmers doing second conventional tillag...
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
PLWinterWheat1ToDo
PLWinterWheat1ToDo
Definition: PLWinterWheat.h:38
Farm::FA_RSM
virtual bool FA_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1154
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
PL_WW_FERTI_P1
#define PL_WW_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: PLWinterWheat.h:28
pl_ww_start
Definition: PLWinterWheat.h:39
Calendar::Date
long Date(void)
Definition: Calendar.h:57
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
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
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
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
cfg_WW_isecticide_prop2
CfgFloat cfg_WW_isecticide_prop2
Provided to allow configuration control of the proportion of farmers doing second insecticide spray i...
PL_WW_DECIDE_TO_GR
#define PL_WW_DECIDE_TO_GR
Definition: PLWinterWheat.h:31
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
pl_ww_fungicide2
Definition: PLWinterWheat.h:73
pl_ww_fungicide4
Definition: PLWinterWheat.h:75
pl_ww_herbicide1
Definition: PLWinterWheat.h:57
cfg_WW_isecticide_prop3
CfgFloat cfg_WW_isecticide_prop3
Provided to allow configuration control of the proportion of farmers doing third insecticide spray in...
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
CfgArray_Double
Definition: Configurator.h:208
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
PLWinterWheat::PLWinterWheat
PLWinterWheat(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PLWinterWheat.h:103
pl_ww_autumn_roll
Definition: PLWinterWheat.h:50
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
pl_ww_stubble_harrow
Definition: PLWinterWheat.h:46
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
pl_ww_stubble_plough
Definition: PLWinterWheat.h:43
Crop::m_field
LE * m_field
Definition: Farm.h:499
pl_ww_harvest
Definition: PLWinterWheat.h:80
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: FarmFuncs.cpp:325
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
PLWINTERWHEAT_BASE
#define PLWINTERWHEAT_BASE
Definition: PLWinterWheat.h:24
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
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
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
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
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
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.
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
pl_ww_fungicide1
Definition: PLWinterWheat.h:58
cfg_seedcoating_winterwheat_on
CfgBool cfg_seedcoating_winterwheat_on
Turn on seed coating for winter wheat.
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
tov_PLWinterWheat
Definition: LandscapeFarmingEnums.h:232
LE
Definition: Elements.h:86
pl_ww_ferti_p8
Definition: PLWinterWheat.h:68
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
pl_ww_ferti_s9
Definition: PLWinterWheat.h:71
pl_ww_foobar
Definition: PLWinterWheat.h:87
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
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
PLWinterWheat::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLWinterWheat.h:112
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
cfg_WW_conv_tillage_prop1
CfgFloat cfg_WW_conv_tillage_prop1
Provided to allow configuration control of the proportion of farmers doing first conventional tillage...
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
Farm
The base class for all farm types.
Definition: Farm.h:755
pl_ww_sleep_all_day
Definition: PLWinterWheat.h:40
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
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
pl_ww_insecticide1
Definition: PLWinterWheat.h:59
Farm::FP_RSM
virtual bool FP_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:940
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
pl_ww_growth_regulator1
Definition: PLWinterWheat.h:78
pl_ww_ferti_s3
Definition: PLWinterWheat.h:53
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
pl_ww_stubble_cultivator_heavy
Definition: PLWinterWheat.h:51
pl_ww_ferti_p5
Definition: PLWinterWheat.h:62
pl_ww_autumn_sow
Definition: PLWinterWheat.h:56
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
PL_WW_FERTI_S1
#define PL_WW_FERTI_S1
Definition: PLWinterWheat.h:29
pl_ww_preseeding_cultivator
Definition: PLWinterWheat.h:54
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
pl_ww_ferti_p7
Definition: PLWinterWheat.h:66
PLWinterWheat
PLWinterWheat class .
Definition: PLWinterWheat.h:99
pl_ww_straw_chopping
Definition: PLWinterWheat.h:81
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
pl_ww_ferti_s11
Definition: PLWinterWheat.h:86
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
pl_ww_ferti_p1
Definition: PLWinterWheat.h:41
cfg_WW_NINV_tillage_prop1
CfgFloat cfg_WW_NINV_tillage_prop1
Provided to allow configuration control of the proportion of farmers doing first non-inversion tillag...
pl_ww_growth_regulator2
Definition: PLWinterWheat.h:79
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
pl_ww_ferti_s1
Definition: PLWinterWheat.h:42
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:630
Crop::SimpleEvent_
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.
Definition: Farm.cpp:751