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
NLOrchardCrop.h
Go to the documentation of this file.
1 //
2 // NLOrchardCrop.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2011, Christopher John Topping, Aarhus University
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without modification, are permitted provided
10 that the following conditions are met:
11 
12 Redistributions of source code must retain the above copyright notice, this list of conditions and the
13 following disclaimer.
14 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 the following disclaimer in the documentation and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ********************************************************************************************************
26 */
27 
28 
29 #ifndef NLORCHARDCROP_H
30 #define NLORCHARDCROP_H
31 
32 #define NLORCHARDCROP_BASE 21700
33 
37 #define NL_ORCH_INSECT a_field->m_user[1]
38 #define NL_ORCH_ISECT_DAY a_field->m_user[2]
39 
40 typedef enum {
41  nl_orch_start = 1, // Compulsory, start event must always be 1 (one).
54 
55 
56 
57 class NLOrchardCrop: public Crop
58 {
59 public:
60  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
61  NLOrchardCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
62  {
65  }
67  const int elements = 2 + (nl_orch_foobar - NLORCHARDCROP_BASE);
69 
70  FarmManagementCategory catlist[elements] =
71  {
72  fmc_Others, // zero element unused but must be here
73  fmc_Others,//nl_orch_start = 1, // Compulsory, start event must always be 1 (one).
74  fmc_Others,//nl_orch_sleep_all_day = NLORCHARDCROP_BASE,
75  fmc_Others,//nl_orch_do_nothing_stop,
76  fmc_Insecticide,//nl_orch_insecticide1,
77  fmc_Insecticide,//nl_orch_insecticide2,
78  fmc_Insecticide,//nl_orch_insecticide3,
79  fmc_Insecticide, //nl_orch_insecticide4,
80  fmc_Cutting,//nl_orch_cut1,
81  fmc_Cutting,//nl_orch_cut2,
82  fmc_Cutting,//nl_orch_cut3,
83  fmc_Cutting//nl_orch_cut4,
84 
85  // no foobar entry
86 
87  };
88  // Iterate over the catlist elements and copy them to vector
89  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
90 
91  }
92 };
93 
94 #endif // NLORCHARDCROP_H
cfg_pest_orchard_on
CfgBool cfg_pest_orchard_on
Turn on pesticides for orchard.
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
nl_orch_insecticide1
Definition: NLOrchardCrop.h:44
nl_orch_cut2
Definition: NLOrchardCrop.h:49
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
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
NLOrchardCropToDo
NLOrchardCropToDo
Definition: NLOrchardCrop.h:40
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
NLOrchardCrop::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: NLOrchardCrop.cpp:39
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
nl_orch_start
Definition: NLOrchardCrop.h:41
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
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
nl_orch_insecticide4
Definition: NLOrchardCrop.h:47
Crop
The base class for all crops.
Definition: Farm.h:495
NLORCHARDCROP_BASE
#define NLORCHARDCROP_BASE
Definition: NLOrchardCrop.h:32
CfgBool::value
bool value() const
Definition: Configurator.h:164
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
nl_orch_cut3
Definition: NLOrchardCrop.h:50
NLOrchardCrop::NLOrchardCrop
NLOrchardCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: NLOrchardCrop.h:61
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
tov_NLOrchardCrop
Definition: LandscapeFarmingEnums.h:271
nl_orch_cut1
Definition: NLOrchardCrop.h:48
NLOrchardCrop
Definition: NLOrchardCrop.h:57
Calendar::Date
long Date(void)
Definition: Calendar.h:57
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
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::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
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
nl_orch_insecticide2
Definition: NLOrchardCrop.h:45
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
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
NL_ORCH_ISECT_DAY
#define NL_ORCH_ISECT_DAY
Definition: NLOrchardCrop.h:38
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
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
nl_orch_do_nothing_stop
Definition: NLOrchardCrop.h:43
cfg_ORCH_InsecticideDay
CfgInt cfg_ORCH_InsecticideDay
Provided to allow configuration control of the first insecticide spray in orchard crops - this change...
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
CfgInt
Integer configurator entry class.
Definition: Configurator.h:102
Farm
The base class for all farm types.
Definition: Farm.h:755
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
nl_orch_foobar
Definition: NLOrchardCrop.h:52
NL_ORCH_INSECT
#define NL_ORCH_INSECT
A flag used to indicate insecticide use.
Definition: NLOrchardCrop.h:37
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
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.
nl_orch_sleep_all_day
Definition: NLOrchardCrop.h:42
nl_orch_cut4
Definition: NLOrchardCrop.h:51
cfg_ORCH_InsecticideMonth
CfgInt cfg_ORCH_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in orchard crops - this change...
NLOrchardCrop::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: NLOrchardCrop.h:66
nl_orch_insecticide3
Definition: NLOrchardCrop.h:46
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
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