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
PTWinterRye.h
Go to the documentation of this file.
1 
14 //
15 // PTWinterRye.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 PTWINTERRYE_H
43 #define PTWINTERRYE_H
44 
45 #define PTWINTERRYE_BASE 32000
46 
55 typedef enum {
56  pt_wr_start = 1, // Compulsory, must always be 1 (one).
59  pt_wr_ferti_p1, // slurry
63  pt_wr_ferti_p3, // Calcium
74 
76 
77 
86 class PTWinterRye: public Crop
87 {
88  public:
89  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
90  PTWinterRye(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
91  {
92  // When we start it off, the first possible date for a farm operation is 15th November
93  // This information is used by other crops when they decide how much post processing of
94  // the management is allowed after harvest before the next crop starts.
95  m_first_date=g_date->DayInYear( 15,11 );
97  }
99  const int elements = 2 + (pt_wr_foobar - PTWINTERRYE_BASE);
101 
102  FarmManagementCategory catlist[elements] =
103  {
104  fmc_Others, // zero element unused but must be here
105  fmc_Others, //pt_wr_start = 1, // Compulsory, must always be 1 (one).
106  fmc_Others, //pt_wr_sleep_all_day = PTWINTERRYE_BASE,
107  fmc_Cultivation, //pt_wr_stubble_harrow,
108  fmc_Fertilizer, //pt_wr_ferti_p1, // slurry
109  fmc_Fertilizer, //pt_wr_ferti_s1,
110  fmc_Fertilizer, //pt_wr_ferti_p2, // NPK
111  fmc_Fertilizer, //pt_wr_ferti_s2,
112  fmc_Fertilizer, //pt_wr_ferti_p3, // Calcium
113  fmc_Fertilizer, //pt_wr_ferti_s3,
114  fmc_Fertilizer, //pt_wr_ferti_p4, // NPK
115  fmc_Fertilizer, //pt_wr_ferti_s4,
116  fmc_Cultivation, //pt_wr_autumn_harrow,
117  fmc_Others, //pt_wr_autumn_sow,
118  fmc_Cultivation, //pt_wr_preseeding_cultivator_sow,
119  fmc_Harvest, //pt_wr_harvest1,
120  fmc_Others, //pt_wr_wait,
121  fmc_Harvest, //pt_wr_harvest2,
122 
123  // no foobar entry
124 
125  };
126  // Iterate over the catlist elements and copy them to vector
127  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
128 
129  }
130 };
131 
132 #endif // PTWINTERRYE_H
133 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
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
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
PTWinterRye
PTWinterRye class .
Definition: PTWinterRye.h:86
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
pt_wr_autumn_harrow
Definition: PTWinterRye.h:67
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_wr_ferti_s3
Definition: PTWinterRye.h:64
pt_wr_harvest1
Definition: PTWinterRye.h:70
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
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
PTWinterRye::PTWinterRye
PTWinterRye(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTWinterRye.h:90
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
Crop
The base class for all crops.
Definition: Farm.h:495
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
pt_wr_ferti_p3
Definition: PTWinterRye.h:63
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
pt_wr_ferti_s1
Definition: PTWinterRye.h:60
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
pt_wr_start
Definition: PTWinterRye.h:56
pt_wr_autumn_sow
Definition: PTWinterRye.h:68
pt_wr_ferti_p1
Definition: PTWinterRye.h:59
PTWinterRye::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: PTWinterRye.cpp:54
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
pt_wr_sleep_all_day
Definition: PTWinterRye.h:57
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
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_wr_ferti_p2
Definition: PTWinterRye.h:61
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
pt_wr_stubble_harrow
Definition: PTWinterRye.h:58
pt_wr_preseeding_cultivator_sow
Definition: PTWinterRye.h:69
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::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
LE
Definition: Elements.h:86
PTWinterRye::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTWinterRye.h:98
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
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
Farm
The base class for all farm types.
Definition: Farm.h:755
pt_wr_wait
Definition: PTWinterRye.h:71
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
pt_wr_ferti_s4
Definition: PTWinterRye.h:66
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pt_wr_foobar
Definition: PTWinterRye.h:73
PTWINTERRYE_BASE
#define PTWINTERRYE_BASE
Definition: PTWinterRye.h:45
pt_wr_ferti_p4
Definition: PTWinterRye.h:65
pt_wr_ferti_s2
Definition: PTWinterRye.h:62
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tov_PTWinterRye
Definition: LandscapeFarmingEnums.h:323
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
pt_wr_harvest2
Definition: PTWinterRye.h:72
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
PTWinterRyeToDo
PTWinterRyeToDo
A flag used to indicate autumn ploughing status.
Definition: PTWinterRye.h:55