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
WinterBarleyStrigling.h
Go to the documentation of this file.
1 //
2 // WinterBarleyStrigling.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 WinterBarleyStrigling_H
38 #define WinterBarleyStrigling_H
39 
40 #define WBarleyStrigling_BASE 7700
41 
42 #define WBS_DID_SEVEN_ONE m_field->m_user[0]
43 #define WBS_DID_SEVEN_TWO m_field->m_user[1]
44 #define WBS_DID_SEVEN_THREE m_field->m_user[2]
45 #define WBS_DID_SEVEN_FOUR m_field->m_user[3]
46 
47 #define WBS_FUNGICIDE_DATE m_field->m_user[4]
48 #define WBS_HERBICIDE_DATE m_field->m_user[5]
49 
50 #define WBS_DID_EIGHT_ONE m_field->m_user[0]
51 #define WBS_DID_EIGHT_TWO m_field->m_user[1]
52 #define WBS_DID_EIGHT_THREE m_field->m_user[2]
53 #define WBS_DID_EIGHT_FOUR m_field->m_user[3]
54 
55 typedef enum {
56  wbs_start = 1, // Compulsory, start event must always be 1 (one).
83 // --FN--
84 } WBTSoDo;
85 
86 
87 
89 {
90 public:
91  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
92  WinterBarleyStrigling(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
93  {
96  }
98  const int elements = 2 + (wbs_foobar - WBarleyStrigling_BASE);
100 
101  FarmManagementCategory catlist[elements] =
102  {
103  fmc_Others, // zero element unused but must be here
104  fmc_Others,//wbs_start = 1, // Compulsory, start event must always be 1 (one).
105  fmc_Fertilizer,//wbs_fertsludge_plant_one = WBarleyStrigling_BASE,
106  fmc_Fertilizer,//wbs_fertmanure_stock,
107  fmc_Fertilizer,//wbs_fertslurry_stock_one,
108  fmc_Cultivation,//wbs_autumn_plough,
109  fmc_Cultivation,//wbs_autumn_harrow,
110  fmc_Others,//wbs_autumn_sow,
111  fmc_Cultivation,//wbs_strigling_one,
112  fmc_Fertilizer,//wbs_fertmanganese_plant_one,
113  fmc_Fertilizer,//wbs_fertmanganese_plant_two,
114  fmc_Fertilizer,//wbs_fertnpk_plant_one,
115  fmc_Fertilizer,//wbs_fertnpk_plant_two,
116  fmc_Fertilizer,//wbs_fertslurry_stock_two,
117  fmc_Fertilizer,//wbs_fertnpk_stock_one,
118  fmc_Fertilizer,//wbs_fertnpk_stock_two,
119  fmc_Cultivation,//wbs_strigling_two,
120  fmc_Insecticide,//wbs_fungicide_one,
121  fmc_Others,//wbs_switchboard,
122  fmc_Insecticide,//wbs_fungicide_two,
123  fmc_Others,//wbs_growth_reg,
124  fmc_Watering,//wbs_water,
125  fmc_Insecticide,//wbs_insecticide,
126  fmc_Harvest,//wbs_harvest,
127  fmc_Others,//wbs_hay_turning,
128  fmc_Others,//wbs_hay_bailing,
129  fmc_Cultivation//wbs_stubble_harrowing
130 
131  // no foobar entry
132 
133  };
134  // Iterate over the catlist elements and copy them to vector
135  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
136 
137  }
138 };
139 
140 #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
WBS_DID_EIGHT_FOUR
#define WBS_DID_EIGHT_FOUR
Definition: WinterBarleyStrigling.h:53
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
wbs_start
Definition: WinterBarleyStrigling.h:56
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
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
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
WinterBarleyStrigling::WinterBarleyStrigling
WinterBarleyStrigling(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: WinterBarleyStrigling.h:92
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
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
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
WBS_DID_SEVEN_TWO
#define WBS_DID_SEVEN_TWO
Definition: WinterBarleyStrigling.h:43
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
wbs_water
Definition: WinterBarleyStrigling.h:76
wbs_autumn_harrow
Definition: WinterBarleyStrigling.h:61
wbs_fertnpk_plant_two
Definition: WinterBarleyStrigling.h:67
wbs_autumn_sow
Definition: WinterBarleyStrigling.h:62
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
WBarleyStrigling_BASE
#define WBarleyStrigling_BASE
Definition: WinterBarleyStrigling.h:40
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wbs_fertnpk_stock_two
Definition: WinterBarleyStrigling.h:70
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
WBS_DID_SEVEN_FOUR
#define WBS_DID_SEVEN_FOUR
Definition: WinterBarleyStrigling.h:45
wbs_strigling_two
Definition: WinterBarleyStrigling.h:71
CfgFloat::value
double value() const
Definition: Configurator.h:142
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wbs_fertmanganese_plant_two
Definition: WinterBarleyStrigling.h:65
wbs_autumn_plough
Definition: WinterBarleyStrigling.h:60
wbs_hay_bailing
Definition: WinterBarleyStrigling.h:80
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
wbs_fertslurry_stock_one
Definition: WinterBarleyStrigling.h:59
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
WBS_DID_EIGHT_THREE
#define WBS_DID_EIGHT_THREE
Definition: WinterBarleyStrigling.h:52
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
WBS_DID_EIGHT_TWO
#define WBS_DID_EIGHT_TWO
Definition: WinterBarleyStrigling.h:51
WBS_DID_EIGHT_ONE
#define WBS_DID_EIGHT_ONE
Definition: WinterBarleyStrigling.h:50
wbs_stubble_harrowing
Definition: WinterBarleyStrigling.h:81
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
wbs_insecticide
Definition: WinterBarleyStrigling.h:77
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wbs_fungicide_two
Definition: WinterBarleyStrigling.h:74
wbs_fertsludge_plant_one
Definition: WinterBarleyStrigling.h:57
WinterBarleyStrigling::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterBarleyStrigling.cpp:38
Calendar::Date
long Date(void)
Definition: Calendar.h:57
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
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
cfg_strigling_prop
CfgFloat cfg_strigling_prop
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
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
WinterBarleyStrigling
Definition: WinterBarleyStrigling.h:88
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
wbs_fertnpk_plant_one
Definition: WinterBarleyStrigling.h:66
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
WBS_HERBICIDE_DATE
#define WBS_HERBICIDE_DATE
Definition: WinterBarleyStrigling.h:48
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
WBS_FUNGICIDE_DATE
#define WBS_FUNGICIDE_DATE
Definition: WinterBarleyStrigling.h:47
wbs_fungicide_one
Definition: WinterBarleyStrigling.h:72
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
wbs_strigling_one
Definition: WinterBarleyStrigling.h:63
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
WBS_DID_SEVEN_ONE
#define WBS_DID_SEVEN_ONE
Definition: WinterBarleyStrigling.h:42
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
LE
Definition: Elements.h:86
wbs_growth_reg
Definition: WinterBarleyStrigling.h:75
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
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
WBTSoDo
WBTSoDo
Definition: WinterBarleyStrigling.h:55
Farm
The base class for all farm types.
Definition: Farm.h:755
WinterBarleyStrigling::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterBarleyStrigling.h:97
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
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
wbs_fertnpk_stock_one
Definition: WinterBarleyStrigling.h:69
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
wbs_fertslurry_stock_two
Definition: WinterBarleyStrigling.h:68
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wbs_hay_turning
Definition: WinterBarleyStrigling.h:79
wbs_switchboard
Definition: WinterBarleyStrigling.h:73
wbs_harvest
Definition: WinterBarleyStrigling.h:78
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
wbs_fertmanure_stock
Definition: WinterBarleyStrigling.h:58
wbs_foobar
Definition: WinterBarleyStrigling.h:82
WARN_BUG
Definition: MapErrorMsg.h:34
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
WBS_DID_SEVEN_THREE
#define WBS_DID_SEVEN_THREE
Definition: WinterBarleyStrigling.h:44
wbs_fertmanganese_plant_one
Definition: WinterBarleyStrigling.h:64