ALMaSS Rodenticide Model ODdox  1.0
Pond Class Reference

Ponds are defined as freshwater bodies between 25m2 and 5000m2. For newts the effective size is limited to 400m2. More...

#include <elements.h>

Public Member Functions

void CalcLarvalFood ()
 Calculates the amount of larval food present. More...
 
void CalcPondPesticide ()
 Calculates the amount of pesticide per unit pond water. More...
 
virtual void DoDevelopment (void)
 
bool IsMaleNewtPresent ()
 Gets whether there is a male newt as present. More...
 
 Pond (void)
 
virtual void SetMaleNewtPresent (bool a_ispresent)
 Sets a male as present/absent. More...
 
bool SubtractLarvalFood (double a_food)
 Called by a larva when feeding, removes an age specific amount of larval food. More...
 
double SupplyPondPesticide ()
 supply the current pesticide concentration per litre More...
 
- Public Member Functions inherited from Freshwater
 Freshwater (void)
 
- Public Member Functions inherited from NonVegElement
 NonVegElement (void)
 
- Public Member Functions inherited from LE
void AddArea (double a_area_diff)
 
void BumpRunNum (void)
 
void DoCopy (const LE *a_Le)
 a copy function to be used because a copy constuctor won't work More...
 
virtual void ForceGrowthDevelopment (void)
 
virtual void ForceGrowthInitialize (void)
 
virtual void ForceGrowthTest (void)
 
int GetALMaSSEleType (void)
 
double GetArea (void)
 
double GetBirdMaize (void)
 
double GetBirdSeed (void)
 
LEGetBorder (void)
 
int GetCattleGrazing (void)
 
virtual APoint GetCentroid ()
 
virtual int GetCentroidX ()
 
virtual int GetCentroidY ()
 
int GetCountryDesignation (void)
 
virtual double GetDayDegrees (void)
 
virtual double GetDeadBiomass (void)
 
virtual double GetDigestability (void)
 
virtual TTypesOfLandscapeElement GetElementType (void)
 
double GetGooseGrazingForage (GooseSpecies a_goose)
 
int GetGooseNos ()
 For goose model functionality, returns the number of geese yesterday. More...
 
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 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...
 
virtual double GetGreenBiomass (void)
 
bool GetHigh (void)
 
virtual double GetInsectPop (void)
 
virtual double GetLAGreen (void)
 
TTypesOfVegetation GetLastSownVeg ()
 Returns the last vegetation type to be sown. More...
 
int GetLastTreatment (int *a_index)
 
virtual double GetLATotal (void)
 
int GetMapIndex (void)
 
bool GetMapValid (void)
 
int GetMaxX (void)
 
int GetMaxY (void)
 
int GetMConstants (int a)
 
int GetMDates (int a, int b)
 
long GetMgtLoopDetectCount (void)
 
long GetMgtLoopDetectDate (void)
 
int GetMinX (void)
 
int GetMinY (void)
 
long GetOldDays (void)
 
int GetOpenness (void)
 For goose model functionality, openness score for the polygon. More...
 
Farm * GetOwner (void)
 
int GetOwnerFile (void)
 
int GetOwnerIndex (void)
 
int GetPesticideCell ()
 
bool GetPigGrazing (void)
 
bool GetPoison (void)
 
int GetPoly (void)
 Returns the polyref number for this polygon. More...
 
virtual TTypesOfVegetation GetPreviousCrop (int)
 
int GetRotIndex (void)
 
long GetRunNum (void)
 
LE_Signal GetSignal (void)
 
virtual bool GetSkScrapes (void)
 
int GetSoilType ()
 
int GetSoilTypeR ()
 
int GetSubType (void)
 
virtual double GetTrafficLoad (void)
 
int GetUnsprayedMarginPolyRef (void)
 
int GetValidX (void)
 
int GetValidY (void)
 
int GetVegAge ()
 
virtual double GetVegBiomass (void)
 
virtual double GetVegCover (void)
 
virtual int GetVegDensity (void)
 
virtual double GetVegHeight (void)
 
