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
PTCorkOak.h
Go to the documentation of this file.
1 
14 //
15 // PTCorkOak.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 PTCORKOAK_H
43 #define PTCORKOAK_H
44 
45 #define PTCORKOAK_BASE 31100
46 
49 #define PT_CO_YEARS_AFTER_PLOUGH a_field->m_user[1]
50 
56 typedef enum {
57  pt_co_start = 1, // Compulsory, must always be 1 (one).
62 
64 
65 
74 class PTCorkOak: public Crop
75 {
76  public:
77  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
78  PTCorkOak(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
79  {
80  // When we start it off, the first possible date for a farm operation is 5th November
81  // This information is used by other crops when they decide how much post processing of
82  // the management is allowed after harvest before the next crop starts.
83  m_first_date=g_date->DayInYear( 15,3 );//@AAS:Last possible date to do the first operation, i.e. plough or sow
85  }
87  const int elements = 2 + (pt_co_foobar - PTCORKOAK_BASE);
89 
90  FarmManagementCategory catlist[elements] =
91  {
92  fmc_Others, // zero element unused but must be here
93  fmc_Others, //pt_co_start = 1, // Compulsory, must always be 1 (one).
94  fmc_Others, //pt_co_sleep_all_day = PTCORKOAK_BASE,
95  fmc_Others, //pt_co_spring_plough,
96  fmc_Others, //pt_co_wait,
97 
98  // no foobar entry
99 
100  };
101  // Iterate over the catlist elements and copy them to vector
102  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
103 
104  }
105 };
106 
107 #endif // PTCORKOAK_H
108 
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
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
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
pt_co_start
Definition: PTCorkOak.h:57
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
PTCorkOakToDo
PTCorkOakToDo
Definition: PTCorkOak.h:56
pt_co_foobar
Definition: PTCorkOak.h:61
PTCorkOak
PTCorkOak class .
Definition: PTCorkOak.h:74
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
pt_co_sleep_all_day
Definition: PTCorkOak.h:58
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
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
PTCorkOak::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTCorkOak.h:86
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
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
pt_co_spring_plough
Definition: PTCorkOak.h:59
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
pt_co_wait
Definition: PTCorkOak.h:60
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
PTCorkOak::PTCorkOak
PTCorkOak(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTCorkOak.h:78
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_CO_YEARS_AFTER_PLOUGH
#define PT_CO_YEARS_AFTER_PLOUGH
A flag used to indicate ploughing status.
Definition: PTCorkOak.h:49
PTCORKOAK_BASE
#define PTCORKOAK_BASE
Definition: PTCorkOak.h:45
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
tov_PTCorkOak
Definition: LandscapeFarmingEnums.h:319
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
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
PTCorkOak::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: PTCorkOak.cpp:53