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
DE_OSugarBeet.h
Go to the documentation of this file.
1 //
2 // DE_OSugarbeet.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2021, Christopher John Topping, Aarhus University - modified by Susanne Stein, Julius-Kuehn-Institute
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 DE_OSugarBeet_h
29 #define DE_OSugarBeet_h
30 
31 #define DE_OSB_BASE 37700
32 
33 #define DE_OSB_WINTER_PLOUGH a_field->m_user[1]
34 #define DE_OSB_DECIDE_TO_HERB m_field->m_user[2]
35 #define DE_OSB_DECIDE_TO_FI m_field->m_user[3]
36 
37 typedef enum {
38  de_osbe_start = 1, // Compulsory, start event must always be 1 (one).
64 
65 
66 
67 class DE_OSugarBeet: public Crop
68 {
69 public:
70  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
71  DE_OSugarBeet(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
72  {
73  m_first_date=g_date->DayInYear(20, 11); //
75  }
77  const int elements = 2 + (de_osbe_foobar - DE_OSB_BASE);
79 
80  FarmManagementCategory catlist[elements] =
81  {
82  fmc_Others, // zero element unused but must be here
83  fmc_Others, // de_osbe_start = 1, // Compulsory, start event must always be 1 (one).
84  fmc_Others, // de_osbe_sleep_all_day = DE_OSB_BASE,
85  fmc_Fertilizer, // de_osbe_ferti_p1,
86  fmc_Fertilizer, // de_osbe_ferti_s1,
87  fmc_Cultivation, // de_osbe_autumn_plough,
88  fmc_Fertilizer, // de_osbe_ferti_s2,
89  fmc_Fertilizer, // de_osbe_ferti_p2,
90  fmc_Cultivation, // de_osbe_spring_plough,
91  fmc_Cultivation, // de_osbe_sharrow1,
92  fmc_Others, // de_osbe_sow,
93  fmc_Cultivation, // de_osbe_strigling,
94  fmc_Cultivation, // de_osbe_harrow,
95  fmc_Cultivation, // de_osbe_row_cultivation1,
96  fmc_Watering, // de_osbe_water1,
97  fmc_Watering, // de_osbe_water2,
98  fmc_Cultivation, // de_osbe_row_cultivation2,
99  fmc_Cultivation, // de_osbe_row_cultivation3,
100  fmc_Fertilizer, // de_osbe_fertiFA_B,
101  fmc_Fertilizer, // de_osbe_fertiFP_B,
102  fmc_Fertilizer, // de_osbe_fertiFA_S,
103  fmc_Fertilizer, // de_osbe_fertiFP_S,
104  fmc_Cultivation, // de_osbe_manualweeding1,
105  fmc_Cultivation, // de_osbe_manualweeding2,
106  fmc_Harvest, // de_osbe_harvest,
107 
108  // no foobar entry
109 
110  };
111  // Iterate over the catlist elements and copy them to vector
112  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
113 
114  }
115 };
116 
117 #endif // DE_OSugarBeet_h
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
FarmEvent::m_forcespring
bool m_forcespring
Definition: Farm.h:392
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
DE_OSugarBeetToDo
DE_OSugarBeetToDo
Definition: DE_OSugarBeet.h:37
tov_DEOSugarBeet
Definition: LandscapeFarmingEnums.h:492
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
DE_OSugarBeet::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: DE_OSugarBeet.h:76
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
de_osbe_ferti_s2
Definition: DE_OSugarBeet.h:43
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:840
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
de_osbe_fertiFA_S
Definition: DE_OSugarBeet.h:57
de_osbe_strigling
Definition: DE_OSugarBeet.h:48
de_osbe_sharrow1
Definition: DE_OSugarBeet.h:46
Farm::DoIt
bool DoIt(double a_probability)
Return chance out of 0 to 100.
Definition: Farm.cpp:856
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
Farm::FA_Manure
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1110
de_osbe_manualweeding2
Definition: DE_OSugarBeet.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
de_osbe_fertiFP_S
Definition: DE_OSugarBeet.h:58
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
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
DE_OSB_WINTER_PLOUGH
#define DE_OSB_WINTER_PLOUGH
Definition: DE_OSugarBeet.h:33
de_osbe_row_cultivation1
Definition: DE_OSugarBeet.h:50
Farm::FP_Manure
virtual bool FP_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:896
DE_OSugarBeet::DE_OSugarBeet
DE_OSugarBeet(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: DE_OSugarBeet.h:71
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
de_osbe_spring_plough
Definition: DE_OSugarBeet.h:45
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
de_osbe_foobar
Definition: DE_OSugarBeet.h:62
Calendar::Date
long Date(void)
Definition: Calendar.h:57
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
DE_OSB_DECIDE_TO_FI
#define DE_OSB_DECIDE_TO_FI
Definition: DE_OSugarBeet.h:35
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
LE::SetVegPatchy
void SetVegPatchy(bool p)
Definition: Elements.h:229
DE_OSugarBeet::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: DE_OSugarBeet.cpp:32
fmc_Watering
Definition: LandscapeFarmingEnums.h:1011
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: FarmFuncs.cpp:1095
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
Farm::FA_Boron
virtual bool FA_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by a stock farmer.
Definition: FarmFuncs.cpp:868
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
Farm::FP_Boron
virtual bool FP_Boron(LE *a_field, double a_user, int a_days)
Apply soluble Boron to a_field owned by an arable farmer.
Definition: FarmFuncs.cpp:854
de_osbe_fertiFA_B
Definition: DE_OSugarBeet.h:55
Farm::ManualWeeding
virtual bool ManualWeeding(LE *a_field, double a_user, int a_days)
Manual weeding on a_field - no tramlines since weeding by hand, the bush stays on field with same veg...
Definition: FarmFuncs.cpp:2002
DE_OSB_BASE
#define DE_OSB_BASE
Definition: DE_OSugarBeet.h:31
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
de_osbe_row_cultivation3
Definition: DE_OSugarBeet.h:54
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
de_osbe_water2
Definition: DE_OSugarBeet.h:52
de_osbe_water1
Definition: DE_OSugarBeet.h:51
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
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
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
de_osbe_harrow
Definition: DE_OSugarBeet.h:49
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
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
de_osbe_autumn_plough
Definition: DE_OSugarBeet.h:42
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
de_osbe_ferti_s1
Definition: DE_OSugarBeet.h:41
de_osbe_sow
Definition: DE_OSugarBeet.h:47
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
de_osbe_sleep_all_day
Definition: DE_OSugarBeet.h:39
de_osbe_ferti_p2
Definition: DE_OSugarBeet.h:44
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
de_osbe_fertiFP_B
Definition: DE_OSugarBeet.h:56
de_osbe_ferti_p1
Definition: DE_OSugarBeet.h:40
de_osbe_harvest
Definition: DE_OSugarBeet.h:61
DE_OSugarBeet
Definition: DE_OSugarBeet.h:67
DE_OSB_DECIDE_TO_HERB
#define DE_OSB_DECIDE_TO_HERB
Definition: DE_OSugarBeet.h:34
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
de_osbe_start
Definition: DE_OSugarBeet.h:38
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
de_osbe_manualweeding1
Definition: DE_OSugarBeet.h:59
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: FarmFuncs.cpp:459
de_osbe_row_cultivation2
Definition: DE_OSugarBeet.h:53
Crop::SimpleEvent_
void SimpleEvent_(long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
Adds an event to this crop management without relying on member variables.
Definition: Farm.cpp:751