virtual bool GetVegPatchy (void)
 
virtual int GetVegPhase (void)
 
int GetVegStore (void)
 
virtual TTypesOfVegetation GetVegType (void)
 
virtual double GetWeedBiomass (void)
 
virtual void GrazeVeg_Extended (double)
 
virtual void GrazeVegetation (double, bool)
 
virtual void GrazeVegetationTotal (double)
 
bool HasTramlines (void)
 
virtual void Insecticide (double)
 
virtual void InsectMortality (double)
 
virtual bool IsCereal ()
 
virtual bool IsGrass ()
 
virtual bool IsMatureCereal ()
 
bool IsRecentlyMown (void)
 
int IsRecentlySprayed (void)
 
 LE (void)
 
virtual void RecalculateBugsNStuff (void)
 
virtual void ReduceVeg (double)
 
virtual void ReduceVeg_Extended (double)
 
virtual void ReduceWeedBiomass (double)
 
virtual void ResetDigestability ()
 sets growth record to zero in descendent classes More...
 
void ResetTrace (void)
 
void SetALMaSSEleType (int a_type)
 
void SetArea (double a_area)
 
void SetBirdMaize (double a_forage)
 
void SetBirdSeed (double a_forage)
 
void SetBorder (LE *a_border)
 
virtual void SetCentroid (int x, int y)
 
void SetCopyTreatment (int a_treatment)
 
void SetCountryDesignation (int a_designation)
 
virtual void SetCropData (double, double, double, TTypesOfVegetation, double, int)
 
virtual void SetCropDataAll (double, double, double, double, TTypesOfVegetation, double, double, int, double, bool, double)
 
void SetElementType (int a_type)
 
void SetGooseNos (int a_number, int a_day)
 
void SetGooseNosTimed (int a_number, int a_day)
 
void SetGooseSpNos (int a_number, int a_day, GooseSpecies a_goose)
 
void SetGooseSpNosTimed (int a_number, int a_day, GooseSpecies a_goose)
 
virtual void SetGrowthPhase (int)
 
void SetHerbicideDelay (int a_decaytime_days)
 
void SetHigh (bool a_high)
 
virtual void SetInsectPop (double)
 
void SetLastSownVeg (TTypesOfVegetation a_tov)
 Records the last vegetation type to be sown. More...
 
void SetLastTreatment (int a_treatment)
 
void SetMapIndex (int a_map_index)
 
void SetMapValid (bool a_valid)
 
void SetMaxX (int x)
 
void SetMaxY (int y)
 
void SetMConstants (int a, int c)
 
void SetMDates (int a, int b, int c)
 
void SetMgtLoopDetectCount (long a_num)
 
void SetMgtLoopDetectDate (long a_num)
 
void SetMinX (int x)
 
void SetMinY (int y)
 
void SetMownDecay (int a_decaytime_days)
 
void SetOldDays (long a_days)
 
void SetOpenness (int a_openness)
 Records the openness statistic for this polygon. More...
 
void SetOwner (Farm *a_owner, int a_owner_num, int a_owner_index)
 
void SetPesticideCell (int a_cell)
 
void SetPoison (bool a_poison)
 
void SetPoly (int a_poly)
 
void SetRotIndex (int a_index)
 
void SetSignal (LE_Signal a_signal)
 
void SetSoilType (int a_st)
 
void SetSubType (int a_subtype)
 
void SetTramlinesDecay (int a_decaytime_days)
 
void SetUnsprayedMarginPolyRef (int a_unsprayedmargin)
 
void SetValidXY (int a_valid_x, int a_valid_y)
 
virtual void SetVegBiomass (int)
 
virtual void SetVegHeight (double)
 
virtual void SetVegParameters (double, double, double, double)
 
virtual void SetVegPatchy (bool)
 
void SetVegStore (int a_veg)
 
virtual void SetVegType (TTypesOfVegetation, TTypesOfVegetation)
 
virtual void StoreLAItotal ()
 
void Tick (void)
 
virtual void ToggleCattleGrazing (void)
 
