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
DE_Potatoes.h
Go to the documentation of this file.
1 
13 //
14 // DE_Potatoes.h
15 //
16 /*
17 
18 Copyright (c) 2021, Christopher John Topping, Aarhus University
19 All rights reserved.
20 
21 
22 Redistribution and use in source and binary forms, with or without
23 modification, are permitted provided that the following conditions are met:
24 
25 *) Redistributions of source code must retain the above copyright notice, this
26 list of conditions and the following disclaimer.
27 *) Redistributions in binary form must reproduce the above copyright notice,
28 this list of conditions and the following disclaimer in the documentation
29 and/or other materials provided with the distribution.
30 *) Neither the name of the NERI nor the names of its contributors
31 may be used to endorse or promote products derived from this software without
32 specific prior written permission.
33 
34 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 POSSIBILITY OF SUCH DAMAGE.
45 
46 */
47 
48 #ifndef DE_POTATOES_H
49 #define DE_POTATOES_H
50 
51 #define DE_POTATOES_BASE 35400
52 
55 #define DE_POT_FERTI_P1 a_field->m_user[1]
56 #define DE_POT_FERTI_S1 a_field->m_user[2]
57 #define DE_POT_STUBBLE_PLOUGH a_field->m_user[3]
58 #define DE_POT_DID_STRIG1 a_field->m_user[4]
59 #define DE_POT_HILL_DATE a_field->m_user[7]
60 #define DE_POT_DID_HILL a_field->m_user[8]
61 #define DE_POT_DID_DESS a_field->m_user[9]
62 
63 
69 typedef enum {
70  de_pot_start = 1, // Compulsory, must always be 1 (one).
113  de_pot_foobar, // Obligatory, must be last
115 
116 
125 class DE_Potatoes: public Crop
126 {
127  public:
128  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
129  DE_Potatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
130  {
136  m_first_date=g_date->DayInYear( 5,11 ); //EZ: This needs to be changed
138  }
140  const int elements = 2 + (de_pot_foobar - DE_POTATOES_BASE);
142 
143  FarmManagementCategory catlist[elements] =
144  {
145  fmc_Others, // zero element unused but must be here
146  // ALL THE NECESSARY ENTRIES HERE
147  fmc_Others, // de_pot_start = 1, // Compulsory, must always be 1 (one)
148  fmc_Others, // de_pot_sleep_all_day
149  fmc_Cultivation, // de_pot_stubble_harrow,
150  fmc_Cultivation, // de_pot_autumn_harrow1,
151  fmc_Cultivation, // de_pot_autumn_harrow2,
152  fmc_Cultivation, // de_pot_stubble_plough,
153  fmc_Cultivation, // de_pot_winter_plough,
154  fmc_Cultivation, // de_pot_spring_harrow
155  fmc_Fertilizer, // de_pot_ferti_s1
156  fmc_Fertilizer, // de_pot_ferti_p1,
157  fmc_Fertilizer, // de_pot_ferti_s2,
158  fmc_Fertilizer, // de_pot_ferti_p2,
159  fmc_Fertilizer, // de_pot_ferti_p4,
160  fmc_Fertilizer, // de_pot_ferti_s4,
161  fmc_Cultivation, // de_pot_spring_harrow2,
162  fmc_Fertilizer, // de_pot_ferti_p5,
163  fmc_Fertilizer, // de_pot_ferti_s5,
164  fmc_Cultivation, // de_pot_spring_plough,
165  fmc_Cultivation, // de_pot_bed_forming,
166  fmc_Others, // de_pot_spring_planting,
167  fmc_Cultivation, // de_pot_hilling1,
168  fmc_Cultivation, // de_pot_hilling2,
169  fmc_Cultivation, // de_pot_hilling3,
170  fmc_Herbicide, // de_pot_herbicide1,
171  fmc_Cultivation, // de_pot_hilling4,
172  fmc_Cultivation, // de_pot_hilling5,
173  fmc_Cultivation, // de_pot_hilling6,
174  fmc_Herbicide, // de_pot_herbicide2,
175  fmc_Fertilizer, // de_pot_ferti_p6,
176  fmc_Fertilizer, // de_pot_ferti_s6,
177  fmc_Fertilizer, // de_pot_ferti_p7,
178  fmc_Fertilizer, // de_pot_ferti_s7,
179  fmc_Fungicide, // de_pot_fungicide1,
180  fmc_Fungicide, // de_pot_fungicide2,
181  fmc_Fungicide, // de_pot_fungicide3,
182  fmc_Fungicide, // de_pot_fungicide4,
183  fmc_Insecticide, // de_pot_insecticide,
184  fmc_Others, // de_pot_dessication1,
185  fmc_Others, // de_pot_dessication2,
186  fmc_Harvest, // de_pot_harvest,
187  fmc_Fertilizer, // de_pot_ferti_p8,
188  fmc_Fertilizer, // de_pot_ferti_s8,
189  // no foobar entry
190 
191  };
192  // Iterate over the catlist elements and copy them to vector
193  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
194 
195  }
196 };
197 
198 #endif // DE_POTATOES_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
DE_Potatoes::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_Potatoes.h:139
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
de_pot_ferti_s1
Definition: DE_Potatoes.h:78
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
de_pot_ferti_p3
Definition: DE_Potatoes.h:82
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
de_pot_insecticide
Definition: DE_Potatoes.h:106
de_pot_autumn_harrow1
Definition: DE_Potatoes.h:73
de_pot_sleep_all_day
Definition: DE_Potatoes.h:71
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::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
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
DE_Potatoes::DE_Potatoes
DE_Potatoes(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DE_Potatoes.h:129
de_pot_spring_harrow2
Definition: DE_Potatoes.h:84
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
de_pot_herbicide1
Definition: DE_Potatoes.h:93
de_pot_ferti_s7
Definition: DE_Potatoes.h:112
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
DE_POTATOES_BASE
#define DE_POTATOES_BASE
Definition: DE_Potatoes.h:51
de_pot_spring_plough
Definition: DE_Potatoes.h:87
de_pot_ferti_s6
Definition: DE_Potatoes.h:101
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
de_pot_dessication1
Definition: DE_Potatoes.h:108
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
de_pot_dessication2
Definition: DE_Potatoes.h:109
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
DE_POT_DID_HILL
#define DE_POT_DID_HILL
Definition: DE_Potatoes.h:60
de_pot_hilling2
Definition: DE_Potatoes.h:91
DE_POT_DID_STRIG1
#define DE_POT_DID_STRIG1
Definition: DE_Potatoes.h:58
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
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
DE_Potatoes
DE_Potatoes class .
Definition: DE_Potatoes.h:125
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
de_pot_winter_plough
Definition: DE_Potatoes.h:76
de_pot_ferti_p2
Definition: DE_Potatoes.h:81
DE_POT_FERTI_S1
#define DE_POT_FERTI_S1
Definition: DE_Potatoes.h:56
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
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::StriglingHill
virtual bool StriglingHill(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field followed by hilling up (probably on potatoes)
Definition: FarmFuncs.cpp:1287
de_pot_hilling5
Definition: DE_Potatoes.h:95
CfgBool::value
bool value() const
Definition: Configurator.h:164
DE_POT_HILL_DATE
#define DE_POT_HILL_DATE
Definition: DE_Potatoes.h:59
de_pot_ferti_s5
Definition: DE_Potatoes.h:99
DE_POT_DID_DESS
#define DE_POT_DID_DESS
Definition: DE_Potatoes.h:61
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
de_pot_fungicide3
Definition: DE_Potatoes.h:104
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
DE_POT_FERTI_P1
#define DE_POT_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: DE_Potatoes.h:55
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
de_pot_hilling4
Definition: DE_Potatoes.h:94
de_pot_ferti_s4
Definition: DE_Potatoes.h:86
de_pot_ferti_p5
Definition: DE_Potatoes.h:98
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
de_pot_hilling3
Definition: DE_Potatoes.h:92
tov_DEPotatoes
Definition: LandscapeFarmingEnums.h:502
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
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
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
Landscape::SupplyPestIncidenceFactor
double SupplyPestIncidenceFactor()
Returns Landscape::m_pestincidencefactor.
Definition: Landscape.h:325
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.
de_pot_insecticideb
Definition: DE_Potatoes.h:107
de_pot_ferti_p4
Definition: DE_Potatoes.h:85
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
de_pot_ferti_p7
Definition: DE_Potatoes.h:111
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
de_pot_bed_forming
Definition: DE_Potatoes.h:88
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
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
de_pot_herbicide2
Definition: DE_Potatoes.h:97
de_pot_autumn_harrow2
Definition: DE_Potatoes.h:74
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
Farm::BiocideTreat
virtual bool BiocideTreat(LE *a_field, double a_user, int a_days)
Apply Biocide to a_field.
Definition: FarmFuncs.cpp:2175
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
de_pot_stubble_harrow
Definition: DE_Potatoes.h:72
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
DE_POT_STUBBLE_PLOUGH
#define DE_POT_STUBBLE_PLOUGH
Definition: DE_Potatoes.h:57
de_pot_foobar
Definition: DE_Potatoes.h:113
de_pot_ferti_p6
Definition: DE_Potatoes.h:100
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
de_pot_hilling6
Definition: DE_Potatoes.h:96
de_pot_harvest
Definition: DE_Potatoes.h:110
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
de_pot_ferti_p1
Definition: DE_Potatoes.h:79
Farm
The base class for all farm types.
Definition: Farm.h:755
DE_Potatoes::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: DE_Potatoes.cpp:88
de_pot_ferti_s3
Definition: DE_Potatoes.h:83
de_pot_fungicide1
Definition: DE_Potatoes.h:102
de_pot_fungicide4
Definition: DE_Potatoes.h:105
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
de_pot_start
Definition: DE_Potatoes.h:70
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
g_landscape_ptr
Landscape * g_landscape_ptr
Definition: Landscape.cpp:352
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
de_pot_spring_harrow
Definition: DE_Potatoes.h:77
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
de_pot_fungicide2
Definition: DE_Potatoes.h:103
de_pot_spring_planting
Definition: DE_Potatoes.h:89
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
DE_PotatoesToDo
DE_PotatoesToDo
Definition: DE_Potatoes.h:69
de_pot_stubble_plough
Definition: DE_Potatoes.h:75
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
de_pot_hilling1
Definition: DE_Potatoes.h:90
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
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
de_pot_ferti_s2
Definition: DE_Potatoes.h:80