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
PTYellowLupin.h
Go to the documentation of this file.
1 
14 //
15 // PTYellowLupin.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 PTYELLOWLUPIN_H
43 #define PTYELLOWLUPIN_H
44 
45 #define PTYELLOWLUPIN_BASE 32200
46 
49 #define PT_YL1_CATTLEOUT_DATE a_field->m_user[1]
50 #define PT_YL2_CATTLEOUT_DATE a_field->m_user[2]
51 #define PT_YL_CULT_SOW a_field->m_user[3]
52 
53 
59 typedef enum {
60  pt_yl_start = 1, // Compulsory, must always be 1 (one).
65  pt_yl_ferti_p2,//organic
66  pt_yl_ferti_s2,//organic
76 
78 
79 
88 class PTYellowLupin: public Crop
89 {
90  public:
91  virtual bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
92  PTYellowLupin(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
93  {
99  m_first_date=g_date->DayInYear( 30,11 );
101  }
103  const int elements = 2 + (pt_yl_foobar - PTYELLOWLUPIN_BASE);
105 
106  FarmManagementCategory catlist[elements] =
107  {
108  fmc_Others, // zero element unused but must be here
109  fmc_Others, //pt_yl_start = 1, // Compulsory, must always be 1 (one).
110  fmc_Others, //pt_yl_sleep_all_day = PTYELLOWLUPIN_BASE,
111  fmc_Cultivation, //pt_yl_autumn_harrow,
112  fmc_Fertilizer, //pt_yl_ferti_p1,
113  fmc_Fertilizer, //pt_yl_ferti_s1,
114  fmc_Fertilizer, //pt_yl_ferti_p2,
115  fmc_Fertilizer, //pt_yl_ferti_s2,
116  fmc_Fertilizer, //pt_yl_ferti_p3,
117  fmc_Fertilizer, //pt_yl_ferti_s3,
118  fmc_Cultivation, //pt_yl_stubble_harrow,
119  fmc_Others, //pt_yl_autumn_sow,
120  fmc_Cultivation, //pt_yl_preseeding_cultivator_sow,
121  fmc_Grazing, //pt_yl_cattle_out1,
122  fmc_Grazing, //pt_yl_cattle_is_out1,
123  fmc_Others, //pt_yl_wait,
124 
125  // no foobar entry
126 
127  };
128  // Iterate over the catlist elements and copy them to vector
129  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
130 
131  }
132 };
133 
134 #endif // PTYELLOWLUPIN_H
135 
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
Farm::IsStockFarmer
bool IsStockFarmer(void)
Definition: Farm.h:961
PT_YL1_CATTLEOUT_DATE
#define PT_YL1_CATTLEOUT_DATE
A flag used to indicate cattle out dates.
Definition: PTYellowLupin.h:49
FarmEvent::m_lock
bool m_lock
Definition: Farm.h:384
pt_yl_ferti_p3
Definition: PTYellowLupin.h:67
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
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_yl_ferti_s1
Definition: PTYellowLupin.h:64
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
PTYellowLupin
PTYellowLupin class .
Definition: PTYellowLupin.h:88
pt_yl_foobar
Definition: PTYellowLupin.h:75
PTYELLOWLUPIN_BASE
#define PTYELLOWLUPIN_BASE
Definition: PTYellowLupin.h:45
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
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
pt_yl_ferti_s3
Definition: PTYellowLupin.h:68
PT_YL_CULT_SOW
#define PT_YL_CULT_SOW
Definition: PTYellowLupin.h:51
Crop
The base class for all crops.
Definition: Farm.h:495
Farm::CattleIsOutLow2
virtual bool CattleIsOutLow2(LE *a_field, double a_user, int a_days, int a_max, int a_max_days)
Generate a 'cattle_out_low2' event for every day the cattle are on a_field, cattle is low grazing and...
Definition: FarmFuncs.cpp:2607
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
pt_yl_autumn_harrow
Definition: PTYellowLupin.h:62
pt_yl_cattle_is_out1
Definition: PTYellowLupin.h:73
Farm::CattleOutLowGrazing
virtual bool CattleOutLowGrazing(LE *a_field, double a_user, int a_days)
Start a extensive grazing event on a_field today.
Definition: FarmFuncs.cpp:2439
pt_yl_start
Definition: PTYellowLupin.h:60
pt_yl_sleep_all_day
Definition: PTYellowLupin.h:61
pt_yl_ferti_s2
Definition: PTYellowLupin.h:66
PTYellowLupin::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: PTYellowLupin.cpp:62
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
fmc_Fertilizer
Definition: LandscapeFarmingEnums.h:1004
Calendar::Date
long Date(void)
Definition: Calendar.h:57
PTYellowLupin::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: PTYellowLupin.h:102
pt_yl_wait
Definition: PTYellowLupin.h:74
fmc_Cultivation
Definition: LandscapeFarmingEnums.h:1008
CfgBool
Bool configurator entry class.
Definition: Configurator.h:155
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
pt_yl_ferti_p1
Definition: PTYellowLupin.h:63
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
PTYellowLupin::PTYellowLupin
PTYellowLupin(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: PTYellowLupin.h:92
pt_yl_ferti_p2
Definition: PTYellowLupin.h:65
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
l_pest_insecticide_amount
CfgFloat l_pest_insecticide_amount
CfgArray_Double
Definition: Configurator.h:208
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
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
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
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: FarmFuncs.cpp:325
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
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
PTYellowLupinToDo
PTYellowLupinToDo
Definition: PTYellowLupin.h:59
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: FarmFuncs.cpp:285
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.
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
pt_yl_stubble_harrow
Definition: PTYellowLupin.h:69
Farm
The base class for all farm types.
Definition: Farm.h:755
CfgFloat
Double configurator entry class.
Definition: Configurator.h:126
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
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
pt_yl_cattle_out1
Definition: PTYellowLupin.h:72
cfg_pest_springwheat_on
CfgBool cfg_pest_springwheat_on
Turn on pesticides for spring wheat.
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
pt_yl_autumn_sow
Definition: PTYellowLupin.h:70
tov_PTYellowLupin
Definition: LandscapeFarmingEnums.h:325
pt_yl_preseeding_cultivator_sow
Definition: PTYellowLupin.h:71
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: FarmFuncs.cpp:1523
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