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
PTRyegrass.h
Go to the documentation of this file.
1 
14 //
15 // PTRyegrass.h
16 //
17 /*
18 *******************************************************************************************************
19 Copyright (c) 2024, Christopher John Topping, University of Aarhus
20 All rights reserved.
21 
22 Redistribution and use in source and binary forms, with or without modification, are permitted provided
23 that the following conditions are met:
24 
25 Redistributions of source code must retain the above copyright notice, this list of conditions and the
26 following disclaimer.
27 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
28 the following disclaimer in the documentation and/or other materials provided with the distribution.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
31 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
32 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
33 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ********************************************************************************************************
39 */
40 
41 
42 #ifndef PTRYEGRASS_H
43 #define PTRYEGRASS_H
44 
45 #define PTRYEGRASS_BASE 32100
46 
52 typedef enum {
53  pt_rg_start = 1, // Compulsory, must always be 1 (one).
79 
81 
82 
91 class PTRyegrass: public Crop
92 {
93  public:
94  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
95  PTRyegrass(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
96  {
102  m_first_date=g_date->DayInYear( 31,10 ); //EZ: This needs to be changed
104  }
106  const int elements = 2 + (pt_rg_foobar - PTRYEGRASS_BASE);
108 
109  FarmManagementCategory catlist[elements] =
110  {
111  fmc_Others, // zero element unused but must be here
112  fmc_Others, //pt_ry_start = 1, // Compulsory, must always be 1 (one).
113  fmc_Others, //pt_ry_sleep_all_day = PTRYEGRASS_BASE,
114  fmc_Cultivation, //pt_rg_autumn_harrow,
115  fmc_Fertilizer, //pt_rg_calcium_p1,
116  fmc_Fertilizer, //pt_rg_calcium_s1,
117  fmc_Fertilizer, //pt_rg_slurry_p1,
118  fmc_Fertilizer, //pt_rg_slurry_s1,
119  fmc_Others, //pt_rg_autumn_sow,
120  fmc_Cultivation, //pt_rg_stubble_harrow,
121  fmc_Harvest, //pt_rg_harvest1,
122  fmc_Fertilizer, //pt_rg_npk1_p1,
123  fmc_Fertilizer, //pt_rg_npk1_s1,
124  fmc_Harvest, //pt_rg_harvest2,
125  fmc_Fertilizer, //pt_rg_npk2_p1,
126  fmc_Fertilizer, //pt_rg_npk2_s1,
127  fmc_Harvest, //pt_rg_harvest3,
128  fmc_Fertilizer, //pt_rg_npk3_p1,
129  fmc_Fertilizer, //pt_rg_npk3_s1,
130  fmc_Harvest, //pt_rg_harvest4,
131  fmc_Fertilizer, //pt_rg_npk4_p1,
132  fmc_Fertilizer, //pt_rg_npk4_s1,
133  fmc_Cutting, //pt_rg_cut_to_hay,
134  fmc_Others, //pt_rg_hay_turning,
135  fmc_Others, //pt_rg_hay_bailing,
136  fmc_Others //pt_rg_wait,
137 
138  // no foobar entry
139 
140  };
141  // Iterate over the catlist elements and copy them to vector
142  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
143 
144  }
145 };
146 
147 #endif // PTRYEGRASS_H
148 
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
PTRyegrass
PTRyegrass class .
Definition: PTRyegrass.h:91
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
pt_rg_slurry_p1
Definition: PTRyegrass.h:58
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
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
pt_rg_npk4_s1
Definition: PTRyegrass.h:73
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
pt_rg_start
Definition: PTRyegrass.h:53
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
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
PTRyegrassToDo
PTRyegrassToDo
Definition: PTRyegrass.h:52
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.
Crop
The base class for all crops.
Definition: Farm.h:495
pt_rg_hay_bailing
Definition: PTRyegrass.h:76
pt_rg_calcium_s1
Definition: PTRyegrass.h:57
pt_rg_npk2_s1
Definition: PTRyegrass.h:67
pt_rg_slurry_s1
Definition: PTRyegrass.h:59
PTRyegrass::PTRyegrass
PTRyegrass(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTRyegrass.h:95
pt_rg_npk1_p1
Definition: PTRyegrass.h:63
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
pt_rg_wait
Definition: PTRyegrass.h:77
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
PTRYEGRASS_BASE
#define PTRYEGRASS_BASE
Definition: PTRyegrass.h:45
Calendar::Date
long Date(void)
Definition: Calendar.h:57
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
pt_rg_harvest4
Definition: PTRyegrass.h:71
pt_rg_harvest2
Definition: PTRyegrass.h:65
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:1168
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
CfgArray_Double
Definition: Configurator.h:208
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:954
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
pt_rg_calcium_p1
Definition: PTRyegrass.h:56
pt_rg_npk3_p1
Definition: PTRyegrass.h:69
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
pt_rg_stubble_harrow
Definition: PTRyegrass.h:61
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
pt_rg_npk2_p1
Definition: PTRyegrass.h:66
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
l_pest_insecticipt_amount
CfgFloat l_pest_insecticipt_amount
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
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
pt_rg_sleep_all_day
Definition: PTRyegrass.h:54
pt_rg_npk1_s1
Definition: PTRyegrass.h:64
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
tov_PTRyegrass
Definition: LandscapeFarmingEnums.h:324
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
pt_rg_harvest1
Definition: PTRyegrass.h:62
pt_rg_harvest3
Definition: PTRyegrass.h:68
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
pt_rg_npk3_s1
Definition: PTRyegrass.h:70
Farm
The base class for all farm types.
Definition: Farm.h:755
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
PTRyegrass::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTRyegrass.h:105
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pt_rg_foobar
Definition: PTRyegrass.h:78
pt_rg_autumn_harrow
Definition: PTRyegrass.h:55
pt_rg_autumn_sow
Definition: PTRyegrass.h:60
cfg_pest_springwheat_on
CfgBool cfg_pest_springwheat_on
Turn on pesticides for spring wheat.
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
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
pt_rg_hay_turning
Definition: PTRyegrass.h:75
pt_rg_npk4_p1
Definition: PTRyegrass.h:72
PTRyegrass::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: PTRyegrass.cpp:62
pt_rg_cut_to_hay
Definition: PTRyegrass.h:74
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
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