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
PLPotatoes.h
Go to the documentation of this file.
1 
16 //
17 // PLPotatoes.h
18 //
19 
20 
21 #ifndef PLPOTATOES_H
22 #define PLPOTATOES_H
23 
24 #define PLPOTATOES_BASE 25800
25 
28 #define PL_POT_FERTI_P1 a_field->m_user[1]
29 #define PL_POT_FERTI_S1 a_field->m_user[2]
30 #define PL_POT_STUBBLE_PLOUGH a_field->m_user[3]
31 #define PL_POT_DID_STRIG1 a_field->m_user[4]
32 #define PL_POT_DID_STRIG2 a_field->m_user[5]
33 #define PL_POT_DID_STRIG3 a_field->m_user[6]
34 #define PL_POT_HILL_DATE a_field->m_user[7]
35 #define PL_POT_DID_HILL a_field->m_user[8]
36 #define PL_POT_DID_DESS a_field->m_user[9]
37 
43 typedef enum {
44  pl_pot_start = 1, // Compulsory, must always be 1 (one).
53  pl_pot_ferti_s2, //20910
91 
92 
101 class PLPotatoes: public Crop
102 {
103  public:
104  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
105  PLPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
106  {
107  // When we start it off, the first possible date for a farm operation is 5th November
108  // This information is used by other crops when they decide how much post processing of
109  // the management is allowed after harvest before the next crop starts.
110  m_first_date=g_date->DayInYear( 5,11 );
112  }
114  const int elements = 2 + (pl_pot_foobar - PLPOTATOES_BASE);
116 
117  FarmManagementCategory catlist[elements] =
118  {
119  fmc_Others, // zero element unused but must be here
120  fmc_Others,//pl_pot_start = 1, // Compulsory, must always be 1 (one).
121  fmc_Others,//pl_pot_sleep_all_day = PLPOTATOES_BASE,
122  fmc_Fertilizer,//pl_pot_ferti_s1,
123  fmc_Fertilizer,//pl_pot_ferti_p1,
124  fmc_Cultivation,//pl_pot_stubble_plough,
125  fmc_Cultivation,//pl_pot_autumn_harrow1,
126  fmc_Cultivation,//pl_pot_autumn_harrow2,
127  fmc_Cultivation,//pl_pot_stubble_harrow,
128  fmc_Fertilizer,//pl_pot_ferti_p2,
129  fmc_Fertilizer,//pl_pot_ferti_s2, //20910
130  fmc_Fertilizer,//pl_pot_ferti_p3,
131  fmc_Fertilizer,//pl_pot_ferti_s3,
132  fmc_Cultivation,//pl_pot_winter_plough,
133  fmc_Cultivation,//pl_pot_spring_harrow,
134  fmc_Fertilizer,//pl_pot_ferti_p4,
135  fmc_Fertilizer,//pl_pot_ferti_s4,
136  fmc_Cultivation,//pl_pot_spring_harrow2,
137  fmc_Fertilizer,//pl_pot_ferti_p5,
138  fmc_Fertilizer,//pl_pot_ferti_s5,
139  fmc_Cultivation,//pl_pot_spring_plough, //20920
140  fmc_Others,//pl_pot_bed_forming,
141  fmc_Others,//pl_pot_spring_planting,
142  fmc_Others,//pl_pot_hilling1,
143  fmc_Others,//pl_pot_hilling2,
144  fmc_Others,//pl_pot_hilling3,
145  fmc_Herbicide,//pl_pot_herbicide1,
146  fmc_Others,//pl_pot_hilling4,
147  fmc_Others,//pl_pot_hilling5,
148  fmc_Others,//pl_pot_hilling6,
149  fmc_Herbicide,//pl_pot_herbicide2, //20930
150  fmc_Fertilizer,//pl_pot_ferti_p6,
151  fmc_Fertilizer,//pl_pot_ferti_s6,
152  fmc_Fertilizer,//pl_pot_ferti_p7,
153  fmc_Fertilizer,//pl_pot_ferti_s7,
154  fmc_Fungicide,//pl_pot_fungicide1,
155  fmc_Fungicide,//pl_pot_fungicide2,
156  fmc_Fungicide,//pl_pot_fungicide3,
157  fmc_Fungicide,//pl_pot_fungicide4,
158  fmc_Insecticide,//pl_pot_insecticide,
159  fmc_Others,//pl_pot_dessication1, //20940
160  fmc_Others,//pl_pot_dessication2,
161  fmc_Harvest,//pl_pot_harvest,
162  fmc_Fertilizer,//pl_pot_ferti_p8,
163  fmc_Fertilizer,//pl_pot_ferti_s8,
164 
165  };
166  // Iterate over the catlist elements and copy them to vector
167  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
168 
169  }
170 };
171 
172 #endif // PLPOTATOES_H
173 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pl_pot_herbicide1
Definition: PLPotatoes.h:69
pl_pot_ferti_s6
Definition: PLPotatoes.h:75
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
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::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:421
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
pl_pot_fungicide2
Definition: PLPotatoes.h:79
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
pl_pot_hilling6
Definition: PLPotatoes.h:72
PLPotatoes::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: PLPotatoes.cpp:65
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::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
PLPotatoes::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLPotatoes.h:113
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
pl_pot_sleep_all_day
Definition: PLPotatoes.h:45
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_POT_DID_HILL
#define PL_POT_DID_HILL
Definition: PLPotatoes.h:35
cfg_POT_InsecticideMonth
CfgInt cfg_POT_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in potatoes crops - this chang...
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
PLPotatoes
PLPotatoes class .
Definition: PLPotatoes.h:101
pl_pot_hilling2
Definition: PLPotatoes.h:67
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
pl_pot_dessication1
Definition: PLPotatoes.h:84
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
Farm::SpringSow
virtual bool SpringSow(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 spring on a_field.
Definition: FarmFuncs.cpp:501
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
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
pl_pot_ferti_s5
Definition: PLPotatoes.h:62
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_pot_harvest
Definition: PLPotatoes.h:86
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
Farm::HillingUp
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
Definition: FarmFuncs.cpp:1302
PL_POT_DID_DESS
#define PL_POT_DID_DESS
Definition: PLPotatoes.h:36
Crop
The base class for all crops.
Definition: Farm.h:495
pl_pot_bed_forming
Definition: PLPotatoes.h:64
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
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
pl_pot_autumn_harrow1
Definition: PLPotatoes.h:49
CfgBool::value
bool value() const
Definition: Configurator.h:164
pl_pot_ferti_s4
Definition: PLPotatoes.h:59
PLPotatoes::PLPotatoes
PLPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PLPotatoes.h:105
cfg_seedcoating_potatoes_on
CfgBool cfg_seedcoating_potatoes_on
Turn on seed coating for potatoes.
PL_POT_STUBBLE_PLOUGH
#define PL_POT_STUBBLE_PLOUGH
Definition: PLPotatoes.h:30
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
pl_pot_ferti_p8
Definition: PLPotatoes.h:87
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
pl_pot_ferti_p3
Definition: PLPotatoes.h:54
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
pl_pot_spring_plough
Definition: PLPotatoes.h:63
pl_pot_ferti_s7
Definition: PLPotatoes.h:77
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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
PL_POT_HILL_DATE
#define PL_POT_HILL_DATE
Definition: PLPotatoes.h:34
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::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_pot_autumn_harrow2
Definition: PLPotatoes.h:50
pl_pot_stubble_harrow
Definition: PLPotatoes.h:51
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.
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
pl_pot_ferti_p2
Definition: PLPotatoes.h:52
pl_pot_fungicide1
Definition: PLPotatoes.h:78
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
pl_pot_fungicide4
Definition: PLPotatoes.h:81
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 ...
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
tov_PLPotatoes
Definition: LandscapeFarmingEnums.h:241
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
cfg_POT_InsecticideDay
CfgInt cfg_POT_InsecticideDay
Provided to allow configuration control of the first insecticide spray in potatoes crops - this chang...
pl_pot_ferti_p7
Definition: PLPotatoes.h:76
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
pl_pot_ferti_s1
Definition: PLPotatoes.h:46
pl_pot_start
Definition: PLPotatoes.h:44
pl_pot_hilling1
Definition: PLPotatoes.h:66
pl_pot_insecticide
Definition: PLPotatoes.h:82
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
pl_pot_herbicide2
Definition: PLPotatoes.h:73
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
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
pl_pot_ferti_s8
Definition: PLPotatoes.h:88
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
pl_pot_ferti_p5
Definition: PLPotatoes.h:61
PL_POT_DID_STRIG2
#define PL_POT_DID_STRIG2
Definition: PLPotatoes.h:32
LE
Definition: Elements.h:86
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
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
pl_pot_spring_harrow
Definition: PLPotatoes.h:57
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
pl_pot_hilling5
Definition: PLPotatoes.h:71
Farm
The base class for all farm types.
Definition: Farm.h:755
PL_POT_FERTI_S1
#define PL_POT_FERTI_S1
Definition: PLPotatoes.h:29
PL_POT_DID_STRIG1
#define PL_POT_DID_STRIG1
Definition: PLPotatoes.h:31
PLPOTATOES_BASE
#define PLPOTATOES_BASE
Definition: PLPotatoes.h:24
pl_pot_spring_planting
Definition: PLPotatoes.h:65
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
pl_pot_stubble_plough
Definition: PLPotatoes.h:48
Farm::WinterPlough
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
Definition: FarmFuncs.cpp:395
pl_pot_ferti_p1
Definition: PLPotatoes.h:47
PLPotatoesToDo
PLPotatoesToDo
Definition: PLPotatoes.h:43
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pl_pot_fungicide3
Definition: PLPotatoes.h:80
pl_pot_insecticideb
Definition: PLPotatoes.h:83
pl_pot_winter_plough
Definition: PLPotatoes.h:56
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_pot_ferti_p4
Definition: PLPotatoes.h:58
pl_pot_ferti_s3
Definition: PLPotatoes.h:55
pl_pot_ferti_p6
Definition: PLPotatoes.h:74
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
pl_pot_hilling3
Definition: PLPotatoes.h:68
pl_pot_foobar
Definition: PLPotatoes.h:89
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
pl_pot_spring_harrow2
Definition: PLPotatoes.h:60
pl_pot_ferti_s2
Definition: PLPotatoes.h:53
PL_POT_DID_STRIG3
#define PL_POT_DID_STRIG3
Definition: PLPotatoes.h:33
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
pl_pot_hilling4
Definition: PLPotatoes.h:70
PL_POT_FERTI_P1
#define PL_POT_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: PLPotatoes.h:28
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
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:459
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
pl_pot_dessication2
Definition: PLPotatoes.h:85