ALMaSS Rabbit ODdox  1.00
The rabbit model description following ODdox protocol
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VegElement Class Reference

#include <elements.h>

Inheritance diagram for VegElement:
LE BeetleBank Field ForestElement GreenElement HedgeBank Hedges PermanentSetaside PermPasture PermPastureLowYield PermPastureTussocky RoadsideVerge

Public Member Functions

 VegElement (void)
 
virtual ~VegElement (void)
 
virtual void DoDevelopment (void)
 
void ResetGeese (void)
 Reset geese numbers to zero in case this was not done by the population manager (the normal situation). More...
 
virtual double GetDigestability (void)
 
virtual double GetLAGreen (void)
 
virtual double GetLATotal (void)
 
virtual double GetVegCover (void)
 
virtual double GetVegHeight (void)
 
virtual double GetVegBiomass (void)
 
virtual double GetDeadBiomass (void)
 
virtual double GetGreenBiomass (void)
 
virtual double GetWeedBiomass (void)
 
virtual int GetVegDensity (void)
 
virtual bool GetSkScrapes (void)
 
virtual bool GetVegPatchy (void)
 
virtual void SetVegPatchy (bool p)
 
virtual double GetInsectPop (void)
 
virtual void SetInsectPop (double insects)
 
virtual TTypesOfVegetation GetVegType (void)
 
virtual void Insecticide (double a_fraction)
 
virtual bool IsCereal ()
 
virtual bool IsMatureCereal ()
 
virtual bool IsMaize ()
 
virtual bool IsGrass ()
 
virtual bool IsGooseGrass ()
 
virtual void InsectMortality (double a_fraction)
 
virtual void ReduceWeedBiomass (double a_fraction)
 
virtual void ToggleCattleGrazing (void)
 
virtual void TogglePigGrazing (void)
 
virtual void GrazeVegetation (double a_grams, bool a_force)
 
virtual void GrazeVegetationTotal (double a_grams)
 
virtual void SetVegType (TTypesOfVegetation a_vege_type, TTypesOfVegetation a_weed_type)
 
virtual void SetCropData (double, double, double, TTypesOfVegetation, double, int)
 
virtual void SetCropDataAll (double, double, double, double, TTypesOfVegetation, double, double, int, double, bool, double)
 
virtual void SetVegHeight (double a_veg_height)
 
virtual void SetVegParameters (double a_veg_height, double a_LAtotal, double a_LAgreen, double a_WeedBiomass)
 
virtual void SetGrowthPhase (int a_phase)
 
virtual void StoreLAItotal ()
 
virtual void ForceGrowthInitialize (void)
 
virtual void ForceGrowthTest (void)
 
virtual void ForceGrowthDevelopment (void)
 
virtual void ZeroVeg (void)
 
virtual void ReduceVeg (double a_reduc)
 
virtual void ReduceVeg_Extended (double a_reduc)
 
void Set_taken (bool a_taken, int index)
 
bool Get_taken (int index)
 
void Set_tov_type (TTypesOfVegetation a_tov_type, int index)
 
void Set_area_in_crop_data (double a_area)
 
void Set_biomass_at_harvest (double a_biomass, int index)
 
void Set_harvested ()
 
bool Get_harvested (int index)
 
void Add_no_herb_app ()
 
void Add_no_fi_app ()
 
void Add_missed_herb_app ()
 
void Add_missed_fi_app ()
 
void Set_CropDataStorage (int index, CropActualValues a_struct)
 
CropActualValues Get_CropDataStorage (int index)
 
void Clean_CropDataStorage (int index)
 
virtual void ResetDigestability ()
 sets growth record to zero More...
 
virtual int GetVegPhase ()
 
- Public Member Functions inherited from LE
 LE (void)
 
virtual ~LE (void)
 
LE_Signal GetSignal (void)
 
void SetSignal (LE_Signal a_signal)
 
int GetSubType (void)
 
void SetSubType (int a_subtype)
 
int GetALMaSSEleType (void)
 
void SetALMaSSEleType (int a_type)
 
virtual TTypesOfLandscapeElement GetElementType (void)
 
void SetElementType (int a_type)
 
void Trace (int a_value)
 
void ResetTrace (void)
 
long GetRunNum (void)
 
void BumpRunNum (void)
 
long GetMgtLoopDetectDate (void)
 
void SetMgtLoopDetectDate (long a_num)
 
long GetMgtLoopDetectCount (void)
 
void SetMgtLoopDetectCount (long a_num)
 
void Tick (void)
 
int GetVegStore (void)
 
void SetVegStore (int a_veg)
 
void ZeroVegAge ()
 
int GetVegAge ()
 
virtual APoint GetCentroid ()
 
virtual int GetCentroidX ()
 
virtual int GetCentroidY ()
 
virtual void SetCentroid (int x, int y)
 
virtual double GetDayDegrees (void)
 
virtual void SetVegBiomass (int)
 
virtual void GrazeVeg_Extended (double)
 
virtual double GetTrafficLoad (void)
 
virtual TTypesOfVegetation GetPreviousCrop (int)
 
bool GetPoison (void)
 
void SetPoison (bool a_poison)
 
bool GetHigh (void)
 
int GetCattleGrazing (void)
 
bool GetPigGrazing (void)
 
bool HasTramlines (void)
 
bool IsRecentlyMown (void)
 
int IsRecentlySprayed (void)
 
int GetPoly (void)
 Returns the polyref number for this polygon. More...
 
int GetMapIndex (void)
 
void SetMapIndex (int a_map_index)
 
int GetOwnerFile (void)
 
int GetOwnerIndex (void)
 
int GetLastTreatment (int *a_index)
 
FarmGetOwner (void)
 
double GetArea (void)
 
double GetGooseGrazingForage (GooseSpecies a_goose)
 
double GetBirdSeed (void)
 
void SetBirdSeed (double a_forage)
 
double GetBirdMaize (void)
 
void SetBirdMaize (double a_forage)
 
int GetCountryDesignation (void)
 
void SetCountryDesignation (int a_designation)
 
long GetOldDays (void)
 
void SetOwner (Farm *a_owner, int a_owner_num, int a_owner_index)
 
void SetHigh (bool a_high)
 
void SetPoly (int a_poly)
 
void SetMapValid (bool a_valid)
 
bool GetMapValid (void)
 
void SetArea (double a_area)
 
int GetSoilType ()
 
int GetSoilTypeR ()
 
void SetSoilType (int a_st)
 
void SetLastSownVeg (TTypesOfVegetation a_tov)
 Records the last vegetation type to be sown. More...
 
TTypesOfVegetation GetLastSownVeg ()
 Returns the last vegetation type to be sown. More...
 
void SetLastTreatment (int a_treatment)
 
void SetSprayedToday (bool a_didit)
 
bool GetSprayedToday ()
 
void SetCopyTreatment (int a_treatment)
 
void SetOldDays (long a_days)
 
void SetRotIndex (int a_index)
 
int GetRotIndex (void)
 
void SetTramlinesDecay (int a_decaytime_days)
 
void SetHerbicideDelay (int a_decaytime_days)
 
void SetMownDecay (int a_decaytime_days)
 
void AddArea (double a_area_diff)
 
LEGetBorder (void)
 
int GetUnsprayedMarginPolyRef (void)
 
void SetBorder (LE *a_border)
 
void SetUnsprayedMarginPolyRef (int a_unsprayedmargin)
 
void SetPesticideCell (int a_cell)
 
int GetPesticideCell ()
 
void SetValidXY (int a_valid_x, int a_valid_y)
 
int GetValidX (void)
 
int GetValidY (void)
 
int GetMaxX (void)
 
int GetMaxY (void)
 
int GetMinX (void)
 
int GetMinY (void)
 
void SetMaxX (int x)
 
void SetMaxY (int y)
 
void SetMinX (int x)
 
void SetMinY (int y)
 
int GetMDates (int a, int b)
 
void SetMDates (int a, int b, int c)
 
int GetMConstants (int a)
 
void SetMConstants (int a, int c)
 
double GetVegDDegs ()
 Get the total of day degrees for the crop/veg on this element. More...
 
int GetOpenness (void)
 For goose model functionality, openness score for the polygon. More...
 
void SetGooseNos (int a_number, int a_day)
 
void SetGooseSpNos (int a_number, int a_day, GooseSpecies a_goose)
 
void SetGooseNosTimed (int a_number, int a_day)
 
void SetGooseSpNosTimed (int a_number, int a_day, GooseSpecies a_goose)
 
int GetGooseNosToday ()
 For goose model functionality, returns the number of geese today. More...
 
int GetGooseNosTodayTimed ()
 For goose model functionality, returns the number of geese today at a predefined time. More...
 
int GetGooseNos ()
 For goose model functionality, returns the number of geese yesterday. More...
 
int GetGooseSpNosToday (GooseSpecies a_goose)
 For goose model functionality, returns the number of geese per species yesterday. More...
 
int GetGooseSpNosTodayTimed (GooseSpecies a_goose)
 For goose model functionality, returns the number of geese per species yesterday at a predefined time. More...
 
void SetOpenness (int a_openness)
 Records the openness statistic for this polygon. More...
 
void DoCopy (const LE *a_Le)
 a copy function to be used because a copy constuctor won't work More...
 
virtual void SetMaleNewtPresent (bool)
 Sets a male newt as present/absent in descendent classes - here only to prevent need for dynamic casts. More...
 
virtual bool IsMaleNewtPresent ()
 Sets a male newt as present/absent in descendent classes - here only to prevent need for dynamic casts. More...
 

Protected Member Functions

void ReadBugPercentageFile (void)
 
virtual void RecalculateBugsNStuff (void)
 
void RandomVegStartValues (double *a_LAtotal, double *a_LAgreen, double *a_veg_height, double *a_weed_biomass)
 
void ForceGrowthSpringTest (void)
 

Protected Attributes

TTypesOfVegetation m_vege_type
 
int m_curve_num
 
int m_weed_curve_num
 
int m_veg_phase
 
int m_nutrient_status
 
double m_LAtotal
 
double m_oldLAtotal
 
double m_LAgreen
 
double m_insect_pop
 
double m_veg_biomass
 
double m_total_biomass
 
double m_total_biomass_old
 
double m_green_biomass
 
double m_dead_biomass
 
double m_weed_biomass
 
double m_veg_height
 
int m_veg_density
 
bool m_veg_patchy
 
double m_veg_cover
 
bool m_forced_phase_shift
 
double m_digestability
 
double m_oldnewgrowth [32]
 
int m_newoldgrowthindex
 
double m_newgrowthsum
 
double m_force_Weed
 
double m_force_LAgreen
 
double m_force_LAtotal
 
double m_force_veg_height
 
bool m_force_growth
 
FILE * m_ifile
 
