File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/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_PotatoesIndustry.h
Go to the documentation of this file.
1 
13 //
14 // DE_PotatoesIndustry.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 //EZ: This is based on potatoes for consumption but harvest was moved + 1 month and there are 3 instead of 1 insecticide applications and done by all farmers;
49 //other pesticides has not been changed
50 
51 #ifndef DE_POTATOESINDUSTRY_H
52 #define DE_POTATOESINDUSTRY_H
53 
54 #define DE_POTATOESINDUSTRY_BASE 38600
55 
58 #define DE_POTIND_FERTI_P1 a_field->m_user[1]
59 #define DE_POTIND_FERTI_S1 a_field->m_user[2]
60 #define DE_POTIND_STUBBLE_PLOUGH a_field->m_user[3]
61 #define DE_POTIND_DID_STRIG1 a_field->m_user[4]
62 #define DE_POTIND_HILL_DATE a_field->m_user[7]
63 #define DE_POTIND_DID_HILL a_field->m_user[8]
64 #define DE_POTIND_DID_DESS a_field->m_user[9]
65 
66 
72 typedef enum {
73  de_potind_start = 1, // Compulsory, must always be 1 (one).
120  de_potind_foobar, // Obligatory, must be last
122 
123 
133 {
134  public:
135  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
136  DE_PotatoesIndustry(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
137  {
143  m_first_date=g_date->DayInYear( 10,11 ); //EZ: This needs to be changed
145  }
147  const int elements = 2 + (de_potind_foobar - DE_POTATOESINDUSTRY_BASE);
149 
150  FarmManagementCategory catlist[elements] =
151  {
152  fmc_Others, // zero element unused but must be here
153  // ALL THE NECESSARY ENTRIES HERE
154  fmc_Others, // de_potind_start = 1, // Compulsory, must always be 1 (one)
155  fmc_Others, // de_potind_sleep_all_day
156  fmc_Cultivation, // de_potind_stubble_harrow,
157  fmc_Cultivation, // de_potind_autumn_harrow1,
158  fmc_Cultivation, // de_potind_autumn_harrow2,
159  fmc_Cultivation, // de_potind_stubble_plough,
160  fmc_Cultivation, // de_potind_winter_plough,
161  fmc_Cultivation, // de_potind_spring_harrow
162  fmc_Fertilizer, // de_potind_ferti_s1
163  fmc_Fertilizer, // de_potind_ferti_p1,
164  fmc_Fertilizer, // de_potind_ferti_s2,
165  fmc_Fertilizer, // de_potind_ferti_p2,
166  fmc_Fertilizer, // de_potind_ferti_p4,
167  fmc_Fertilizer, // de_potind_ferti_s4,
168  fmc_Cultivation, // de_potind_spring_harrow2,
169  fmc_Fertilizer, // de_potind_ferti_p5,
170  fmc_Fertilizer, // de_potind_ferti_s5,
171  fmc_Cultivation, // de_potind_spring_plough,
172  fmc_Cultivation, // de_potind_bed_forming,
173  fmc_Others, // de_potind_spring_planting,
174  fmc_Cultivation, // de_potind_hilling1,
175  fmc_Cultivation, // de_potind_hilling2,
176  fmc_Cultivation, // de_potind_hilling3,
177  fmc_Herbicide, // de_potind_herbicide1,
178  fmc_Cultivation, // de_potind_hilling4,
179  fmc_Cultivation, // de_potind_hilling5,
180  fmc_Cultivation, // de_potind_hilling6,
181  fmc_Herbicide, // de_potind_herbicide2,
182  fmc_Fertilizer, // de_potind_ferti_p6,
183  fmc_Fertilizer, // de_potind_ferti_s6,
184  fmc_Fertilizer, // de_potind_ferti_p7,
185  fmc_Fertilizer, // de_potind_ferti_s7,
186  fmc_Fungicide, // de_potind_fungicide1,
187  fmc_Fungicide, // de_potind_fungicide2,
188  fmc_Fungicide, // de_potind_fungicide3,
189  fmc_Fungicide, // de_potind_fungicide4,
190  fmc_Insecticide, // de_potind_insecticide1,
191  fmc_Insecticide, // de_potind_insecticide2,
192  fmc_Insecticide, // de_potind_insecticide3,
193  fmc_Others, // de_potind_dessication1,
194  fmc_Others, // de_potind_dessication2,
195  fmc_Harvest, // de_potind_harvest,
196  fmc_Fertilizer, // de_potind_ferti_p8,
197  fmc_Fertilizer, // de_potind_ferti_s8,
198  // no foobar entry
199 
200  };
201  // Iterate over the catlist elements and copy them to vector
202  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
203 
204  }
205 };
206 
207 #endif // DE_POTATOESINDUSTRY_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
DE_PotatoesIndustry::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_PotatoesIndustry.cpp:88
de_potind_autumn_harrow2
Definition: DE_PotatoesIndustry.h:77
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
de_potind_ferti_s5
Definition: DE_PotatoesIndustry.h:102
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
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_POTIND_DID_STRIG1
#define DE_POTIND_DID_STRIG1
Definition: DE_PotatoesIndustry.h:61
de_potind_harvest
Definition: DE_PotatoesIndustry.h:117
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
de_potind_insecticide2b
Definition: DE_PotatoesIndustry.h:112
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
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
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
de_potind_ferti_p3
Definition: DE_PotatoesIndustry.h:85
de_potind_fungicide1
Definition: DE_PotatoesIndustry.h:105
de_potind_spring_harrow2
Definition: DE_PotatoesIndustry.h:87
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
de_potind_hilling2
Definition: DE_PotatoesIndustry.h:94
de_potind_ferti_p4
Definition: DE_PotatoesIndustry.h:88
de_potind_hilling6
Definition: DE_PotatoesIndustry.h:99
DE_POTIND_DID_HILL
#define DE_POTIND_DID_HILL
Definition: DE_PotatoesIndustry.h:63
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
de_potind_fungicide3
Definition: DE_PotatoesIndustry.h:107
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
de_potind_ferti_s6
Definition: DE_PotatoesIndustry.h:104
DE_POTIND_FERTI_P1
#define DE_POTIND_FERTI_P1
A flag used to indicate autumn ploughing status.
Definition: DE_PotatoesIndustry.h:58
de_potind_sleep_all_day
Definition: DE_PotatoesIndustry.h:74
DE_POTIND_DID_DESS
#define DE_POTIND_DID_DESS
Definition: DE_PotatoesIndustry.h:64
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_potind_hilling3
Definition: DE_PotatoesIndustry.h:95
de_potind_ferti_p1
Definition: DE_PotatoesIndustry.h:82
de_potind_spring_planting
Definition: DE_PotatoesIndustry.h:92
Crop
The base class for all crops.
Definition: Farm.h:495
de_potind_herbicide2
Definition: DE_PotatoesIndustry.h:100
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
CfgBool::value
bool value() const
Definition: Configurator.h:164
DE_POTIND_HILL_DATE
#define DE_POTIND_HILL_DATE
Definition: DE_PotatoesIndustry.h:62
de_potind_dessication2
Definition: DE_PotatoesIndustry.h:116
de_potind_hilling5
Definition: DE_PotatoesIndustry.h:98
DE_PotatoesIndustryToDo
DE_PotatoesIndustryToDo
Definition: DE_PotatoesIndustry.h:72
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
DE_POTATOESINDUSTRY_BASE
#define DE_POTATOESINDUSTRY_BASE
Definition: DE_PotatoesIndustry.h:54
DE_PotatoesIndustry
DE_PotatoesIndustry class .
Definition: DE_PotatoesIndustry.h:132
de_potind_autumn_harrow1
Definition: DE_PotatoesIndustry.h:76
de_potind_ferti_p2
Definition: DE_PotatoesIndustry.h:84
Calendar::Date
long Date(void)
Definition: Calendar.h:57
DE_POTIND_FERTI_S1
#define DE_POTIND_FERTI_S1
Definition: DE_PotatoesIndustry.h:59
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
de_potind_ferti_p6
Definition: DE_PotatoesIndustry.h:103
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
de_potind_ferti_s7
Definition: DE_PotatoesIndustry.h:119
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_potind_insecticide1b
Definition: DE_PotatoesIndustry.h:110
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
de_potind_ferti_s1
Definition: DE_PotatoesIndustry.h:81
de_potind_ferti_s3
Definition: DE_PotatoesIndustry.h:86
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
de_potind_ferti_s4
Definition: DE_PotatoesIndustry.h:89
de_potind_hilling1
Definition: DE_PotatoesIndustry.h:93
de_potind_start
Definition: DE_PotatoesIndustry.h:73
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
de_potind_spring_harrow
Definition: DE_PotatoesIndustry.h:80
de_potind_spring_plough
Definition: DE_PotatoesIndustry.h:90
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
cfg_pest_potatoes_on
CfgBool cfg_pest_potatoes_on
Turn on pesticides for potatoes.
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_potind_herbicide1
Definition: DE_PotatoesIndustry.h:96
LE::GetGreenBiomass
virtual double GetGreenBiomass(void)
Definition: Elements.h:160
de_potind_insecticide2
Definition: DE_PotatoesIndustry.h:111
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
DE_POTIND_STUBBLE_PLOUGH
#define DE_POTIND_STUBBLE_PLOUGH
Definition: DE_PotatoesIndustry.h:60
de_potind_insecticide3b
Definition: DE_PotatoesIndustry.h:114
de_potind_insecticide1
Definition: DE_PotatoesIndustry.h:109
LE
Definition: Elements.h:86
tov_DEPotatoesIndustry
Definition: LandscapeFarmingEnums.h:503
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
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
de_potind_fungicide2
Definition: DE_PotatoesIndustry.h:106
Farm
The base class for all farm types.
Definition: Farm.h:755
DE_PotatoesIndustry::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_PotatoesIndustry.h:146
de_potind_ferti_p5
Definition: DE_PotatoesIndustry.h:101
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
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_PotatoesIndustry::DE_PotatoesIndustry
DE_PotatoesIndustry(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DE_PotatoesIndustry.h:136
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
de_potind_stubble_plough
Definition: DE_PotatoesIndustry.h:78
de_potind_stubble_harrow
Definition: DE_PotatoesIndustry.h:75
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
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_potind_bed_forming
Definition: DE_PotatoesIndustry.h:91
de_potind_insecticide3
Definition: DE_PotatoesIndustry.h:113
g_landscape_ptr
Landscape * g_landscape_ptr
Definition: Landscape.cpp:352
de_potind_fungicide4
Definition: DE_PotatoesIndustry.h:108
de_potind_ferti_p7
Definition: DE_PotatoesIndustry.h:118
de_potind_dessication1
Definition: DE_PotatoesIndustry.h:115
de_potind_hilling4
Definition: DE_PotatoesIndustry.h:97
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
de_potind_foobar
Definition: DE_PotatoesIndustry.h:120
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
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
de_potind_winter_plough
Definition: DE_PotatoesIndustry.h:79
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_potind_ferti_s2
Definition: DE_PotatoesIndustry.h:83