virtual void TogglePigGrazing (void)
 
void Trace (int a_value)
 
virtual void ZeroVeg (void)
 
void ZeroVegAge ()
 
virtual ~LE (void)
 

Protected Attributes

double m_LarvalFood
 The amount of larval food present. More...
 
double m_LarvalFoodScaler
 The proportion of larval food per m2. More...
 
bool m_MaleNewtPresent
 Flag for presence of a male newt. More...
 
double m_pondpesticide
 Holds the pesticide content per unit pond water. More...
 
- Protected Attributes inherited from LE
int m_almass_le_type
 This holds the ALMaSS element type reference number. More...
 
double m_area
 
double m_birdmaizeforage
 The maize forage present in KJ/m2. More...
 
double m_birdseedforage
 The grain forage present in KJ/m2. More...
 
LEm_border
 
int m_cattle_grazing
 
int m_centroidx
 
int m_centroidy
 
int m_countrydesignation
 
int m_days_since_insecticide_spray
 
double m_ddegs
 
int m_default_grazing_level
 
int m_farmfunc_tried_to_do
 
double m_goosegrazingforage [gs_foobar]
 The grazing forage present in KJ/min. More...
 
int m_gooseNos [366]
 The number of geese each day. More...
 
int m_gooseNosTimed [366]
 The number of geese at a predefined time per day. More...
 
int m_gooseSpNos [366][gs_foobar]
 The number of geese of each species each day. More...
 
int m_gooseSpNosTimed [366][gs_foobar]
 The number of geese of each species at a predefined time per day. More...
 
int m_herbicidedelay
 
bool m_high
 
bool m_is_in_map
 
unsigned int m_lastindex
 
TTypesOfVegetation m_lastsownvegtype
 Records the last vegegetation type that was sown on the element. More...
 
vector< intm_lasttreat
 
long m_management_loop_detect_count
 
long m_management_loop_detect_date
 
int m_map_index
 
int m_maxx
 
int m_maxy
 
int m_minx
 
int m_miny
 
int m_mowndecay
 
long m_olddays
 
int m_openness
 The openness metric for a field (if any) More...
 
Farm * m_owner
 
int m_owner_file
 
int m_owner_index
 
int m_PesticideGridCell
 
bool m_pig_grazing
 
bool m_poison
 
int m_poly
 The polyref number for this polygon. More...
 
int m_rot_index
 
long m_running
 
LE_Signal m_signal_mask
 
int m_soiltype
 
int m_subtype
 
int m_tramlinesdecay
 
TTypesOfLandscapeElement m_type
 
int m_unsprayedmarginpolyref
 
int m_valid_x
 
int m_valid_y
 
int m_vegage
 
int m_vege_danger_store
 
double m_yddegs
 
int MConsts [10]
 
int MDates [2][25]
 

Additional Inherited Members

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

Detailed Description

Ponds are defined as freshwater bodies between 25m2 and 5000m2. For newts the effective size is limited to 400m2.

Currently the only pond 'behviour' is related to provision of food for newt larvae. This is determined daily and can be seasonally adjusted.

Constructor & Destructor Documentation

Pond::Pond ( void  )

References LE_TypeClass::BackTranslateEleTypes(), m_LarvalFood, m_MaleNewtPresent, LE::m_type, and LE::SetALMaSSEleType().

2371  : Freshwater() {
2372  m_type = tole_Pond;
2374  m_LarvalFood = 0.01;
2375  m_MaleNewtPresent = false;
2376 }
int BackTranslateEleTypes(TTypesOfLandscapeElement EleReference)
Definition: elements.cpp:3037
Freshwater(void)
Definition: elements.cpp:2359
bool m_MaleNewtPresent
Flag for presence of a male newt.
Definition: elements.h:1082
double m_LarvalFood
The amount of larval food present.
Definition: elements.h:1076
class LE_TypeClass * g_letype
Definition: elements.cpp:265
void SetALMaSSEleType(int a_type)
Definition: elements.h:112
TTypesOfLandscapeElement m_type
Definition: elements.h:419