CropActualValues m_CropDataStorage [2]
 Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be stored (hence size - 2). Used by a farmer to make a yearly accounting (OptimisingFarm::ActualProfit()). More...
 
int m_crop_index
 
- Protected Attributes inherited from LE
long m_running
 
LEm_border
 
int m_unsprayedmarginpolyref
 
int m_valid_x
 
int m_valid_y
 
int m_centroidx
 
int m_centroidy
 
int m_vege_danger_store
 
int m_PesticideGridCell
 
bool m_is_in_map
 
int m_subtype
 
int m_maxx
 
int m_minx
 
int m_maxy
 
int m_miny
 
long m_olddays
 
long m_management_loop_detect_date
 
long m_management_loop_detect_count
 
Farmm_owner
 
int m_countrydesignation
 
int m_owner_file
 
int m_owner_index
 
int m_rot_index
 
bool m_sprayedtoday
 flag to indicate an overspray situation More...
 
int m_poly
 The polyref number for this polygon. More...
 
int m_map_index
 
int m_almass_le_type
 This holds the ALMaSS element type reference number. More...
 
int m_farmfunc_tried_to_do
 
int m_tramlinesdecay
 
int m_mowndecay
 
int m_herbicidedelay
 
TTypesOfLandscapeElement m_type
 
double m_area
 
int m_gooseNos [366]
 The number of geese each day. More...
 
int m_gooseSpNos [366][gs_foobar]
 The number of geese of each species each day. More...
 
int m_gooseNosTimed [366]
 The number of geese at a predefined time per day. More...
 
int m_gooseSpNosTimed [366][gs_foobar]
 The number of geese of each species at a predefined time per day. More...
 
double m_birdseedforage
 The grain forage present in KJ/m2. More...
 
double m_birdmaizeforage
 The maize forage present in KJ/m2. More...
 
double m_goosegrazingforage [gs_foobar]
 The grazing forage present in KJ/min. More...
 
TTypesOfVegetation m_lastsownvegtype
 Records the last vegegetation type that was sown on the element. More...
 
int m_openness
 The openness metric for a field (if any) More...
 
int m_vegage
 
int m_soiltype
 
int m_days_since_insecticide_spray
 
bool m_high
 
bool m_poison
 
int m_cattle_grazing
 
int m_default_grazing_level
 
bool m_pig_grazing
 
double m_vegddegs
 
double m_yddegs
 
double m_ddegs
 
vector< int > m_lasttreat
 
unsigned int m_lastindex
 
int MDates [2][25]
 
int MConsts [10]
 
LE_Signal m_signal_mask
 

Additional Inherited Members

- Public Attributes inherited from LE
int m_tried_to_do
 
int m_squares_in_map
 
bool m_skylarkscrapes
 For management testing of skylark scrapes. More...
 
long m_user [EL_MAX_USERSPACE]
 Variable used to record the current grazing pressure by e.g. voles. More...
 
bool m_repeat_start
 
- Static Protected Attributes inherited from LE
static double m_monthly_traffic []
 Used for birds that feed on grain on cereal fields 3% spill is expected. More...
 
static double m_largeroad_load []
 
static double m_smallroad_load []
 

Detailed Description

Definition at line 487 of file elements.h.

Constructor & Destructor Documentation

VegElement::VegElement ( void  )

Definition at line 573 of file elements.cpp.

References Clean_CropDataStorage(), EL_BUG_PERCENT_A, EL_BUG_PERCENT_B, EL_BUG_PERCENT_C, EL_BUG_PERCENT_D, EL_BUG_PERCENT_Edges_A, EL_BUG_PERCENT_Edges_B, EL_BUG_PERCENT_Edges_C, EL_BUG_PERCENT_G_A, EL_BUG_PERCENT_G_B, EL_BUG_PERCENT_G_C, EL_BUG_PERCENT_SB_A, EL_BUG_PERCENT_SB_B, EL_BUG_PERCENT_SB_C, EL_BUG_PERCENT_WR_A, EL_BUG_PERCENT_WR_B, EL_BUG_PERCENT_WR_C, EL_BUG_PERCENT_WRy_A, EL_BUG_PERCENT_WRy_B, EL_BUG_PERCENT_WRy_C, EL_BUG_PERCENT_WW_A, EL_BUG_PERCENT_WW_B, EL_BUG_PERCENT_WW_C, g_biomass_scale, g_bug_percent_a, g_bug_percent_b, g_bug_percent_c, g_bug_percent_d, g_crops, g_weed_percent, janfirst, l_el_read_bug_percentage_file(), m_crop_index, m_curve_num, LE::m_ddegs, m_digestability, m_force_growth, m_forced_phase_shift, m_insect_pop, m_LAgreen, m_LAtotal, m_newgrowthsum, m_newoldgrowthindex, m_nutrient_status, m_oldnewgrowth, m_total_biomass, m_total_biomass_old, m_veg_biomass, m_veg_cover, m_veg_height, LE::m_vegddegs, m_vege_type, m_weed_biomass, m_weed_curve_num, LE::m_yddegs, SetGrowthPhase(), SetVegPatchy(), tov_AgroChemIndustryCereal, tov_BroadBeans, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FieldPeas, tov_FieldPeasSilage, tov_FieldPeasStrigling, tov_FodderBeet, tov_FodderGrass, tov_Heath, tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_NaturalGrass, tov_NoGrowth, tov_None, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OFirstYearDanger, tov_OFodderBeet, tov_OGrazingPigs, tov_OMaizeSilage, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OrchardCrop, tov_OSBarleySilage, tov_OSeedGrass1, tov_OSeedGrass2, tov_OSetaside, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_OWinterWheatUndersownExt, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyCloverGrassStrigling, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_SpringWheat, tov_SugarBeet, tov_Triticale, tov_Wasteland, tov_WinterBarley, tov_WinterBarleyStrigling, tov_WinterRape, tov_WinterRapeStrigling, tov_WinterRye, tov_WinterRyeStrigling, tov_WinterWheat, tov_WinterWheatShort, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, tov_YoungForest, CfgBool::value(), and CropData::VegTypeToCurveNum().

573  : LE() {
574  SetVegPatchy(false);
575  m_nutrient_status = 0; // default
576  m_veg_biomass = 0.0;
577  m_weed_biomass = 0.0;
578  m_veg_height = 0.0;
579  m_veg_cover = 0.0;
580  m_insect_pop = 1.0;
583  m_weed_curve_num = 99; // 99 used as zero growth curve
584  m_yddegs = 0.0;
585  m_vegddegs = -1.0;
586  m_ddegs = 0.0;
587  m_LAgreen = 0.0;
588  m_LAtotal = 0.0;
589  m_digestability = 1.0;
590  for (int i = 0; i < 32; i++) m_oldnewgrowth[i] = 0.5;
592  m_newgrowthsum = 8.0;
593  m_forced_phase_shift = false;
594  m_force_growth = false;
596  m_total_biomass = 0.0;
597  m_total_biomass_old = 0.0;
598 
599 
600 
601  g_biomass_scale[tov_Carrots] = 0.7857;
605  g_biomass_scale[ tov_BroadBeans ] = 0.857;
606  g_biomass_scale[ tov_FieldPeas ] = 0.857;
611  g_biomass_scale[tov_Maize] = 1.00;
614  g_biomass_scale[tov_NaturalGrass] = 0.567; //0.567 is scaled for actual yield
615  g_biomass_scale[tov_Heath] = 0.567; //0.567 is scaled for actual yield
617  g_biomass_scale[tov_None] = 0.0;
619  g_biomass_scale[tov_Oats] = 0.857;
621  g_biomass_scale[tov_OSBarleySilage] = 0.857 * 0.8;
622  g_biomass_scale[tov_OCarrots] = 0.7857 * 0.8;
626  g_biomass_scale[tov_OFieldPeas] = 0.857 * 0.8;
627  g_biomass_scale[tov_OFieldPeasSilage] = 0.857 * 0.8;
629  g_biomass_scale[tov_OGrazingPigs] = 0.7857 * 0.8;
630  g_biomass_scale[tov_OOats] = 0.857 * 0.8;
632  g_biomass_scale[tov_OPotatoes] = 0.857 * 0.8;
635  g_biomass_scale[tov_OSetaside] = 0.7857;
636  g_biomass_scale[tov_OSpringBarley] = 0.857 * 0.8;
637  g_biomass_scale[tov_OSpringBarleyExt] = 0.857 * 0.8 * 0.8;
640  g_biomass_scale[tov_OSpringBarleyPigs] = 0.857 * 0.8;
641  g_biomass_scale[tov_OTriticale] = 1.00 * 0.8;
642  g_biomass_scale[tov_OWinterBarley] = 0.857 * 0.8;
643  g_biomass_scale[tov_OWinterBarleyExt] = 0.857 * 0.8 * 0.8;
644  g_biomass_scale[tov_OWinterRape] = 1.071 * 0.8;
645  g_biomass_scale[tov_OWinterRye] = 0.857 * 0.8;
646  g_biomass_scale[ tov_OWinterWheat ] = 1.00 * 0.8;
648  g_biomass_scale[ tov_OWinterWheatUndersownExt ] = 1.00 * 0.8 * 0.8;
653  g_biomass_scale[tov_Potatoes] = 0.857;
659  g_biomass_scale[tov_Setaside] = 0.7857;
674  g_biomass_scale[tov_WinterWheat] = 1.00; // This gives approx 18 tonnes biomass for WW
693  g_biomass_scale[tov_YoungForest] = 0.7857 * 0.67;
694  g_biomass_scale[tov_Wasteland] = 0.7857 * 0.67;
695 
697  //ReadBugPercentageFile();
698  return;
699  }
700 
703  g_weed_percent[ tov_Maize ] = 0.05;
743  g_weed_percent[tov_OOats] = 0.1;
744  g_weed_percent[tov_Oats] = 0.1;
745  g_weed_percent[tov_Heath] = 0.1;
747  g_weed_percent[ tov_FieldPeas ] = 0.1;
764  g_weed_percent[tov_None] = 0.1;
788 
879 
966 
1053 
1139 
1140 
1141  //05.03.13 - modifications for farmer decision making, AM
1144  m_crop_index = 0;
1145 }
static CfgBool l_el_read_bug_percentage_file("ELEM_READ_BUG_PERCENTAGE_FILE", CFG_CUSTOM, false)
LE(void)
Definition: elements.cpp:267
#define EL_BUG_PERCENT_WR_A
Definition: elements.cpp:56
static double g_bug_percent_c[tov_Undefined]
Definition: elements.cpp:122
int VegTypeToCurveNum(TTypesOfVegetation VegReference)
Definition: plants.cpp:231
double m_vegddegs
Definition: elements.h:455
#define EL_BUG_PERCENT_Edges_C
Definition: elements.cpp:70
#define EL_BUG_PERCENT_C
Definition: elements.cpp:34
#define EL_BUG_PERCENT_WR_C
Definition: elements.cpp:58
#define EL_BUG_PERCENT_A
Definition: elements.cpp:32
class CropData * g_crops
Definition: plants.cpp:39
bool m_force_growth
Definition: elements.h:632
int m_newoldgrowthindex
Definition: elements.h:626
int m_nutrient_status
Definition: elements.h:608
#define EL_BUG_PERCENT_WW_A
Definition: elements.cpp:44
static double g_bug_percent_b[tov_Undefined]
Definition: elements.cpp:121
double m_newgrowthsum
Definition: elements.h:627
virtual void SetVegPatchy(bool p)
Definition: elements.h:506
static double g_bug_percent_a[tov_Undefined]
Definition: elements.cpp:120
static double g_bug_percent_d[tov_Undefined]
Definition: elements.cpp:123
double m_LAtotal
Definition: elements.h:609
#define EL_BUG_PERCENT_G_B
Definition: elements.cpp:63
double m_digestability
Definition: elements.h:624
#define EL_BUG_PERCENT_B
Definition: elements.cpp:33
double m_total_biomass
Definition: elements.h:614
#define EL_BUG_PERCENT_WR_B
Definition: elements.cpp:57
double m_veg_cover
Definition: elements.h:622
#define EL_BUG_PERCENT_G_C
Definition: elements.cpp:64
#define EL_BUG_PERCENT_WW_B
Definition: elements.cpp:45
virtual void SetGrowthPhase(int a_phase)
Definition: elements.cpp:1471
static double g_biomass_scale[tov_Undefined]
Definition: elements.cpp:118
TTypesOfVegetation m_vege_type
Definition: elements.h:604
bool m_forced_phase_shift
Definition: elements.h:623
bool value(void)
Definition: configurator.h:123
double m_insect_pop
Definition: elements.h:612
double m_weed_biomass
Definition: elements.h:618
static double g_weed_percent[tov_Undefined]
Definition: elements.cpp:119
double m_ddegs
Definition: elements.h:457
double m_total_biomass_old
Definition: elements.h:615
#define EL_BUG_PERCENT_WRy_A
Definition: elements.cpp:50
#define EL_BUG_PERCENT_SB_C
Definition: elements.cpp:40
double m_oldnewgrowth[32]
Definition: elements.h:625
double m_LAgreen
Definition: elements.h:611
double m_yddegs
Definition: elements.h:456
double m_veg_height
Definition: elements.h:619
#define EL_BUG_PERCENT_SB_A
Definition: elements.cpp:38
int m_weed_curve_num
Definition: elements.h:606
#define EL_BUG_PERCENT_G_A
Definition: elements.cpp:62
double m_veg_biomass
Definition: elements.h:613
#define EL_BUG_PERCENT_Edges_A
Definition: elements.cpp:68
#define EL_BUG_PERCENT_WRy_C
Definition: elements.cpp:52
int m_crop_index
Definition: elements.h:643
#define EL_BUG_PERCENT_Edges_B
Definition: elements.cpp:69
#define EL_BUG_PERCENT_D
Definition: elements.cpp:71
int m_curve_num
Definition: elements.h:605
#define EL_BUG_PERCENT_WW_C
Definition: elements.cpp:46
#define EL_BUG_PERCENT_SB_B
Definition: elements.cpp:39
#define EL_BUG_PERCENT_WRy_B
Definition: elements.cpp:51
void Clean_CropDataStorage(int index)
Definition: elements.cpp:1751
virtual VegElement::~VegElement ( void  )
inlinevirtual

