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
NLPotatoes.h
Go to the documentation of this file.
1 
16 //
17 // NLPotatoes.h
18 //
19 
20 
21 #ifndef NLPOTATOES_H
22 #define NLPOTATOES_H
23 
24 #define NLPOTATOES_BASE 22000
25 
28 #define NL_POT_HERBI a_field->m_user[1]
29 #define NL_POT_FUNGI1 a_field->m_user[2]
30 #define NL_POT_FUNGI2 a_field->m_user[3]
31 #define NL_POT_FUNGI3 a_field->m_user[4]
32 #define NL_POT_FUNGI4 a_field->m_user[5]
33 #define NL_POT_FUNGI5 a_field->m_user[6]
34 
40 typedef enum {
41  nl_pot_start = 1, // Compulsory, must always be 1 (one).
85 
86 
95 class NLPotatoes: public Crop
96 {
97  public:
98  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
99  NLPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
100  {
101  // When we start it off, the first possible date for a farm operation is 5th November
102  // This information is used by other crops when they decide how much post processing of
103  // the management is allowed after harvest before the next crop starts.
104  m_first_date=g_date->DayInYear( 5,11 );
105  m_forcespringpossible = true;
107  }
109  const int elements = 2 + (nl_pot_foobar - NLPOTATOES_BASE);
111 
112  FarmManagementCategory catlist[elements] =
113  {
114  fmc_Others, // zero element unused but must be here
115  fmc_Others,//nl_pot_start = 1, // Compulsory, must always be 1 (one).
116  fmc_Others,//nl_pot_sleep_all_day = NLPOTATOES_BASE,
117  fmc_Cultivation,//nl_pot_stubble_harrow,
118  fmc_Cultivation,//nl_pot_winter_plough_clay,
119  fmc_Fertilizer,//nl_pot_ferti_p2_clay,
120  fmc_Fertilizer,//nl_pot_ferti_s2_clay,
121  fmc_Fertilizer,//nl_pot_ferti_p1_sandy,
122  fmc_Fertilizer,//nl_pot_ferti_s1_sandy,
123  fmc_Cultivation,//nl_pot_spring_plough_sandy,
124  fmc_Fertilizer,//nl_pot_ferti_p2_sandy,
125  fmc_Fertilizer,//nl_pot_ferti_s2_sandy,
126  fmc_Others,//nl_pot_bed_forming,
127  fmc_Others,//nl_pot_spring_planting,
128  fmc_Others,//nl_pot_hilling1,
129  fmc_Fertilizer,//nl_pot_ferti_p3_clay,
130  fmc_Fertilizer,//nl_pot_ferti_s3_clay,
131  fmc_Fertilizer,//nl_pot_ferti_p3_sandy,
132  fmc_Fertilizer,//nl_pot_ferti_s3_sandy,
133  fmc_Fertilizer,//nl_pot_ferti_p4,
134  fmc_Fertilizer,//nl_pot_ferti_s4,
135  fmc_Herbicide,//nl_pot_herbicide1,
136  fmc_Herbicide,//nl_pot_herbicide2,
137  fmc_Fungicide,//nl_pot_fungicide1,
138  fmc_Fungicide,//nl_pot_fungicide2,
139  fmc_Fungicide,//nl_pot_fungicide3,
140  fmc_Fungicide,//nl_pot_fungicide4,
141  fmc_Fungicide,//nl_pot_fungicide5,
142  fmc_Fungicide,//nl_pot_fungicide6,
143  fmc_Fungicide,//nl_pot_fungicide7,
144  fmc_Fungicide,//nl_pot_fungicide8,
145  fmc_Fungicide,//nl_pot_fungicide9,
146  fmc_Fungicide,//nl_pot_fungicide10,
147  fmc_Fungicide,//nl_pot_fungicide11,
148  fmc_Fungicide,//nl_pot_fungicide12,
149  fmc_Fungicide,//nl_pot_fungicide13,
150  fmc_Fungicide,//nl_pot_fungicide14,
151  fmc_Fungicide,//nl_pot_fungicide15,
152  fmc_Insecticide,//nl_pot_insecticide,
153  fmc_Others,//nl_pot_dessication1,
154  fmc_Others,//nl_pot_dessication2,
155  fmc_Harvest//nl_pot_harvest,
156 
157  // no foobar entry
158 
159  };
160  // Iterate over the catlist elements and copy them to vector
161  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
162 
163  }
164 };
165 
166 #endif // NLPOTATOES_H
167 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
nl_pot_ferti_p4
Definition: NLPotatoes.h:59
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
NLPotatoesToDo
NLPotatoesToDo
Definition: NLPotatoes.h:40
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
nl_pot_ferti_s3_clay
Definition: NLPotatoes.h:56
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
nl_pot_foobar
Definition: NLPotatoes.h:83
nl_pot_stubble_harrow
Definition: NLPotatoes.h:43
nl_pot_herbicide2
Definition: NLPotatoes.h:62
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
NLPotatoes::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: NLPotatoes.cpp:64
nl_pot_fungicide8
Definition: NLPotatoes.h:70
nl_pot_ferti_p2_sandy
Definition: NLPotatoes.h:50
nl_pot_fungicide1
Definition: NLPotatoes.h:63
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
nl_pot_harvest
Definition: NLPotatoes.h:82
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::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
nl_pot_fungicide9
Definition: NLPotatoes.h:71
NL_POT_FUNGI1
#define NL_POT_FUNGI1
Definition: NLPotatoes.h:29
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
Farm::BedForming
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
Definition: FarmFuncs.cpp:1316
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
NL_POT_FUNGI3
#define NL_POT_FUNGI3
Definition: NLPotatoes.h:31
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
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
nl_pot_ferti_s4
Definition: NLPotatoes.h:60
nl_pot_ferti_s2_clay
Definition: NLPotatoes.h:46
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
nl_pot_herbicide1
Definition: NLPotatoes.h:61
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
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
NLPotatoes::NLPotatoes
NLPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: NLPotatoes.h:99
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
NLPotatoes::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLPotatoes.h:108
nl_pot_ferti_p3_clay
Definition: NLPotatoes.h:55
nl_pot_ferti_s2_sandy
Definition: NLPotatoes.h:51
Crop
The base class for all crops.
Definition: Farm.h:495
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
nl_pot_fungicide3
Definition: NLPotatoes.h:65
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
nl_pot_winter_plough_clay
Definition: NLPotatoes.h:44
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
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
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
NLPotatoes
NLPotatoes class .
Definition: NLPotatoes.h:95
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
NL_POT_FUNGI2
#define NL_POT_FUNGI2
Definition: NLPotatoes.h:30
nl_pot_ferti_s1_sandy
Definition: NLPotatoes.h:48
nl_pot_ferti_p3_sandy
Definition: NLPotatoes.h:57
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
nl_pot_dessication2
Definition: NLPotatoes.h:81
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
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.
nl_pot_hilling1
Definition: NLPotatoes.h:54
NL_POT_FUNGI5
#define NL_POT_FUNGI5
Definition: NLPotatoes.h:33
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
nl_pot_fungicide4
Definition: NLPotatoes.h:66
Crop::StartUpCrop
bool StartUpCrop(int a_spring, std::vector< std::vector< int >> a_flexdates, int a_todo)
Holds the translation between the farm operation enum for each cropand the farm management category a...
Definition: Farm.cpp:652
nl_pot_bed_forming
Definition: NLPotatoes.h:52
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
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
cfg_POT_InsecticideDay
CfgInt cfg_POT_InsecticideDay
Provided to allow configuration control of the first insecticide spray in potatoes crops - this chang...
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
nl_pot_spring_plough_sandy
Definition: NLPotatoes.h:49
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
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
nl_pot_start
Definition: NLPotatoes.h:41
nl_pot_fungicide12
Definition: NLPotatoes.h:74
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
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
nl_pot_fungicide13
Definition: NLPotatoes.h:75
NLPOTATOES_BASE
#define NLPOTATOES_BASE
Definition: NLPotatoes.h:24
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
nl_pot_spring_planting
Definition: NLPotatoes.h:53
nl_pot_fungicide7
Definition: NLPotatoes.h:69
Farm
The base class for all farm types.
Definition: Farm.h:755
nl_pot_fungicide10
Definition: NLPotatoes.h:72
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
nl_pot_ferti_p1_sandy
Definition: NLPotatoes.h:47
nl_pot_dessication1
Definition: NLPotatoes.h:80
nl_pot_fungicide11
Definition: NLPotatoes.h:73
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
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
nl_pot_insecticide
Definition: NLPotatoes.h:78
nl_pot_insecticideb
Definition: NLPotatoes.h:79
nl_pot_fungicide15
Definition: NLPotatoes.h:77
nl_pot_fungicide6
Definition: NLPotatoes.h:68
nl_pot_fungicide14
Definition: NLPotatoes.h:76
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
NL_POT_HERBI
#define NL_POT_HERBI
A flag used to indicate autumn ploughing status.
Definition: NLPotatoes.h:28
nl_pot_ferti_s3_sandy
Definition: NLPotatoes.h:58
nl_pot_ferti_p2_clay
Definition: NLPotatoes.h:45
Crop::m_forcespringpossible
bool m_forcespringpossible
Used to signal that the crop can be forced to start in spring.
Definition: Farm.h:508
nl_pot_fungicide5
Definition: NLPotatoes.h:67
NL_POT_FUNGI4
#define NL_POT_FUNGI4
Definition: NLPotatoes.h:32
nl_pot_fungicide2
Definition: NLPotatoes.h:64
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tov_NLPotatoes
Definition: LandscapeFarmingEnums.h:254
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
nl_pot_sleep_all_day
Definition: NLPotatoes.h:42
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
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