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
NLGrassGrazedExtensiveLast.h
Go to the documentation of this file.
1 
16 //
17 // NLGrassGrazedExtensiveLast.h
18 //
19 
20 
21 #ifndef NLGRASSGRAZEDEXTENSIVELAST_H
22 #define NLGRASSGRAZEDEXTENSIVELAST_H
23 
24 #define NLGRASSGRAZEDEXTENSIVELAST_BASE 21300
25 
28 #define NL_GGEL_FERTI_DATE a_field->m_user[1]
29 #define NL_GGEL_CUT_DATE a_field->m_user[2]
30 #define NL_GGEL_WATER_DATE a_field->m_user[3]
31 
32 
38 typedef enum {
39  nl_ggel_start = 1, // Compulsory, must always be 1 (one).
61 
62 
72 {
73  public:
74  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
76  {
77  // When we start it off, the first possible date for a farm operation is 5th November
78  // This information is used by other crops when they decide how much post processing of
79  // the management is allowed after harvest before the next crop starts.
80  m_first_date = g_date->DayInYear(30, 3);
82  }
84  const int elements = 2 + (nl_ggel_foobar - NLGRASSGRAZEDEXTENSIVELAST_BASE);
86 
87  FarmManagementCategory catlist[elements] =
88  {
89  fmc_Others, // zero element unused but must be here
90  fmc_Others,//nl_ggel_start = 1, // Compulsory, must always be 1 (one).
91  fmc_Others,//nl_ggel_sleep_all_day = NLGRASSGRAZEDEXTENSIVELAST_BASE,
92  fmc_Fertilizer,//nl_ggel_ferti_p1,
93  fmc_Fertilizer,//nl_ggel_ferti_s1,
94  fmc_Cutting,//nl_ggel_cut_to_silage1,
95  fmc_Cutting,//nl_ggel_cut_to_silage2,
96  fmc_Fertilizer,//nl_ggel_ferti_p2,
97  fmc_Fertilizer,//nl_ggel_ferti_s2,
98  fmc_Fertilizer,//nl_ggel_ferti_p3,
99  fmc_Fertilizer,//nl_ggel_ferti_s3,
100  fmc_Fertilizer,//nl_ggel_ferti_p4,
101  fmc_Fertilizer,//nl_ggel_ferti_s4,
102  fmc_Fertilizer,//nl_ggel_ferti_p5,
103  fmc_Fertilizer,//nl_ggel_ferti_s5,
104  fmc_Fertilizer,//nl_ggel_ferti_p6,
105  fmc_Fertilizer,//nl_ggel_ferti_s6,
106  fmc_Watering,//nl_ggel_watering,
107  fmc_Grazing,//nl_ggel_cattle_out,
108  fmc_Grazing,//nl_ggel_cattle_is_out,
109  fmc_Cultivation//nl_ggel_winter_plough_clay,
110 
111  // no foobar entry
112 
113  };
114  // Iterate over the catlist elements and copy them to vector
115  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
116 
117  }
118 };
119 
120 #endif // NLGRASSGRAZEDEXTENSIVELAST_H
121 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
nl_ggel_ferti_s5
Definition: NLGrassGrazedExtensiveLast.h:52
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
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_ggel_ferti_s6
Definition: NLGrassGrazedExtensiveLast.h:54
NLGRASSGRAZEDEXTENSIVELAST_BASE
#define NLGRASSGRAZEDEXTENSIVELAST_BASE
Definition: NLGrassGrazedExtensiveLast.h:24
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
nl_ggel_watering
Definition: NLGrassGrazedExtensiveLast.h:55
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
nl_ggel_ferti_p5
Definition: NLGrassGrazedExtensiveLast.h:51
nl_ggel_cattle_is_out
Definition: NLGrassGrazedExtensiveLast.h:57
nl_ggel_ferti_s2
Definition: NLGrassGrazedExtensiveLast.h:46
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
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
nl_ggel_cut_to_silage1
Definition: NLGrassGrazedExtensiveLast.h:43
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
NLGrassGrazedExtensiveLast
NLGrassGrazedExtensiveLast class .
Definition: NLGrassGrazedExtensiveLast.h:71
nl_ggel_ferti_p6
Definition: NLGrassGrazedExtensiveLast.h:53
NL_GGEL_CUT_DATE
#define NL_GGEL_CUT_DATE
Definition: NLGrassGrazedExtensiveLast.h:29
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
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
nl_ggel_ferti_s4
Definition: NLGrassGrazedExtensiveLast.h:50
Crop
The base class for all crops.
Definition: Farm.h:495
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
nl_ggel_foobar
Definition: NLGrassGrazedExtensiveLast.h:59
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
nl_ggel_cattle_out
Definition: NLGrassGrazedExtensiveLast.h:56
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
NLGrassGrazedExtensiveLast::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLGrassGrazedExtensiveLast.h:83
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
nl_ggel_winter_plough_clay
Definition: NLGrassGrazedExtensiveLast.h:58
NLGrassGrazedExtensiveLastToDo
NLGrassGrazedExtensiveLastToDo
Definition: NLGrassGrazedExtensiveLast.h:38
nl_ggel_ferti_p1
Definition: NLGrassGrazedExtensiveLast.h:41
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp: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_ggel_cut_to_silage2
Definition: NLGrassGrazedExtensiveLast.h:44
NL_GGEL_WATER_DATE
#define NL_GGEL_WATER_DATE
Definition: NLGrassGrazedExtensiveLast.h:30
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
nl_ggel_start
Definition: NLGrassGrazedExtensiveLast.h:39
nl_ggel_ferti_s1
Definition: NLGrassGrazedExtensiveLast.h:42
NLGrassGrazedExtensiveLast::NLGrassGrazedExtensiveLast
NLGrassGrazedExtensiveLast(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: NLGrassGrazedExtensiveLast.h:75
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
nl_ggel_sleep_all_day
Definition: NLGrassGrazedExtensiveLast.h:40
nl_ggel_ferti_p3
Definition: NLGrassGrazedExtensiveLast.h:47
LE
Definition: Elements.h:86
tov_NLGrassGrazedExtensiveLast
Definition: LandscapeFarmingEnums.h:276
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
NL_GGEL_FERTI_DATE
#define NL_GGEL_FERTI_DATE
A flag used to indicate autumn ploughing status.
Definition: NLGrassGrazedExtensiveLast.h:28
fmc_Grazing
Definition: LandscapeFarmingEnums.h:1010
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Farm
The base class for all farm types.
Definition: Farm.h:755
nl_ggel_ferti_p4
Definition: NLGrassGrazedExtensiveLast.h:49
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_ggel_ferti_s3
Definition: NLGrassGrazedExtensiveLast.h:48
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
nl_ggel_ferti_p2
Definition: NLGrassGrazedExtensiveLast.h:45
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
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
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
NLGrassGrazedExtensiveLast::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: NLGrassGrazedExtensiveLast.cpp:54