File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/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
DK_WinterCloverGrassGrazedSown.h
Go to the documentation of this file.
1 //
2 // DK_WinterCloverGrassGrazedSown.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2021, Christopher John Topping, Aarhus University - modified by Luna Kondrup Marcussen
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 DK_WinterCloverGrassSown_H
29 #define DK_WinterCloverGrassSown_H
30 
31 #define DK_WCS_BASE 62300
32 
33 #define DK_WCS_CC m_field->m_user[0]
34 #define DK_WCS_CUT m_field->m_user[1]
35 #define GRASS_READY_WCS m_field->m_user[2]
36 
37 typedef enum {
38  dk_wcs_start = 1, // Compulsory, start event must always be 1 (one).
67 
68 
69 
71 {
72 public:
73  bool Do(Farm* a_farm, LE* a_field, FarmEvent* a_ev);
75  {
76  m_first_date = g_date->DayInYear(12, 8);
78  }
80  const int elements = 2 + (dk_wcs_foobar - DK_WCS_BASE);
82 
83  FarmManagementCategory catlist[elements] =
84  {
85  fmc_Others, // zero element unused but must be here
86  fmc_Others, // dk_wcs_start = 1, // Compulsory, start event must always be 1 (one).
87  fmc_Harvest, // dk_wcs_harvest = DK_LW_BASE,
88  fmc_Cultivation, // dk_wcs_autumn_plough,
89  fmc_Cultivation, // dk_wcs_autumn_roll1,
90  fmc_Cultivation, // dk_wcs_autumn_harrow,
91  fmc_Cultivation, // dk_wcs_autumn_roll2,
92  fmc_Fertilizer, // dk_wcs_manure_pig_s,
93  fmc_Fertilizer, // dk_wcs_npk_s,
94  fmc_Fertilizer, // dk_wcs_manure_pig_p,
95  fmc_Fertilizer, // dk_wcs_npk_p,
96  fmc_Others, // dk_wcs_sow,
97  fmc_Herbicide, // dk_wcs_herbicide1,
98  fmc_Insecticide, // dk_wcs_insecticide,
99  fmc_Others, // dk_wcs_sow_spot,
100  fmc_Cutting, // dk_wcs_cutting1,
101  fmc_Cutting, // dk_wcs_cutting_graze,
102  fmc_Cutting, // dk_wcs_cutting2,
103  fmc_Cutting, // dk_wcs_cutting3,
104  fmc_Cutting, // dk_wcs_cutting4,
105  fmc_Grazing, // dk_wcs_grazing,
106  fmc_Grazing, // dk_wcs_cattle_out,
107  fmc_Herbicide, // dk_wcs_herbicide2,
108  fmc_Watering, // dk_wcs_water,
109  fmc_Cutting, // dk_wcs_swathing,
110  fmc_Others, // dk_wcs_grass_collected.,
111  fmc_Others, // dk_wcs_wait,
112  fmc_Others, // dk_wcs_force_growth,
113 
114  // no foobar entry
115 
116  };
117  // Iterate over the catlist elements and copy them to vector
118  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
119 
120  }
121 
122 };
123 
124 #endif // DK_WinterCloverGrassGrazedSown_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
dk_wcs_harvest
Definition: DK_WinterCloverGrassGrazedSown.h:39
dk_wcs_cutting1
Definition: DK_WinterCloverGrassGrazedSown.h:52
dk_wcs_manure_pig_p
Definition: DK_WinterCloverGrassGrazedSown.h:46
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1067
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
dk_wcs_force_growth
Definition: DK_WinterCloverGrassGrazedSown.h:64
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
dk_wcs_cattle_out
Definition: DK_WinterCloverGrassGrazedSown.h:58
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
cfg_farm_cattle_grass_low
CfgInt cfg_farm_cattle_grass_low
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
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
Apply test pesticide to a_field.
Definition: FarmFuncs.cpp:2267
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
Farm::CattleIsOut
virtual bool CattleIsOut(LE *a_field, double a_user, int a_days, int a_max)
Generate a 'cattle_out' event for every day the cattle are on a_field.
Definition: FarmFuncs.cpp:2470
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::CutToSilage
virtual bool CutToSilage(LE *a_field, double a_user, int a_days)
Cut vegetation for silage on a_field.
Definition: FarmFuncs.cpp:1644
dk_wcs_wait
Definition: DK_WinterCloverGrassGrazedSown.h:63
Farm::StrawRemoval
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: FarmFuncs.cpp:1752
dk_wcs_foobar
Definition: DK_WinterCloverGrassGrazedSown.h:65
LE::ForceGrowthTest
virtual void ForceGrowthTest(void)
Definition: Elements.h:188
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
DK_WinterCloverGrassGrazedSown::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: DK_WinterCloverGrassGrazedSown.cpp:41
dk_wcs_npk_p
Definition: DK_WinterCloverGrassGrazedSown.h:47
dk_wcs_water
Definition: DK_WinterCloverGrassGrazedSown.h:60
Farm::SpringSow
virtual bool SpringSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the spring on a_field.
Definition: FarmFuncs.cpp:501
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_wcs_cutting_graze
Definition: DK_WinterCloverGrassGrazedSown.h:53
dk_wcs_start
Definition: DK_WinterCloverGrassGrazedSown.h:38
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:982
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
dk_wcs_insecticide
Definition: DK_WinterCloverGrassGrazedSown.h:50
CfgBool::value
bool value() const
Definition: Configurator.h:164
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
DK_WCS_CC
#define DK_WCS_CC
Definition: DK_WinterCloverGrassGrazedSown.h:33
tov_DKWinterCloverGrassGrazedSown
Definition: LandscapeFarmingEnums.h:369
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
dk_wcs_autumn_roll1
Definition: DK_WinterCloverGrassGrazedSown.h:41
DK_WinterCloverGrassGrazedSown::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_WinterCloverGrassGrazedSown.h:79
DK_WinterCloverGrassGrazedSown
Definition: DK_WinterCloverGrassGrazedSown.h:70
Calendar::Date
long Date(void)
Definition: Calendar.h:57
cfg_pest_grass_on
CfgBool cfg_pest_grass_on
Turn on pesticides for grass.
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
cfg_greg_app_prop
CfgFloat cfg_greg_app_prop
DK_WinterCloverGrassGrazedSown::DK_WinterCloverGrassGrazedSown
DK_WinterCloverGrassGrazedSown(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DK_WinterCloverGrassGrazedSown.h:74
dk_wcs_herbicide1
Definition: DK_WinterCloverGrassGrazedSown.h:49
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
dk_wcs_npk_s
Definition: DK_WinterCloverGrassGrazedSown.h:45
cfg_herbi_app_prop
CfgFloat cfg_herbi_app_prop
LE::GetVegHeight
virtual double GetVegHeight(void)
Definition: Elements.h:148
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
dk_wcs_autumn_roll2
Definition: DK_WinterCloverGrassGrazedSown.h:43
dk_wcs_herbicide2
Definition: DK_WinterCloverGrassGrazedSown.h:59
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
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
dk_wcs_grazing
Definition: DK_WinterCloverGrassGrazedSown.h:57
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
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
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
dk_wcs_sow
Definition: DK_WinterCloverGrassGrazedSown.h:48
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: FarmFuncs.cpp:299
Farm::ShallowHarrow
virtual bool ShallowHarrow(LE *a_field, double a_user, int a_days)
Carry out a shallow harrow event on a_field, e.g., after grass cutting event.
Definition: FarmFuncs.cpp:473
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:823
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
GRASS_READY_WCS
#define GRASS_READY_WCS
Definition: DK_WinterCloverGrassGrazedSown.h:35
dk_wcs_manure_pig_s
Definition: DK_WinterCloverGrassGrazedSown.h:44
LE
Definition: Elements.h:86
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: FarmFuncs.cpp:1330
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
dk_wcs_cutting2
Definition: DK_WinterCloverGrassGrazedSown.h:54
cfg_fungi_app_prop1
CfgFloat cfg_fungi_app_prop1
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: FarmFuncs.cpp:212
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
dk_wcs_cutting4
Definition: DK_WinterCloverGrassGrazedSown.h:56
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
dk_wcs_autumn_harrow
Definition: DK_WinterCloverGrassGrazedSown.h:42
Farm
The base class for all farm types.
Definition: Farm.h:755
Crop::m_date_modifier
static int m_date_modifier
Holds a value that shifts test pesticide use by this many days in crops modified to use it.
Definition: Farm.h:514
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out a sowing event in the autumn on a_field.
Definition: FarmFuncs.cpp:360
dk_wcs_grass_collected
Definition: DK_WinterCloverGrassGrazedSown.h:62
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
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::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_wcs_sow_spot
Definition: DK_WinterCloverGrassGrazedSown.h:51
cfg_farm_cattle_grass_high
CfgInt cfg_farm_cattle_grass_high
DK_WinterCloverGrassGrazedSownToDo
DK_WinterCloverGrassGrazedSownToDo
Definition: DK_WinterCloverGrassGrazedSown.h:37
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
cfg_ins_app_prop1
CfgFloat cfg_ins_app_prop1
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
Farm::CattleOut
virtual bool CattleOut(LE *a_field, double a_user, int a_days)
Start a grazing event on a_field today.
Definition: FarmFuncs.cpp:2368
dk_wcs_autumn_plough
Definition: DK_WinterCloverGrassGrazedSown.h:40
dk_wcs_cutting3
Definition: DK_WinterCloverGrassGrazedSown.h:55
dk_wcs_swathing
Definition: DK_WinterCloverGrassGrazedSown.h:61
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
DK_WCS_BASE
#define DK_WCS_BASE
Definition: DK_WinterCloverGrassGrazedSown.h:31
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
DK_WCS_CUT
#define DK_WCS_CUT
Definition: DK_WinterCloverGrassGrazedSown.h:34