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
FI_OCaraway2.h
Go to the documentation of this file.
1 
15 //
16 // FI_OCaraway2.h
17 //
18 /*
19 
20 Copyright (c) 2021, Christopher John Topping, Aarhus University
21 All rights reserved.
22 
23 
24 Redistribution and use in source and binary forms, with or without
25 modification, are permitted provided that the following conditions are met:
26 
27 *) Redistributions of source code must retain the above copyright notice, this
28 list of conditions and the following disclaimer.
29 *) Redistributions in binary form must reproduce the above copyright notice,
30 this list of conditions and the following disclaimer in the documentation
31 and/or other materials provided with the distribution.
32 *) Neither the name of the NERI nor the names of its contributors
33 may be used to endorse or promote products derived from this software without
34 specific prior written permission.
35 
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 POSSIBILITY OF SUCH DAMAGE.
47 
48 */
49 
50 #ifndef FI_OCARAWAY2_H
51 #define FI_OCARAWAY2_H
52 
53 #define FI_OCW2_BASE 74600
54 
60 typedef enum {
61  fi_ocw2_start = 1, // Compulsory, must always be 1 (one).
69 
70 
79 class FI_OCaraway2 : public Crop
80 {
81 public:
82  virtual bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
83  FI_OCaraway2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
84  {
85  // When we start it off, the first possible date for a farm operation is
86  // This information is used by other crops when they decide how much post processing of
87  // the management is allowed after harvest before the next crop starts.
88  m_first_date = g_date->DayInYear(1, 4);
90  }
92  const int elements = 2 + (fi_ocw_foobar - FI_OCW2_BASE);
94 
95  FarmManagementCategory catlist[elements] =
96  {
97  fmc_Others, // zero element unused but must be here
98  fmc_Others, // fi_ocw2_start = 1, // Compulsory, must always be 1 (one).
99  fmc_Others, // fi_ocw2_sleep_all_day = FI_OCW2_BASE,
100  fmc_Fertilizer, // fi_ocw2_nk,
101  fmc_Fertilizer, // fi_ocw2_npk1,
102  fmc_Harvest, // fi_ocw2_harvest,
103  fmc_Fertilizer // fi_ocw2_npk2_for_next_year,
104 
105 
106  // no foobar entry
107 
108  };
109  // Iterate over the catlist elements and copy them to vector
110  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
111 
112  }
113 };
114 
115 #endif // FI_OCARAWAY2_H
116 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
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
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
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
FI_OCaraway2::FI_OCaraway2
FI_OCaraway2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: FI_OCaraway2.h:83
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
fi_ocw_foobar
Definition: FI_OCaraway2.h:67
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
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
CfgBool::value
bool value() const
Definition: Configurator.h:164
fi_ocw2_npk1
Definition: FI_OCaraway2.h:64
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
LE::m_skylarkscrapes
bool m_skylarkscrapes
For management testing of skylark scrapes.
Definition: Elements.h:95
Calendar::Date
long Date(void)
Definition: Calendar.h:57
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fi_ocw2_nk
Definition: FI_OCaraway2.h:63
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
fi_ocw2_start
Definition: FI_OCaraway2.h:61
FI_OCaraway2
FI_OCaraway2 class .
Definition: FI_OCaraway2.h:79
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
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
LE
Definition: Elements.h:86
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
FI_OCW2_BASE
#define FI_OCW2_BASE
Definition: FI_OCaraway2.h:53
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
fi_ocw2_sleep_all_day
Definition: FI_OCaraway2.h:62
Farm
The base class for all farm types.
Definition: Farm.h:755
FI_OCaraway2ToDo
FI_OCaraway2ToDo
Definition: FI_OCaraway2.h:60
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::FP_NK
virtual bool FP_NK(LE *a_field, double a_user, int a_days)
Apply NK fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:766
FI_OCaraway2::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: FI_OCaraway2.h:91
CFG_CUSTOM
Definition: Configurator.h:70
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
fi_ocw2_npk2_for_next_year
Definition: FI_OCaraway2.h:66
FI_OCaraway2::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: FI_OCaraway2.cpp:86
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
cfg_FI_OCaraway2_SkScrapes
CfgBool cfg_FI_OCaraway2_SkScrapes("DK_CROP_OCW2_SK_SCRAPES", CFG_CUSTOM, false)
fi_ocw2_harvest
Definition: FI_OCaraway2.h:65