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
WinterRye.h
Go to the documentation of this file.
1 //
2 // WinterRye.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 WinterRye_H
38 #define WinterRye_H
39 
40 #define WRYE_BASE 8000
41 #define WRY_DID_MANURE m_field->m_user[0]
42 #define WRY_DID_SLUDGE m_field->m_user[1]
43 #define WRY_DECIDE_TO_HERB m_field->m_user[2]
44 
45 typedef enum {
46  wry_start = 1, // Compulsory, start event must always be 1 (one).
62  wry_herbicide_two, //added 030513
74 
75 
76 
77 class WinterRye: public Crop
78 {
79 public:
80  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
81  WinterRye(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
82  {
85  }
87  const int elements = 2 + (wry_foobar - WRYE_BASE);
89 
90  FarmManagementCategory catlist[elements] =
91  {
92  fmc_Others, // zero element unused but must be here
93  fmc_Others,//wry_start = 1, // Compulsory, start event must always be 1 (one).
94  fmc_Fertilizer,//wry_fertmanure_stock = WRYE_BASE,
95  fmc_Fertilizer,//wry_fertsludge_stock,
96  fmc_Cultivation,//wry_autumn_plough,
97  fmc_Cultivation,//wry_autumn_harrow,
98  fmc_Others,//wry_autumn_sow,
99  fmc_Others,//wry_autumn_roll,
100  fmc_Fertilizer,//wry_fertmanganese_plant_one,
101  fmc_Fertilizer,//wry_fertnpk_plant,
102  fmc_Fertilizer,//wry_fertmanganese_plant_two,
103  fmc_Fertilizer,//wry_fertslurry_stock,
104  fmc_Fertilizer,//wry_fert_ammonium_stock,
105  fmc_Others,//wry_spring_roll,
106  fmc_Cultivation,//wry_strigling,
107  fmc_Others,//wry_growth_reg_one,
108  fmc_Herbicide,//wry_herbicide,
109  fmc_Herbicide,//wry_herbicide_two, //added 030513
110  fmc_Others,//wry_growth_reg_two,
111  fmc_Fungicide,//wry_fungicide,
112  fmc_Insecticide,//wry_insecticide,
113  fmc_Watering,//wry_water,
114  fmc_Harvest,//wry_harvest,
115  fmc_Others,//wry_straw_chopping,
116  fmc_Others,//wry_hay_turning,
117  fmc_Others,//wry_hay_bailing,
118  fmc_Cultivation//wry_stubble_harrowing
119 
120  // no foobar entry
121 
122  };
123  // Iterate over the catlist elements and copy them to vector
124  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
125 
126  }
127 };
128 
129 #endif // WinterRye_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::SpringRoll
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
Definition: FarmFuncs.cpp:487
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
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
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
WinterRye::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterRye.h:86
wry_fungicide
Definition: WinterRye.h:64
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
wry_fertmanure_stock
Definition: WinterRye.h:47
wry_fertnpk_plant
Definition: WinterRye.h:54
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
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
wry_herbicide
Definition: WinterRye.h:61
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wry_water
Definition: WinterRye.h:66
wry_fert_ammonium_stock
Definition: WinterRye.h:57
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
Farm::FA_Sludge
virtual bool FA_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege sludge on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1140
CfgFloat::value
double value() const
Definition: Configurator.h:142
wry_foobar
Definition: WinterRye.h:72
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
wry_insecticide
Definition: WinterRye.h:65
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
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
wry_hay_turning
Definition: WinterRye.h:69
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Crop
The base class for all crops.
Definition: Farm.h:495
WRY_DECIDE_TO_HERB
#define WRY_DECIDE_TO_HERB
Definition: WinterRye.h:43
wry_fertsludge_stock
Definition: WinterRye.h:48
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
WRY_DID_MANURE
#define WRY_DID_MANURE
Definition: WinterRye.h:41
Farm::Prob_multiplier
virtual double Prob_multiplier()
Definition: Farm.h:778
WRY_DID_SLUDGE
#define WRY_DID_SLUDGE
Definition: WinterRye.h:42
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
wry_growth_reg_two
Definition: WinterRye.h:63
Calendar::Date
long Date(void)
Definition: Calendar.h:57
wry_autumn_roll
Definition: WinterRye.h:52
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
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
WinterRye::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterRye.cpp:37
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
wry_harvest
Definition: WinterRye.h:67
WinterRyeToDo
WinterRyeToDo
Definition: WinterRye.h:45
WinterRye::WinterRye
WinterRye(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: WinterRye.h:81
wry_herbicide_two
Definition: WinterRye.h:62
wry_spring_roll
Definition: WinterRye.h:58
wry_autumn_plough
Definition: WinterRye.h:49
WinterRye
Definition: WinterRye.h:77
wry_autumn_sow
Definition: WinterRye.h:51
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
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
wry_growth_reg_one
Definition: WinterRye.h:60
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
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: FarmFuncs.cpp:299
WRYE_BASE
#define WRYE_BASE
Definition: WinterRye.h:40
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
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
wry_straw_chopping
Definition: WinterRye.h:68
wry_fertmanganese_plant_two
Definition: WinterRye.h:55
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
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1081
wry_strigling
Definition: WinterRye.h:59
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
wry_stubble_harrowing
Definition: WinterRye.h:71
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
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
wry_fertmanganese_plant_one
Definition: WinterRye.h:53
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
wry_autumn_harrow
Definition: WinterRye.h:50
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wry_start
Definition: WinterRye.h:46
wry_hay_bailing
Definition: WinterRye.h:70
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
WARN_BUG
Definition: MapErrorMsg.h:34
wry_fertslurry_stock
Definition: WinterRye.h:56
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
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