Definition at line 490 of file elements.h.

490 { ; };

Member Function Documentation

void VegElement::Add_missed_fi_app ( )
inline

Definition at line 587 of file elements.h.

CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Add_missed_herb_app ( )
inline

Definition at line 586 of file elements.h.

CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Add_no_fi_app ( )
inline

Definition at line 579 of file elements.h.

Referenced by OptimisingFarm::FungicideTreat(), and OptimisingFarm::InsecticideTreat().

CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Add_no_herb_app ( )
inline

Definition at line 576 of file elements.h.

Referenced by OptimisingFarm::HerbicideTreat().

CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Clean_CropDataStorage ( int  index)

Sets the values of a struct in an array m_CropDataStorage (at a given index) to default values.

Definition at line 1751 of file elements.cpp.

References CropActualValues::area, CropActualValues::biomass_at_harvest, CropActualValues::harvested, m_CropDataStorage, CropActualValues::missed_fi_app, CropActualValues::missed_herb_app, CropActualValues::no_fi_app, CropActualValues::no_herb_app, CropActualValues::taken, CropActualValues::tov_type, and tov_Undefined.

Referenced by OptimisingFarm::ActualProfit(), OptimisingFarm::HandleEvents(), and VegElement().

1751  {
1752  //05.03.13 AM
1754 
1755  m_CropDataStorage[index].taken = false;
1758  m_CropDataStorage[index].harvested = false;
1759  m_CropDataStorage[index].area = 0;
1760  m_CropDataStorage[index].no_herb_app = 0;
1762  m_CropDataStorage[index].no_fi_app = 0;
1763  m_CropDataStorage[index].missed_fi_app = 0;
1764 }
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
double biomass_at_harvest
Definition: elements.h:477
TTypesOfVegetation tov_type
Definition: elements.h:476
void VegElement::DoDevelopment ( void  )
virtual

Reimplemented from LE.

Reimplemented in MownGrass, OrchardBand, Orchard, ForestElement, UnsprayedFieldMargin, Wasteland, NaturalGrassWet, NaturalGrassDry, Scrub, GreenElement, RoadsideSlope, RoadsideVerge, BeetleBank, HedgeBank, Hedges, and Field.

Definition at line 1621 of file elements.cpp.

References cfg_ele_weedscaling, Calendar::Date(), ForceGrowthDevelopment(), g_crops, g_date, g_landscape_p, g_weather, Weather::GetDDDegs(), CropData::GetHeightDiff(), CropData::GetLAgreenDiff(), CropData::GetLAtotalDiff(), m_curve_num, LE::m_ddegs, m_force_growth, LE::m_herbicidedelay, m_LAgreen, m_LAtotal, LE::m_owner_index, LE::m_poly, m_veg_height, m_veg_phase, LE::m_vegddegs, m_weed_biomass, m_weed_curve_num, LE::m_yddegs, RecalculateBugsNStuff(), ResetGeese(), Landscape::SupplyFarmIntensity(), and CfgFloat::value().

Referenced by Field::DoDevelopment(), Hedges::DoDevelopment(), HedgeBank::DoDevelopment(), BeetleBank::DoDevelopment(), RoadsideVerge::DoDevelopment(), GreenElement::DoDevelopment(), Scrub::DoDevelopment(), NaturalGrassDry::DoDevelopment(), NaturalGrassWet::DoDevelopment(), Wasteland::DoDevelopment(), ForestElement::DoDevelopment(), Orchard::DoDevelopment(), OrchardBand::DoDevelopment(), and MownGrass::DoDevelopment().

