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
FodderGrass.h
Go to the documentation of this file.
1 //
2 // FodderGrass.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 FodderGrassH
29 #define FodderGrassH
30 
31 #define FG_CUT_DATE m_field->m_user[0]
32 #define FG_WATER_DATE m_field->m_user[1]
33 #define FG_FERTI_DATE m_field->m_user[2]
34 #define FG_FORCE_SECOND_CUT m_field->m_user[3]
35 #define FG_HALT_SECOND_WATER m_field->m_user[4]
36 #define FG_BASE 1900
37 
38 typedef enum {
39  fg_start = 1, // Compulsory, start event must always be 1 (one).
53 
54 
55 class FodderGrass: public Crop
56 {
57 public:
58  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
59  FodderGrass(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
60  {
63  }
65  const int elements = 2 + (fg_foobar - FG_BASE);
67 
68  FarmManagementCategory catlist[elements] =
69  {
70  fmc_Others, // zero element unused but must be here
71  fmc_Others, // fg_start = 1, // Compulsory, start event must always be 1 (one).
72  fmc_Fertilizer, // fg_ferti_zero=FG_BASE,
73  fmc_Fertilizer, // fg_ferti_one,
74  fmc_Fertilizer, // fg_ferti_two,
75  fmc_Fertilizer, // fg_ferti_three,
76  fmc_Fertilizer, // fg_ferti_four,
77  fmc_Cutting, // fg_cut_to_silage,
78  fmc_Cutting, // fg_cut_to_silage2,
79  fmc_Cutting, // fg_cut_to_silage3,
80  fmc_Watering, // fg_water_zero,
81  fmc_Watering, // fg_water_one,
82  fmc_Herbicide // fg_productapplic_one,
83 
84 
85  // no foobar entry
86 
87  };
88  // Iterate over the catlist elements and copy them to vector
89  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
90 
91  }
92 };
93 
94 #endif
95 // FodderGrass.h
96 
FG_WATER_DATE
#define FG_WATER_DATE
Definition: FodderGrass.h:32
fg_foobar
Definition: FodderGrass.h:51
fg_cut_to_silage3
Definition: FodderGrass.h:47
FodderGrass
Definition: FodderGrass.h:55
FG_BASE
#define FG_BASE
Definition: FodderGrass.h:36
fg_ferti_four
Definition: FodderGrass.h:44
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
fg_productapplic_one
Definition: FodderGrass.h:50
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
fg_water_zero
Definition: FodderGrass.h:48
fg_cut_to_silage2
Definition: FodderGrass.h:46
cfg_pest_productapplic_period
CfgInt cfg_pest_productapplic_period
Period for applying pesticide.
Definition: Elements.cpp:169
cfg_pest_productapplic_startdate
CfgInt cfg_pest_productapplic_startdate
Start date for applying pesticide the first time.
Definition: Elements.cpp:166
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
fg_ferti_two
Definition: FodderGrass.h:42
fg_water_one
Definition: FodderGrass.h:49
Crop
The base class for all crops.
Definition: Farm.h:495
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
FodderGrass::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: FodderGrass.h:64
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
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.
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fg_cut_to_silage
Definition: FodderGrass.h:45
FG_CUT_DATE
#define FG_CUT_DATE
Definition: FodderGrass.h:31
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
FG_HALT_SECOND_WATER
#define FG_HALT_SECOND_WATER
Definition: FodderGrass.h:35
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
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
FodderGrass::FodderGrass
FodderGrass(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: FodderGrass.h:59
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
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
CfgInt
Integer configurator entry class.
Definition: Configurator.h:102
Farm
The base class for all farm types.
Definition: Farm.h:755
fg_ferti_zero
Definition: FodderGrass.h:40
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
fg_ferti_one
Definition: FodderGrass.h:41
FodderGrassToDo
FodderGrassToDo
Definition: FodderGrass.h:38
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
FG_FORCE_SECOND_CUT
#define FG_FORCE_SECOND_CUT
Definition: FodderGrass.h:34
cfg_silage_prop
CfgFloat cfg_silage_prop
FG_FERTI_DATE
#define FG_FERTI_DATE
Definition: FodderGrass.h:33
FodderGrass::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: FodderGrass.cpp:43
WARN_BUG
Definition: MapErrorMsg.h:34
fg_start
Definition: FodderGrass.h:39
ppp_1
Definition: LandscapeFarmingEnums.h:1079
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
fg_ferti_three
Definition: FodderGrass.h:43