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
WinterRape.h
Go to the documentation of this file.
1 //
2 // WinterRape.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 WINTERRAPE_H
38 #define WINTERRAPE_H
39 
40 // <cropname>_BASE is the first event number to be dumped into the
41 // debugging log from this crop. *Must* be unique among all crops.
42 // I suggest steps of 100 between crops.
43 
44 #define WINTERRAPE_BASE 7800
45 #define WR_DID_RC_CLEAN m_field->m_user[0]
46 #define WR_DID_HERBI_ZERO m_field->m_user[1]
47 #define WR_INSECT_DATE m_field->m_user[2]
48 #define WR_FUNGI_DATE m_field->m_user[3]
49 #define WR_SWARTH_DATE m_field->m_user[4]
50 #define WR_HARVEST_DATE m_field->m_user[5]
51 
52 typedef enum {
53  wr_start = 1, // Compulsory, start event must always be 1 (one).
80 
81 
82 
83 class WinterRape: public Crop
84 {
85  // Private methods corresponding to the different management steps
86  // (when needed).
87  void HerbiZero( void );
88  void RowcolOne( void );
89 
90 public:
91  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
92  WinterRape(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
93  {
94  m_first_date = g_date->DayInYear(24, 8);
96  }
98  const int elements = 2 + (wr_foobar - WINTERRAPE_BASE);
100 
101  FarmManagementCategory catlist[elements] =
102  {
103  fmc_Others, // zero element unused but must be here
104  fmc_Others,//wr_start = 1, // Compulsory, start event must always be 1 (one).
105  fmc_Fertilizer,//wr_ferti_zero = WINTERRAPE_BASE,
106  fmc_Cultivation,//wr_autumn_plough,
107  fmc_Cultivation,//wr_autumn_harrow,
108  fmc_Others,//wr_autumn_sow,
109  fmc_Cultivation,//wr_rowcol_clean,
110  fmc_Herbicide,//wr_herbi_zero,
111  fmc_Fertilizer,//wr_ferti_p1,
112  fmc_Fertilizer,//wr_ferti_p2,
113  fmc_Fertilizer,//wr_ferti_s1,
114  fmc_Fertilizer,//wr_ferti_s2,
115  fmc_Herbicide,//wr_herbi_one,
116  fmc_Fungicide,//wr_fungi_one,
117  fmc_Cultivation,//wr_rowcol_one,
118  fmc_Cultivation,//wr_rowcol_one_b,
119  fmc_Insecticide,//wr_insect_one,
120  fmc_Insecticide,//wr_insect_one_b,
121  fmc_Insecticide,//wr_insect_one_c,
122  fmc_Cutting,//wr_swarth,
123  fmc_Harvest,//wr_harvest,
124  fmc_Others,//wr_cuttostraw,
125  fmc_Others,//wr_compress,
126  fmc_Cultivation,//wr_stub_harrow,
127  fmc_Cultivation,//wr_grubbing,
128  fmc_Others//wr_productapplic_one
129 
130  // no foobar entry
131 
132  };
133  // Iterate over the catlist elements and copy them to vector
134  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
135 
136  }
137 };
138 
139 #endif // WINTERRAPE_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
wr_autumn_plough
Definition: WinterRape.h:55
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
wr_autumn_harrow
Definition: WinterRape.h:56
wr_herbi_zero
Definition: WinterRape.h:59
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
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::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
cfg_seedcoating_product_amounts
CfgArray_Double cfg_seedcoating_product_amounts
Amount of seed coating pesticide applied in grams of active substance per hectare for each of the 10 ...
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
wr_productapplic_one
Definition: WinterRape.h:77
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
cfg_pest_productapplic_startdate
CfgInt cfg_pest_productapplic_startdate
Start date for applying pesticide the first time.
Definition: Elements.cpp:166
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
WinterRape::RowcolOne
void RowcolOne(void)
Definition: WinterRape.cpp:573
wr_ferti_p1
Definition: WinterRape.h:60
cfg_seedcoating_winterrape_on
CfgBool cfg_seedcoating_winterrape_on
Turn on seed coating for winter rape.
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
wr_ferti_s2
Definition: WinterRape.h:63
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
wr_ferti_s1
Definition: WinterRape.h:62
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
wr_harvest
Definition: WinterRape.h:72
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
WR_HARVEST_DATE
#define WR_HARVEST_DATE
Definition: WinterRape.h:50
WinterRape
Definition: WinterRape.h:83
WinterRape::WinterRape
WinterRape(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: WinterRape.h:92
Crop
The base class for all crops.
Definition: Farm.h:495
WinterRapeToDo
WinterRapeToDo
Definition: WinterRape.h:52
cfg_OSR_InsecticideDay
CfgInt cfg_OSR_InsecticideDay
Provided to allow configuration control of the first insecticide spray in OSR - this changes the day ...
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
CfgBool::value
bool value() const
Definition: Configurator.h:164
WinterRape::HerbiZero
void HerbiZero(void)
Definition: WinterRape.cpp:600
wr_ferti_p2
Definition: WinterRape.h:61
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
WINTERRAPE_BASE
#define WINTERRAPE_BASE
Definition: WinterRape.h:44
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
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Farm::ProductApplication_DateLimited
virtual bool ProductApplication_DateLimited(LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false)
Special pesticide trial functionality.
Definition: FarmFuncs.cpp:2342
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
WinterRape::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: WinterRape.cpp:48
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
wr_insect_one_b
Definition: WinterRape.h:69
wr_autumn_sow
Definition: WinterRape.h:57
WR_FUNGI_DATE
#define WR_FUNGI_DATE
Definition: WinterRape.h:48
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
wr_stub_harrow
Definition: WinterRape.h:75
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
cfg_pest_winterrape_on
CfgBool cfg_pest_winterrape_on
Turn on pesticides for winter rape.
WR_INSECT_DATE
#define WR_INSECT_DATE
Definition: WinterRape.h:47
wr_foobar
Definition: WinterRape.h:78
WR_SWARTH_DATE
#define WR_SWARTH_DATE
Definition: WinterRape.h:49
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
wr_insect_one
Definition: WinterRape.h:68
CfgArray_Double
Definition: Configurator.h:208
cfg_OSR_InsecticideMonth
CfgInt cfg_OSR_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in OSR - this changes the mont...
cfg_pest_productapplic_period
CfgInt cfg_pest_productapplic_period
Period for applying pesticide.
Definition: Elements.cpp:169
wr_rowcol_one_b
Definition: WinterRape.h:67
WR_DID_HERBI_ZERO
#define WR_DID_HERBI_ZERO
Definition: WinterRape.h:46
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
CfgInt::value
int value() const
Definition: Configurator.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
wr_cuttostraw
Definition: WinterRape.h:73
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
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
wr_insect_one_c
Definition: WinterRape.h:70
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
wr_ferti_zero
Definition: WinterRape.h:54
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
WR_DID_RC_CLEAN
#define WR_DID_RC_CLEAN
Definition: WinterRape.h:45
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.
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
CfgInt
Integer configurator entry class.
Definition: Configurator.h:102
wr_herbi_one
Definition: WinterRape.h:64
wr_rowcol_one
Definition: WinterRape.h:66
Farm
The base class for all farm types.
Definition: Farm.h:755
Farm::DeepPlough
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
Definition: FarmFuncs.cpp:408
wr_rowcol_clean
Definition: WinterRape.h:58
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
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
wr_compress
Definition: WinterRape.h:74
WinterRape::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: WinterRape.h:97
wr_swarth
Definition: WinterRape.h:71
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
wr_fungi_one
Definition: WinterRape.h:65
wr_start
Definition: WinterRape.h:53
wr_grubbing
Definition: WinterRape.h:76
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: FarmFuncs.cpp:1350
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
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
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
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