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
DE_SpringBarley.h
Go to the documentation of this file.
1 
13 //
14 // DE_SpringBarley.
15 //
16 /*
17 
18 Copyright (c) 2021, Christopher John Topping, Aarhus University
19 All rights reserved.
20 
21 
22 Redistribution and use in source and binary forms, with or without
23 modification, are permitted provided that the following conditions are met:
24 
25 *) Redistributions of source code must retain the above copyright notice, this
26 list of conditions and the following disclaimer.
27 *) Redistributions in binary form must reproduce the above copyright notice,
28 this list of conditions and the following disclaimer in the documentation
29 and/or other materials provided with the distribution.
30 *) Neither the name of the NERI nor the names of its contributors
31 may be used to endorse or promote products derived from this software without
32 specific prior written permission.
33 
34 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 POSSIBILITY OF SUCH DAMAGE.
45 
46 */
47 
48 #ifndef DE_SPRINGBARLEY_H
49 #define DE_SPRINGBARLEY_H
50 
51 #define DE_SPRINGBARLEY_BASE 39200
52 
55 #define DE_SB_FUNGII a_field->m_user[1]
56 
57 
63 typedef enum {
64  de_sb_start = 1, // Compulsory, must always be 1 (one).
80  de_sb_foobar, // Obligatory, must be last
82 
83 
92 class DE_SpringBarley : public Crop
93 {
94 public:
95  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
96  DE_SpringBarley(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
97  {
103  m_first_date = g_date->DayInYear(19, 3);
105  }
107  const int elements = 2 + (de_sb_foobar - DE_SPRINGBARLEY_BASE);
109 
110  FarmManagementCategory catlist[elements] =
111  {
112  fmc_Others, // zero element unused but must be here
113  // ALL THE NECESSARY ENTRIES HERE
114  fmc_Others, // de_sb_start = 1, // Compulsory, must always be 1 (one).
115  fmc_Others, // de_sb_sleep_all_day
116  fmc_Fertilizer, // de_sb_ferti_p1,
117  fmc_Fertilizer, // de_sb_ferti_s1,
118  fmc_Cultivation, // de_sb_spring_plough,
119  fmc_Fertilizer, // de_sb_ferti_p2,
120  fmc_Fertilizer, // de_sb_ferti_s2,
121  fmc_Cultivation, // de_sb_preseeding_cultivator_sow,
122  fmc_Herbicide, // de_sb_herbicide,
123  fmc_Fungicide, // de_sb_fungicide,
124  fmc_Insecticide, // de_sb_insecticide,
125  fmc_Others, // de_sb_growth_regulator1,
126  fmc_Others, // de_sb_growth_regulator2,
127  fmc_Harvest, // de_sb_harvest,
128  fmc_Others, // de_sb_straw_chopping,
129  fmc_Others, // de_sb_hay_bailing,
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 // DE_SPRINGBARLEY_H
141 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
DE_SPRINGBARLEYToDo
DE_SPRINGBARLEYToDo
Definition: DE_SpringBarley.h:63
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
DE_SpringBarley::DE_SpringBarley
DE_SpringBarley(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DE_SpringBarley.h:96
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
de_sb_ferti_p1
Definition: DE_SpringBarley.h:66
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::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
de_sb_insecticide
Definition: DE_SpringBarley.h:74
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
de_sb_growth_regulator2
Definition: DE_SpringBarley.h:76
Farm::DoIt_prob
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
Definition: Farm.cpp:864
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
DE_SpringBarley::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: DE_SpringBarley.cpp:89
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
de_sb_hay_bailing
Definition: DE_SpringBarley.h:79
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
de_sb_straw_chopping
Definition: DE_SpringBarley.h:78
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
Crop
The base class for all crops.
Definition: Farm.h:495
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:673
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
de_sb_herbicide
Definition: DE_SpringBarley.h:72
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
de_sb_growth_regulator1
Definition: DE_SpringBarley.h:75
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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::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
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
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
de_sb_ferti_p2
Definition: DE_SpringBarley.h:69
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
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
DE_SpringBarley
DE_SpringBarley class .
Definition: DE_SpringBarley.h:92
DE_SPRINGBARLEY_BASE
#define DE_SPRINGBARLEY_BASE
Definition: DE_SpringBarley.h:51
de_sb_harvest
Definition: DE_SpringBarley.h:77
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
de_sb_sleep_all_day
Definition: DE_SpringBarley.h:65
CfgArray_Double
Definition: Configurator.h:208
DE_SpringBarley::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_SpringBarley.h:106
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
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
de_sb_foobar
Definition: DE_SpringBarley.h:80
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
de_sb_preseeding_cultivator_sow
Definition: DE_SpringBarley.h:71
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: FarmFuncs.cpp:325
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
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
g_landscape_ptr
Landscape * g_landscape_ptr
Definition: Landscape.cpp:352
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
Farm
The base class for all farm types.
Definition: Farm.h:755
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
cfg_pest_springbarley_on
CfgBool cfg_pest_springbarley_on
Turn on pesticides for spring barley.
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: FarmFuncs.cpp:2070
de_sb_spring_plough
Definition: DE_SpringBarley.h:68
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
de_sb_start
Definition: DE_SpringBarley.h:64
de_sb_ferti_s2
Definition: DE_SpringBarley.h:70
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1010
de_sb_ferti_s1
Definition: DE_SpringBarley.h:67
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
tov_DESpringBarley
Definition: LandscapeFarmingEnums.h:517
de_sb_fungicide
Definition: DE_SpringBarley.h:73
Crop::SimpleEvent_
void SimpleEvent_(long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
Adds an event to this crop management without relying on member variables.
Definition: Farm.cpp:751