1621  {
1622  if ( m_force_growth ) {
1625  ResetGeese();
1626  return;
1627  }
1628 
1629  m_yddegs = m_ddegs;
1631  if (m_vegddegs != -1.0) m_vegddegs += m_ddegs; // Sum up the vegetation day degrees since sowing
1632  m_ddegs += m_yddegs; // and sum up the phase ddegs
1633 
1637 
1638  m_LAgreen += dLAG;
1639  if ( m_LAgreen < 0.0 )
1640  m_LAgreen = 0.0;
1641 
1642  m_LAtotal += dLAT;
1643  if ( m_LAtotal < 0.0 )
1644  m_LAtotal = 0.0;
1645  int fintensity = 0;
1646 #ifdef __EXTSHRINKSHEIGHT
1647  if (this->m_owner_index != -1) { // This only works because only crops and similar structures have owners
1648  fintensity = g_landscape_p->SupplyFarmIntensity(m_poly);
1649  if (fintensity==1) {
1650  // 1 means extensive, so reduce vegetation height by 10%
1651  dHgt *=0.9;
1652  }
1653  }
1654 #endif
1655 
1656 
1657  m_veg_height += dHgt;
1658  if ( m_veg_height < 0.0 ) m_veg_height = 0.0;
1659  if ( m_herbicidedelay == 0 ) {
1661  m_weed_biomass += dWee * cfg_ele_weedscaling.value()* (1+fintensity);
1662  }
1663  if ( m_weed_biomass < 0.0 ) m_weed_biomass = 0.0;
1665  // Here we need to set today's goose numbers to zero in case they are not written by the goose population manager (the normal situation)
1666  ResetGeese();
1667 }
double m_vegddegs
Definition: elements.h:455
long Date(void)
Definition: calendar.h:57
double GetLAtotalDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:109
class CropData * g_crops
Definition: plants.cpp:39
bool m_force_growth
Definition: elements.h:632
static CfgFloat cfg_ele_weedscaling("ELE_WEEDSCALING", CFG_CUSTOM, 1.0)
double m_LAtotal
Definition: elements.h:609
double value(void)
Definition: configurator.h:107
class Weather * g_weather
Definition: weather.cpp:41
int m_herbicidedelay
Definition: elements.h:426
double GetDDDegs(long a_date)
Definition: weather.cpp:155
double GetHeightDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:116
double m_weed_biomass
Definition: elements.h:618
double m_ddegs
Definition: elements.h:457
class Calendar * g_date
Definition: calendar.cpp:38
double m_LAgreen
Definition: elements.h:611
int m_veg_phase
Definition: elements.h:607
int m_owner_index
Definition: elements.h:412
double m_yddegs
Definition: elements.h:456
double m_veg_height
Definition: elements.h:619
int m_poly
The polyref number for this polygon.
Definition: elements.h:417
int m_weed_curve_num
Definition: elements.h:606
int SupplyFarmIntensity(int a_x, int a_y)
Definition: Landscape.cpp:619
double GetLAgreenDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:102
void ResetGeese(void)
Reset geese numbers to zero in case this was not done by the population manager (the normal situation...
Definition: elements.cpp:1669
int m_curve_num
Definition: elements.h:605
virtual void RecalculateBugsNStuff(void)
Definition: elements.cpp:1339
virtual void ForceGrowthDevelopment(void)
Definition: elements.cpp:1596
class Landscape * g_landscape_p
Definition: Landscape.cpp:238
void VegElement::ForceGrowthDevelopment ( void  )
virtual

Reimplemented from LE.

Definition at line 1596 of file elements.cpp.

References m_force_LAgreen, m_force_LAtotal, m_force_veg_height, m_LAgreen, m_LAtotal, and m_veg_height.

Referenced by DoDevelopment().

1596  {
1597  //if ( m_herbicidedelay == 0 ) m_weed_biomass += m_force_Weed; // ***CJT*** 12th Sept 2008 - rather than force growth, weeds might be allowed to grow on their own
1601  // RecalculateBugsNStuff(); REMOVED BY CJT 3/2/2015 If no problems occur then we can delete permanantly
1602 }
double m_LAtotal
Definition: elements.h:609
double m_force_LAtotal
Definition: elements.h:630
double m_force_veg_height
Definition: elements.h:631
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
double m_force_LAgreen
Definition: elements.h:629
void VegElement::ForceGrowthInitialize ( void  )
virtual

Reimplemented from LE.

Definition at line 1553 of file elements.cpp.

References Calendar::DayInYear(), g_crops, g_date, CropData::GetStartValue(), janfirst, m_curve_num, m_force_growth, m_force_LAgreen, m_force_LAtotal, m_force_veg_height, m_force_Weed, m_LAgreen, m_LAtotal, m_veg_height, m_weed_biomass, m_weed_curve_num, marchfirst, RandomVegStartValues(), and CropData::StartValid().

Referenced by ForceGrowthSpringTest(), and ForceGrowthTest().

1553  {
1554  double LAgreen_target;
1555  double Weed_target;
1556  double LAtotal_target;
1557  double veg_height_target;
1558  int next_phase, daysleft;
1559 
1560  // Figure out what our target phase is.
1561  if ( g_date->DayInYear() < g_date->DayInYear( 3, 1 ) ) {
1562  daysleft = g_date->DayInYear( 1, 3 ) - g_date->DayInYear();
1563  next_phase = marchfirst;
1564  } else if ( g_date->DayInYear() >= g_date->DayInYear( 1, 11 ) ) {
1565  daysleft = 365 - g_date->DayInYear();
1566  next_phase = janfirst;
1567  } else {
1568  return;
1569  }
1570  if ( daysleft <= 0 )
1571  // Uh! Oh! This really shouldn't happen.
1572  return;
1573 
1574  if ( !g_crops->StartValid( m_curve_num, next_phase ) ) {
1575  // If no valid starting values for next phase, then
1576  // preinitialize the random starting values! Ie. make the
1577  // choice here and then do not choose another set come
1578  // next phase transition, but use the values we already
1579  // got at that point in time.
1580  RandomVegStartValues( & LAtotal_target, & LAgreen_target, & veg_height_target, & Weed_target );
1581  } else {
1582  Weed_target = g_crops->GetStartValue( m_weed_curve_num, next_phase, 0 );
1583  LAgreen_target = g_crops->GetStartValue( m_curve_num, next_phase, 0 );
1584  LAtotal_target = g_crops->GetStartValue( m_curve_num, next_phase, 1 );
1585  veg_height_target = g_crops->GetStartValue( m_curve_num, next_phase, 2 );
1586  }
1587 
1588  m_force_growth = true;
1589  m_force_Weed = ( Weed_target - m_weed_biomass ) / ( double )daysleft;
1590  m_force_LAgreen = ( LAgreen_target - m_LAgreen ) / ( double )daysleft;
1591  m_force_LAtotal = ( LAtotal_target - m_LAtotal ) / ( double )daysleft;
1592  m_force_veg_height = ( veg_height_target - m_veg_height ) / ( double )daysleft;
1593 }
class CropData * g_crops
Definition: plants.cpp:39
bool m_force_growth
Definition: elements.h:632
double m_LAtotal
Definition: elements.h:609
double m_force_Weed
Definition: elements.h:628
double m_force_LAtotal
Definition: elements.h:630
int DayInYear(void)
Definition: calendar.h:58
bool StartValid(int a_veg_type, int a_phase)
Definition: plants.cpp:364
double m_weed_biomass
Definition: elements.h:618
class Calendar * g_date
Definition: calendar.cpp:38
double m_force_veg_height
Definition: elements.h:631
double GetStartValue(int a_veg_type, int a_phase, int a_type)
Definition: plants.h:105
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
int m_weed_curve_num
Definition: elements.h:606
void RandomVegStartValues(double *a_LAtotal, double *a_LAgreen, double *a_veg_height, double *a_weed_biomass)
Definition: elements.cpp:1463
int m_curve_num
Definition: elements.h:605
double m_force_LAgreen
Definition: elements.h:629
void VegElement::ForceGrowthSpringTest ( void  )
protected

Definition at line 1534 of file elements.cpp.

References ForceGrowthInitialize(), g_crops, CropData::GetHeightDiff(), CropData::GetLAgreenDiff(), CropData::GetLAtotalDiff(), janfirst, and m_curve_num.

Referenced by SetGrowthPhase().

1534  {
1535  // Unless we are on the list of special growth curves where we have worked
1536  // out vegetation declines (grasses), then
1537  // check if there are any positive growth differentials in the curve
1538  // for the first two months of the year. Do nothing if there is.
1539  //if (IsGrass()) return;
1540  // If we have any positive growth then no need to force either
1541  if (g_crops->GetLAgreenDiff(90000.0, 0.0, m_curve_num, janfirst) > 0.001
1542  || g_crops->GetLAtotalDiff(90000.0, 0.0, m_curve_num, janfirst) > 0.001
1543  || g_crops->GetHeightDiff(90000.0, 0.0, m_curve_num, janfirst) > 0.001) {
1544  return;
1545  }
1546 
1547  // No growth, force it.
1549 }
double GetLAtotalDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:109
class CropData * g_crops
Definition: plants.cpp:39
double GetHeightDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:116
virtual void ForceGrowthInitialize(void)
Definition: elements.cpp:1553
double GetLAgreenDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
Definition: plants.cpp:102
int m_curve_num
Definition: elements.h:605
void VegElement::ForceGrowthTest ( void  )
virtual

Reimplemented from LE.

Definition at line 1523 of file elements.cpp.

References Calendar::DayInYear(), ForceGrowthInitialize(), g_date, and m_force_growth.

Referenced by ReduceVeg(), ReduceVeg_Extended(), and ZeroVeg().

1523  {
1524  // Called whenever the farmer does something 'destructive' to a
1525  // field, that reduced the vegetaion.
1526  if ( g_date->DayInYear() >= g_date->DayInYear( 1, 11 )
1527  || ( g_date->DayInYear() < g_date->DayInYear( 1, 3 ) && m_force_growth ) ) {
1529  }
1530 }
bool m_force_growth
Definition: elements.h:632
int DayInYear(void)
Definition: calendar.h:58
class Calendar * g_date
Definition: calendar.cpp:38
virtual void ForceGrowthInitialize(void)
Definition: elements.cpp:1553
CropActualValues VegElement::Get_CropDataStorage ( int  index)
inline

Definition at line 592 of file elements.h.

Referenced by OptimisingFarm::ActualProfit(), and OptimisingFarm::HandleEvents().

592 {return m_CropDataStorage[index];};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
bool VegElement::Get_harvested ( int  index)
inline

Definition at line 574 of file elements.h.

574 {return m_CropDataStorage[index].harvested;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
bool VegElement::Get_taken ( int  index)
inline

Definition at line 567 of file elements.h.

Referenced by OptimisingFarm::ActualProfit(), and OptimisingFarm::HandleEvents().

567 {return m_CropDataStorage[index].taken;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
virtual double VegElement::GetDeadBiomass ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 500 of file elements.h.

500 { return m_dead_biomass; }
double m_dead_biomass
Definition: elements.h:617
virtual double VegElement::GetDigestability ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 494 of file elements.h.

494 { return m_digestability; }
double m_digestability
Definition: elements.h:624
virtual double VegElement::GetGreenBiomass ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 501 of file elements.h.

501 { return m_green_biomass; }
double m_green_biomass
Definition: elements.h:616
virtual double VegElement::GetInsectPop ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 507 of file elements.h.

507 { return m_insect_pop; }
double m_insect_pop
Definition: elements.h:612
virtual double VegElement::GetLAGreen ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 495 of file elements.h.

495 { return m_LAgreen; }
double m_LAgreen
Definition: elements.h:611
virtual double VegElement::GetLATotal ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 496 of file elements.h.

496 { return m_LAtotal; }
double m_LAtotal
Definition: elements.h:609
virtual bool VegElement::GetSkScrapes ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 504 of file elements.h.

504 { return m_skylarkscrapes; }
bool m_skylarkscrapes
For management testing of skylark scrapes.
Definition: elements.h:88
virtual double VegElement::GetVegBiomass ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 499 of file elements.h.

499 { return m_veg_biomass; }
double m_veg_biomass
Definition: elements.h:613
virtual double VegElement::GetVegCover ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 497 of file elements.h.

497 { return m_veg_cover; }
double m_veg_cover
Definition: elements.h:622
virtual int VegElement::GetVegDensity ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 503 of file elements.h.

503 { return m_veg_density; }
int m_veg_density
Definition: elements.h:620
virtual double VegElement::GetVegHeight ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 498 of file elements.h.

498 { return m_veg_height; }
double m_veg_height
Definition: elements.h:619
virtual bool VegElement::GetVegPatchy ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 505 of file elements.h.

505 { return m_veg_patchy; }
bool m_veg_patchy
Definition: elements.h:621
virtual int VegElement::GetVegPhase ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 602 of file elements.h.

602 { return m_veg_phase; }
int m_veg_phase
Definition: elements.h:607
virtual TTypesOfVegetation VegElement::GetVegType ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 509 of file elements.h.

Referenced by OptimisingFarm::Harvest().

509 { return m_vege_type; }
TTypesOfVegetation m_vege_type
Definition: elements.h:604
virtual double VegElement::GetWeedBiomass ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 502 of file elements.h.

502 { return m_weed_biomass; }
double m_weed_biomass
Definition: elements.h:618
void VegElement::GrazeVegetation ( double  a_grams,
bool  a_force 
)
virtual

/brief Reduce the total vegetation biomass as a result of grazing per m2

Used to calculate the change in vegetation height and biomass as a result of grazing. Input parameter is the change in wet biomass/m2. The problem is to convert this into changes in LAtotal, LAgreen and height. We have an area, biomass, total biomass, height and density. If biomass is missing we need to change height and biomass before continuing and and do something with LA_total and LA_Green. Some assumptions: 1 - The grazing takes all LA equally 2 - That biomass is evenly distributed 3 - That LA is proportional to biomass in some way, so LA is also evenly distributed 4 - That we can use the current grazing pressure to alter a_reduc

Reimplemented from LE.

Definition at line 1682 of file elements.cpp.

References LE::m_default_grazing_level, m_LAgreen, m_LAtotal, m_oldLAtotal, m_veg_biomass, m_veg_height, and m_weed_biomass.

Referenced by GrazeVegetationTotal().

1683 {
1695  if (!a_force) a_reduc *= m_default_grazing_level;
1696  if (a_reduc >= m_veg_biomass) return;
1697  double propreduc = 1.0 - (a_reduc / m_veg_biomass);
1698  m_veg_height *= propreduc;
1699  m_weed_biomass *= propreduc;
1700  m_veg_biomass -= a_reduc;
1701  // Need to do something with the LA too -
1702  m_LAgreen *= propreduc;
1703  m_LAtotal *= propreduc;
1704  m_oldLAtotal = m_LAtotal; // this stops double reduction of biomass later in RecalculateBugsNStuff();
1705 }
double m_oldLAtotal
Definition: elements.h:610
int m_default_grazing_level
Definition: elements.h:453
double m_LAtotal
Definition: elements.h:609
double m_weed_biomass
Definition: elements.h:618
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
double m_veg_biomass
Definition: elements.h:613
void VegElement::GrazeVegetationTotal ( double  a_grams)
virtual

/brief Reduce the total vegetation biomass as a result of grazing per polygon

Reimplemented from LE.

Definition at line 1677 of file elements.cpp.

References GrazeVegetation(), and LE::m_area.

1678 {
1679  GrazeVegetation( a_grams/m_area, true );
1680 }
virtual void GrazeVegetation(double a_grams, bool a_force)
Definition: elements.cpp:1682
double m_area
Definition: elements.h:428
virtual void VegElement::Insecticide ( double  a_fraction)
inlinevirtual

Reimplemented from LE.

Definition at line 510 of file elements.h.

511  {
512  m_insect_pop *= a_fraction;
514  }
double m_insect_pop
Definition: elements.h:612
int m_days_since_insecticide_spray
Definition: elements.h:449
void VegElement::InsectMortality ( double  a_fraction)
virtual

Reimplemented from LE.

Definition at line 1813 of file elements.cpp.

References m_insect_pop.

1813  {
1814  m_insect_pop *= a_fraction;
1815 }
double m_insect_pop
Definition: elements.h:612
bool VegElement::IsCereal ( void  )
virtual

Reimplemented from LE.

Definition at line 1175 of file elements.cpp.

References LE::m_lastsownvegtype, tov_AgroChemIndustryCereal, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OOats, tov_OSBarleySilage, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringWheat, tov_Triticale, tov_WinterBarley, tov_WinterRye, tov_WinterWheat, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, and tov_WWheatPTreatment.

Referenced by RecalculateBugsNStuff().

1176 {
1177  switch (m_lastsownvegtype)
1178  {
1179  case tov_SpringBarley:
1180  case tov_SpringBarleySpr:
1181  case tov_WinterBarley:
1182  case tov_SpringWheat:
1183  case tov_WinterWheat:
1184  case tov_WinterRye:
1185  case tov_Oats:
1186  case tov_Triticale:
1187  case tov_SpringBarleySeed:
1194  case tov_OWinterBarley:
1195  case tov_OWinterBarleyExt:
1196  case tov_OWinterRye:
1197  case tov_SpringBarleyGrass:
1201  case tov_OSpringBarley:
1202  case tov_OSpringBarleyPigs:
1204  case tov_OWinterWheat:
1205  case tov_OOats:
1206  case tov_OTriticale:
1207  case tov_WWheatPControl:
1209  case tov_WWheatPTreatment:
1213  case tov_OSpringBarleyExt:
1215  case tov_OSBarleySilage:
1217  return true;
1218  default: // No matching code so is should not be cereal
1219  return false;
1220  }
1221 }
TTypesOfVegetation m_lastsownvegtype
Records the last vegegetation type that was sown on the element.
Definition: elements.h:444
bool VegElement::IsGooseGrass ( )
inlinevirtual

Definition at line 1311 of file elements.cpp.

References LE::m_lastsownvegtype, m_vege_type, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FodderGrass, tov_NaturalGrass, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OSeedGrass1, tov_OSeedGrass2, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_SeedGrass1, and tov_SeedGrass2.

Referenced by RecalculateBugsNStuff().

1311  {
1312  switch (m_vege_type) {
1313  case tov_NaturalGrass:
1317  return true;
1318  default: break;
1319  }
1320  switch (m_lastsownvegtype) {
1321  case tov_SeedGrass1:
1322  case tov_SeedGrass2:
1323  case tov_OSeedGrass1:
1324  case tov_OSeedGrass2:
1329  case tov_FodderGrass:
1330  return true;
1331  default:
1332  return false;
1333  }
1334 
1335 }
TTypesOfVegetation m_lastsownvegtype
Records the last vegegetation type that was sown on the element.
Definition: elements.h:444
TTypesOfVegetation m_vege_type
Definition: elements.h:604
bool VegElement::IsGrass ( )
inlinevirtual

Reimplemented from LE.

Definition at line 1284 of file elements.cpp.

References m_vege_type, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FodderGrass, tov_Heath, tov_NaturalGrass, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OrchardCrop, tov_OSeedGrass1, tov_OSeedGrass2, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, and tov_YoungForest.

1285 {
1286  switch (m_vege_type)
1287  {
1288  case tov_NaturalGrass:
1292  case tov_PermanentSetaside:
1293  case tov_Setaside:
1294  case tov_SeedGrass1:
1295  case tov_SeedGrass2:
1296  case tov_OSeedGrass1:
1297  case tov_OSeedGrass2:
1302  case tov_OrchardCrop:
1303  case tov_YoungForest:
1304  case tov_FodderGrass:
1305  case tov_Heath:
1306  return true;
1307  default: return false;
1308  }
1309 }
TTypesOfVegetation m_vege_type
Definition: elements.h:604
bool VegElement::IsMaize ( void  )
virtual

Currently (18/03/2015) only used for goose foraging, so silage maize does not produce grain

Definition at line 1269 of file elements.cpp.

References m_vege_type, tov_Maize, tov_MaizeSilage, and tov_OMaizeSilage.

1270 {
1272  switch (m_vege_type)
1273  {
1274  case tov_Maize:
1275  case tov_OMaizeSilage:
1276  case tov_MaizeSilage:
1277  return true;
1278  default: // No matching code so is should not be maize
1279  return false;
1280  }
1281 }
TTypesOfVegetation m_vege_type
Definition: elements.h:604
bool VegElement::IsMatureCereal ( void  )
virtual

Reimplemented from LE.

Definition at line 1223 of file elements.cpp.

References m_vege_type, tov_AgroChemIndustryCereal, tov_Oats, tov_OOats, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringWheat, tov_Triticale, tov_WinterBarley, tov_WinterRye, tov_WinterWheat, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, and tov_WWheatPTreatment.

1224 {
1225  switch (m_vege_type)
1226  {
1227  case tov_SpringBarley:
1228  case tov_SpringBarleySpr:
1229  case tov_WinterBarley:
1230  case tov_SpringWheat:
1231  case tov_WinterWheat:
1232  case tov_WinterRye:
1233  case tov_Oats:
1234  case tov_Triticale:
1235  case tov_SpringBarleySeed:
1242  case tov_OWinterBarley:
1243  case tov_OWinterBarleyExt:
1244  case tov_OWinterRye:
1245  case tov_SpringBarleyGrass:
1248  case tov_OSpringBarley:
1249  case tov_OSpringBarleyPigs:
1251  case tov_OWinterWheat:
1252  case tov_OOats:
1253  case tov_OTriticale:
1254  case tov_WWheatPControl:
1256  case tov_WWheatPTreatment:
1260  case tov_OSpringBarleyExt:
1263  return true;
1264  default: // No matching code so is should not be mature cereal
1265  return false;
1266  }
1267 }
TTypesOfVegetation m_vege_type
Definition: elements.h:604
void VegElement::RandomVegStartValues ( double *  a_LAtotal,
double *  a_LAgreen,
double *  a_veg_height,
double *  a_weed_biomass 
)
protected

Definition at line 1463 of file elements.cpp.

References EL_VEG_HEIGHTSCALE, and EL_VEG_START_LAIT.

Referenced by ForceGrowthInitialize().

1463  {
1464  * a_LAtotal = EL_VEG_START_LAIT * ( ( ( ( double )( random( 21 ) - 10 ) ) / 100.0 ) + 1.0 ); // +/- 10%
1465  * a_LAgreen = * a_LAtotal / 4.0;
1466  * a_veg_height = * a_LAgreen * EL_VEG_HEIGHTSCALE;
1467  * a_weed_biomass = * a_LAgreen * 0.1; // 10% weeds by biomass
1468 }
#define EL_VEG_HEIGHTSCALE
Definition: elements.cpp:179
#define EL_VEG_START_LAIT
Definition: elements.cpp:175
void VegElement::ReadBugPercentageFile ( void  )
protected

Definition at line 1147 of file elements.cpp.

References FloatToDouble(), g_bug_percent_a, g_bug_percent_b, g_bug_percent_c, g_bug_percent_d, g_msg, g_weed_percent, l_el_bug_percentage_file(), m_ifile, tov_Undefined, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.

1147  {
1148  m_ifile=fopen(l_el_bug_percentage_file.value(), "r" );
1149  if ( !m_ifile ) {
1150  g_msg->Warn( WARN_FILE, "CropData::ReadBugPercentageFile(): Unable to open file", l_el_bug_percentage_file.value() );
1151  exit( 1 );
1152  }
1153  for ( int i = 0; i < tov_Undefined; i++ ) {
1154  int vegnum;
1155  // **cjt** modified 31/01/2004
1156  float weedpercent, bugpercent_a, bugpercent_b, bugpercent_c, bugpercent_d;
1157  if ( 2 != fscanf( m_ifile, "%d %f %f %f %f %f", & vegnum, & weedpercent, & bugpercent_a, & bugpercent_b,
1158  & bugpercent_c, & bugpercent_d ) ) {
1159  char vegnums[ 20 ];
1160  sprintf( vegnums, "%d", tov_Undefined );
1161  g_msg->Warn( WARN_FILE,
1162  "VegElement::ReadBugPercentageFile(): Unable to read"
1163  " sufficient number of int/double pairs from bug percentage file."" Lines expected:", vegnums );
1164  exit( 1 );
1165  }
1166  FloatToDouble( g_weed_percent[ vegnum ], weedpercent);
1167  FloatToDouble( g_bug_percent_a[ vegnum ] , bugpercent_a);
1168  FloatToDouble( g_bug_percent_b[ vegnum ] , bugpercent_b);
1169  FloatToDouble( g_bug_percent_c[ vegnum ] , bugpercent_c);
1170  FloatToDouble( g_bug_percent_d[ vegnum ] , bugpercent_d);
1171  }
1172  fclose( m_ifile );
1173 }
static double g_bug_percent_c[tov_Undefined]
Definition: elements.cpp:122
void FloatToDouble(double &, float)
FILE * m_ifile
Definition: elements.h:633
static double g_bug_percent_b[tov_Undefined]
Definition: elements.cpp:121
static double g_bug_percent_a[tov_Undefined]
Definition: elements.cpp:120
static double g_bug_percent_d[tov_Undefined]
Definition: elements.cpp:123
static CfgStr l_el_bug_percentage_file("ELEM_BUG_PERCENTAGE_FILE", CFG_CUSTOM,"bugpercents.txt")
const char * value(void)
Definition: configurator.h:139
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:38
static double g_weed_percent[tov_Undefined]
Definition: elements.cpp:119
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:56
void VegElement::RecalculateBugsNStuff ( void  )
protectedvirtual

Here we also want to know how much biomass we have on the field in total. So we multiply the current biomass by area

Todo:
This could probably be optimised for speed
Todo:
This could probably be optimised for speed

The 1.0325 is a quick fix to account for higher energy intake on winter cereal - Based on Therkildsen & Madsen 2000 Energetics of feeding...

or potentially it is a grazable grass

Reimplemented from LE.

Definition at line 1339 of file elements.cpp.

References c_SolarConversion, g_biomass_scale, g_bug_percent_a, g_bug_percent_b, g_bug_percent_c, g_landscape_p, IsCereal(), IsGooseGrass(), LE::m_area, LE::m_birdmaizeforage, LE::m_birdseedforage, LE::m_days_since_insecticide_spray, m_dead_biomass, m_digestability, LE::m_goosegrazingforage, m_green_biomass, m_insect_pop, m_LAgreen, m_LAtotal, m_newgrowthsum, m_newoldgrowthindex, m_oldLAtotal, m_oldnewgrowth, LE::m_owner_index, LE::m_poly, m_total_biomass, m_total_biomass_old, m_veg_biomass, m_veg_cover, m_veg_density, m_veg_height, m_vege_type, m_weed_biomass, Landscape::SupplyFarmIntensity(), Landscape::SupplyGlobalRadiation(), Landscape::SupplyGooseGrazingForageH(), Landscape::SupplyTemp(), tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_NoGrowth, tov_None, tov_OFirstYearDanger, tov_OMaizeSilage, tov_OPotatoes, tov_Potatoes, tov_PotatoesIndustry, and CfgFloat::value().

Referenced by RoadsideVerge::Cutting(), DoDevelopment(), and ZeroVeg().

1339  {
1340 
1341  double newgrowth=0;
1342  m_veg_cover = 1.0 - ( exp( m_LAtotal * -0.6 ) ); // Beer's Law to give cover
1343  double usefull_veg_cover = 1.0 - ( exp( m_LAgreen * -0.4 ) ); // This is used to calc growth rate
1344  // Need gloabal radiation today
1345  double glrad = g_landscape_p->SupplyGlobalRadiation();
1346  // This is different for maize (a C4 plant)
1347  int ptype;
1348  if (( m_vege_type == tov_Maize ) || ( m_vege_type == tov_OMaizeSilage ) || (m_vege_type == tov_MaizeSilage) || (m_vege_type == tov_MaizeStrigling)) ptype = 1; else ptype = 0;
1349  int index = ( int )floor( 0.5 + g_landscape_p->SupplyTemp() ) + 30; // There are 30 negative temps
1350  double radconv = c_SolarConversion[ ptype ] [ index ];
1351  if ( m_LAtotal >= m_oldLAtotal ) {
1352  // we are in positive growth so grow depending on our equation
1353  newgrowth = usefull_veg_cover * glrad * radconv * g_biomass_scale[ m_vege_type ];
1354  if (m_owner_index != -1) { // This only works because only crops and similar structures have owners
1355  int fintensity = g_landscape_p->SupplyFarmIntensity(m_poly);
1356  if (fintensity==1) {
1357  // 1 means extensive, so reduce vegetation biomass by 20%
1358  // NB this cannot be used with extensive crop types otherwise you get an additional 20% reduction
1359  // This way of doing things provides a quick and dirty general effect.
1360  m_veg_biomass += newgrowth * 0.8;
1361  } else m_veg_biomass += newgrowth;
1362  } else m_veg_biomass += newgrowth;
1363  } else {
1364  // Negative growth - so shrink proportional to the loss in LAI Total
1365  if ( m_oldLAtotal > 0 ) {
1367  }
1368  }
1372  // For geese that eat spilled grain and maize we need to remove some of this daily (loss to other things than geese)
1374  if (m_birdseedforage <0.01) m_birdseedforage = 0.0;
1376  if (m_birdmaizeforage <0.01) m_birdmaizeforage = 0.0;
1377  // Another thing to do is to calculate mean vegetation digestability
1378  // This is a 32-day running average of the amount of new growth per day divided by veg biomass
1379  // With a minimum value of 0.5
1380  ++m_newoldgrowthindex &= 31;
1381  if (m_veg_biomass>0 ) {
1382  switch (m_vege_type) {
1383  case tov_NoGrowth:
1384  case tov_None:
1385  case tov_OFirstYearDanger:
1386  m_digestability=0.0;
1387  break;
1388  case tov_OPotatoes:
1389  case tov_Maize:
1390  case tov_MaizeSilage:
1391  case tov_OMaizeSilage:
1392  case tov_MaizeStrigling:
1393  case tov_Potatoes:
1394  case tov_PotatoesIndustry:
1395  m_digestability=0.5;
1396  break;
1397  default:
1398  //m_oldnewgrowth[m_newoldgrowthindex]=(newgrowth/m_veg_biomass);
1399  m_oldnewgrowth[m_newoldgrowthindex]=(newgrowth);
1400  m_newgrowthsum=0.0;
1401  for (int i=0; i<32; i++) {
1403  }
1405  m_digestability+=0.5;
1406  if (m_digestability>0.8) m_digestability=0.8;
1407  }
1408  }
1409  else {
1411  m_digestability = 0.0;
1412  }
1413  // We also need to calculate non-grain forage for geese
1414  if (IsCereal()) {
1415  if (m_green_biomass > 0.5) //Testing if this could be a suitable fix for the cereals
1416  {
1417  for (unsigned i = 0; i < gs_foobar; i++) {
1418  //m_goosegrazingforage[ i ] = 0.0;
1420  m_goosegrazingforage[ i ] = g_landscape_p->SupplyGooseGrazingForageH( m_veg_height, (GooseSpecies)i ) * 1.0325;
1421  }
1422  }
1423  else for (unsigned i = 0; i < gs_foobar; i++) {
1424  m_goosegrazingforage[i] = 0.0;
1425  }
1426  }
1428  else if (IsGooseGrass()) {
1429  for (unsigned i = 0; i < gs_foobar; i++) {
1430  //m_goosegrazingforage[ i ] = 0.0;
1432  }
1433  }
1434  else for (unsigned i = 0; i < gs_foobar; i++) m_goosegrazingforage[ i ] = 0.0;
1435 
1436  // NB The m_weed_biomass is calculated directly from the curve in Curves.pre
1437  // rather than going through the rigmorole of converting leaf-area index
1438  // The insect calculation part
1439  // Bugmass = a + b(biomass) + c(height)
1440  double temp_bugmass = //g_bug_percent_d[ m_vege_type ] // This was used as a scaler - now not used
1443  // Set a minimum value (regressions will otherwise sometimes give a -ve value
1444  if ( temp_bugmass < 0.05 ) temp_bugmass = 0.05;
1445  // Now need to check for deviations caused by management
1446  // First spot the deviation - this is easy because the only deviation that does
1447  // not affect the vegetation too is insecticide spraying
1448  if ( m_days_since_insecticide_spray > 0 ) {
1449  // Need to change insects still, so grow towards the target, but only when 21 days from zero effect
1452  }
1453  else {
1454  m_insect_pop = temp_bugmass;
1455  }
1456  m_veg_density = (int) (floor( 0.5 + ( m_veg_biomass / ( 1 + m_veg_height ) ) ));
1457  if ( m_veg_density > 100 ) m_veg_density = 100; // to stop array bounds problems
1458  if (m_LAtotal == 0.0) m_green_biomass = 0.0;
1461  }
int m_veg_density
Definition: elements.h:620
static double g_bug_percent_c[tov_Undefined]
Definition: elements.cpp:122
double m_birdmaizeforage
The maize forage present in KJ/m2.
Definition: elements.h:440
double m_oldLAtotal
Definition: elements.h:610
int m_newoldgrowthindex
Definition: elements.h:626
static double g_bug_percent_b[tov_Undefined]
Definition: elements.cpp:121
double m_newgrowthsum
Definition: elements.h:627
static double g_bug_percent_a[tov_Undefined]
Definition: elements.cpp:120
double m_LAtotal
Definition: elements.h:609
virtual bool IsCereal()
Definition: elements.cpp:1175
double value(void)
Definition: configurator.h:107
double m_digestability
Definition: elements.h:624
double m_total_biomass
Definition: elements.h:614
double SupplyGooseGrazingForageH(double a_height, GooseSpecies a_goose)
Returns the leaf forage resource as seen from a goose standpoint at a polygon based on the height onl...
Definition: landscape.h:505
double m_veg_cover
Definition: elements.h:622
static double g_biomass_scale[tov_Undefined]
Definition: elements.cpp:118
TTypesOfVegetation m_vege_type
Definition: elements.h:604
double m_insect_pop
Definition: elements.h:612
double m_dead_biomass
Definition: elements.h:617
double m_goosegrazingforage[gs_foobar]
The grazing forage present in KJ/min.
Definition: elements.h:442
double SupplyGlobalRadiation()
Definition: landscape.h:1267
double m_weed_biomass
Definition: elements.h:618
double m_total_biomass_old
Definition: elements.h:615
double m_green_biomass
Definition: elements.h:616
double m_oldnewgrowth[32]
Definition: elements.h:625
double m_birdseedforage
The grain forage present in KJ/m2.
Definition: elements.h:438
double m_LAgreen
Definition: elements.h:611
CfgFloat cfg_goose_GrainDecayRate
int m_owner_index
Definition: elements.h:412
double m_veg_height
Definition: elements.h:619
int m_poly
The polyref number for this polygon.
Definition: elements.h:417
double m_veg_biomass
Definition: elements.h:613
const double c_SolarConversion[2][81]
Definition: elements.cpp:93
int SupplyFarmIntensity(int a_x, int a_y)
Definition: Landscape.cpp:619
int m_days_since_insecticide_spray
Definition: elements.h:449
double m_area
Definition: elements.h:428
virtual bool IsGooseGrass()
Definition: elements.cpp:1311
class Landscape * g_landscape_p
Definition: Landscape.cpp:238
double SupplyTemp(void)
Definition: landscape.h:1312
void VegElement::ReduceVeg ( double  a_reduc)
virtual

Reimplemented from LE.

Definition at line 1707 of file elements.cpp.

References ForceGrowthTest(), m_LAgreen, m_LAtotal, m_oldLAtotal, m_veg_biomass, m_veg_height, and m_weed_biomass.

Referenced by OrchardBand::DoDevelopment().

1707  {
1708  m_LAgreen *= a_reduc;
1709  m_LAtotal *= a_reduc;
1710  m_veg_height *= a_reduc;
1711  m_veg_biomass *= a_reduc;
1712  m_weed_biomass *= a_reduc;
1713 
1714  ForceGrowthTest();
1715  m_oldLAtotal = m_LAtotal; // this stops double reduction of biomass later in RecalculateBugsNStuff();
1716 }
double m_oldLAtotal
Definition: elements.h:610
double m_LAtotal
Definition: elements.h:609
double m_weed_biomass
Definition: elements.h:618
virtual void ForceGrowthTest(void)
Definition: elements.cpp:1523
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
double m_veg_biomass
Definition: elements.h:613
void VegElement::ReduceVeg_Extended ( double  a_reduc)
virtual

Reimplemented from LE.

Definition at line 1718 of file elements.cpp.

References Calendar::DayInYear(), EL_GROWTH_DATE_MAGIC, EL_GROWTH_DAYDEG_MAGIC, EL_GROWTH_PHASE_SHIFT_LEVEL, ForceGrowthTest(), g_date, harvest1, LE::m_ddegs, m_forced_phase_shift, m_LAgreen, m_LAtotal, m_oldLAtotal, m_veg_biomass, m_veg_height, m_weed_biomass, LE::m_yddegs, and SetGrowthPhase().

1718  {
1719  m_LAgreen *= a_reduc;
1720  m_LAtotal *= a_reduc;
1721  m_veg_height *= a_reduc;
1722  m_veg_biomass *= a_reduc;
1723  m_weed_biomass *= a_reduc;
1724 
1725  if ( a_reduc < EL_GROWTH_PHASE_SHIFT_LEVEL ) {
1726  m_yddegs = 0.0;
1728  }
1729 
1732  m_forced_phase_shift = true;
1733  }
1734 
1735  ForceGrowthTest();
1736  m_oldLAtotal = m_LAtotal; // this stops double reduction of biomass later in RecalculateBugsNStuff();
1737 }
double m_oldLAtotal
Definition: elements.h:610
double m_LAtotal
Definition: elements.h:609
virtual void SetGrowthPhase(int a_phase)
Definition: elements.cpp:1471
bool m_forced_phase_shift
Definition: elements.h:623
int DayInYear(void)
Definition: calendar.h:58
#define EL_GROWTH_PHASE_SHIFT_LEVEL
Definition: elements.cpp:158
double m_weed_biomass
Definition: elements.h:618
double m_ddegs
Definition: elements.h:457
#define EL_GROWTH_DAYDEG_MAGIC
Definition: elements.cpp:146
class Calendar * g_date
Definition: calendar.cpp:38
virtual void ForceGrowthTest(void)
Definition: elements.cpp:1523
double m_LAgreen
Definition: elements.h:611
#define EL_GROWTH_DATE_MAGIC
Definition: elements.cpp:152
double m_yddegs
Definition: elements.h:456
double m_veg_height
Definition: elements.h:619
double m_veg_biomass
Definition: elements.h:613
virtual void VegElement::ReduceWeedBiomass ( double  a_fraction)
inlinevirtual

Reimplemented from LE.

Definition at line 521 of file elements.h.

522  {
523  m_weed_biomass *= a_fraction;
524  }
double m_weed_biomass
Definition: elements.h:618
virtual void VegElement::ResetDigestability ( )
inlinevirtual

sets growth record to zero

Reimplemented from LE.

Definition at line 597 of file elements.h.

598  {
599  for (int i = 0; i<32; i++) m_oldnewgrowth[i] = 0.0;
600  }
double m_oldnewgrowth[32]
Definition: elements.h:625
void VegElement::ResetGeese ( void  )

Reset geese numbers to zero in case this was not done by the population manager (the normal situation).

Definition at line 1669 of file elements.cpp.

References Calendar::DayInYear(), g_date, LE::m_gooseNos, LE::m_gooseSpNos, and LE::m_gooseSpNosTimed.

Referenced by DoDevelopment().

1669  {
1670  m_gooseNos[ g_date->DayInYear() ] = 0;
1671  for (unsigned i = 0; i < gs_foobar; i++) {
1672  m_gooseSpNos[ g_date->DayInYear() ][ (GooseSpecies)i ] = 0;
1673  m_gooseSpNosTimed[ g_date->DayInYear() ][ (GooseSpecies)i ] = 0;
1674  }
1675 }
int m_gooseNos[366]
The number of geese each day.
Definition: elements.h:430
int DayInYear(void)
Definition: calendar.h:58
class Calendar * g_date
Definition: calendar.cpp:38
int m_gooseSpNos[366][gs_foobar]
The number of geese of each species each day.
Definition: elements.h:432
int m_gooseSpNosTimed[366][gs_foobar]
The number of geese of each species at a predefined time per day.
Definition: elements.h:436
void VegElement::Set_area_in_crop_data ( double  a_area)
inline

Definition at line 570 of file elements.h.

Referenced by OptimisingFarm::HandleEvents().

570 {m_CropDataStorage[0].area = a_area;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Set_biomass_at_harvest ( double  a_biomass,
int  index 
)
inline

Definition at line 571 of file elements.h.

Referenced by OptimisingFarm::Harvest().

571 {m_CropDataStorage[index].biomass_at_harvest = a_biomass;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
double biomass_at_harvest
Definition: elements.h:477
void VegElement::Set_CropDataStorage ( int  index,
CropActualValues  a_struct 
)
inline

Definition at line 591 of file elements.h.

Referenced by OptimisingFarm::HandleEvents().

591 {m_CropDataStorage[index] = a_struct;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Set_harvested ( )
inline

Definition at line 573 of file elements.h.

Referenced by OptimisingFarm::Harvest().

573 {m_CropDataStorage[0].harvested = true;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Set_taken ( bool  a_taken,
int  index 
)
inline

Definition at line 566 of file elements.h.

Referenced by OptimisingFarm::HandleEvents().

566 {m_CropDataStorage[index].taken = a_taken;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
void VegElement::Set_tov_type ( TTypesOfVegetation  a_tov_type,
int  index 
)
inline

Definition at line 568 of file elements.h.

Referenced by OptimisingFarm::HandleEvents().

568 {m_CropDataStorage[index].tov_type = a_tov_type;};
CropActualValues m_CropDataStorage[2]
Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be store...
Definition: elements.h:642
TTypesOfVegetation tov_type
Definition: elements.h:476
void VegElement::SetCropData ( double  a_veg_height,
double  a_LAtotal,
double  a_LAgreen,
TTypesOfVegetation  a_veg,
double  a_cover,
int  a_grazed 
)
virtual

Reimplemented from LE.

Definition at line 1788 of file elements.cpp.

References LE::m_cattle_grazing, m_LAgreen, m_LAtotal, m_veg_cover, m_veg_height, and m_vege_type.

1789  {
1790  m_veg_height = a_veg_height;
1791  m_LAtotal = a_LAtotal;
1792  m_LAgreen = a_LAgreen;
1793  m_vege_type = a_veg;
1794  m_veg_cover = a_cover;
1795  m_cattle_grazing = a_grazed;
1796 }
double m_LAtotal
Definition: elements.h:609
double m_veg_cover
Definition: elements.h:622
TTypesOfVegetation m_vege_type
Definition: elements.h:604
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
int m_cattle_grazing
Definition: elements.h:452
void VegElement::SetCropDataAll ( double  a_veg_height,
double  a_biomass,
double  a_LAtotal,
double  a_LAgreen,
TTypesOfVegetation  a_veg,
double  a_wb,
double  a_cover,
int  a_grazed,
double  a_ins,
bool  a_patchy,
double  a_dens 
)
virtual

Reimplemented from LE.

Definition at line 1798 of file elements.cpp.

References LE::m_cattle_grazing, m_insect_pop, m_LAgreen, m_LAtotal, m_veg_biomass, m_veg_cover, m_veg_density, m_veg_height, m_veg_patchy, m_vege_type, and m_weed_biomass.

1799  {
1800  m_veg_height = a_veg_height;
1801  m_veg_biomass = a_biomass;
1802  m_LAtotal = a_LAtotal;
1803  m_LAgreen = a_LAgreen;
1804  m_vege_type = a_veg;
1805  m_weed_biomass = a_wb;
1806  m_veg_cover = a_cover;
1807  m_cattle_grazing = a_grazed;
1808  m_insect_pop = a_ins;
1809  m_veg_density = (int) a_dens;
1810  m_veg_patchy = a_patchy;
1811 }
int m_veg_density
Definition: elements.h:620
double m_LAtotal
Definition: elements.h:609
double m_veg_cover
Definition: elements.h:622
TTypesOfVegetation m_vege_type
Definition: elements.h:604
double m_insect_pop
Definition: elements.h:612
double m_weed_biomass
Definition: elements.h:618
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
double m_veg_biomass
Definition: elements.h:613
int m_cattle_grazing
Definition: elements.h:452
bool m_veg_patchy
Definition: elements.h:621
void VegElement::SetGrowthPhase ( int  a_phase)
virtual

If it is the first growth phase of the year then we might cause some unnecessary hops if e.g. our biomass is 0 and we suddenly jump up to 20 cm To stop this happening we check here and if our settings are lower than the targets we do nothing.

Reimplemented from LE.

Definition at line 1471 of file elements.cpp.

References Calendar::Date(), ForceGrowthSpringTest(), g_crops, g_date, g_weather, Weather::GetDDDegs(), CropData::GetStartValue(), harvest, janfirst, m_curve_num, LE::m_ddegs, m_force_growth, m_forced_phase_shift, m_LAgreen, m_LAtotal, m_veg_height, m_veg_phase, LE::m_vegddegs, LE::m_yddegs, sow, and CropData::StartValid().

Referenced by Orchard::Cutting(), MownGrass::Cutting(), ReduceVeg_Extended(), and VegElement().

1471  {
1472 
1473  if (a_phase == sow) {
1474  m_vegddegs = 0.0;
1475  }
1476  else if (a_phase == harvest) m_vegddegs = -1;
1477  if (a_phase == janfirst) {
1478  m_forced_phase_shift = false;
1483  if (g_crops->StartValid(m_curve_num, a_phase)) {
1484  double temp_veg_height = g_crops->GetStartValue(m_curve_num, a_phase, 2);
1485  if (temp_veg_height < m_veg_height) { // Otherwise we are better off with the numbers we have to start with
1486  m_LAgreen = g_crops->GetStartValue(m_curve_num, a_phase, 0);
1487  m_LAtotal = g_crops->GetStartValue(m_curve_num, a_phase, 1);
1489  }
1490  }
1491 
1492  }
1493  else if (g_crops->StartValid(m_curve_num, a_phase)) {
1494  m_LAgreen = g_crops->GetStartValue(m_curve_num, a_phase, 0);
1495  m_LAtotal = g_crops->GetStartValue(m_curve_num, a_phase, 1);
1497  }
1498  else if (!m_force_growth) {
1499  // If we are in forced growth mode (which is very likely),
1500  // then do not choose a new set of starting values, as we have
1501  // already calculated our way to a reasonable set of values.
1502  //RandomVegStartValues( & m_LAtotal, & m_LAgreen, & m_veg_height, & m_weed_biomass ); // **CJT** Testing removal 17/02/2015
1503  }
1504  m_veg_phase = a_phase;
1505  m_yddegs = 0.0;
1507  m_force_growth = false;
1508 
1509  if (m_veg_phase == janfirst) {
1510  // For some growth curves there is no growth in the first
1511  // two months of the year. This will more likely than
1512  // not cause a discontinuous jump in the growth curves
1513  // come March first. ForceGrowthSpringTest() tries
1514  // to avoid that by checking for positive growth values
1515  // for the January growth phase. If none are found, then
1516  // it initializes a forced growth/transition to the March
1517  // 1st starting values.
1518  ForceGrowthSpringTest(); // Removal of this causes continuous increase in vegetation growth year on year for any curve that does not have a hard reset (e.g. harvest).
1519  }
1520 }
double m_vegddegs
Definition: elements.h:455
long Date(void)
Definition: calendar.h:57
class CropData * g_crops
Definition: plants.cpp:39
bool m_force_growth
Definition: elements.h:632
double m_LAtotal
Definition: elements.h:609
class Weather * g_weather
Definition: weather.cpp:41
double GetDDDegs(long a_date)
Definition: weather.cpp:155
bool m_forced_phase_shift
Definition: elements.h:623
bool StartValid(int a_veg_type, int a_phase)
Definition: plants.cpp:364
double m_ddegs
Definition: elements.h:457
Definition: plants.h:51
class Calendar * g_date
Definition: calendar.cpp:38
double GetStartValue(int a_veg_type, int a_phase, int a_type)
Definition: plants.h:105
double m_LAgreen
Definition: elements.h:611
int m_veg_phase
Definition: elements.h:607
double m_yddegs
Definition: elements.h:456
double m_veg_height
Definition: elements.h:619
void ForceGrowthSpringTest(void)
Definition: elements.cpp:1534
int m_curve_num
Definition: elements.h:605
virtual void VegElement::SetInsectPop ( double  insects)
inlinevirtual

Reimplemented from LE.

Definition at line 508 of file elements.h.

508 { m_insect_pop=insects; }
double m_insect_pop
Definition: elements.h:612
virtual void VegElement::SetVegHeight ( double  a_veg_height)
inlinevirtual

Reimplemented from LE.

Definition at line 546 of file elements.h.

546 { m_veg_height = a_veg_height; }
double m_veg_height
Definition: elements.h:619
virtual void VegElement::SetVegParameters ( double  a_veg_height,
double  a_LAtotal,
double  a_LAgreen,
double  a_WeedBiomass 
)
inlinevirtual

Reimplemented from LE.

Definition at line 547 of file elements.h.

548  {
549  m_veg_height = a_veg_height;
550  m_LAtotal = a_LAtotal;
551  m_LAgreen = a_LAgreen;
552  m_weed_biomass = a_WeedBiomass;
553  //RecalculateBugsNStuff();
554  }
double m_LAtotal
Definition: elements.h:609
double m_weed_biomass
Definition: elements.h:618
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
virtual void VegElement::SetVegPatchy ( bool  p)
inlinevirtual

Reimplemented from LE.

Definition at line 506 of file elements.h.

Referenced by VegElement().

506 { m_veg_patchy=p; }
bool m_veg_patchy
Definition: elements.h:621
virtual void VegElement::SetVegType ( TTypesOfVegetation  a_vege_type,
TTypesOfVegetation  a_weed_type 
)
inlinevirtual

Reimplemented from LE.

Definition at line 536 of file elements.h.

References g_crops, tov_Undefined, and CropData::VegTypeToCurveNum().

537  {
538  m_vege_type = a_vege_type;
539  m_curve_num = g_crops->VegTypeToCurveNum( a_vege_type );
540  // -1 is used as a signal not to change the weed type
541  // this is because it may be specific to that field
542  if (a_weed_type!=tov_Undefined) m_weed_curve_num = a_weed_type;
543  }
int VegTypeToCurveNum(TTypesOfVegetation VegReference)
Definition: plants.cpp:231
class CropData * g_crops
Definition: plants.cpp:39
TTypesOfVegetation m_vege_type
Definition: elements.h:604
int m_weed_curve_num
Definition: elements.h:606
int m_curve_num
Definition: elements.h:605
virtual void VegElement::StoreLAItotal ( )
inlinevirtual

Reimplemented from LE.

Definition at line 556 of file elements.h.

556 { m_oldLAtotal = m_LAtotal; }
double m_oldLAtotal
Definition: elements.h:610
double m_LAtotal
Definition: elements.h:609
virtual void VegElement::ToggleCattleGrazing ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 525 of file elements.h.

int m_default_grazing_level
Definition: elements.h:453
int m_cattle_grazing
Definition: elements.h:452
virtual void VegElement::TogglePigGrazing ( void  )
inlinevirtual

Reimplemented from LE.

Definition at line 526 of file elements.h.

bool m_pig_grazing
Definition: elements.h:454
void VegElement::ZeroVeg ( void  )
virtual

Reimplemented from LE.

Definition at line 1606 of file elements.cpp.

References ForceGrowthTest(), LE::m_birdmaizeforage, LE::m_birdseedforage, m_LAgreen, m_LAtotal, m_veg_biomass, m_veg_cover, m_veg_height, m_weed_biomass, and RecalculateBugsNStuff().

1606  {
1607  m_LAgreen = 0.0;
1608  m_LAtotal = 0.0;
1609  m_veg_height = 0.0;
1610  m_veg_cover = 0.0;
1611  m_veg_biomass = 0.0;
1612  m_weed_biomass = 0.0;
1613  m_birdseedforage = 0.0;
1614  m_birdmaizeforage = 0.0;
1615 
1616  ForceGrowthTest();
1618 }
double m_birdmaizeforage
The maize forage present in KJ/m2.
Definition: elements.h:440
double m_LAtotal
Definition: elements.h:609
double m_veg_cover
Definition: elements.h:622
double m_weed_biomass
Definition: elements.h:618
virtual void ForceGrowthTest(void)
Definition: elements.cpp:1523
double m_birdseedforage
The grain forage present in KJ/m2.
Definition: elements.h:438
double m_LAgreen
Definition: elements.h:611
double m_veg_height
Definition: elements.h:619
double m_veg_biomass
Definition: elements.h:613
virtual void RecalculateBugsNStuff(void)
Definition: elements.cpp:1339

Member Data Documentation

int VegElement::m_crop_index
protected

Definition at line 643 of file elements.h.

Referenced by VegElement().

CropActualValues VegElement::m_CropDataStorage[2]
protected

Keeps data on pesticide applications, biomass at harvest etc. Data for maximum two crops can be stored (hence size - 2). Used by a farmer to make a yearly accounting (OptimisingFarm::ActualProfit()).

Definition at line 642 of file elements.h.

Referenced by Clean_CropDataStorage().

int VegElement::m_curve_num
protected
double VegElement::m_dead_biomass
protected

Definition at line 617 of file elements.h.

Referenced by RecalculateBugsNStuff().

double VegElement::m_digestability
protected
bool VegElement::m_force_growth
protected
double VegElement::m_force_LAgreen
protected

Definition at line 629 of file elements.h.

Referenced by ForceGrowthDevelopment(), and ForceGrowthInitialize().

double VegElement::m_force_LAtotal
protected

Definition at line 630 of file elements.h.

Referenced by ForceGrowthDevelopment(), and ForceGrowthInitialize().

double VegElement::m_force_veg_height
protected

Definition at line 631 of file elements.h.

Referenced by ForceGrowthDevelopment(), and ForceGrowthInitialize().

double VegElement::m_force_Weed
protected

Definition at line 628 of file elements.h.

Referenced by ForceGrowthInitialize().

bool VegElement::m_forced_phase_shift
protected

Definition at line 623 of file elements.h.

Referenced by ReduceVeg_Extended(), SetGrowthPhase(), and VegElement().

double VegElement::m_green_biomass
protected

Definition at line 616 of file elements.h.

Referenced by RecalculateBugsNStuff().

FILE* VegElement::m_ifile
protected

Definition at line 633 of file elements.h.

Referenced by ReadBugPercentageFile().

double VegElement::m_insect_pop
protected
double VegElement::m_LAgreen
protected
double VegElement::m_LAtotal
protected
double VegElement::m_newgrowthsum
protected

Definition at line 627 of file elements.h.

Referenced by RecalculateBugsNStuff(), and VegElement().

int VegElement::m_newoldgrowthindex
protected

Definition at line 626 of file elements.h.

Referenced by RecalculateBugsNStuff(), and VegElement().

int VegElement::m_nutrient_status
protected

Definition at line 608 of file elements.h.

Referenced by VegElement().

double VegElement::m_oldLAtotal
protected

Definition at line 610 of file elements.h.

Referenced by GrazeVegetation(), RecalculateBugsNStuff(), ReduceVeg(), and ReduceVeg_Extended().

double VegElement::m_oldnewgrowth[32]
protected

Definition at line 625 of file elements.h.

Referenced by RecalculateBugsNStuff(), and VegElement().

double VegElement::m_total_biomass
protected

Definition at line 614 of file elements.h.

Referenced by RecalculateBugsNStuff(), and VegElement().

double VegElement::m_total_biomass_old
protected

Definition at line 615 of file elements.h.

Referenced by RecalculateBugsNStuff(), and VegElement().

double VegElement::m_veg_biomass
protected
double VegElement::m_veg_cover
protected
int VegElement::m_veg_density
protected
double VegElement::m_veg_height
protected
bool VegElement::m_veg_patchy
protected
int VegElement::m_veg_phase
protected

Definition at line 607 of file elements.h.

Referenced by DoDevelopment(), UnsprayedFieldMargin::DoDevelopment(), and SetGrowthPhase().

TTypesOfVegetation VegElement::m_vege_type
protected
double VegElement::m_weed_biomass
protected
int VegElement::m_weed_curve_num
protected

The documentation for this class was generated from the following files: