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
PLCarrots.h
Go to the documentation of this file.
1 
16 //
17 // PLCarrots.h
18 //
19 
20 
21 #ifndef PLCarrots_H
22 #define PLCarrots_H
23 
24 #define PLCarrots_BASE 25300
25 
28 #define PL_CA_STUBBLE_PLOUGH a_field->m_user[1]
29 #define PL_CA_WEEDING a_field->m_user[2]
30 #define PL_CA_HERBI a_field->m_user[3]
31 
37 typedef enum {
38  pl_ca_start = 1, // Compulsory, must always be 1 (one).
66 
67 
76 class PLCarrots: public Crop
77 {
78  public:
79  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
80  PLCarrots(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
81  {
82  // When we start it off, the first possible date for a farm operation is 20th October
83  // This information is used by other crops when they decide how much post processing of
84  // the management is allowed after harvest before the next crop starts.
85  m_first_date=g_date->DayInYear( 5,11 );
87  }
89  const int elements = 2 + (pl_ca_foobar - PLCarrots_BASE);
91 
92  FarmManagementCategory catlist[elements] =
93  {
94  fmc_Others, // zero element unused but must be here
95  fmc_Others,//pl_ca_start = 1, // Compulsory, must always be 1 (one).
96  fmc_Others,//pl_ca_sleep_all_day = PLCarrots_BASE,
97  fmc_Cultivation,//pl_ca_stubble_plough,
98  fmc_Cultivation,//pl_ca_autumn_harrow1,
99  fmc_Cultivation,//pl_ca_autumn_harrow2,
100  fmc_Cultivation,//pl_ca_stubble_harrow,
101  fmc_Fertilizer,//pl_ca_ferti_p1,
102  fmc_Fertilizer,//pl_ca_ferti_s1,
103  fmc_Cultivation,//pl_ca_winter_plough,
104  fmc_Fertilizer,//pl_ca_ferti_p2,
105  fmc_Fertilizer,//pl_ca_ferti_s2,
106  fmc_Cultivation,//pl_ca_spring_harrow,
107  fmc_Cultivation,//pl_ca_preseeding_cultivator,
108  fmc_Others,//pl_ca_bed_forming,
109  fmc_Others,//pl_ca_spring_sow,
110  fmc_Others,//pl_ca_strigling,
111  fmc_Herbicide,//pl_ca_herbicide1,
112  fmc_Herbicide,//pl_ca_herbicide2,
113  fmc_Herbicide,//pl_ca_herbicide3,
114  fmc_Fungicide,//pl_ca_fungicide1,
115  fmc_Fungicide,//pl_ca_fungicide2,
116  fmc_Fertilizer,//pl_ca_ferti_p3,
117  fmc_Fertilizer,//pl_ca_ferti_s3,
118  fmc_Harvest,//pl_ca_harvest,
119  fmc_Fertilizer,//pl_ca_ferti_p4,
120  fmc_Fertilizer//pl_ca_ferti_s4,
121  };
122  // Iterate over the catlist elements and copy them to vector
123  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
124 
125  }
126 };
127 
128 #endif // PLCarrots_H
129 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pl_ca_spring_sow
Definition: PLCarrots.h:52
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.
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: FarmFuncs.cpp:312
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
pl_ca_ferti_s1
Definition: PLCarrots.h:45
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
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: FarmFuncs.cpp:1364
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
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::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
PLCarrotsToDo
PLCarrotsToDo
Definition: PLCarrots.h:37
pl_ca_ferti_p1
Definition: PLCarrots.h:44
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: FarmFuncs.cpp:232
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
pl_ca_ferti_p2
Definition: PLCarrots.h:47
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
pl_ca_ferti_s2
Definition: PLCarrots.h:48
tov_PLCarrots
Definition: LandscapeFarmingEnums.h:245
Farm::BedForming
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
Definition: FarmFuncs.cpp:1316
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
PL_CA_STUBBLE_PLOUGH
#define PL_CA_STUBBLE_PLOUGH
A flag used to indicate autumn ploughing status.
Definition: PLCarrots.h:28
pl_ca_winter_plough
Definition: PLCarrots.h:46
PLCarrots_BASE
#define PLCarrots_BASE
Definition: PLCarrots.h:24
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
pl_ca_autumn_harrow1
Definition: PLCarrots.h:41
Farm::SpringSow
virtual bool SpringSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the spring on a_field.
Definition: FarmFuncs.cpp:501
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pl_ca_start
Definition: PLCarrots.h:38
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
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
pl_ca_foobar
Definition: PLCarrots.h:64
cfg_CA_InsecticideDay
CfgInt cfg_CA_InsecticideDay
Crop
The base class for all crops.
Definition: Farm.h:495
pl_ca_strigling
Definition: PLCarrots.h:53
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_ca_spring_harrow
Definition: PLCarrots.h:49
pl_ca_ferti_s3
Definition: PLCarrots.h:60
CfgBool::value
bool value() const
Definition: Configurator.h:164
pl_ca_stubble_harrow
Definition: PLCarrots.h:43
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
pl_ca_herbicide3
Definition: PLCarrots.h:56
Calendar::Date
long Date(void)
Definition: Calendar.h:57
pl_ca_ferti_s4
Definition: PLCarrots.h:63
PLCarrots::PLCarrots
PLCarrots(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PLCarrots.h:80
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
pl_ca_ferti_p4
Definition: PLCarrots.h:62
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
pl_ca_fungicide2
Definition: PLCarrots.h:58
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
pl_ca_preseeding_cultivator
Definition: PLCarrots.h:50
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
PLCarrots::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PLCarrots.h:88
pl_ca_bed_forming
Definition: PLCarrots.h:51
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
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
pl_ca_herbicide1
Definition: PLCarrots.h:54
PL_CA_HERBI
#define PL_CA_HERBI
Definition: PLCarrots.h:30
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
cfg_CA_InsecticideMonth
CfgInt cfg_CA_InsecticideMonth
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
pl_ca_fungicide1
Definition: PLCarrots.h:57
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
PLCarrots::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: PLCarrots.cpp:65
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
pl_ca_harvest
Definition: PLCarrots.h:61
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
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
Farm
The base class for all farm types.
Definition: Farm.h:755
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
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
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pl_ca_autumn_harrow2
Definition: PLCarrots.h:42
PL_CA_WEEDING
#define PL_CA_WEEDING
Definition: PLCarrots.h:29
cfg_seedcoating_product_amounts
CfgArray_Double cfg_seedcoating_product_amounts
Amount of seed coating pesticide applied in grams of active substance per hectare for each of the 10 ...
pl_ca_ferti_p3
Definition: PLCarrots.h:59
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
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
cfg_pest_carrots_on
CfgBool cfg_pest_carrots_on
Turn on pesticides for carrots.
WARN_BUG
Definition: MapErrorMsg.h:34
cfg_seedcoating_carrots_on
CfgBool cfg_seedcoating_carrots_on
Turn on seed coating for carrots.
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
PLCarrots
PLCarrots class .
Definition: PLCarrots.h:76
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: FarmFuncs.cpp:459
pl_ca_stubble_plough
Definition: PLCarrots.h:40
pl_ca_sleep_all_day
Definition: PLCarrots.h:39
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
pl_ca_herbicide2
Definition: PLCarrots.h:55