Member Function Documentation

void Pond::CalcLarvalFood ( )

Calculates the amount of larval food present.

The larval food is calculated assuming a logistic equation in the form of Nt+1 = Nt+(N*r * (1-N/K)) t = one day, N is a scaler which is multiplied by a constant and the area of the pond to get the total larval food, K & r are carrying capacity and instantaneous reproductive rate respectively. K can change with season and this is currently hard coded, but could be an input variable later. The values are held in LarvalFoodMonthlyK
The steps in the calculation are:

  • Enforce a assumed pond size for newts as maximum 400 m2
  • Ensure we never get zero larval food, so there is always something to grow the curve from.
  • Back calculate the current scaler value. This is needed because between time steps, food may be eaten by larvae. This is done based on the area and a fixed constant held in cfg_PondLarvalFoodBiomassConst
  • Calculate the new scaler based on the logistic equation as described above
  • Re-calculate the new total food biomass based on the area and a fixed constant held in cfg_PondLarvalFoodBiomassConst

References cfg_PondLarvalFoodBiomassConst(), cfg_PondLarvalFoodR(), LE::m_area, m_LarvalFood, and m_LarvalFoodScaler.

Referenced by DoDevelopment().

2418 {
2431  double area = m_area;
2432  if (m_area > 400) area = 400;
2433  const double LarvalFoodMonthlyK[12] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
2434  // Back calculate the scaler
2435  if (m_LarvalFood < 0.01) m_LarvalFood = 0.01;
2437  // Calculate the new scaler
2438  m_LarvalFoodScaler = m_LarvalFoodScaler + (m_LarvalFoodScaler*cfg_PondLarvalFoodR.value() * (1 - (m_LarvalFoodScaler / LarvalFoodMonthlyK[g_date->GetMonth() - 1])));
2439  // Calculate the new food biomass
2441 }
CfgFloat cfg_PondLarvalFoodBiomassConst("POND_LARVALFOODBIOMASSCONST", CFG_CUSTOM, 255.0)
A constant relating the proportion of food units per m2. The value is calibrated to estimates of newt...
double m_LarvalFood
The amount of larval food present.
Definition: elements.h:1076
CfgFloat cfg_PondLarvalFoodR("POND_LARVALFOODFOODR", CFG_CUSTOM, 0.04)
The instanteous rate of growth for larval food (r from logistic equation)
double m_LarvalFoodScaler
The proportion of larval food per m2.
Definition: elements.h:1078
double m_area
Definition: elements.h:420
void Pond::CalcPondPesticide ( )

Calculates the amount of pesticide per unit pond water.

The pesticide is calculated based on the mean concentration per m2 which is then multiplied by a factor representing run-off from the surroundings or other movements of pesticides through soil into the pond. This method assumes a uniform depth of water, which is then ignored (so can be seen as being part of the run-off factor). The pesticide concentration is calculated each day. These calculations are heavy on CPU time because of the need to search the landscape map for pond 1m2 and sum pesticide. So this has to be set to run by flagging using cfg_calc_pond_pesticide

To create the sum of pesticide the map is searched from min x,y to max x,y coords, and pond cells are summed for their pesticide content. Then the mean found.

We assume a mean pond depth of 1 m, so pesticide per l = m_pondpesticide/1000 to get per litre then multiplied buy the run-off factor

References cfg_calc_pond_pesticide(), cfg_pondpesticiderunoff(), g_landscape_p, LE::m_area, LE::m_maxx, LE::m_maxy, LE::m_minx, LE::m_miny, LE::m_poly, m_pondpesticide, Landscape::SupplyPesticide(), and Landscape::SupplyPolyRef().

Referenced by DoDevelopment().

