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
FR_Sunflower.h
Go to the documentation of this file.
1 
46 #ifndef FR_SUNFLOWER_H
47 #define FR_SUNFLOWER_H
48 
49 #define FR_SF_PLOUGH a_field->m_user[1]
50 #define FR_SF_SLURRY a_field->m_user[2]
51 
52 #define FR_SF_BASE 191000
53 
62 typedef enum {
63  fr_sf_start = 1, // Compulsory, must always be 1 (one).
87 
88 
97 class FR_Sunflower : public Crop
98 {
99  public:
100  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
101  FR_Sunflower(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
102  {
103  // When we start it off, the first possible date for a farm operation is 1st October
104  // This information is used by other crops when they decide how much post processing of
105  // the management is allowed after harvest before the next crop starts.
106  m_first_date=g_date->DayInYear( 1,12 );
108  }
110  const int elements = 2 + (fr_sf_foobar - FR_SF_BASE);
112 
113  FarmManagementCategory catlist[elements] =
114  {
115  fmc_Others, // zero element unused but must be here
116  fmc_Others, //fr_m_start = 1, // Compulsory, must always be 1 (one).
117  fmc_Others, //fr_m_sleep_all_day = FR_SF_BASE,
118  fmc_Fertilizer, //fr_sf_mineral,
119  fmc_Cultivation, //fr_sf_stubble_harrow,
120  fmc_Cultivation, //fr_sf_stubble_plough,
121  fmc_Cultivation, //fr_sf_autumn_harrow,
122  fmc_Fertilizer, //fr_sf_manure,
123  fmc_Cultivation, //fr_sf_winter_plough,
124  fmc_Fertilizer, //fr_sf_fertilizer,
125  fmc_Cultivation, //fr_sf_spring_plough,
126  fmc_Cultivation, //fr_sf_spring_harrow,
127  fmc_Cultivation, //fr_sf_harrow1,
128  fmc_Herbicide, //fr_sf_herbicide1,
129  fmc_Cultivation, //fr_sf_preseed_cultivation,
130  fmc_Others, //fr_sf_sow,
131  fmc_Fertilizer, //fr_sf_fertilizer2,
132  fmc_Cultivation, //fr_sf_harrow2,
133  fmc_Herbicide, // fr_sf_herbicide2,
134  fmc_Herbicide, //fr_sf_herbicide3,
135  fmc_Insecticide, //fr_sf_insecticide,
136  fmc_Fertilizer, //fr_sf_n,
137  fmc_Harvest, //fr_sf_harvest,
138 
139 
140  // no foobar entry
141 
142  };
143  // Iterate over the catlist elements and copy them to vector
144  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
145 
146  }
147 };
148 
149 #endif // FR_SUNFLOWER_H
150 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
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
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
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
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
fr_sf_slurry
Definition: FR_Sunflower.h:69
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
fr_sf_preseed_cultivation
Definition: FR_Sunflower.h:76
fr_sf_insecticide
Definition: FR_Sunflower.h:82
FR_SunflowerToDo
FR_SunflowerToDo
A flag used to indicate autumn ploughing status.
Definition: FR_Sunflower.h:62
fr_sf_herbicide3
Definition: FR_Sunflower.h:81
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
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
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
fr_sf_fertilizer2
Definition: FR_Sunflower.h:78
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
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
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
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
FR_SF_BASE
#define FR_SF_BASE
Definition: FR_Sunflower.h:52
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
cfg_FR_Sunflower_SkScrapes
CfgBool cfg_FR_Sunflower_SkScrapes("FR_CROP_SF_SCRAPES", CFG_CUSTOM, false)
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
fr_sf_n
Definition: FR_Sunflower.h:83
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
Crop
The base class for all crops.
Definition: Farm.h:495
fr_sf_harrow1
Definition: FR_Sunflower.h:74
FR_Sunflower::FR_Sunflower
FR_Sunflower(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: FR_Sunflower.h:101
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
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.
fr_sf_autumn_harrow
Definition: FR_Sunflower.h:68
CfgBool::value
bool value() const
Definition: Configurator.h:164
Farm::FP_Manure
virtual bool FP_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:896
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fr_sf_spring_plough
Definition: FR_Sunflower.h:72
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
Farm::FP_N
virtual bool FP_N(LE *a_field, double a_user, int a_days)
Apply N fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:700
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
cfg_SF_InsecticideMonth
CfgInt cfg_SF_InsecticideMonth
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
FR_Sunflower::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: FR_Sunflower.h:109
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
fr_sf_sleep_all_day
Definition: FR_Sunflower.h:64
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
FR_Sunflower
FR_Sunflower class .
Definition: FR_Sunflower.h:97
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
fr_sf_stubble_plough
Definition: FR_Sunflower.h:67
FR_Sunflower::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: FR_Sunflower.cpp:98
cfg_SF_InsecticideDay
CfgInt cfg_SF_InsecticideDay
fr_sf_herbicide2
Definition: FR_Sunflower.h:80
fr_sf_fertilizer
Definition: FR_Sunflower.h:71
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
fr_sf_spring_harrow
Definition: FR_Sunflower.h:73
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
Farm::FP_P
virtual bool FP_P(LE *a_field, double a_user, int a_days)
Apply P fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:687
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
fr_sf_start
Definition: FR_Sunflower.h:63
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
fr_sf_sow
Definition: FR_Sunflower.h:77
fr_sf_stubble_harrow
Definition: FR_Sunflower.h:66
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
cfg_pest_sunflower_on
CfgBool cfg_pest_sunflower_on
Turn on pesticides for sunflower.
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
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
fr_sf_harrow2
Definition: FR_Sunflower.h:79
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
fr_sf_winter_plough
Definition: FR_Sunflower.h:70
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
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
FR_SF_SLURRY
#define FR_SF_SLURRY
Definition: FR_Sunflower.h:50
CFG_CUSTOM
Definition: Configurator.h:70
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
fr_sf_mineral
Definition: FR_Sunflower.h:65
fr_sf_foobar
Definition: FR_Sunflower.h:85
cfg_fungi_app_prop2
CfgFloat cfg_fungi_app_prop2
fr_sf_herbicide1
Definition: FR_Sunflower.h:75
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
fr_sf_harvest
Definition: FR_Sunflower.h:84
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
FR_SF_PLOUGH
#define FR_SF_PLOUGH
Definition: FR_Sunflower.h:49
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
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
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