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_OOrchard.h
Go to the documentation of this file.
1 
13 //
14 // DE_OOrchard.
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 plan is the same as for conventional orchard but without any pesticides
49 
50 #ifndef DE_OORCH_H
51 #define DE_OORCH_H
52 
53 #define DE_OORCH_RC_DATE m_field->m_user[0]
54 
55 #define DE_OORCH_BASE 39600
56 
67 typedef enum {
68  de_oorch_start = 1, // Compulsory, must always be 1 (one).
130  de_oorch_foobar, // Obligatory, must be last
131 } DE_OORCHToDo;
132 
133 
142 class DE_OOrchard : public Crop
143 {
144 public:
145  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
146  DE_OOrchard(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
147  {
153  m_first_date = g_date->DayInYear(30, 3);
155  }
157  const int elements = 2 + (de_oorch_foobar - DE_OORCH_BASE);
159 
160  FarmManagementCategory catlist[elements] =
161  {
162  fmc_Others, // zero element unused but must be here
163  // ALL THE NECESSARY ENTRIES HERE
164  fmc_Others, // de_oorch_start = 1, // Compulsory, must always be 1 (one).
165  fmc_Harvest, // de_oorch_harvest
166  fmc_Fertilizer, // de_oorch_ferti_p1,
167  fmc_Fertilizer, // de_oorch_ferti_s1,
168  fmc_Fertilizer, // de_oorch_ferti_p2,
169  fmc_Fertilizer, // de_oorch_ferti_s2,
170  fmc_Fertilizer, // de_oorch_ferti_p3,
171  fmc_Fertilizer, // de_oorch_ferti_s3,
172  fmc_Fertilizer, // de_oorch_ferti_p4,
173  fmc_Fertilizer, // de_oorch_ferti_s4,
174  fmc_Fertilizer, // de_oorch_ferti_p5,
175  fmc_Fertilizer, // de_oorch_ferti_s5,
176  fmc_Fertilizer, // de_oorch_ferti_p,
177  fmc_Fertilizer, // de_oorch_ferti_s,
178  fmc_Fertilizer, // de_oorch_ferti_p,
179  fmc_Fertilizer, // de_oorch_ferti_s,
180  fmc_Fertilizer, // de_oorch_ferti_p,
181  fmc_Fertilizer, // de_oorch_ferti_s,
182  fmc_Fertilizer, // de_oorch_ferti_p,
183  fmc_Fertilizer, // de_oorch_ferti_s,
184  fmc_Others, // de_oorch_fungicide,
185  fmc_Others, // de_oorch_fungicide,
186  fmc_Others, // de_oorch_fungicide,
187  fmc_Others, // de_oorch_fungicide,
188  fmc_Others, // de_oorch_fungicide,
189  fmc_Others, // de_oorch_fungicide,
190  fmc_Others, // de_oorch_fungicide,
191  fmc_Others, // de_oorch_fungicide,
192  fmc_Others, // de_oorch_fungicide,
193  fmc_Others, // de_oorch_fungicide,
194  fmc_Others, // de_oorch_fungicide,
195  fmc_Others, // de_oorch_fungicide,
196  fmc_Others, // de_oorch_fungicide,
197  fmc_Others, // de_oorch_fungicide,
198  fmc_Others, // de_oorch_fungicide,
199  fmc_Others, // de_oorch_fungicide,
200  fmc_Others, // de_oorch_fungicide,
201  fmc_Others, // de_oorch_fungicide,
202  fmc_Others, // de_oorch_fungicide,
203  fmc_Others, // de_oorch_fungicide,
204  fmc_Others, // de_oorch_fungicide,
205  fmc_Others, // de_oorch_fungicide,
206  fmc_Others, // de_oorch_pheromone,
207  fmc_Others, // de_oorch_insecticide,
208  fmc_Others, // de_oorch_insecticide,
209  fmc_Others, // de_oorch_insecticide,
210  fmc_Others, // de_oorch_insecticide,
211  fmc_Others, // de_oorch_insecticide,
212  fmc_Others, // de_oorch_insecticide,
213  fmc_Others, // de_oorch_insecticide,
214  fmc_Others, // de_oorch_insecticide,
215  fmc_Others, // de_oorch_insecticide,
216  fmc_Others, // de_oorch_insecticide,
217  fmc_Others, // de_oorch_insecticide,
218  fmc_Cultivation, // de_oorch_row_cultivation,
219  fmc_Cultivation, // de_oorch_row_cultivation,
220  fmc_Cultivation, // de_oorch_row_cultivation,
221  fmc_Cultivation, // de_oorch_row_cultivation,
222  fmc_Cultivation, // de_oorch_row_cultivation,
223  fmc_Cultivation, // de_oorch_row_cultivation,
224  fmc_Cultivation, // de_oorch_manual_weeding,
225  fmc_Cultivation, // de_oorch_manual_weeding,
226 
227  // no foobar entry
228 
229  };
230  // Iterate over the catlist elements and copy them to vector
231  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
232 
233  }
234 };
235 
236 #endif // DE_OORCH_H
237 
238 
de_oorch_ferti_s5
Definition: DE_OOrchard.h:79
de_oorch_pheromone
Definition: DE_OOrchard.h:110
de_oorch_insecticide9
Definition: DE_OOrchard.h:119
Farm::OrganicInsecticide
virtual bool OrganicInsecticide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
Definition: FarmFuncs.cpp:2195
de_oorch_fungicide5
Definition: DE_OOrchard.h:92
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
de_oorch_fungicide11
Definition: DE_OOrchard.h:98
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
de_oorch_fungicide12
Definition: DE_OOrchard.h:99
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
de_oorch_ferti_p2
Definition: DE_OOrchard.h:72
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
de_oorch_row_cultivation3
Definition: DE_OOrchard.h:124
de_oorch_ferti_p7
Definition: DE_OOrchard.h:82
de_oorch_fungicide18
Definition: DE_OOrchard.h:105
de_oorch_fungicide20
Definition: DE_OOrchard.h:107
de_oorch_fungicide8
Definition: DE_OOrchard.h:95
de_oorch_ferti_s3
Definition: DE_OOrchard.h:75
de_oorch_row_cultivation1
Definition: DE_OOrchard.h:122
de_oorch_ferti_s8
Definition: DE_OOrchard.h:85
de_oorch_fungicide21
Definition: DE_OOrchard.h:108
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
de_oorch_insecticide8
Definition: DE_OOrchard.h:118
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
de_oorch_ferti_s7
Definition: DE_OOrchard.h:83
de_oorch_fungicide1
Definition: DE_OOrchard.h:88
de_oorch_fungicide22
Definition: DE_OOrchard.h:109
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
de_oorch_insecticide11
Definition: DE_OOrchard.h:121
de_oorch_ferti_s1
Definition: DE_OOrchard.h:71
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
de_oorch_fungicide19
Definition: DE_OOrchard.h:106
DE_OOrchard::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_OOrchard.cpp:87
de_oorch_ferti_s9
Definition: DE_OOrchard.h:87
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
de_oorch_insecticide7
Definition: DE_OOrchard.h:117
de_oorch_ferti_p6
Definition: DE_OOrchard.h:80
de_oorch_manual_weeding1
Definition: DE_OOrchard.h:128
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
de_oorch_insecticide6
Definition: DE_OOrchard.h:116
de_oorch_insecticide3
Definition: DE_OOrchard.h:113
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_oorch_fungicide15
Definition: DE_OOrchard.h:102
de_oorch_ferti_s6
Definition: DE_OOrchard.h:81
de_oorch_manual_weeding2
Definition: DE_OOrchard.h:129
de_oorch_harvest
Definition: DE_OOrchard.h:69
de_oorch_fungicide2
Definition: DE_OOrchard.h:89
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
de_oorch_fungicide13
Definition: DE_OOrchard.h:100
tov_DEOOrchard
Definition: LandscapeFarmingEnums.h:519
de_oorch_foobar
Definition: DE_OOrchard.h:130
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
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
de_oorch_fungicide4
Definition: DE_OOrchard.h:91
de_oorch_fungicide16
Definition: DE_OOrchard.h:103
de_oorch_ferti_p8
Definition: DE_OOrchard.h:84
de_oorch_ferti_p5
Definition: DE_OOrchard.h:78
Farm::ManualWeeding
virtual bool ManualWeeding(LE *a_field, double a_user, int a_days)
Manual weeding on a_field - no tramlines since weeding by hand, the bush stays on field with same veg...
Definition: FarmFuncs.cpp:2002
de_oorch_fungicide3
Definition: DE_OOrchard.h:90
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
Farm::Pheromone
virtual bool Pheromone(LE *a_field, double a_user, int a_days)
Pheromone applied on a_field - same as with org. pesticides for now.
Definition: FarmFuncs.cpp:2249
de_oorch_ferti_s2
Definition: DE_OOrchard.h:73
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
DE_OORCH_BASE
#define DE_OORCH_BASE
Definition: DE_OOrchard.h:55
de_oorch_ferti_p1
Definition: DE_OOrchard.h:70
de_oorch_fungicide7
Definition: DE_OOrchard.h:94
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
de_oorch_insecticide2
Definition: DE_OOrchard.h:112
de_oorch_row_cultivation6
Definition: DE_OOrchard.h:127
de_oorch_fungicide17
Definition: DE_OOrchard.h:104
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
de_oorch_ferti_p3
Definition: DE_OOrchard.h:74
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
de_oorch_insecticide1
Definition: DE_OOrchard.h:111
de_oorch_start
Definition: DE_OOrchard.h:68
de_oorch_fungicide6
Definition: DE_OOrchard.h:93
DE_OORCH_RC_DATE
#define DE_OORCH_RC_DATE
Definition: DE_OOrchard.h:53
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
DE_OOrchard
DE_OOrchard class .
Definition: DE_OOrchard.h:142
de_oorch_row_cultivation4
Definition: DE_OOrchard.h:125
Farm
The base class for all farm types.
Definition: Farm.h:755
de_oorch_insecticide4
Definition: DE_OOrchard.h:114
de_oorch_ferti_p4
Definition: DE_OOrchard.h:76
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::FruitHarvest
virtual bool FruitHarvest(LE *a_field, double a_user, int a_days)
FruitHarvest (harvest of the mature fruits, e.g., grapes) applied on a_field.
Definition: FarmFuncs.cpp:1959
DE_OORCHToDo
DE_OORCHToDo
A flag used to indicate autumn ploughing status.
Definition: DE_OOrchard.h:67
de_oorch_fungicide9
Definition: DE_OOrchard.h:96
de_oorch_fungicide10
Definition: DE_OOrchard.h:97
g_landscape_ptr
Landscape * g_landscape_ptr
Definition: Landscape.cpp:352
de_oorch_ferti_s4
Definition: DE_OOrchard.h:77
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
DE_OOrchard::DE_OOrchard
DE_OOrchard(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DE_OOrchard.h:146
Farm::OrganicFungicide
virtual bool OrganicFungicide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
Definition: FarmFuncs.cpp:2231
de_oorch_row_cultivation2
Definition: DE_OOrchard.h:123
de_oorch_row_cultivation5
Definition: DE_OOrchard.h:126
de_oorch_fungicide14
Definition: DE_OOrchard.h:101
DE_OOrchard::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_OOrchard.h:156
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
de_oorch_ferti_p9
Definition: DE_OOrchard.h:86
WARN_BUG
Definition: MapErrorMsg.h:34
de_oorch_insecticide5
Definition: DE_OOrchard.h:115
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
de_oorch_insecticide10
Definition: DE_OOrchard.h:120
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