2387 {
2396  m_pondpesticide = 0.0;
2397  if (!cfg_calc_pond_pesticide.value())
2398  {
2399  return;
2400  }
2405  for (int x = m_minx; x <= m_maxx; x++)
2406  for (int y = m_miny; y <= m_maxy; y++)
2407  {
2409  }
2414  m_pondpesticide *= cfg_pondpesticiderunoff.value()/1000.0;
2415 }
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1412
int m_minx
Definition: elements.h:397
int m_maxx
Definition: elements.h:396
double m_pondpesticide
Holds the pesticide content per unit pond water.
Definition: elements.h:1080
double SupplyPesticide(int a_x, int a_y)
Gets total pesticide for a location.
Definition: Landscape.cpp:481
CfgBool cfg_calc_pond_pesticide("POND_PEST_CALC_ON", CFG_CUSTOM, false)
Flag to determine whether to calculate pond pesticide concentration.
int m_miny
Definition: elements.h:399
int m_poly
The polyref number for this polygon.
Definition: elements.h:409
double m_area
Definition: elements.h:420
CfgFloat cfg_pondpesticiderunoff("POND_PEST_RUNOFFFACTOR", CFG_CUSTOM, 10.0)
The multiplication factor assumed to account for ingress of pesticide from run-off and soil water to ...
int m_maxy
Definition: elements.h:398
class Landscape * g_landscape_p
Definition: Landscape.cpp:238
void Pond::DoDevelopment ( void  )
virtual

DoDevelopment is needed due to special development for this element type, i.e. larval food calculations for newts.

Reimplemented from LE.

References CalcLarvalFood(), CalcPondPesticide(), LE::DoDevelopment(), and m_MaleNewtPresent.

2379 {
2382  CalcLarvalFood();
2383  m_MaleNewtPresent = false;
2384 }
bool m_MaleNewtPresent
Flag for presence of a male newt.
Definition: elements.h:1082
virtual void DoDevelopment(void)
Definition: elements.cpp:511
void CalcPondPesticide()
Calculates the amount of pesticide per unit pond water.
Definition: elements.cpp:2386
void CalcLarvalFood()
Calculates the amount of larval food present.
Definition: elements.cpp:2417
bool Pond::IsMaleNewtPresent ( )
inlinevirtual

Gets whether there is a male newt as present.

Reimplemented from LE.

1100 { return m_MaleNewtPresent; };
bool m_MaleNewtPresent
Flag for presence of a male newt.
Definition: elements.h:1082
virtual void Pond::SetMaleNewtPresent ( bool  a_ispresent)
inlinevirtual

Sets a male as present/absent.

Reimplemented from LE.

1098 { m_MaleNewtPresent = a_ispresent; };
bool m_MaleNewtPresent
Flag for presence of a male newt.
Definition: elements.h:1082
bool Pond::SubtractLarvalFood ( double  a_food)

Called by a larva when feeding, removes an age specific amount of larval food.

Removes the amount of food passed in a_food. If that amount exists then it is removed and the calling animal is assumed to be fed, return value true. Otherwise no food is removed and the return value is false.

References g_rand_uni, m_LarvalFood, and m_LarvalFoodScaler.

2444 {
2450  if (g_rand_uni() > m_LarvalFoodScaler * 2) return false;
2451  else
2452  {
2453  m_LarvalFood -= a_food;
2454  return true;
2455  }
2456 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
double m_LarvalFood
The amount of larval food present.
Definition: elements.h:1076
double m_LarvalFoodScaler
The proportion of larval food per m2.
Definition: elements.h:1078
double Pond::SupplyPondPesticide ( )
inline

supply the current pesticide concentration per litre

1096 { return m_pondpesticide; }
double m_pondpesticide
Holds the pesticide content per unit pond water.
Definition: elements.h:1080

Member Data Documentation

double Pond::m_LarvalFood
protected

The amount of larval food present.

Referenced by CalcLarvalFood(), Pond(), and SubtractLarvalFood().

double Pond::m_LarvalFoodScaler
protected

The proportion of larval food per m2.

Referenced by CalcLarvalFood(), and SubtractLarvalFood().

bool Pond::m_MaleNewtPresent
protected

Flag for presence of a male newt.

Referenced by DoDevelopment(), and Pond().

double Pond::m_pondpesticide
protected

Holds the pesticide content per unit pond water.

Referenced by CalcPondPesticide().


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