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
DK_MixedVeg.h
Go to the documentation of this file.
1 //
2 // DK_MixedVeg.h
3 //
4 /*
5 
6 Copyright (c) 2022, Christopher John Topping, Aarhus University
7 All rights reserved.
8 
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 
13 *) Redistributions of source code must retain the above copyright notice, this
14 list of conditions and the following disclaimer.
15 *) Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
18 *) Neither the name of the NERI nor the names of its contributors
19 may be used to endorse or promote products derived from this software without
20 specific prior written permission.
21 
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #ifndef DK_MixedVeg_H
37 #define DK_MixedVeg_H
38 
39 
40 #define DK_MV_BASE 69000 // based on salat
41 
42 #define DK_MV_FORCESPRING a_field->m_user[1]
43 
44 typedef enum {
45  dk_mv_start = 1, // Compulsory, start event must always be 1 (one).
81 
82 
83 
84 class DK_MixedVeg: public Crop
85 {
86 public:
87  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
88  DK_MixedVeg(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
89  {
92  }
94  const int elements = 2 + (dk_mv_foobar - DK_MV_BASE);
96 
97  FarmManagementCategory catlist[elements] =
98  {
99  fmc_Others, // zero element unused but must be here
100  fmc_Others, // dk_mv_start = 1, // Compulsory, start event must always be 1 (one).
101  fmc_Others, // dk_mv_mollusicicde = DK_MV_BASE,
102  fmc_Cultivation, // dk_mv_spring_plough,
103  fmc_Cultivation, // dk_mv_strigling1,
104  fmc_Cultivation, // dk_mv_strigling2,
105  fmc_Cultivation, // dk_mv_strigling3,
106  fmc_Cultivation, // dk_mv_strigling4,
107  fmc_Herbicide, // dk_mv_herbicide1,
108  fmc_Herbicide, // dk_mv_herbicide2,
109  fmc_Herbicide, // dk_mv_herbicide3,
110  fmc_Herbicide, // dk_mv_herbicide4,
111  fmc_Others, // dk_mv_plant1,
112  fmc_Others, // dk_mv_plant2,
113  fmc_Others, // dk_mv_plant3,
114  fmc_Others, // dk_mv_plant4,
115  fmc_Fertilizer, // dk_mv_ferti_s1,
116  fmc_Fertilizer, // dk_mv_ferti_p1,
117  fmc_Fertilizer, // dk_mv_ferti_s2,
118  fmc_Fertilizer, // dk_mv_ferti_p2,
119  fmc_Fungicide, // dk_mv_fungicide1,
120  fmc_Fungicide, // dk_mv_fungicide2,
121  fmc_Others, // dk_mv_cover_on,
122  fmc_Others, // dk_mv_cover_off,
123  fmc_Watering, // dk_mv_water1,
124  fmc_Watering, // dk_mv_water2,
125  fmc_Watering, // dk_mv_water3,
126  fmc_Cultivation, // dk_mv_row_cultivation1,
127  fmc_Cultivation, // dk_mv_row_cultivation2,
128  fmc_Insecticide, // dk_mv_insecticide1,
129  fmc_Insecticide, // dk_mv_insecticide2,
130  fmc_Harvest, // dk_mv_harvest1,
131  fmc_Harvest, // dk_mv_harvest2,
132  fmc_Harvest, // dk_mv_harvest3,
133  fmc_Others, // dk_mv_wait,
134  // No foobar entry
135  };
136  // Iterate over the catlist elements and copy them to vector
137  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
138  }
139 };
140 
141 #endif // DK_MixedVeg_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
dk_mv_ferti_s2
Definition: DK_MixedVeg.h:62
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
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
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: FarmFuncs.cpp:1206
dk_mv_ferti_s1
Definition: DK_MixedVeg.h:60
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
tov_DKMixedVeg
Definition: LandscapeFarmingEnums.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
dk_mv_cover_off
Definition: DK_MixedVeg.h:67
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscicide to a_field.
Definition: FarmFuncs.cpp:2310
tos_SandyClayLoam
Definition: LandscapeFarmingEnums.h:722
dk_mv_harvest3
Definition: DK_MixedVeg.h:77
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.
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
tos_SandyLoam
Definition: LandscapeFarmingEnums.h:721
DK_MixedVeg::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: DK_MixedVeg.cpp:34
dk_mv_strigling2
Definition: DK_MixedVeg.h:49
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:968
dk_mv_fungicide2
Definition: DK_MixedVeg.h:65
dk_mv_strigling4
Definition: DK_MixedVeg.h:51
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
dk_mv_ferti_p2
Definition: DK_MixedVeg.h:63
dk_mv_water2
Definition: DK_MixedVeg.h:69
dk_mv_herbicide2
Definition: DK_MixedVeg.h:53
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
dk_mv_herbicide1
Definition: DK_MixedVeg.h:52
DK_MV_BASE
#define DK_MV_BASE
Definition: DK_MixedVeg.h:40
dk_mv_foobar
Definition: DK_MixedVeg.h:79
DK_MixedVeg::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DK_MixedVeg.h:93
DK_MixedVegToDo
DK_MixedVegToDo
Definition: DK_MixedVeg.h:44
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
dk_mv_ferti_p1
Definition: DK_MixedVeg.h:61
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
DK_MixedVeg
Definition: DK_MixedVeg.h:84
dk_mv_start
Definition: DK_MixedVeg.h:45
dk_mv_wait
Definition: DK_MixedVeg.h:78
dk_mv_row_cultivation2
Definition: DK_MixedVeg.h:72
Calendar::Date
long Date(void)
Definition: Calendar.h:57
dk_mv_herbicide3
Definition: DK_MixedVeg.h:54
dk_mv_water1
Definition: DK_MixedVeg.h:68
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
LE::GetSoilType
int GetSoilType()
Definition: Elements.h:302
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
dk_mv_harvest2
Definition: DK_MixedVeg.h:76
dk_mv_strigling1
Definition: DK_MixedVeg.h:48
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
dk_mv_plant2
Definition: DK_MixedVeg.h:57
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
Farm::FiberCovering
virtual bool FiberCovering(LE *a_field, double a_user, int a_days)
Fiber covering applied on a_field.
Definition: FarmFuncs.cpp:1766
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
dk_mv_strigling3
Definition: DK_MixedVeg.h:50
CfgArray_Double
Definition: Configurator.h:208
dk_mv_harvest1
Definition: DK_MixedVeg.h:75
dk_mv_water3
Definition: DK_MixedVeg.h:70
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_mv_cover_on
Definition: DK_MixedVeg.h:66
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
DK_MixedVeg::DK_MixedVeg
DK_MixedVeg(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DK_MixedVeg.h:88
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
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
tos_Sand
Definition: LandscapeFarmingEnums.h:719
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
dk_mv_herbicide4
Definition: DK_MixedVeg.h:55
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: FarmFuncs.cpp:1183
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
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
dk_mv_row_cultivation1
Definition: DK_MixedVeg.h:71
Farm::SpringSowWithFerti
virtual bool SpringSowWithFerti(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 with start fertilizer in the spring on a_field.
Definition: FarmFuncs.cpp:537
dk_mv_fungicide1
Definition: DK_MixedVeg.h:64
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
cfg_pest_veg_on
CfgBool cfg_pest_veg_on
Turn on pesticides for mixed vegetables.
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
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
dk_mv_plant4
Definition: DK_MixedVeg.h:59
Farm::FiberRemoval
virtual bool FiberRemoval(LE *a_field, double a_user, int a_days)
Fiber covering removed from a_field.
Definition: FarmFuncs.cpp:1780
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
dk_mv_plant1
Definition: DK_MixedVeg.h:56
dk_mv_insecticide2
Definition: DK_MixedVeg.h:74
dk_mv_insecticide1
Definition: DK_MixedVeg.h:73
dk_mv_plant3
Definition: DK_MixedVeg.h:58
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
tos_LoamySand
Definition: LandscapeFarmingEnums.h:720
dk_mv_spring_plough
Definition: DK_MixedVeg.h:47
WARN_BUG
Definition: MapErrorMsg.h:34
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
DK_MV_FORCESPRING
#define DK_MV_FORCESPRING
Definition: DK_MixedVeg.h:42
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:630
dk_mv_molluscicide
Definition: DK_MixedVeg.h:46