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
PTCabbage_Hort.h
Go to the documentation of this file.
1 
14 //
15 // PTCabbage_Hort.h
16 //
17 /*
18 *******************************************************************************************************
19 Copyright (c) 2024, Christopher John Topping, University of Aarhus
20 All rights reserved.
21 
22 Redistribution and use in source and binary forms, with or without modification, are permitted provided
23 that the following conditions are met:
24 
25 Redistributions of source code must retain the above copyright notice, this list of conditions and the
26 following disclaimer.
27 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
28 the following disclaimer in the documentation and/or other materials provided with the distribution.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
31 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
32 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
33 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ********************************************************************************************************
39 */
40 
41 
42 #ifndef PTCABBAGE_HORT_H
43 #define PTCABBAGE_HORT_H
44 
45 #define PTCABBAGE_HORT_BASE 32800
46 
52 typedef enum {
53  pt_cabb_hort_start = 1, // Compulsory, must always be 1 (one).
69 
70 
79 class PTCabbage_Hort: public Crop
80 {
81  public:
82  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
83  PTCabbage_Hort(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
84  {
90  m_first_date = g_date->DayInYear(31, 3); // changed from 31,3
93  }
95  const int elements = 2 + (pt_cabb_hort_foobar - PTCABBAGE_HORT_BASE);
97 
98  FarmManagementCategory catlist[elements] =
99  {
100  fmc_Others, // zero element unused but must be here
101  fmc_Others, //pt_cabb_hort_start = 1, // Compulsory, must always be 1 (one).
102  fmc_Others, //pt_cabb_hort_sleep_all_day = PTCABBAGE_HORT_BASE,
103  fmc_Cultivation, //pt_cabb_hort_winter_plough,
104  fmc_Cultivation, //pt_cabb_hort_winter_harrow,
105  fmc_Fertilizer, //pt_cabb_hort_ferti_p1, // Manure
106  fmc_Fertilizer, //pt_cabb_hort_ferti_s1,
107  fmc_Others, //pt_cabb_hort_winter_sow,
108  fmc_Watering, //pt_cabb_hort_irrigation_start1,
109  fmc_Watering, //pt_cabb_hort_irrigation1,
110  fmc_Herbicide, //pt_cabb_hort_herbicide,
111  fmc_Fertilizer, //pt_cabb_hort_ferti_p2, //NPK
112  fmc_Fertilizer, //pt_cabb_hort_ferti_s2,
113  fmc_Insecticide, //pt_cabb_hort_insecticide,
114  fmc_Harvest //pt_cabb_hort_harvest,
115 
116  // no foobar entry
117 
118  };
119  // Iterate over the catlist elements and copy them to vector
120  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
121 
122  }
123 };
124 
125 #endif // PTCABBAGE_HORT_H
126 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Returns a pointer to the object referred to by the polygon number.
Definition: Landscape.h:1722
pt_cabb_hort_irrigation1
Definition: PTCabbage_Hort.h:61
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
tov_PTCabbage_Hort
Definition: LandscapeFarmingEnums.h:331
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
pt_cabb_hort_ferti_p2
Definition: PTCabbage_Hort.h:63
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
Farm::Irrigation
virtual bool Irrigation(LE *a_field, double a_user, int a_days, int a_max)
Generate an 'irrigation' event with a frequency defined by a_freq in the irrigation period on a_field...
Definition: FarmFuncs.cpp:1856
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
pt_cabb_hort_ferti_p1
Definition: PTCabbage_Hort.h:57
pt_cabb_hort_irrigation_start1
Definition: PTCabbage_Hort.h:60
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
Farm::FA_Manure
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1110
Farm::GetNextCropStartDate
int GetNextCropStartDate(LE *a_field, TTypesOfVegetation &a_curr_veg)
Returns the start date of the next crop in the rotation.
Definition: Farm.cpp:920
PTCABBAGE_HORT_BASE
#define PTCABBAGE_HORT_BASE
Definition: PTCabbage_Hort.h:45
Farm::AddNewEvent
void AddNewEvent(TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop, FarmManagementCategory a_fmc, bool a_forcespring, bool a_forcespringOK)
Adds an event to the event queue for a farm.
Definition: Farm.cpp:845
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
CfgFloat::value
double value() const
Definition: Configurator.h:142
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
pt_cabb_hort_herbicide
Definition: PTCabbage_Hort.h:62
Crop
The base class for all crops.
Definition: Farm.h:495
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
Farm::IrrigationStart
virtual bool IrrigationStart(LE *a_field, double a_user, int a_days)
Start a irrigation event on a_field today.
Definition: FarmFuncs.cpp:1834
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
PTCabbage_Hort::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: PTCabbage_Hort.cpp:58
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
tocc_Catch
Definition: LandscapeFarmingEnums.h:627
pt_cabb_hort_foobar
Definition: PTCabbage_Hort.h:67
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
pt_cabb_hort_winter_plough
Definition: PTCabbage_Hort.h:55
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
PTCabbage_Hort::PTCabbage_Hort
PTCabbage_Hort(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTCabbage_Hort.h:83
PTCabbage_Hort::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTCabbage_Hort.h:94
pt_cabb_hort_winter_harrow
Definition: PTCabbage_Hort.h:56
FarmEvent::m_field
LE * m_field
Definition: Farm.h:391
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
PTCabbage_Hort
PTCabbage_Hort class .
Definition: PTCabbage_Hort.h:79
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
tov_Undefined
Definition: LandscapeFarmingEnums.h:610
LE::SetVegType
virtual void SetVegType(TTypesOfVegetation)
Definition: Elements.h:175
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
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
pt_cabb_hort_start
Definition: PTCabbage_Hort.h:53
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
pt_cabb_hort_harvest
Definition: PTCabbage_Hort.h:66
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::GetUnsprayedMarginPolyRef
int GetUnsprayedMarginPolyRef(void)
Definition: Elements.h:383
pt_cabb_hort_ferti_s1
Definition: PTCabbage_Hort.h:58
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
g_farm_fixed_crop_enable
CfgBool g_farm_fixed_crop_enable
Crop::SetCropClassification
void SetCropClassification(int a_classification)
Definition: Farm.h:549
tov_PTHorticulture
Definition: LandscapeFarmingEnums.h:329
Farm::WinterHarrow
virtual bool WinterHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the winter on a_field.
Definition: FarmFuncs.cpp:1539
pt_cabb_hort_winter_sow
Definition: PTCabbage_Hort.h:59
pt_cabb_hort_insecticide
Definition: PTCabbage_Hort.h:65
PROG_START
#define PROG_START
Definition: Farm.h:69
pt_cabb_hort_sleep_all_day
Definition: PTCabbage_Hort.h:54
PTCabbage_HortToDo
PTCabbage_HortToDo
Definition: PTCabbage_Hort.h:52
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
Crop::m_OurLandscape
Landscape * m_OurLandscape
Definition: Farm.h:506
WARN_BUG
Definition: MapErrorMsg.h:34
pt_cabb_hort_ferti_s2
Definition: PTCabbage_Hort.h:64
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
cfg_PTHorticulturePct
CfgFloat cfg_PTHorticulturePct