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
ITOOrchard.h
Go to the documentation of this file.
1 
15 //
16 // ITOOrchard.h
17 //
18 /*
19 
20 Copyright (c) 2021, Christopher John Topping, Aarhus University
21 All rights reserved.
22 
23 
24 Redistribution and use in source and binary forms, with or without
25 modification, are permitted provided that the following conditions are met:
26 
27 *) Redistributions of source code must retain the above copyright notice, this
28 list of conditions and the following disclaimer.
29 *) Redistributions in binary form must reproduce the above copyright notice,
30 this list of conditions and the following disclaimer in the documentation
31 and/or other materials provided with the distribution.
32 *) Neither the name of the NERI nor the names of its contributors
33 may be used to endorse or promote products derived from this software without
34 specific prior written permission.
35 
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 POSSIBILITY OF SUCH DAMAGE.
47 
48 */
49 
50 #ifndef ITOORCHARD_H
51 #define ITOORCHARD_H
52 
53 #define IT_OO_EARLY a_field->m_user[1]
54 #define IT_OO_MID a_field->m_user[2]
55 #define IT_OO_LATE a_field->m_user[3]
56 
57 #define IT_OO_BASE 50200
58 
67 typedef enum {
68  it_oo_start = 1, // Compulsory, must always be 1 (one).
159 
160 
169 class ITOOrchard : public Crop
170 {
171 public:
172  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
173  ITOOrchard(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
174  {
175  // When we start it off, the first possible date for a farm operation
176  // This information is used by other crops when they decide how much post processing of
177  // the management is allowed after harvest before the next crop starts.
178  m_first_date = g_date->DayInYear(1, 1);
180  }
182  const int elements = 2 + (it_oo_foobar - IT_OO_BASE);
184 
185  FarmManagementCategory catlist[elements] =
186  {
187  fmc_Others, // zero element unused but must be here it_oo_start = 1, // Compulsory, must always be 1 (one).
188  fmc_Others, // it_oo_sleep_all_day = IT_O_BASE,
189  fmc_Cutting, // it_oo_winter_pruning,
190  fmc_Fertilizer, // it_oo_ferti_s1,
191  fmc_Fertilizer, // it_oo_ferti_p1,
192  fmc_Watering, // it_oo_irrigation,
193  fmc_Watering, // it_oo_irrigation,
194  fmc_Watering, // it_oo_irrigation,
195  fmc_Fungicide, // it_oo_fungi_1,
196  fmc_Fungicide, // it_oo_fungi_2,
197  fmc_Fungicide, // it_oo_fungi_3,
198  fmc_Fungicide, // it_oo_fungi_4,
199  fmc_Fungicide, // it_oo_fungi_5,
200  fmc_Fungicide, // it_oo_fungi_6,
201  fmc_Fungicide, // it_oo_fungi_7,
202  fmc_Fungicide, // it_oo_fungi_8,
203  fmc_Fungicide, // it_oo_fungi_9,
204  fmc_Fungicide, // it_oo_fungi_10,
205  fmc_Fungicide, // it_oo_fungi_11,
206  fmc_Fungicide, // it_oo_fungi_12,
207  fmc_Fungicide, // it_oo_fungi_13,
208  fmc_Fungicide, // it_oo_fungi_14,
209  fmc_Fungicide, // it_oo_fungi_15,
210  fmc_Fungicide, // it_oo_fungi_16,
211  fmc_Fungicide, // it_oo_fungi_17,
212  fmc_Fungicide, // it_oo_fungi_18,
213  fmc_Fungicide, // it_oo_fungi_19,
214  fmc_Fungicide, // it_oo_fungi_20,
215  fmc_Fungicide, // it_oo_fungi_21,
216  fmc_Fungicide, // it_oo_fungi_22,
217  fmc_Fungicide, // it_oo_fungi_23,
218  fmc_Fungicide, // it_oo_fungi_24,
219  fmc_Fungicide, // it_oo_fungi_25,
220  fmc_Fungicide, // it_oo_fungi_26,
221  fmc_Fungicide, // it_oo_fungi_27,
222  fmc_Fungicide, // it_oo_fungi_28,
223  fmc_Fungicide, // it_oo_fungi_29,
224  fmc_Fungicide, // it_oo_fungi_30,
225  fmc_Fungicide, // it_oo_fungi_31,
226  fmc_Fungicide, // it_oo_fungi_32,
227  fmc_Fungicide, // it_oo_fungi_33,
228  fmc_Fungicide, // it_oo_fungi_34,
229  fmc_Insecticide, // it_oo_insecti_1,
230  fmc_Insecticide, // it_oo_insecti_2,
231  fmc_Insecticide, // it_oo_insecti_3,
232  fmc_Insecticide, // it_oo_insecti_4,
233  fmc_Insecticide, // it_oo_insecti_5,
234  fmc_Insecticide, // it_oo_insecti_6,
235  fmc_Fertilizer, // it_oo_foliar_feed_s1,
236  fmc_Fertilizer, // it_oo_foliar_feed_s2,
237  fmc_Fertilizer, // it_oo_foliar_feed_s3,
238  fmc_Fertilizer, // it_oo_foliar_feed_s4,
239  fmc_Fertilizer, // it_oo_foliar_feed_s5,
240  fmc_Fertilizer, // it_oo_foliar_feed_s6,
241  fmc_Fertilizer, // it_oo_foliar_feed_s7,
242  fmc_Fertilizer, // it_oo_foliar_feed_s8,
243  fmc_Fertilizer, // it_oo_foliar_feed_s9,
244  fmc_Fertilizer, // it_oo_foliar_feed_s10,
245  fmc_Fertilizer, // it_oo_foliar_feed_p1,
246  fmc_Fertilizer, // it_oo_foliar_feed_p2,
247  fmc_Fertilizer, // it_oo_foliar_feed_p3,
248  fmc_Fertilizer, // it_oo_foliar_feed_p4,
249  fmc_Fertilizer, // it_oo_foliar_feed_p5,
250  fmc_Fertilizer, // it_oo_foliar_feed_p6,
251  fmc_Fertilizer, // it_oo_foliar_feed_p7,
252  fmc_Fertilizer, // it_oo_foliar_feed_p8,
253  fmc_Fertilizer, // it_oo_foliar_feed_p9,
254  fmc_Fertilizer, // it_oo_foliar_feed_p10,
255  fmc_Others, // it_oo_GR_russet_1,
256  fmc_Others, // it_oo_GR_russet_2,
257  fmc_Cutting, // it_oo_mechanical_thin_1,
258  fmc_Cutting, // it_oo_mechanical_thin_2,
259  fmc_Cutting, // it_oo_mechanical_thin_3,
260  fmc_Others, // it_oo_GR_growth_inhib,
261  fmc_Cutting, // it_oo_weed_mowing_1,
262  fmc_Cutting, // it_oo_weed_mowing_2,
263  fmc_Cutting, // it_oo_weed_mowing_3,
264  fmc_Cutting, // it_oo_weed_mowing_4,
265  fmc_Watering, // it_oo_DI_continued_early,
266  fmc_Watering, // it_oo_DI_continued_mid,
267  fmc_Watering, // it_oo_DI_continued_late,
268  fmc_Cutting, // it_oo_manual_thin,
269  fmc_Harvest, // it_oo_harvest_early1,
270  fmc_Harvest, // it_oo_harvest_early2,
271  fmc_Harvest, // it_oo_harvest_mid1,
272  fmc_Harvest, // it_oo_harvest_mid2,
273  fmc_Harvest, // it_oo_harvest_late1,
274  fmc_Harvest, // it_oo_harvest_late2,
275  fmc_Cutting, // it_oo_summer_pruning,
276 
277  // no foobar entry
278 
279  };
280  // Iterate over the catlist elements and copy them to vector
281  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
282 
283  }
284 };
285 
286 #endif // ITOOrchard_H
it_oo_foliar_feed_p1
Definition: ITOOrchard.h:126
it_oo_foliar_feed_p8
Definition: ITOOrchard.h:133
it_oo_fungi_30
Definition: ITOOrchard.h:105
it_oo_foliar_feed_s10
Definition: ITOOrchard.h:125
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
it_oo_ferti_s1
Definition: ITOOrchard.h:71
it_oo_weed_mowing_2
Definition: ITOOrchard.h:143
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
it_oo_irrigation_early
Definition: ITOOrchard.h:73
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
ITOOrchard::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: ITOOrchard.cpp:82
it_oo_foliar_feed_s3
Definition: ITOOrchard.h:118
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
it_oo_fungi_29
Definition: ITOOrchard.h:104
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
it_oo_fungi_21
Definition: ITOOrchard.h:96
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
it_oo_fungi_15
Definition: ITOOrchard.h:90
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: Elements.h:238
it_oo_fungi_16
Definition: ITOOrchard.h:91
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
it_oo_foliar_feed_p6
Definition: ITOOrchard.h:131
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
it_oo_harvest_mid2
Definition: ITOOrchard.h:153
ITOOrchard::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: ITOOrchard.h:181
Farm::GetPreviousTov
TTypesOfVegetation GetPreviousTov(int a_index)
Definition: Farm.h:966
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
it_oo_foliar_feed_s6
Definition: ITOOrchard.h:121
it_oo_fungi_2
Definition: ITOOrchard.h:77
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
it_oo_fungi_8
Definition: ITOOrchard.h:83
it_oo_fungi_3
Definition: ITOOrchard.h:78
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
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
it_oo_weed_mowing_3
Definition: ITOOrchard.h:144
it_oo_DI_continued_mid
Definition: ITOOrchard.h:147
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
it_oo_fungi_23
Definition: ITOOrchard.h:98
it_oo_fungi_33
Definition: ITOOrchard.h:108
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
IT_OO_BASE
#define IT_OO_BASE
Definition: ITOOrchard.h:57
IT_OO_EARLY
#define IT_OO_EARLY
Definition: ITOOrchard.h:53
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
it_oo_fungi_28
Definition: ITOOrchard.h:103
it_oo_weed_mowing_1
Definition: ITOOrchard.h:142
it_oo_fungi_1
Definition: ITOOrchard.h:76
it_oo_insecti_2
Definition: ITOOrchard.h:111
it_oo_fungi_11
Definition: ITOOrchard.h:86
it_oo_fungi_14
Definition: ITOOrchard.h:89
it_oo_insecti_1
Definition: ITOOrchard.h:110
it_oo_foliar_feed_p7
Definition: ITOOrchard.h:132
ITOOrchardToDo
ITOOrchardToDo
Definition: ITOOrchard.h:67
Calendar::Date
long Date(void)
Definition: Calendar.h:57
it_oo_fungi_31
Definition: ITOOrchard.h:106
it_oo_foliar_feed_p9
Definition: ITOOrchard.h:134
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
it_oo_weed_mowing_4
Definition: ITOOrchard.h:145
it_oo_foliar_feed_s7
Definition: ITOOrchard.h:122
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
it_oo_GR_growth_inhib
Definition: ITOOrchard.h:141
it_oo_fungi_32
Definition: ITOOrchard.h:107
it_oo_fungi_4
Definition: ITOOrchard.h:79
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
it_oo_foliar_feed_p10
Definition: ITOOrchard.h:135
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::CutOrch
virtual bool CutOrch(LE *a_field, double a_user, int a_days)
Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard.
Definition: FarmFuncs.cpp:1666
LE::GetRotIndex
int GetRotIndex(void)
Definition: Elements.h:373
it_oo_mechanical_thin_2
Definition: ITOOrchard.h:139
it_oo_fungi_26
Definition: ITOOrchard.h:101
it_oo_harvest_early1
Definition: ITOOrchard.h:150
FarmEvent::m_next_tov
TTypesOfVegetation m_next_tov
Definition: Farm.h:390
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
it_oo_foliar_feed_s1
Definition: ITOOrchard.h:116
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
it_oo_foliar_feed_p3
Definition: ITOOrchard.h:128
IT_OO_LATE
#define IT_OO_LATE
Definition: ITOOrchard.h:55
it_oo_fungi_34
Definition: ITOOrchard.h:109
it_oo_ferti_p1
Definition: ITOOrchard.h:72
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
it_oo_sleep_all_day
Definition: ITOOrchard.h:69
it_oo_fungi_7
Definition: ITOOrchard.h:82
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: FarmFuncs.cpp:272
it_oo_GR_russet_2
Definition: ITOOrchard.h:137
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
it_oo_foliar_feed_p2
Definition: ITOOrchard.h:127
it_oo_mechanical_thin_3
Definition: ITOOrchard.h:140
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
it_oo_harvest_early2
Definition: ITOOrchard.h:151
LE
Definition: Elements.h:86
it_oo_fungi_19
Definition: ITOOrchard.h:94
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
it_oo_insecti_4
Definition: ITOOrchard.h:113
it_oo_fungi_13
Definition: ITOOrchard.h:88
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
it_oo_DI_continued_late
Definition: ITOOrchard.h:148
Farm::LeafThinning
virtual bool LeafThinning(LE *a_field, double a_user, int a_days)
LeafThinning (leaf removal to increase areation and sun exposure of fruits, e.g., grapes) applied on ...
Definition: FarmFuncs.cpp:1927
it_oo_irrigation_mid
Definition: ITOOrchard.h:74
it_oo_mechanical_thin_1
Definition: ITOOrchard.h:138
it_oo_DI_continued_early
Definition: ITOOrchard.h:146
it_oo_harvest_late1
Definition: ITOOrchard.h:154
it_oo_start
Definition: ITOOrchard.h:68
it_oo_fungi_6
Definition: ITOOrchard.h:81
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
it_oo_fungi_9
Definition: ITOOrchard.h:84
it_oo_fungi_27
Definition: ITOOrchard.h:102
ITOOrchard
ITOOrchardd class .
Definition: ITOOrchard.h:169
it_oo_fungi_24
Definition: ITOOrchard.h:99
it_oo_foliar_feed_p4
Definition: ITOOrchard.h:129
it_oo_manual_thin
Definition: ITOOrchard.h:149
Farm
The base class for all farm types.
Definition: Farm.h:755
it_oo_fungi_20
Definition: ITOOrchard.h:95
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
Farm::Pruning
virtual bool Pruning(LE *a_field, double a_user, int a_days)
Pruning applied on a_field - details needs to be added (e.g., impact on biomass, influence/impacts in...
Definition: FarmFuncs.cpp:1897
it_oo_foliar_feed_s4
Definition: ITOOrchard.h:119
it_oo_harvest_late2
Definition: ITOOrchard.h:155
it_oo_insecti_6
Definition: ITOOrchard.h:115
it_oo_insecti_5
Definition: ITOOrchard.h:114
ITOOrchard::ITOOrchard
ITOOrchard(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: ITOOrchard.h:173
it_oo_insecti_3
Definition: ITOOrchard.h:112
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
it_oo_summer_pruning
Definition: ITOOrchard.h:156
IT_OO_MID
#define IT_OO_MID
Definition: ITOOrchard.h:54
LE::GetOwner
Farm * GetOwner(void)
Definition: Elements.h:256
it_oo_foliar_feed_s8
Definition: ITOOrchard.h:123
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
it_oo_fungi_25
Definition: ITOOrchard.h:100
it_oo_fungi_22
Definition: ITOOrchard.h:97
it_oo_irrigation_late
Definition: ITOOrchard.h:75
it_oo_fungi_12
Definition: ITOOrchard.h:87
it_oo_GR_russet_1
Definition: ITOOrchard.h:136
it_oo_fungi_5
Definition: ITOOrchard.h:80
it_oo_foliar_feed_s5
Definition: ITOOrchard.h:120
it_oo_winter_pruning
Definition: ITOOrchard.h:70
it_oo_fungi_18
Definition: ITOOrchard.h:93
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
it_oo_foobar
Definition: ITOOrchard.h:157
it_oo_fungi_10
Definition: ITOOrchard.h:85
it_oo_fungi_17
Definition: ITOOrchard.h:92
it_oo_foliar_feed_s9
Definition: ITOOrchard.h:124
WARN_BUG
Definition: MapErrorMsg.h:34
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
it_oo_foliar_feed_p5
Definition: ITOOrchard.h:130
it_oo_foliar_feed_s2
Definition: ITOOrchard.h:117
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:630
it_oo_harvest_mid1
Definition: ITOOrchard.h:152