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
NLPermanentGrassGrazed.h
Go to the documentation of this file.
1 
16 //
17 // NLPermanentGrassGrazed.h
18 //
19 
20 
21 #ifndef NLPERMANENTGRASSLANDGRAZED_H
22 #define NLPERMANENTGRASSLANDGRAZED_H
23 
24 #define NLPERMANENTGRASSLANDGRAZED_BASE 21800
25 
28 #define NL_PGG_FERTI_DATE a_field->m_user[1]
29 #define NL_PGG_CUT_DATE a_field->m_user[2]
30 #define NL_PGG_WATER_DATE a_field->m_user[3]
31 
32 
38 typedef enum {
39  nl_pgg_start = 1, // Compulsory, must always be 1 (one).
74 
75 
85 {
86  public:
87  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
88  NLPermanentGrassGrazed(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
89  {
90  // When we start it off, the first possible date for a farm operation is 5th November
91  // This information is used by other crops when they decide how much post processing of
92  // the management is allowed after harvest before the next crop starts.
93  m_first_date=g_date->DayInYear( 30,3 );
95  }
97  const int elements = 2 + (nl_pgg_foobar - NLPERMANENTGRASSLANDGRAZED_BASE);
99 
100  FarmManagementCategory catlist[elements] =
101  {
102  fmc_Others, // zero element unused but must be here
103  fmc_Others,//nl_pgg_start = 1, // Compulsory, must always be 1 (one).
104  fmc_Others,//nl_pgg_sleep_all_day = NLPERMANENTGRASSLANDGRAZED_BASE,
105  fmc_Fertilizer,//nl_pgg_ferti_p1,
106  fmc_Fertilizer,//nl_pgg_ferti_s1,
107  fmc_Cutting,//nl_pgg_cut_to_silage1,
108  fmc_Cutting,//nl_pgg_cut_to_silage2,
109  fmc_Cutting,//nl_pgg_cut_to_silage3,
110  fmc_Cutting,//nl_pgg_cut_to_silage4,
111  fmc_Cutting,//nl_pgg_cut_to_silage5,
112  fmc_Cutting,//nl_pgg_cut_to_silage6,
113  fmc_Fertilizer,//nl_pgg_ferti_p2,
114  fmc_Fertilizer,//nl_pgg_ferti_s2,
115  fmc_Fertilizer,//nl_pgg_ferti_p3,
116  fmc_Fertilizer,//nl_pgg_ferti_s3,
117  fmc_Fertilizer,//nl_pgg_ferti_p4,
118  fmc_Fertilizer,//nl_pgg_ferti_s4,
119  fmc_Fertilizer,//nl_pgg_ferti_p5,
120  fmc_Fertilizer,//nl_pgg_ferti_s5,
121  fmc_Fertilizer,//nl_pgg_ferti_p6,
122  fmc_Fertilizer,//nl_pgg_ferti_s6,
123  fmc_Fertilizer,//nl_pgg_ferti_p7,
124  fmc_Fertilizer,//nl_pgg_ferti_s7,
125  fmc_Fertilizer,//nl_pgg_ferti_p8,
126  fmc_Fertilizer,//nl_pgg_ferti_s8,
127  fmc_Fertilizer,//nl_pgg_ferti_p9,
128  fmc_Fertilizer,//nl_pgg_ferti_s9,
129  fmc_Fertilizer,//nl_pgg_ferti_p10,
130  fmc_Fertilizer,//nl_pgg_ferti_s10,
131  fmc_Fertilizer,//nl_pgg_ferti_p11,
132  fmc_Fertilizer,//nl_pgg_ferti_s11,
133  fmc_Watering,//nl_pgg_watering,
134  fmc_Grazing,//nl_pgg_cattle_out,
135  fmc_Grazing//nl_pgg_cattle_is_out,
136 
137  // no foobar entry
138 
139  };
140  // Iterate over the catlist elements and copy them to vector
141  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
142 
143  }
144 };
145 
146 #endif // NLPERMANENTGRASSLANDGRAZED_H
147 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
nl_pgg_ferti_p10
Definition: NLPermanentGrassGrazed.h:65
nl_pgg_cut_to_silage5
Definition: NLPermanentGrassGrazed.h:47
NLPermanentGrassGrazedToDo
NLPermanentGrassGrazedToDo
Definition: NLPermanentGrassGrazed.h:38
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_pgg_ferti_p2
Definition: NLPermanentGrassGrazed.h:49
NLPermanentGrassGrazed::NLPermanentGrassGrazed
NLPermanentGrassGrazed(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: NLPermanentGrassGrazed.h:88
NL_PGG_FERTI_DATE
#define NL_PGG_FERTI_DATE
A flag used to indicate autumn ploughing status.
Definition: NLPermanentGrassGrazed.h:28
nl_pgg_ferti_s5
Definition: NLPermanentGrassGrazed.h:56
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
nl_pgg_ferti_s3
Definition: NLPermanentGrassGrazed.h:52
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
nl_pgg_ferti_p3
Definition: NLPermanentGrassGrazed.h:51
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
NL_PGG_WATER_DATE
#define NL_PGG_WATER_DATE
Definition: NLPermanentGrassGrazed.h:30
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
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
nl_pgg_ferti_s8
Definition: NLPermanentGrassGrazed.h:62
nl_pgg_ferti_p1
Definition: NLPermanentGrassGrazed.h:41
nl_pgg_ferti_s4
Definition: NLPermanentGrassGrazed.h:54
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
nl_pgg_ferti_s10
Definition: NLPermanentGrassGrazed.h:66
NLPERMANENTGRASSLANDGRAZED_BASE
#define NLPERMANENTGRASSLANDGRAZED_BASE
Definition: NLPermanentGrassGrazed.h:24
nl_pgg_cut_to_silage3
Definition: NLPermanentGrassGrazed.h:45
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
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
Crop
The base class for all crops.
Definition: Farm.h:495
nl_pgg_ferti_p11
Definition: NLPermanentGrassGrazed.h:67
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
tov_NLPermanentGrassGrazed
Definition: LandscapeFarmingEnums.h:261
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
nl_pgg_ferti_s9
Definition: NLPermanentGrassGrazed.h:64
nl_pgg_ferti_p8
Definition: NLPermanentGrassGrazed.h:61
Calendar::Date
long Date(void)
Definition: Calendar.h:57
nl_pgg_ferti_s6
Definition: NLPermanentGrassGrazed.h:58
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
NLPermanentGrassGrazed::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: NLPermanentGrassGrazed.cpp:54
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
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
nl_pgg_ferti_s2
Definition: NLPermanentGrassGrazed.h:50
nl_pgg_watering
Definition: NLPermanentGrassGrazed.h:69
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_pgg_cattle_is_out
Definition: NLPermanentGrassGrazed.h:71
nl_pgg_foobar
Definition: NLPermanentGrassGrazed.h:72
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
nl_pgg_ferti_p6
Definition: NLPermanentGrassGrazed.h:57
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
nl_pgg_cut_to_silage2
Definition: NLPermanentGrassGrazed.h:44
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
nl_pgg_sleep_all_day
Definition: NLPermanentGrassGrazed.h:40
LE
Definition: Elements.h:86
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
fmc_Grazing
Definition: LandscapeFarmingEnums.h:1010
nl_pgg_ferti_s7
Definition: NLPermanentGrassGrazed.h:60
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
NLPermanentGrassGrazed::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLPermanentGrassGrazed.h:96
Farm
The base class for all farm types.
Definition: Farm.h:755
nl_pgg_ferti_p9
Definition: NLPermanentGrassGrazed.h:63
nl_pgg_ferti_p7
Definition: NLPermanentGrassGrazed.h:59
nl_pgg_cut_to_silage4
Definition: NLPermanentGrassGrazed.h:46
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
NLPermanentGrassGrazed
NLPermanentGrassGrazed class .
Definition: NLPermanentGrassGrazed.h:84
nl_pgg_ferti_p4
Definition: NLPermanentGrassGrazed.h:53
nl_pgg_start
Definition: NLPermanentGrassGrazed.h:39
nl_pgg_ferti_p5
Definition: NLPermanentGrassGrazed.h:55
nl_pgg_cut_to_silage6
Definition: NLPermanentGrassGrazed.h:48
nl_pgg_ferti_s1
Definition: NLPermanentGrassGrazed.h:42
nl_pgg_cut_to_silage1
Definition: NLPermanentGrassGrazed.h:43
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
NL_PGG_CUT_DATE
#define NL_PGG_CUT_DATE
Definition: NLPermanentGrassGrazed.h:29
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
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
nl_pgg_cattle_out
Definition: NLPermanentGrassGrazed.h:70
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
nl_pgg_ferti_s11
Definition: NLPermanentGrassGrazed.h:68