File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/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
TestCrop.h
Go to the documentation of this file.
1 
7 #ifndef TESTCROP_H
8 #define TESTCROP_H
9 
10 #define TESTCROP_BASE 1
11 
14 #define TC_WW_FERTI_P1 a_field->m_user[1]
15 #define TC_WW_FERTI_S1 a_field->m_user[2]
16 #define TC_WW_STUBBLE_PLOUGH a_field->m_user[3]
17 #define TC_WW_DECIDE_TO_GR a_field->m_user[4]
18 
24 typedef enum {
25  testcrop_ww_start = 1, // Compulsory, must always be 1 (one).
74 } TestCropToDo;
75 
76 
77 class TestCrop: public Crop
78 {
79  public:
80  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
81  TestCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
82  {
83  // When we start it off, the first possible date for a farm operation is 20th September
84  // This information is used by other crops when they decide how much post processing of
85  // the management is allowed after harvest before the next crop starts.
86  m_first_date=g_date->DayInYear( 20,9 );
88  }
90  const int elements = 2 + (testcrop_ww_foobar - TESTCROP_BASE);
92 
93  FarmManagementCategory catlist[elements] =
94  {
95  fmc_Others, // zero element unused but must be here
96  fmc_Others,//testcrop_ww_start = 1, // Compulsory, must always be 1 (one).
97  fmc_Others,//testcrop_ww_sleep_all_day = TESTCROP_BASE,
98  fmc_Fertilizer,//testcrop_ww_ferti_p1,
99  fmc_Fertilizer,//testcrop_ww_ferti_s1,
100  fmc_Cultivation,//testcrop_ww_stubble_plough,
101  fmc_Cultivation,//testcrop_ww_autumn_harrow1,
102  fmc_Cultivation,//testcrop_ww_autumn_harrow2,
103  fmc_Cultivation,//testcrop_ww_stubble_harrow,
104  fmc_Fertilizer,//testcrop_ww_ferti_p2,
105  fmc_Fertilizer,//testcrop_ww_ferti_s2,
106  fmc_Cultivation,//testcrop_ww_autumn_plough,
107  fmc_Others,//testcrop_ww_autumn_roll,
108  fmc_Cultivation,//testcrop_ww_stubble_cultivator_heavy,
109  fmc_Fertilizer,//testcrop_ww_ferti_p3,
110  fmc_Fertilizer,//testcrop_ww_ferti_s3,
111  fmc_Cultivation,//testcrop_ww_preseeding_cultivator,
112  fmc_Cultivation,//testcrop_ww_preseeding_cultivator_sow,
113  fmc_Others,//testcrop_ww_autumn_sow,
114  fmc_Herbicide,//testcrop_ww_herbicide1,
115  fmc_Fungicide,//testcrop_ww_fungicide1,
116  fmc_Insecticide,//testcrop_ww_insecticide1,
117  fmc_Fertilizer,//testcrop_ww_ferti_p4,
118  fmc_Fertilizer,//testcrop_ww_ferti_s4,
119  fmc_Fertilizer,//testcrop_ww_ferti_p5,
120  fmc_Fertilizer,//testcrop_ww_ferti_s5,
121  fmc_Fertilizer,//testcrop_ww_ferti_p6,
122  fmc_Fertilizer,//testcrop_ww_ferti_s6,
123  fmc_Fertilizer,//testcrop_ww_ferti_p7,
124  fmc_Fertilizer,//testcrop_ww_ferti_s7,
125  fmc_Fertilizer,//testcrop_ww_ferti_p8,
126  fmc_Fertilizer,//testcrop_ww_ferti_s8,
127  fmc_Fertilizer,//testcrop_ww_ferti_p9,
128  fmc_Fertilizer,//testcrop_ww_ferti_s9,
129  fmc_Herbicide,//testcrop_ww_herbicide2,
130  fmc_Fungicide,//testcrop_ww_fungicide2,
131  fmc_Fungicide,//testcrop_ww_fungicide3,
132  fmc_Fungicide,//testcrop_ww_fungicide4,
133  fmc_Insecticide,//testcrop_ww_insecticide2,
134  fmc_Insecticide,//testcrop_ww_insecticide3,
135  fmc_Others,//testcrop_ww_growth_regulator1,
136  fmc_Others,//testcrop_ww_growth_regulator2,
137  fmc_Harvest,//testcrop_ww_harvest,
138  fmc_Others,//testcrop_ww_straw_chopping,
139  fmc_Others,//testcrop_ww_hay_bailing,
140  fmc_Fertilizer,//testcrop_ww_ferti_p10,
141  fmc_Fertilizer,//testcrop_ww_ferti_s10,
142  fmc_Fertilizer,//testcrop_ww_ferti_p11,
143  fmc_Fertilizer//testcrop_ww_ferti_s11,
144 
145  // no foobar entry
146 
147  };
148  // Iterate over the catlist elements and copy them to vector
149  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
150 
151  }
152 };
153 
154 #endif // TESTCROP_H
155 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
testcrop_ww_fungicide2
Definition: TestCrop.h:59
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
TC_WW_DECIDE_TO_GR
#define TC_WW_DECIDE_TO_GR
Definition: TestCrop.h:17
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...
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
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.
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
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
testcrop_ww_preseeding_cultivator_sow
Definition: TestCrop.h:41
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
TestCrop::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: TestCrop.cpp:54
testcrop_ww_ferti_p9
Definition: TestCrop.h:56
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
cfg_pest_winterwheat_on
CfgBool cfg_pest_winterwheat_on
Turn on pesticides for winter wheat.
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
TestCropToDo
TestCropToDo
Definition: TestCrop.h:24
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
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...
Farm::GetFarmer
Farmer * GetFarmer()
Returns the pointer to this farm's farmer.
Definition: Farm.h:817
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
testcrop_ww_fungicide3
Definition: TestCrop.h:60
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
testcrop_ww_ferti_p7
Definition: TestCrop.h:52
testcrop_ww_stubble_plough
Definition: TestCrop.h:29
CfgFloat::value
double value() const
Definition: Configurator.h:142
testcrop_ww_ferti_p8
Definition: TestCrop.h:54
testcrop_ww_autumn_sow
Definition: TestCrop.h:42
testcrop_ww_straw_chopping
Definition: TestCrop.h:67
testcrop_ww_ferti_p10
Definition: TestCrop.h:69
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
testcrop_ww_ferti_s8
Definition: TestCrop.h:55
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
testcrop_ww_start
Definition: TestCrop.h:25
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
testcrop_ww_harvest
Definition: TestCrop.h:66
testcrop_ww_ferti_s7
Definition: TestCrop.h:53
TestCrop
Definition: TestCrop.h:77
Crop
The base class for all crops.
Definition: Farm.h:495
testcrop_ww_ferti_p5
Definition: TestCrop.h:48
CfgBool::value
bool value() const
Definition: Configurator.h:164
testcrop_ww_stubble_harrow
Definition: TestCrop.h:32
TC_WW_FERTI_P1
#define TC_WW_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: TestCrop.h:14
testcrop_ww_stubble_cultivator_heavy
Definition: TestCrop.h:37
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
TestCrop::TestCrop
TestCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: TestCrop.h:81
testcrop_ww_herbicide1
Definition: TestCrop.h:43
testcrop_ww_preseeding_cultivator
Definition: TestCrop.h:40
testcrop_ww_growth_regulator1
Definition: TestCrop.h:64
Calendar::Date
long Date(void)
Definition: Calendar.h:57
testcrop_ww_ferti_s1
Definition: TestCrop.h:28
testcrop_ww_ferti_s10
Definition: TestCrop.h:70
testcrop_ww_autumn_harrow2
Definition: TestCrop.h:31
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
testcrop_ww_ferti_s4
Definition: TestCrop.h:47
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
testcrop_ww_ferti_p4
Definition: TestCrop.h:46
cfg_WW_isecticide_prop1
CfgFloat cfg_WW_isecticide_prop1
Provided to allow configuration control of the proportion of farmers doing first insecticide spray in...
testcrop_ww_autumn_roll
Definition: TestCrop.h:36
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
testcrop_ww_herbicide2
Definition: TestCrop.h:58
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
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
testcrop_ww_autumn_harrow1
Definition: TestCrop.h:30
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
cfg_WW_isecticide_prop2
CfgFloat cfg_WW_isecticide_prop2
Provided to allow configuration control of the proportion of farmers doing second insecticide spray i...
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
testcrop_ww_insecticide1
Definition: TestCrop.h:45
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
testcrop_ww_ferti_s11
Definition: TestCrop.h:72
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
testcrop_ww_ferti_s3
Definition: TestCrop.h:39
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
testcrop_ww_ferti_s2
Definition: TestCrop.h:34
TestCrop::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: TestCrop.h:89
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
cfg_WW_isecticide_prop3
CfgFloat cfg_WW_isecticide_prop3
Provided to allow configuration control of the proportion of farmers doing third insecticide spray in...
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...
testcrop_ww_autumn_plough
Definition: TestCrop.h:35
testcrop_ww_growth_regulator2
Definition: TestCrop.h:65
testcrop_ww_fungicide4
Definition: TestCrop.h:61
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
TESTCROP_BASE
#define TESTCROP_BASE
Definition: TestCrop.h:10
Farm
The base class for all farm types.
Definition: Farm.h:755
testcrop_ww_ferti_p11
Definition: TestCrop.h:71
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...
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
testcrop_ww_insecticide3
Definition: TestCrop.h:63
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
testcrop_ww_sleep_all_day
Definition: TestCrop.h:26
testcrop_ww_hay_bailing
Definition: TestCrop.h:68
testcrop_ww_ferti_p1
Definition: TestCrop.h:27
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
testcrop_ww_ferti_s5
Definition: TestCrop.h:49
TC_WW_FERTI_S1
#define TC_WW_FERTI_S1
Definition: TestCrop.h:15
testcrop_ww_ferti_p2
Definition: TestCrop.h:33
testcrop_ww_insecticide2
Definition: TestCrop.h:62
testcrop_ww_ferti_p6
Definition: TestCrop.h:50
testcrop_ww_foobar
Definition: TestCrop.h:73
testcrop_ww_ferti_s9
Definition: TestCrop.h:57
testcrop_ww_ferti_p3
Definition: TestCrop.h:38
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
TC_WW_STUBBLE_PLOUGH
#define TC_WW_STUBBLE_PLOUGH
Definition: TestCrop.h:16
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
testcrop_ww_fungicide1
Definition: TestCrop.h:44
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
testcrop_ww_ferti_s6
Definition: TestCrop.h:51