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
CloverGrassGrazed2.h
Go to the documentation of this file.
1 //
2 // CloverGrassGrazed2.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2011, Christopher John Topping, Aarhus University
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without modification, are permitted provided
10 that the following conditions are met:
11 
12 Redistributions of source code must retain the above copyright notice, this list of conditions and the
13 following disclaimer.
14 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 the following disclaimer in the documentation and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ********************************************************************************************************
26 */
27 
28 #ifndef CloverGrassGrazed2H
29 #define CloverGrassGrazed2H
30 
31 #define CGG2_CUT_DATE m_field->m_user[0]
32 #define CGG2_WATER_DATE m_field->m_user[1]
33 #define CGG2_DO_STUBBLE m_field->m_user[2]
34 #define CGG2_STOP_CATTLE m_field->m_user[3]
35 #define CGG2_BASE 1500
36 
37 typedef enum {
38  cgg2_start = 1, // Compulsory, start event must always be 1 (one).
51 
52 
53 
54 class CloverGrassGrazed2: public Crop
55 {
56 public:
57  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
58  CloverGrassGrazed2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
59  {
62  }
64  const int elements = 2 + (cgg2_foobar - CGG2_BASE);
66 
67  FarmManagementCategory catlist[elements] =
68  {
69  fmc_Others, // zero element unused but must be here
70  fmc_Others, // cgg2_start = 1, // Compulsory, start event must always be 1 (one).
71  fmc_Fertilizer, // cgg2_ferti_zero=CGG2_BASE,
72  fmc_Fertilizer, // cgg2_ferti_one,
73  fmc_Fertilizer, // cgg2_ferti_two,
74  fmc_Cutting, // cgg2_cut_to_silage,
75  fmc_Watering, // cgg2_water_zero,
76  fmc_Watering, // cgg2_water_one,
77  fmc_Grazing, // cgg2_cattle_out,
78  fmc_Grazing, // cgg2_cattle_is_out,
79  fmc_Cultivation, // cgg2_stubble_harrow,
80  fmc_Herbicide // cgg2_productapplic_one,
81 
82 
83  // no foobar entry
84 
85  };
86  // Iterate over the catlist elements and copy them to vector
87  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
88 
89  }
90 };
91 
92 #endif
93 // CloverGrassGrazed2.H
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
CGG2_BASE
#define CGG2_BASE
Definition: CloverGrassGrazed2.h:35
cfg_pest_productapplic_startdate
CfgInt cfg_pest_productapplic_startdate
Start date for applying pesticide the first time.
Definition: Elements.cpp:166
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
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
CfgFloat::value
double value() const
Definition: Configurator.h:142
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
CloverGrassGrazed2ToDo
CloverGrassGrazed2ToDo
Definition: CloverGrassGrazed2.h:37
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.
CGG2_DO_STUBBLE
#define CGG2_DO_STUBBLE
Definition: CloverGrassGrazed2.h:33
Crop
The base class for all crops.
Definition: Farm.h:495
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
cgg2_cattle_is_out
Definition: CloverGrassGrazed2.h:46
cgg2_ferti_two
Definition: CloverGrassGrazed2.h:41
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
cgg2_water_zero
Definition: CloverGrassGrazed2.h:43
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
CloverGrassGrazed2
Definition: CloverGrassGrazed2.h:54
cgg2_stubble_harrow
Definition: CloverGrassGrazed2.h:47
cgg2_water_one
Definition: CloverGrassGrazed2.h:44
CfgInt::value
int value() const
Definition: Configurator.h:116
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
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
cgg2_cattle_out
Definition: CloverGrassGrazed2.h:45
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
cgg2_productapplic_one
Definition: CloverGrassGrazed2.h:48
LE
Definition: Elements.h:86
CloverGrassGrazed2::CloverGrassGrazed2
CloverGrassGrazed2(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: CloverGrassGrazed2.h:58
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
CloverGrassGrazed2::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: CloverGrassGrazed2.h:63
fmc_Grazing
Definition: LandscapeFarmingEnums.h:1010
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
cfg_pest_productapplic_period
CfgInt cfg_pest_productapplic_period
Period for applying pesticide.
Definition: Elements.cpp:169
Farm
The base class for all farm types.
Definition: Farm.h:755
CGG2_CUT_DATE
#define CGG2_CUT_DATE
Definition: CloverGrassGrazed2.h:31
cgg2_ferti_one
Definition: CloverGrassGrazed2.h:40
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
cgg2_ferti_zero
Definition: CloverGrassGrazed2.h:39
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
CGG2_WATER_DATE
#define CGG2_WATER_DATE
Definition: CloverGrassGrazed2.h:32
CGG2_STOP_CATTLE
#define CGG2_STOP_CATTLE
Definition: CloverGrassGrazed2.h:34
cgg2_start
Definition: CloverGrassGrazed2.h:38
cfg_silage_prop
CfgFloat cfg_silage_prop
cgg2_foobar
Definition: CloverGrassGrazed2.h:49
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
CloverGrassGrazed2::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: CloverGrassGrazed2.cpp:39
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
cgg2_cut_to_silage
Definition: CloverGrassGrazed2.h:42