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
DK_SeedGrassFescue_Spring.h
Go to the documentation of this file.
1 
15 //
16 // DK_SeedGrassFescue_Spring.h
17 //
18 /*
19 
20 Copyright (c) 2021, Christopher John Topping, Aarhus University
21 All rights reserved.
22 
23 
24 Redistribution and use in source and binary forms, with or without
25 modification, are permitted provided that the following conditions are met:
26 
27 *) Redistributions of source code must retain the above copyright notice, this
28 list of conditions and the following disclaimer.
29 *) Redistributions in binary form must reproduce the above copyright notice,
30 this list of conditions and the following disclaimer in the documentation
31 and/or other materials provided with the distribution.
32 *) Neither the name of the NERI nor the names of its contributors
33 may be used to endorse or promote products derived from this software without
34 specific prior written permission.
35 
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 POSSIBILITY OF SUCH DAMAGE.
47 
48 */
49 
50 #ifndef DK_SEEDGRASSFESCUE_S_H
51 #define DK_SEEDGRASSFESCUE_S_H
52 
53 #define DK_SGF_EVERY_3RD_YEAR a_field->m_user[1]
54 #define DK_SGF_FORCESPRING a_field->m_user[2]
55 
56 #define DK_SGF_BASE 64500
57 
66 typedef enum {
67  dk_sgf_start = 1, // Compulsory, must always be 1 (one).
106 
107 
117 {
118 public:
119  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
121  {
122  // When we start it off, the first possible date for a farm operation
123  // This information is used by other crops when they decide how much post processing of
124  // the management is allowed after harvest before the next crop starts.
125  m_first_date = g_date->DayInYear(30, 11);
127  }
129  const int elements = 2 + (dk_sgf_foobar - DK_SGF_BASE);
131 
132  FarmManagementCategory catlist[elements] =
133  {
134  fmc_Others, // zero element unused but must be here
135  fmc_Others, // dk_sgf_start = 1, // Compulsory, must always be 1 (one).
136  fmc_Cultivation, // dk_sfg_autumn_plough = DK_SGF_BASE
137  fmc_Cultivation, // dk_sfg_spring_plough
138  fmc_Others, // dk_sgf_sow
139  fmc_Herbicide, // dk_sgf_herbicide1,
140  fmc_Herbicide, // dk_sgf_herbicide2,
141  fmc_Harvest, // dk_sgf_harvest,
142  fmc_Others, // dk_sgf_remove_straw1
143  fmc_Fertilizer, // dk_sgf_ferti_s1,
144  fmc_Fertilizer, // dk_sgf_ferti_p1,
145  fmc_Herbicide, // dk_sgf_herbicide3,
146  fmc_Fertilizer, // dk_sgf_ferti_s2,
147  fmc_Fertilizer, // dk_sgf_ferti_p2,
148  fmc_Herbicide, // dk_sgf_herbicide4,
149  fmc_Herbicide, // dk_sgf_herbicide5,
150  fmc_Herbicide, // dk_sgf_herbicide6,
151  fmc_Others, // dk_sgf_growth_reg,
152  fmc_Cutting, // dk_sgf_swathing,
153  fmc_Harvest, // dk_sgf_seed_harvest,
154  fmc_Cutting, // dk_sgf_straw_chopping,
155  fmc_Others, // dk_sgf_burn_straw
156  fmc_Others, // dk_sgf_remove_straw2
157  fmc_Cutting, // dk_sgf_cutting1,
158  fmc_Fertilizer, // dk_sgf_ferti_s3,
159  fmc_Fertilizer, // dk_sgf_ferti_p3,
160  fmc_Fertilizer, // dk_sgf_ferti_s_y3,
161  fmc_Fertilizer, // dk_sgf_ferti_p_y3,
162  fmc_Herbicide, // dk_sgf_herbicide1_y3,
163  fmc_Herbicide, // dk_sgf_herbicide2_y3,
164  fmc_Herbicide, // dk_sgf_herbicide3_y3,
165  fmc_Others, // dk_sgf_growth_reg_y3,
166  fmc_Cutting, // dk_sgf_swathing_y3,
167  fmc_Harvest, // dk_sgf_seed_harvest_y3,
168  fmc_Cutting, // dk_sgf_straw_chopping_y3,
169  fmc_Others, // dk_sgf_burn_straw_y3,
170  fmc_Others, // dk_sgf_remove_straw2_y3,
171  fmc_Cutting, // dk_sgf_cutting1_y3,
172 
173  // no foobar entry
174 
175  };
176  // Iterate over the catlist elements and copy them to vector
177  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
178 
179  }
180 };
181 
182 #endif // DK_SeedGrassFescue_Spring_H
dk_sgf_herbicide4
Definition: DK_SeedGrassFescue_Spring.h:80
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
dk_sgf_sow
Definition: DK_SeedGrassFescue_Spring.h:70
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
dk_sgf_herbicide1
Definition: DK_SeedGrassFescue_Spring.h:71
cfg_SGF_InsecticideDay
CfgInt cfg_SGF_InsecticideDay
dk_sgf_herbicide5
Definition: DK_SeedGrassFescue_Spring.h:81
dk_sgf_swathing
Definition: DK_SeedGrassFescue_Spring.h:84
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: FarmFuncs.cpp:421
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
dk_sgf_cutting1_y3
Definition: DK_SeedGrassFescue_Spring.h:103
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
cfg_DK_SeedGrassFescue_Spring_SkScrapes
CfgBool cfg_DK_SeedGrassFescue_Spring_SkScrapes("DK_CROP_SGF_SK_SCRAPES", CFG_CUSTOM, false)
dk_sgf_start
Definition: DK_SeedGrassFescue_Spring.h:67
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_ins_app_prop1
CfgFloat cfg_ins_app_prop1
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
dk_sgf_seed_harvest
Definition: DK_SeedGrassFescue_Spring.h:85
dk_sgf_ferti_p2
Definition: DK_SeedGrassFescue_Spring.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
dk_sgf_foobar
Definition: DK_SeedGrassFescue_Spring.h:104
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
Farm::StrawRemoval
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1752
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
dk_sgf_burn_straw
Definition: DK_SeedGrassFescue_Spring.h:87
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
cfg_ins_app_prop2
CfgFloat cfg_ins_app_prop2
Farm::SpringSow
virtual bool SpringSow(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 spring on a_field.
Definition: FarmFuncs.cpp:501
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_sgf_ferti_s_y3
Definition: DK_SeedGrassFescue_Spring.h:92
dk_sgf_autumn_plough
Definition: DK_SeedGrassFescue_Spring.h:68
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::CutToHay
virtual bool CutToHay(LE *a_field, double a_user, int a_days)
Carry out hay cutting on a_field.
Definition: FarmFuncs.cpp:1607
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
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
dk_sgf_growth_reg_y3
Definition: DK_SeedGrassFescue_Spring.h:97
dk_sgf_ferti_p1
Definition: DK_SeedGrassFescue_Spring.h:76
Crop
The base class for all crops.
Definition: Farm.h:495
DK_SGF_BASE
#define DK_SGF_BASE
Definition: DK_SeedGrassFescue_Spring.h:56
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_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
dk_sgf_herbicide2
Definition: DK_SeedGrassFescue_Spring.h:72
DK_SeedGrassFescue_Spring::Do
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
The one and only method for a crop management plan. All farm actions go through here.
Definition: DK_SeedGrassFescue_Spring.cpp:98
dk_sgf_ferti_p_y3
Definition: DK_SeedGrassFescue_Spring.h:93
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
dk_sgf_harvest
Definition: DK_SeedGrassFescue_Spring.h:73
cfg_ins_app_prop3
CfgFloat cfg_ins_app_prop3
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_sgf_remove_straw1
Definition: DK_SeedGrassFescue_Spring.h:74
Calendar::Date
long Date(void)
Definition: Calendar.h:57
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:882
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
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
DK_SeedGrassFescue_Spring::DK_SeedGrassFescue_Spring
DK_SeedGrassFescue_Spring(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DK_SeedGrassFescue_Spring.h:120
dk_sgf_herbicide3_y3
Definition: DK_SeedGrassFescue_Spring.h:96
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
DK_SeedGrassFescue_Spring
DK_SeedGrassFescue_Spring class .
Definition: DK_SeedGrassFescue_Spring.h:116
dk_sgf_seed_harvest_y3
Definition: DK_SeedGrassFescue_Spring.h:99
DK_SeedGrassFescue_Spring::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_SeedGrassFescue_Spring.h:128
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
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
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
dk_sgf_ferti_p3
Definition: DK_SeedGrassFescue_Spring.h:91
dk_sgf_herbicide2_y3
Definition: DK_SeedGrassFescue_Spring.h:95
dk_sgf_ferti_s2
Definition: DK_SeedGrassFescue_Spring.h:78
dk_sgf_growth_reg
Definition: DK_SeedGrassFescue_Spring.h:83
dk_sgf_herbicide3
Definition: DK_SeedGrassFescue_Spring.h:77
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
dk_sgf_spring_plough
Definition: DK_SeedGrassFescue_Spring.h:69
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
tos_Sand
Definition: LandscapeFarmingEnums.h:719
cfg_fungi_app_prop2
CfgFloat cfg_fungi_app_prop2
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
dk_sgf_remove_straw2
Definition: DK_SeedGrassFescue_Spring.h:88
LE
Definition: Elements.h:86
dk_sgf_swathing_y3
Definition: DK_SeedGrassFescue_Spring.h:98
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::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
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
dk_sgf_cutting1
Definition: DK_SeedGrassFescue_Spring.h:89
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
cfg_SGF_InsecticideMonth
CfgInt cfg_SGF_InsecticideMonth
dk_sgf_straw_chopping_y3
Definition: DK_SeedGrassFescue_Spring.h:100
dk_sgf_ferti_s1
Definition: DK_SeedGrassFescue_Spring.h:75
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
DK_SeedGrassFescue_SpringToDo
DK_SeedGrassFescue_SpringToDo
Definition: DK_SeedGrassFescue_Spring.h:66
CFG_CUSTOM
Definition: Configurator.h:70
tov_DKSeedGrassFescue_Spring
Definition: LandscapeFarmingEnums.h:407
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
DK_SGF_EVERY_3RD_YEAR
#define DK_SGF_EVERY_3RD_YEAR
Definition: DK_SeedGrassFescue_Spring.h:53
Farm::BurnStrawStubble
virtual bool BurnStrawStubble(LE *a_field, double a_user, int a_days)
Burn stubble on a_field.
Definition: FarmFuncs.cpp:1567
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
dk_sgf_straw_chopping
Definition: DK_SeedGrassFescue_Spring.h:86
dk_sgf_remove_straw2_y3
Definition: DK_SeedGrassFescue_Spring.h:102
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_sgf_herbicide6
Definition: DK_SeedGrassFescue_Spring.h:82
dk_sgf_herbicide1_y3
Definition: DK_SeedGrassFescue_Spring.h:94
dk_sgf_burn_straw_y3
Definition: DK_SeedGrassFescue_Spring.h:101
WARN_BUG
Definition: MapErrorMsg.h:34
dk_sgf_ferti_s3
Definition: DK_SeedGrassFescue_Spring.h:90
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
DK_SGF_FORCESPRING
#define DK_SGF_FORCESPRING
Definition: DK_SeedGrassFescue_Spring.h:54