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
PTSetAside.h
Go to the documentation of this file.
1 
14 //
15 // PTSetAside.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 PTSETASIDE_H
43 #define PTSETASIDE_H
44 
45 
46 #define PTSETASIDE_BASE 32900
47 
56 typedef enum {
57  pt_sa_start = 1, // Compulsory, must always be 1 (one).
66 
67 
76 class PTSetAside : public Crop
77 {
78 public:
79  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
80  PTSetAside(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
81  {
82  // When we start it off, the first possible date for a farm operation
83  // This information is used by other crops when they decide how much post processing of
84  // the management is allowed after harvest before the next crop starts.
85  m_first_date = g_date->DayInYear(31, 12);
87  }
89  const int elements = 2 + (pt_sa_foobar - PTSETASIDE_BASE);
91 
92  FarmManagementCategory catlist[elements] =
93  {
94  fmc_Others, // zero element unused but must be here
95  fmc_Others, // pt_sa_start = 1, // Compulsory, must always be 1 (one).
96  fmc_Others, // pt_sa_wait1, = PTSETASIDE_BASE
97  fmc_Others, // pt_sa_wait2,
98  fmc_Cutting, // pt_sa_cutting,
99  fmc_Cultivation, // pt_sa_strigling,
100  fmc_Cutting, // pt_sa_swathing,
101  fmc_Herbicide, // pt_sa_herbicide,
102 
103  // no foobar entry
104 
105  };
106  // Iterate over the catlist elements and copy them to vector
107  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
108 
109  }
110 };
111 
112 #endif // PTSetAside_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
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::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
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
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
PTSETASIDE_BASE
#define PTSETASIDE_BASE
Definition: PTSetAside.h:46
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
pt_sa_cutting
Definition: PTSetAside.h:60
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
LE::GetVegBiomass
virtual double GetVegBiomass(void)
Definition: Elements.h:164
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
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
pt_sa_herbicide
Definition: PTSetAside.h:63
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
PTSetAside::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTSetAside.h:88
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
pt_sa_start
Definition: PTSetAside.h:57
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
pt_sa_wait2
Definition: PTSetAside.h:59
PTSetAside::PTSetAside
PTSetAside(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTSetAside.h:80
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
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
PTSetAsideToDo
PTSetAsideToDo
Definition: PTSetAside.h:56
PTSetAside
PTSetAside class .
Definition: PTSetAside.h:76
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: FarmFuncs.cpp:272
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tov_PTSetAside
Definition: LandscapeFarmingEnums.h:337
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
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
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pt_sa_foobar
Definition: PTSetAside.h:64
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
pt_sa_wait1
Definition: PTSetAside.h:58
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
pt_sa_swathing
Definition: PTSetAside.h:62
WARN_BUG
Definition: MapErrorMsg.h:34
pt_sa_strigling
Definition: PTSetAside.h:61
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
PTSetAside::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: PTSetAside.cpp:55