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
WinterBarley.h
Go to the documentation of this file.
1 //
2 // WinterBarley.h
3 //
4 /*
5 
6 Copyright (c) 2003, National Environmental Research Institute, Denmark (NERI)
7 
8 All rights reserved.
9 
10 
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 
14 *) Redistributions of source code must retain the above copyright notice, this
15 list of conditions and the following disclaimer.
16 *) Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 *) Neither the name of the NERI nor the names of its contributors
20 may be used to endorse or promote products derived from this software without
21 specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 
35 */
36 
37 #ifndef WinterBarley_H
38 #define WinterBarley_H
39 
40 #define WBarley_BASE 7600
41 
42 #define WB_DID_SEVEN_ONE m_field->m_user[0]
43 #define WB_DID_SEVEN_TWO m_field->m_user[1]
44 #define WB_DID_SEVEN_THREE m_field->m_user[2]
45 #define WB_DID_SEVEN_FOUR m_field->m_user[3]
46 
47 #define WB_FUNGICIDE_DATE m_field->m_user[4]
48 #define WB_HERBICIDE_DATE m_field->m_user[5]
49 
50 #define WB_DID_EIGHT_ONE m_field->m_user[0]
51 #define WB_DID_EIGHT_TWO m_field->m_user[1]
52 #define WB_DID_EIGHT_THREE m_field->m_user[2]
53 #define WB_DID_EIGHT_FOUR m_field->m_user[3]
54 #define WB_DECIDE_TO_HERB m_field->m_user[4]
55 #define WB_DECIDE_TO_FI m_field->m_user[5]
56 
57 
58 typedef enum {
59  wb_start = 1, // Compulsory, start event must always be 1 (one).
86 // --FN--
87 } WBToDo;
88 
89 
90 
91 class WinterBarley: public Crop
92 {
93 public:
94  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
95  WinterBarley(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
96  {
99  }
101  const int elements = 2 + (wb_foobar - WBarley_BASE);
103 
104  FarmManagementCategory catlist[elements] =
105  {
106  fmc_Others, // zero element unused but must be here
107  fmc_Others,//wb_start = 1, // Compulsory, start event must always be 1 (one).
108  fmc_Fertilizer,//wb_fertsludge_plant_one = WBarley_BASE,
109  fmc_Fertilizer,//wb_fertmanure_stock,
110  fmc_Fertilizer,//wb_fertslurry_stock_one,
111  fmc_Cultivation,//wb_autumn_plough,
112  fmc_Cultivation,//wb_autumn_harrow,
113  fmc_Others,//wb_autumn_sow,
114  fmc_Herbicide,//wb_herbicide_one,
115  fmc_Fertilizer,//wb_fertmanganese_plant_one,
116  fmc_Fertilizer,//wb_fertmanganese_plant_two,
117  fmc_Fertilizer,//wb_fertnpk_plant_one,
118  fmc_Fertilizer,//wb_fertnpk_plant_two,
119  fmc_Fertilizer,//wb_fertslurry_stock_two,
120  fmc_Fertilizer,//wb_fertnpk_stock_one,
121  fmc_Fertilizer,//wb_fertnpk_stock_two,
122  fmc_Herbicide,//wb_herbicide_two,
123  fmc_Fungicide,//wb_fungicide_one,
124  fmc_Others,//wb_switchboard,
125  fmc_Fungicide,//wb_fungicide_two,
126  fmc_Others,//wb_growth_reg,
127  fmc_Watering,//wb_water,
128  fmc_Insecticide,//wb_insecticide,
129  fmc_Harvest,//wb_harvest,
130  fmc_Others,//wb_hay_turning,
131  fmc_Others,//wb_hay_bailing,
132  fmc_Cultivation//wb_stubble_harrowing
133 
134  // no foobar entry
135 
136  };
137  // Iterate over the catlist elements and copy them to vector
138  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
139 
140  }
141 };
142 
143 #endif // WinterBarley_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::FP_Sludge
virtual bool FP_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:926
wb_fertslurry_stock_one
Definition: WinterBarley.h:62
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
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
wb_fertnpk_plant_one
Definition: WinterBarley.h:69
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
WinterBarley::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterBarley.cpp:37
WinterBarley
Definition: WinterBarley.h:91
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
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
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
LE::GetMConstants
int GetMConstants(int a)
Definition: Elements.h:407
wb_water
Definition: WinterBarley.h:79
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
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
wb_hay_turning
Definition: WinterBarley.h:82
wb_fertmanganese_plant_one
Definition: WinterBarley.h:67
wb_autumn_harrow
Definition: WinterBarley.h:64
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
WB_DECIDE_TO_FI
#define WB_DECIDE_TO_FI
Definition: WinterBarley.h:55
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
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
CfgFloat::value
double value() const
Definition: Configurator.h:142
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
WBarley_BASE
#define WBarley_BASE
Definition: WinterBarley.h:40
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
WB_DID_EIGHT_THREE
#define WB_DID_EIGHT_THREE
Definition: WinterBarley.h:52
wb_growth_reg
Definition: WinterBarley.h:78
wb_fungicide_two
Definition: WinterBarley.h:77
WB_DID_EIGHT_ONE
#define WB_DID_EIGHT_ONE
Definition: WinterBarley.h:50
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
wb_fungicide_one
Definition: WinterBarley.h:75
Crop
The base class for all crops.
Definition: Farm.h:495
WBToDo
WBToDo
Definition: WinterBarley.h:58
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
wb_hay_bailing
Definition: WinterBarley.h:83
wb_foobar
Definition: WinterBarley.h:85
wb_start
Definition: WinterBarley.h:59
wb_switchboard
Definition: WinterBarley.h:76
wb_fertsludge_plant_one
Definition: WinterBarley.h:60
wb_herbicide_one
Definition: WinterBarley.h:66
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: Farm.h:778
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
wb_autumn_plough
Definition: WinterBarley.h:63
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
WB_FUNGICIDE_DATE
#define WB_FUNGICIDE_DATE
Definition: WinterBarley.h:47
WB_DID_SEVEN_FOUR
#define WB_DID_SEVEN_FOUR
Definition: WinterBarley.h:45
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: FarmFuncs.cpp:1507
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
WB_DECIDE_TO_HERB
#define WB_DECIDE_TO_HERB
Definition: WinterBarley.h:54
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: FarmFuncs.cpp:1475
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
wb_fertmanure_stock
Definition: WinterBarley.h:61
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
WinterBarley::WinterBarley
WinterBarley(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: WinterBarley.h:95
wb_herbicide_two
Definition: WinterBarley.h:74
wb_harvest
Definition: WinterBarley.h:81
wb_fertnpk_plant_two
Definition: WinterBarley.h:70
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
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
WB_HERBICIDE_DATE
#define WB_HERBICIDE_DATE
Definition: WinterBarley.h:48
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
WB_DID_SEVEN_TWO
#define WB_DID_SEVEN_TWO
Definition: WinterBarley.h:43
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
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
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
WB_DID_EIGHT_TWO
#define WB_DID_EIGHT_TWO
Definition: WinterBarley.h:51
wb_fertslurry_stock_two
Definition: WinterBarley.h:71
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
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
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Farm
The base class for all farm types.
Definition: Farm.h:755
wb_fertmanganese_plant_two
Definition: WinterBarley.h:68
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
WB_DID_EIGHT_FOUR
#define WB_DID_EIGHT_FOUR
Definition: WinterBarley.h:53
Farm::AutumnSow
virtual bool AutumnSow(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 autumn on a_field.
Definition: FarmFuncs.cpp:360
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
WB_DID_SEVEN_THREE
#define WB_DID_SEVEN_THREE
Definition: WinterBarley.h:44
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wb_insecticide
Definition: WinterBarley.h:80
wb_stubble_harrowing
Definition: WinterBarley.h:84
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Crop::ChooseNextCrop
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
Definition: Farm.cpp:756
Farm::HayTurning
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
Definition: FarmFuncs.cpp:1491
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
wb_fertnpk_stock_two
Definition: WinterBarley.h:73
WinterBarley::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterBarley.h:100
WARN_BUG
Definition: MapErrorMsg.h:34
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
wb_autumn_sow
Definition: WinterBarley.h:65
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
WB_DID_SEVEN_ONE
#define WB_DID_SEVEN_ONE
Definition: WinterBarley.h:42
wb_fertnpk_stock_one
Definition: WinterBarley.h:72