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
IRGrassland_no_reseed.h
Go to the documentation of this file.
1 
15 //
16 // IRGrassland_no_reseed.h
17 //
18 /*
19 
20 Copyright (c) 2021, Christopher John Topping, Aarhus University
21 All rights reserved.
22 
23 
24 Redistribution and use in source and binary forms, with or without
25 modification, are permitted provided that the following conditions are met:
26 
27 *) Redistributions of source code must retain the above copyright notice, this
28 list of conditions and the following disclaimer.
29 *) Redistributions in binary form must reproduce the above copyright notice,
30 this list of conditions and the following disclaimer in the documentation
31 and/or other materials provided with the distribution.
32 *) Neither the name of the NERI nor the names of its contributors
33 may be used to endorse or promote products derived from this software without
34 specific prior written permission.
35 
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 POSSIBILITY OF SUCH DAMAGE.
47 
48 */
49 
50 #ifndef IRGRASSLAND_N_RS_H
51 #define IRGRASSLAND_N_RS_H
52 
53 #define IR_GNRS_BASE 90300
54 
57 #define IR_GNRS_W_SIL a_field->m_user[0]
58 #define IR_GNRS_W_SIL_1 a_field->m_user[1]
59 #define IR_GNRS_W_SIL_2 a_field->m_user[2]
60 #define IR_GNRS_EARLY a_field->m_user[3]
61 #define IR_GNRS_MID a_field->m_user[4]
62 #define IR_GNRS_LATE a_field->m_user[5]
63 #define IR_GNRS_PEST_APP a_field->m_user[6]
64 #define IR_GNRS_PEST_APP_1 a_field->m_user[7]
65 #define IR_GNRS_PEST_APP_2 a_field->m_user[8]
66 
67 
73 typedef enum {
74  ir_gnrs_start = 1, // Compulsory, must always be 1 (one).
114 
115 
125 {
126 public:
127  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
128  IRGrassland_no_reseed(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
129  {
130  // When we start it off, the first possible date for a farm operation is 1st October
131  // This information is used by other crops when they decide how much post processing of
132  // the management is allowed after harvest before the next crop starts.
133  m_first_date = g_date->DayInYear(16, 8);
135  }
137  const int elements = 2 + (ir_gnrs_foobar - IR_GNRS_BASE);
139 
140  FarmManagementCategory catlist[elements] =
141  {
142  fmc_Others, // zero element unused but must be here ir_gnrs_start = 1, // Compulsory, must always be 1 (one).
143  fmc_Others, // ir_gnrs_sleep_all_day = IR_GNRS_BASE,
144  fmc_Fertilizer, // ir_gnrs_ferti_s1,
145  fmc_Fertilizer, // ir_gnrs_ferti_p1,
146  fmc_Fertilizer, // ir_gnrs_ferti_s2,
147  fmc_Fertilizer, // ir_gnrs_ferti_p2,
148  fmc_Grazing, // ir_gnrs_grazing1,
149  fmc_Grazing, // ir_gnrs_cattle_out1,
150  fmc_Fertilizer, // ir_gnrs_ferti_s3,
151  fmc_Fertilizer, // ir_gnrs_ferti_p3,
152  fmc_Herbicide, // ir_gnrs_herbicide1,
153  fmc_Fertilizer, // ir_gnrs_ferti_s4_s,
154  fmc_Fertilizer, // ir_gnrs_ferti_p4_s,
155  fmc_Fertilizer, // ir_gnrs_ferti_s4_c,
156  fmc_Fertilizer, // ir_gnrs_ferti_p4_c,
157  fmc_Cutting, // ir_gnrs_cutting1,
158  fmc_Grazing, // ir_gnrs_grazing2,
159  fmc_Grazing, // ir_gnrs_cattle_out2,
160  fmc_Fertilizer, // ir_gnrs_ferti_s5,
161  fmc_Fertilizer, // ir_gnrs_ferti_p5,
162  fmc_Herbicide, // ir_gnrs_herbicide2,
163  fmc_Fertilizer, // ir_gnrs_ferti_s6_s,
164  fmc_Fertilizer, // ir_gnrs_ferti_p6_s,
165  fmc_Fertilizer, // ir_gnrs_ferti_s6_c,
166  fmc_Fertilizer, // ir_gnrs_ferti_p6_c,
167  fmc_Cutting, // ir_gnrs_cutting2,
168  fmc_Grazing, // ir_gnrs_grazing3,
169  fmc_Grazing, // ir_gnrs_cattle_out3,
170  fmc_Fertilizer, // ir_gnrs_ferti_s7,
171  fmc_Fertilizer, // ir_gnrs_ferti_p7,
172  fmc_Herbicide, // ir_gnrs_herbicide3,
173  fmc_Fertilizer, // ir_gnrs_ferti_s8_c,
174  fmc_Fertilizer, // ir_gnrs_ferti_p8_c,
175  fmc_Fertilizer, // ir_gnrs_ferti_s8_s,
176  fmc_Fertilizer, // ir_gnrs_ferti_p8_s,
177  fmc_Cutting, // ir_gnrs_cutting3,
178  fmc_Grazing, // ir_gnrs_grazing4,
179  fmc_Grazing, // ir_gnrs_cattle_out4,
180 
181 
182 
183  // no foobar entry
184 
185  };
186  // Iterate over the catlist elements and copy them to vector
187  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
188 
189  }
190 };
191 
192 #endif // IRGRASSLAND_N_RS_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
ir_gnrs_cattle_out4
Definition: IRGrassland_no_reseed.h:111
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
ir_gnrs_ferti_p4_c
Definition: IRGrassland_no_reseed.h:88
ir_gnrs_ferti_p4_s
Definition: IRGrassland_no_reseed.h:86
IR_GNRS_W_SIL_1
#define IR_GNRS_W_SIL_1
Definition: IRGrassland_no_reseed.h:58
IR_GNRS_PEST_APP_1
#define IR_GNRS_PEST_APP_1
Definition: IRGrassland_no_reseed.h:64
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
ir_gnrs_herbicide1
Definition: IRGrassland_no_reseed.h:84
ir_gnrs_cattle_out2
Definition: IRGrassland_no_reseed.h:91
ir_gnrs_cutting2
Definition: IRGrassland_no_reseed.h:99
ir_gnrs_ferti_s2
Definition: IRGrassland_no_reseed.h:78
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
ir_gnrs_ferti_s8_s
Definition: IRGrassland_no_reseed.h:107
Farm::CattleIsOut
virtual bool CattleIsOut(LE *a_field, double a_user, int a_days, int a_max)
Generate a 'cattle_out' event for every day the cattle are on a_field.
Definition: FarmFuncs.cpp:2470
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::CutToSilage
virtual bool CutToSilage(LE *a_field, double a_user, int a_days)
Cut vegetation for silage on a_field.
Definition: FarmFuncs.cpp:1644
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
IRGrassland_no_reseed
IRGrassland_no_reseed class .
Definition: IRGrassland_no_reseed.h:124
ir_gnrs_ferti_s1
Definition: IRGrassland_no_reseed.h:76
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
ir_gnrs_ferti_p2
Definition: IRGrassland_no_reseed.h:79
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
IRGrassland_no_reseedToDo
IRGrassland_no_reseedToDo
Definition: IRGrassland_no_reseed.h:73
cfg_GNRS_InsecticideDay
CfgInt cfg_GNRS_InsecticideDay
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
ir_gnrs_cutting3
Definition: IRGrassland_no_reseed.h:109
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
ir_gnrs_ferti_p6_c
Definition: IRGrassland_no_reseed.h:98
IR_GNRS_BASE
#define IR_GNRS_BASE
Definition: IRGrassland_no_reseed.h:53
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
ir_gnrs_ferti_p5
Definition: IRGrassland_no_reseed.h:93
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
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
ir_gnrs_ferti_s6_s
Definition: IRGrassland_no_reseed.h:95
Crop
The base class for all crops.
Definition: Farm.h:495
cfg_IR_Grassland_no_reseed_SkScrapes
CfgBool cfg_IR_Grassland_no_reseed_SkScrapes("IR_CROP_GNRS_SK_SCRAPES", CFG_CUSTOM, false)
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
ir_gnrs_ferti_p3
Definition: IRGrassland_no_reseed.h:83
IR_GNRS_PEST_APP
#define IR_GNRS_PEST_APP
Definition: IRGrassland_no_reseed.h:63
IR_GNRS_W_SIL_2
#define IR_GNRS_W_SIL_2
Definition: IRGrassland_no_reseed.h:59
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
ir_gnrs_ferti_p7
Definition: IRGrassland_no_reseed.h:103
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
ir_gnrs_cutting1
Definition: IRGrassland_no_reseed.h:89
IR_GNRS_W_SIL
#define IR_GNRS_W_SIL
A flag used to indicate autumn ploughing status.
Definition: IRGrassland_no_reseed.h:57
cfg_fungi_app_prop2
CfgFloat cfg_fungi_app_prop2
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
ir_gnrs_ferti_p1
Definition: IRGrassland_no_reseed.h:77
IR_GNRS_LATE
#define IR_GNRS_LATE
Definition: IRGrassland_no_reseed.h:62
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
cfg_GNRS_InsecticideMonth
CfgInt cfg_GNRS_InsecticideMonth
IR_GNRS_EARLY
#define IR_GNRS_EARLY
Definition: IRGrassland_no_reseed.h:60
ir_gnrs_grazing3
Definition: IRGrassland_no_reseed.h:100
ir_gnrs_ferti_s7
Definition: IRGrassland_no_reseed.h:102
ir_gnrs_ferti_s3
Definition: IRGrassland_no_reseed.h:82
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
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
ir_gnrs_grazing4
Definition: IRGrassland_no_reseed.h:110
ir_gnrs_ferti_s4_s
Definition: IRGrassland_no_reseed.h:85
cfg_pest_grassland_n_rs_on
CfgBool cfg_pest_grassland_n_rs_on
ir_gnrs_sleep_all_day
Definition: IRGrassland_no_reseed.h:75
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
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
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
ir_gnrs_ferti_s5
Definition: IRGrassland_no_reseed.h:92
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
ir_gnrs_ferti_p8_s
Definition: IRGrassland_no_reseed.h:108
ir_gnrs_herbicide2
Definition: IRGrassland_no_reseed.h:94
ir_gnrs_cattle_out3
Definition: IRGrassland_no_reseed.h:101
IRGrassland_no_reseed::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: IRGrassland_no_reseed.h:136
fmc_Grazing
Definition: LandscapeFarmingEnums.h:1010
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
ir_gnrs_herbicide3
Definition: IRGrassland_no_reseed.h:104
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
Farm
The base class for all farm types.
Definition: Farm.h:755
ir_gnrs_ferti_s6_c
Definition: IRGrassland_no_reseed.h:97
IR_GNRS_PEST_APP_2
#define IR_GNRS_PEST_APP_2
Definition: IRGrassland_no_reseed.h:65
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
IRGrassland_no_reseed::IRGrassland_no_reseed
IRGrassland_no_reseed(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: IRGrassland_no_reseed.h:128
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
ir_gnrs_grazing2
Definition: IRGrassland_no_reseed.h:90
ir_gnrs_ferti_p6_s
Definition: IRGrassland_no_reseed.h:96
CFG_CUSTOM
Definition: Configurator.h:70
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.
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
ir_gnrs_ferti_s4_c
Definition: IRGrassland_no_reseed.h:87
ir_gnrs_ferti_p8_c
Definition: IRGrassland_no_reseed.h:106
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
ir_gnrs_cattle_out1
Definition: IRGrassland_no_reseed.h:81
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Farm::CattleOut
virtual bool CattleOut(LE *a_field, double a_user, int a_days)
Start a grazing event on a_field today.
Definition: FarmFuncs.cpp:2368
IRGrassland_no_reseed::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: IRGrassland_no_reseed.cpp:98
ir_gnrs_start
Definition: IRGrassland_no_reseed.h:74
ir_gnrs_ferti_s8_c
Definition: IRGrassland_no_reseed.h:105
WARN_BUG
Definition: MapErrorMsg.h:34
ir_gnrs_grazing1
Definition: IRGrassland_no_reseed.h:80
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
ir_gnrs_foobar
Definition: IRGrassland_no_reseed.h:112
IR_GNRS_MID
#define IR_GNRS_MID
Definition: IRGrassland_no_reseed.h:61
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