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
PLFodderLucerne2.h
Go to the documentation of this file.
1 
16 //
17 // PLFodderLucerne2.h
18 //
19 
20 
21 #ifndef PLFODDERLUCERNE2_H
22 #define PLFODDERLUCERNE2_H
23 
24 #define PLFODDERLUCERNE2_BASE 25500
25 
31 typedef enum {
32  pl_fl2_start = 1, // Compulsory, must always be 1 (one).
56 
57 
66 class PLFodderLucerne2 : public Crop
67 {
68 public:
69  virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev);
70  PLFodderLucerne2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
71  {
72  // When we start it off, the first possible date for a farm operation is 31th March
73  // This information is used by other crops when they decide how much post processing of
74  // the management is allowed after harvest before the next crop starts.
75  m_first_date = g_date->DayInYear(31, 3);
77  }
79  const int elements = 2 + (pl_fl2_foobar - PLFODDERLUCERNE2_BASE);
81 
82  FarmManagementCategory catlist[elements] =
83  {
84  fmc_Others, // zero element unused but must be here
85  fmc_Others,//pl_fl2_start = 1, // Compulsory, must always be 1 (one).
86  fmc_Others,//pl_fl2_sleep_all_day = PLFODDERLUCERNE2_BASE,
87  fmc_Cultivation,//pl_fl2_spring_harrow,
88  fmc_Fertilizer,//pl_fl2_ferti_p0,
89  fmc_Fertilizer,//pl_fl2_ferti_s0,
90  fmc_Herbicide,//pl_fl2_herbicide1,
91  fmc_Cutting,//pl_fl2_cut_to_silage1A,
92  fmc_Cultivation,//pl_fl2_harrow1A,
93  fmc_Fertilizer,//pl_fl2_ferti_p1A,
94  fmc_Fertilizer,//pl_fl2_ferti_s1A,
95  fmc_Cutting,//pl_fl2_cut_to_silage2A,
96  fmc_Cultivation,//pl_fl2_harrow2A,
97  fmc_Cutting,//pl_fl2_cut_to_silage3A,
98  fmc_Cutting,//pl_fl2_cut_to_silage1B,
99  fmc_Cultivation,//pl_fl2_harrow1B,
100  fmc_Fertilizer,//pl_fl2_ferti_p1B,
101  fmc_Fertilizer,//pl_fl2_ferti_s1B,
102  fmc_Cutting,//pl_fl2_cut_to_silage2B,
103  fmc_Cultivation,//pl_fl2_harrow2B,
104  fmc_Cutting,//pl_fl2_cut_to_silage3B,
105  fmc_Cultivation,//pl_fl2_harrow3B,
106  fmc_Cutting//pl_fl2_cut_to_silage4B,y
107 
108  };
109  // Iterate over the catlist elements and copy them to vector
110  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
111 
112  }
113 };
114 
115 #endif // PLFODDERLUCERNE2_H
116 
pl_fl2_cut_to_silage3A
Definition: PLFodderLucerne2.h:44
PLFodderLucerne2
PLFodderLucerne2 class .
Definition: PLFodderLucerne2.h:66
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
PLFodderLucerne2::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLFodderLucerne2.h:78
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
pl_fl2_harrow1B
Definition: PLFodderLucerne2.h:46
pl_fl2_harrow2B
Definition: PLFodderLucerne2.h:50
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
pl_fl2_ferti_p1B
Definition: PLFodderLucerne2.h:47
PLFodderLucerne2::PLFodderLucerne2
PLFodderLucerne2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PLFodderLucerne2.h:70
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
PLFodderLucerne2::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: PLFodderLucerne2.cpp:56
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
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
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
pl_fl2_spring_harrow
Definition: PLFodderLucerne2.h:34
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_fl2_cut_to_silage2A
Definition: PLFodderLucerne2.h:42
pl_fl2_start
Definition: PLFodderLucerne2.h:32
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Crop
The base class for all crops.
Definition: Farm.h:495
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
pl_fl2_cut_to_silage4B
Definition: PLFodderLucerne2.h:53
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
pl_fl2_ferti_p1A
Definition: PLFodderLucerne2.h:40
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
pl_fl2_foobar
Definition: PLFodderLucerne2.h:54
pl_fl2_cut_to_silage1B
Definition: PLFodderLucerne2.h:45
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
pl_fl2_harrow2A
Definition: PLFodderLucerne2.h:43
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
pl_fl2_ferti_p0
Definition: PLFodderLucerne2.h:35
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
pl_fl2_ferti_s1B
Definition: PLFodderLucerne2.h:48
pl_fl2_harrow3B
Definition: PLFodderLucerne2.h:52
PLFODDERLUCERNE2_BASE
#define PLFODDERLUCERNE2_BASE
Definition: PLFodderLucerne2.h:24
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
pl_fl2_sleep_all_day
Definition: PLFodderLucerne2.h:33
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
pl_fl2_ferti_s0
Definition: PLFodderLucerne2.h:36
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::ShallowHarrow
virtual bool ShallowHarrow(LE *a_field, double a_user, int a_days)
Carry out a shallow harrow event on a_field, e.g., after grass cutting event.
Definition: FarmFuncs.cpp:473
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
pl_fl2_cut_to_silage2B
Definition: PLFodderLucerne2.h:49
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
pl_fl2_ferti_s1A
Definition: PLFodderLucerne2.h:41
pl_fl2_harrow1A
Definition: PLFodderLucerne2.h:39
pl_fl2_cut_to_silage1A
Definition: PLFodderLucerne2.h:38
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
PLFodderLucerne2ToDo
PLFodderLucerne2ToDo
Definition: PLFodderLucerne2.h:31
pl_fl2_herbicide1
Definition: PLFodderLucerne2.h:37
tov_PLFodderLucerne2
Definition: LandscapeFarmingEnums.h:244
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
pl_fl2_cut_to_silage3B
Definition: PLFodderLucerne2.h:51
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