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
PTPotatoes.h
Go to the documentation of this file.
1 
14 //
15 // PTPotatoes.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 PTPOTATOES_H
43 #define PTPOTATOES_H
44 
45 #define PTPOTATOES_BASE 32500
46 
52 typedef enum {
53  pt_pot_start = 1, // Compulsory, must always be 1 (one).
57  pt_pot_ferti_p1, // Manure
72 
73 
82 class PTPotatoes: public Crop
83 {
84  public:
85  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
86  PTPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
87  {
93  m_first_date = g_date->DayInYear(15, 4);
95  }
97  const int elements = 2 + (pt_pot_foobar - PTPOTATOES_BASE);
99 
100  FarmManagementCategory catlist[elements] =
101  {
102  fmc_Others, // zero element unused but must be here
103  fmc_Others, //pt_pot_start = 1, // Compulsory, must always be 1 (one).
104  fmc_Others, //pt_pot_sleep_all_day = PTPOTATOES_BASE,
105  fmc_Cultivation, //pt_pot_spring_plough,
106  fmc_Cultivation, //pt_pot_spring_harrow,
107  fmc_Fertilizer, //pt_pot_ferti_p1, // Manure
108  fmc_Fertilizer, //pt_pot_ferti_s1,
109  fmc_Others, //pt_pot_bed_forming,
110  fmc_Others, //pt_pot_spring_sow,
111  fmc_Watering, //pt_pot_irrigation_start1,
112  fmc_Watering, //pt_pot_irrigation1,
113  fmc_Others, //pt_pot_hilling,
114  fmc_Fertilizer, //pt_pot_ferti_p2, //NPK
115  fmc_Fertilizer, //pt_pot_ferti_s2,
116  fmc_Fungicide, //pl_pot_fungicide1,
117  fmc_Fungicide, //pl_pot_fungicide2,
118  fmc_Others, //pl_pot_desiccation,
119  fmc_Harvest //pt_pot_harvest1,
120 
121  // no foobar entry
122 
123  };
124  // Iterate over the catlist elements and copy them to vector
125  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
126 
127  }
128 };
129 
130 #endif // PTPOTATOES_H
131 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pt_pot_ferti_p1
Definition: PTPotatoes.h:57
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
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
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
PTPotatoes
PTPotatoes class .
Definition: PTPotatoes.h:82
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
pt_pot_ferti_s1
Definition: PTPotatoes.h:58
pt_pot_hilling
Definition: PTPotatoes.h:63
pt_pot_irrigation_start1
Definition: PTPotatoes.h:61
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_pot_ferti_p2
Definition: PTPotatoes.h:64
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
PTPotatoes::PTPotatoes
PTPotatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTPotatoes.h:86
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
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
pt_pot_fungicide2
Definition: PTPotatoes.h:67
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
pt_pot_harvest
Definition: PTPotatoes.h:69
pt_pot_spring_harrow
Definition: PTPotatoes.h:56
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
PTPotatoes::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTPotatoes.h:96
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
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
Farm::HillingUp
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
Definition: FarmFuncs.cpp:1302
pt_pot_foobar
Definition: PTPotatoes.h:70
Crop
The base class for all crops.
Definition: Farm.h:495
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
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
pt_pot_start
Definition: PTPotatoes.h:53
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
tov_PTPotatoes
Definition: LandscapeFarmingEnums.h:328
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
PTPotatoesToDo
PTPotatoesToDo
Definition: PTPotatoes.h:52
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
pt_pot_fungicide1
Definition: PTPotatoes.h:66
pt_pot_desiccation
Definition: PTPotatoes.h:68
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
PTPotatoes::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: PTPotatoes.cpp:55
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
pt_pot_ferti_s2
Definition: PTPotatoes.h:65
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
g_farm_fixed_crop_enable
CfgBool g_farm_fixed_crop_enable
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
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
PTPOTATOES_BASE
#define PTPOTATOES_BASE
Definition: PTPotatoes.h:45
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_pot_bed_forming
Definition: PTPotatoes.h:59
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
pt_pot_spring_plough
Definition: PTPotatoes.h:55
pt_pot_irrigation1
Definition: PTPotatoes.h:62
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pt_pot_spring_sow
Definition: PTPotatoes.h:60
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
pt_pot_sleep_all_day
Definition: PTPotatoes.h:54
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
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