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
PTVineyards.h
Go to the documentation of this file.
1 
14 //
15 // PTVineyards.h
16 //
17 /*
18 *******************************************************************************************************
19 Copyright (c) 2024, Christopher John Topping, University of Aarhus
20 All rights reserved.
21 
22 Redistribution and use in source and binary forms, with or without modification, are permitted provided
23 that the following conditions are met:
24 
25 Redistributions of source code must retain the above copyright notice, this list of conditions and the
26 following disclaimer.
27 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
28 the following disclaimer in the documentation and/or other materials provided with the distribution.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
31 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
32 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
33 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ********************************************************************************************************
39 */
40 
41 
42 #ifndef PTVINEYARDS_H
43 #define PTVINEYARDS_H
44 
45 #define PTVINEYARDS_BASE 31700
46 
50 #define PT_VINE_PRUNING_DATE a_field->m_user[1]
51 #define PT_VINE_PRUNING_DONE a_field->m_user[2]
52 
58 typedef enum {
59  pt_vine_start = 1, // Compulsory, must always be 1 (one).
61  // Vine care treatments
69  // Mowing
72  // NPK
75  // Herbicides
78  // Insecticides
83  // Fungicides
90  // Harvest
93 
95 
96 
105 class PTVineyards: public Crop
106 {
107  public:
108  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
109  PTVineyards(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
110  {
111  // When we start it off, the first possible date for a farm operation is 10th September
112  // This information is used by other crops when they decide how much post processing of
113  // the management is allowed after harvest before the next crop starts.
114  m_first_date=g_date->DayInYear( 31,12 );// AAS:Last possible date to do the first operation, i.e. plough or sow
116  }
118  const int elements = 2 + (pt_vine_foobar - PTVINEYARDS_BASE);
120 
121  FarmManagementCategory catlist[elements] =
122  {
123  fmc_Others, // zero element unused but must be here
124  fmc_Others, //pt_vine_start = 1, // Compulsory, must always be 1 (one).
125  fmc_Others, //pt_vine_sleep_all_day = PTVINEYARDS_BASE,
126  fmc_Others, //pt_vine_autumn_pruning,
127  fmc_Others, //pt_vine_spring_pruning,
128  fmc_Others, //pt_vine_shredding,
129  fmc_Others, //pt_vine_suckering,
130  fmc_Others, //pt_vine_trimming,
131  fmc_Others, //pt_vine_leafthinning,
132  fmc_Others, //pt_vine_greenharvest,
133  fmc_Cutting, //pt_vine_mowing1,
134  fmc_Cutting, //pt_vine_mowing2,
135  fmc_Fertilizer, //pt_vine_npk1,
136  fmc_Fertilizer, //pt_vine_npk2,
137  fmc_Herbicide, //pt_vine_herbicide1,
138  fmc_Herbicide, //pt_vine_herbicide2,
139  fmc_Insecticide, //pt_vine_insecticide1,
140  fmc_Insecticide, //pt_vine_insecticide2,
141  fmc_Insecticide, //pt_vine_insecticide3,
142  fmc_Insecticide, //pt_vine_insecticide4,
143  fmc_Fungicide, //pt_vine_fungicide1,
144  fmc_Fungicide, //pt_vine_fungicide2,
145  fmc_Fungicide, //pt_vine_fungicide3,
146  fmc_Fungicide, //pt_vine_fungicide4,
147  fmc_Fungicide, //pt_vine_fungicide5,
148  fmc_Fungicide, //pt_vine_fungicide6,
149  fmc_Harvest, //pt_vine_harvest,
150 
151  // no foobar entry
152 
153  };
154  // Iterate over the catlist elements and copy them to vector
155  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
156 
157  }
158 };
159 
160 #endif // PTVINEYARDS_H
161 
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
pt_vine_npk2
Definition: PTVineyards.h:74
fmc_Insecticide
Definition: LandscapeFarmingEnums.h:1005
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: FarmFuncs.cpp:2025
pt_vine_insecticide4
Definition: PTVineyards.h:82
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
pt_vine_mowing2
Definition: PTVineyards.h:71
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
pt_vine_harvest
Definition: PTVineyards.h:91
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
fmc_Herbicide
Definition: LandscapeFarmingEnums.h:1006
PTVineyards::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTVineyards.h:117
pt_vine_insecticide2
Definition: PTVineyards.h:80
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
PTVineyardsToDo
PTVineyardsToDo
Definition: PTVineyards.h:58
pt_vine_fungicide1
Definition: PTVineyards.h:84
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
PTVineyards
PTVineyards class .
Definition: PTVineyards.h:105
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: FarmFuncs.cpp:2101
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
pt_vine_suckering
Definition: PTVineyards.h:65
pt_vine_insecticide3
Definition: PTVineyards.h:81
pt_vine_mowing1
Definition: PTVineyards.h:70
fmc_Cutting
Definition: LandscapeFarmingEnums.h:1009
tov_PTVineyards
Definition: LandscapeFarmingEnums.h:320
Farm::GreenHarvest
virtual bool GreenHarvest(LE *a_field, double a_user, int a_days)
GreenHarvest (remove of excess production that may affect the desired quality of the fruits,...
Definition: FarmFuncs.cpp:1942
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
pt_vine_insecticide1
Definition: PTVineyards.h:79
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
PTVineyards::Do
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
The one and only method for a crop management plan. All farm actions go through here.
Definition: PTVineyards.cpp:61
pt_vine_shredding
Definition: PTVineyards.h:64
Calendar::Date
long Date(void)
Definition: Calendar.h:57
pt_vine_spring_pruning
Definition: PTVineyards.h:63
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
pt_vine_fungicide5
Definition: PTVineyards.h:88
cfg_pest_vineyard_on
CfgBool cfg_pest_vineyard_on
Turn on pesticides for wineyard.
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
LE::GetLastTreatment
int GetLastTreatment(int *a_index)
Definition: Elements.cpp:1077
pt_vine_foobar
Definition: PTVineyards.h:92
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
Farm::CutOrch
virtual bool CutOrch(LE *a_field, double a_user, int a_days)
Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard.
Definition: FarmFuncs.cpp:1666
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
pt_vine_fungicide2
Definition: PTVineyards.h:85
PT_VINE_PRUNING_DONE
#define PT_VINE_PRUNING_DONE
Definition: PTVineyards.h:51
pt_vine_trimming
Definition: PTVineyards.h:66
pt_vine_herbicide1
Definition: PTVineyards.h:76
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
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
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::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: FarmFuncs.cpp:2135
pt_vine_fungicide6
Definition: PTVineyards.h:89
pt_vine_leafthinning
Definition: PTVineyards.h:67
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
pt_vine_sleep_all_day
Definition: PTVineyards.h:60
pt_vine_npk1
Definition: PTVineyards.h:73
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
pt_vine_greenharvest
Definition: PTVineyards.h:68
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::LeafThinning
virtual bool LeafThinning(LE *a_field, double a_user, int a_days)
LeafThinning (leaf removal to increase areation and sun exposure of fruits, e.g., grapes) applied on ...
Definition: FarmFuncs.cpp:1927
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
pt_vine_fungicide3
Definition: PTVineyards.h:86
Farm
The base class for all farm types.
Definition: Farm.h:755
pt_vine_start
Definition: PTVineyards.h:59
Farm::Shredding
virtual bool Shredding(LE *a_field, double a_user, int a_days)
Shredding (destruction of the pruning residues with a shredders using hammer mower) applied on a_fiel...
Definition: FarmFuncs.cpp:1912
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
fmc_Harvest
Definition: LandscapeFarmingEnums.h:1012
Farm::FruitHarvest
virtual bool FruitHarvest(LE *a_field, double a_user, int a_days)
FruitHarvest (harvest of the mature fruits, e.g., grapes) applied on a_field.
Definition: FarmFuncs.cpp:1959
Farm::Pruning
virtual bool Pruning(LE *a_field, double a_user, int a_days)
Pruning applied on a_field - details needs to be added (e.g., impact on biomass, influence/impacts in...
Definition: FarmFuncs.cpp:1897
PT_VINE_PRUNING_DATE
#define PT_VINE_PRUNING_DATE
A flag used to indicate autumn ploughing status.
Definition: PTVineyards.h:50
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
PTVineyards::PTVineyards
PTVineyards(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTVineyards.h:109
pt_vine_herbicide2
Definition: PTVineyards.h:77
pt_vine_fungicide4
Definition: PTVineyards.h:87
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
pt_vine_autumn_pruning
Definition: PTVineyards.h:62
ppp_1
Definition: LandscapeFarmingEnums.h:1079
fmc_Fungicide
Definition: LandscapeFarmingEnums.h:1007
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
PTVINEYARDS_BASE
#define PTVINEYARDS_BASE
Definition: PTVineyards.h:45
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