Goose Management Model ODdox  1.02
Goose_Barnacle_Base Class Reference

A class to describe the Barnacle goose base. More...

#include <GooseBarnacle_All.h>

Public Member Functions

 Goose_Barnacle_Base (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Goose_Barnacle_Base constructor. More...
 
void Init (Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Intitialise object. More...
 
void ReInit (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 ReInit for object pool. More...
 
virtual ~Goose_Barnacle_Base ()
 Goose_Barnacle_Base destructor. More...
 
- Public Member Functions inherited from Goose_Base
void AddBodyCondition (double a_condition)
 Alters body conditon by addition of a double value. More...
 
double AdjustIntakeRateToSnowDepth (double a_intakerate)
 When there is snow, the intake rate is decreased by 10 % per cm of snow. More...
 
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep (10 minutes). More...
 
virtual void EndStep (void)
 The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
void EvaluateForageToHopLoc (APoint a_HopLoc)
 Do a forage evaluation from current location to a_HopLoc. More...
 
void Explore ()
 Behavioural exploration of the area to find forage. More...
 
double GetBodyCondition ()
 Returns the current body condition. More...
 
double GetDailyEnergyBudget ()
 Returns the daily energy budget. More...
 
double GetDailyEnergyExpenditure ()
 Returns the daily energy expenditure. More...
 
double GetFlightCost ()
 Get the flight costs per m per g. More...
 
int GetFlightDistance ()
 Returns the total daily distance flown. More...
 
int GetFlightNumber ()
 Returns the total daily number of flights. More...
 
int GetForageLocIndex ()
 Gets for the forage location index. More...
 
int GetForagingTime (int a_EndForagingTime, double a_RoostLeaveTime)
 Returns the time spent foraging. More...
 
double GetGooseMinForageRate (GooseSpecies a_species)
 Returns the minimum forage rate for the species. More...
 
int GetGroupsize ()
 Returns the groupsize. More...
 
int GetMaxAppetiteHitTime ()
 Returns m_DailyMaxAppetiteHitTime. More...
 
double GetMaxForageRate (double a_grain, double a_maize, double a_grass, double a_interferenceComp, bool a_iscereal, TTypesOfVegetation a_veg, bool a_stubble, TTypesOfVegetation a_prevcrop)
 Returns the max forage rate of the three different types of forage The max rate is adjusted according to feeding time in the time budget, according to the interference competition value and to the current snow depth in the landscape. More...
 
double GetMaxIntakeRate (double a_grain, double a_maize, double a_grass)
 Returns the max intake rate of the three different types of intake. More...
 
TMaxIntakeSource GetMaxIntakeSource ()
 Supply the current max intake source. More...
 
APoint GetRoost ()
 Supply roost coords. More...
 
double GetRoostLeaveTime ()
 Returns the time when the goose leaves the roost. More...
 
bool GetSex ()
 Returns the sex. More...
 
GooseSpecies GetSpecies ()
 Returns the species. More...
 
double GetTotalWeight ()
 Returns the weight of the bird. More...
 
 Goose_Base (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Goose_Base constructor. More...
 
void Init (Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Intitialise object. More...
 
virtual void KillThis ()
 The bird is dead of some external cause. More...
 
void On_Bang (int a_polyid)
 The goose is scared by a bang at location. More...
 
void On_Bang (int a_polyid, double a_scare)
 The goose is scared by a bang at location. More...
 
virtual void On_Emigrate ()
 Cause the bird to immediately transition to Emigrate. More...
 
void On_Migrate (TTypeOfLeaveReason a_leavereason)
 The goose is told to leave the simulation area (poss due to bad weather) More...
 
void On_MoveTo (int a_x, int a_y)
 The goose is moved to the location specified by a_x, a_y - caused by group decision. More...
 
void ReInit (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 ReInit for object pool. More...
 
double ScaleForageToGroupsize (double a_forage)
 Scales forage to groupsize. More...
 
void Set_GooseFattoKJConversion (double a_cost)
 Set the fat to kJ conversion constant for all geese. More...
 
void Set_GooseFieldForageDist (double sp1, double sp2, double sp3)
 Set the max forage distance from a field for all geese. More...
 
void Set_GooseFollowingLikelyhood (int a_likelyhood, GooseSpeciesType a_speciestype)
 Set the followinglikelyhood. More...
 
void Set_GooseForageDist (double sp1, double sp2, double sp3)
 Set the max forage distance from roost for all geese. More...
 
void Set_GooseKJtoFatConversion (double a_cost)
 Set the kJ to fat conversion constant for all geese. More...
 
void Set_GooseLeavingRoost (bool a_leaving)
 Set the flag to indicate if we are coming from the roost. More...
 
void Set_GooseLeavingThreshold (double a_threshold)
 Set the body condition threshold for leaving for all geese. More...
 
void Set_GooseMaxAppetiteScaler (double a_cost)
 Set the goose appetite scale used to calculate max intake for all geese. More...
 
void Set_GooseMaxEnergyReserveProportion (double a_prop)
 Set the maximum energy reserve proportion allowed for all geese. More...
 
void Set_GooseMinForageOpenness (double a_cost)
 Set the min forage openess for all geese. More...
 
void Set_Indivmingooseforagerate (double a_cost)
 Set the mimimum tolerated forage rate for the individual goose. More...
 
void Set_mingooseforagerate (double a_cost, GooseSpecies a_species)
 Set the mimimum tolerated forage rate for all geese. More...
 
void SetBodyCondition (double a_condition, unsigned a_index)
 Sets the current body condition. More...
 
void SetFlightCost (double a_cost)
 Set the flight cost per m per g. More...
 
void SetSex (bool a_sex)
 Sets the sex. More...
 
void st_Dying (void)
 Behavioural state dying. More...
 
TTypeOfGoose_BaseState st_Forage ()
 Behavioural forage. More...
 
TTypeOfGoose_BaseState st_Roost ()
 Roosting until next forage or next morning. More...
 
virtual void StartDay (void)
 Do any 'housekeeping' associated with the start of day. More...
 
virtual void Step (void)
 The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'. More...
 
void SubtractBodyCondition (double a_condition)
 Alters body conditon by subtraction of a double value. More...
 
virtual ~Goose_Base ()
 Goose_Base destructor. More...
 

Protected Member Functions

virtual void ChangeRoost ()
 Find the closest roost. More...
 
virtual APoint ChooseHopLoc ()
 Pick a hop location point within a_dist meters - must be overridden by descendent classes. More...
 
TTypeOfGoose_BaseState st_ToRoost ()
 Return to roost and assess whether to forage again that day. More...
 
- Protected Member Functions inherited from Goose_Base
void FlyTo (APoint a_pt)
 The goose flys to the location specified by a_pt. More...
 
void FlyTo (int a_x, int a_y)
 The goose flys to the location specified by a_x, a_y. More...
 
TTypeOfGoose_BaseState st_ChooseForageLocation (void)
 Selects a forage location based on past memory, or initiates an exploration. More...
 

Additional Inherited Members

- Protected Attributes inherited from Goose_Base
TTypeOfGoose_BaseState CurrentGState
 Variable to record current behavioural state. More...
 
double m_BMR
 The daily BMR. More...
 
double m_BodyCondition [5]
 A variable describing current body condition over the past 5 days. More...
 
unsigned m_BodyConditionCounter
 A counter for the daily body condition. More...
 
double m_DailyMaxAppetite
 The daily max kJ possible to get as intake. More...
 
int m_DailyMaxAppetiteHitTime
 The time of day when m_DailyMaxAppetite was hit. More...
 
double m_DEB
 The daily energy budget excluding flying (kJ) More...
 
double m_energyReserve
 The bird's energy reserves in grams. More...
 
double m_energyToday
 The bird's daily energy account (kJ) More...
 
int m_FlightDistance
 Storage for the total distance flown per day. More...
 
int m_FlightNumber
 Counter for the number of flights per day. More...
 
int m_forageLocCount
 The number of forage locations visited today. More...
 
int m_groupsize
 The size of the group this bird represents. More...
 
double m_Indivmingooseforagerate
 The minimum tolerable forage rate in kJ/minute for the individual. More...
 
double m_LeaveRoostTime
 Controls the time when the goose will leave the roost. More...
 
bool m_LeavingRoost
 Flag to indicate that we are coming from the roost. Used to control code for "following". More...
 
TMaxIntakeSource m_MaxIntakeSource
 Holds information about the food source which gave max intake rate. More...
 
int m_myForageIndex
 Temporary storage for a forage location index - this is a speed optimisation. More...
 
GooseSpeciesType m_myGooseSpeciesType
 Holds the goose species type. More...
 
GooseMemoryMapm_MyMemory
 The Goose Memory. More...
 
int m_myMemPolyID
 Temporary storage for a memory location polygon id. More...
 
APoint m_MyRoost
 The current roost location. More...
 
GooseSpecies m_myspecies
 Holds goose species. More...
 
Goose_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
bool m_sex
 Sex of bird, true = male false = female. More...
 
double m_TheBodyCondition
 A variable describing current body condition averaged over 5 days. More...
 
double m_weight
 The weight of the bird in gram excluding fat reserve. More...
 
double m_weightTotal
 The weight of the bird in g including fat reserve. More...
 
- Static Protected Attributes inherited from Goose_Base
static double m_flightcost = -1
 The cost of flight per g per m in kJ. More...
 
static int m_followinglikelyhood [(int) gst_foobar] = { -1, -1, -1 , -1, -1, -1 }
 An attribute used to determine the chance of following or exploring when foraging. More...
 
static double m_GooseFattoKJConversion = -1
 Conversion rate fat to kJ. More...
 
static double m_GooseFieldForageDist [gs_foobar] = { -1, -1, -1 }
 The maximum distance travelled from roost to forage sites for each species of goose (m) More...
 
static double m_GooseFieldForageDistX2 [gs_foobar] = { -1, -1, -1 }
 Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this is a speed optimisation. More...
 
static double m_GooseForageDist [gs_foobar] = { -1, -1, -1 }
 The maximum distance travelled from roost to forage sites for each species of goose (m) More...
 
static double m_GooseForageDistX2 [gs_foobar] = { -1, -1, -1 }
 Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this is a speed optimisation. More...
 
static double m_GooseKJtoFatConversion = -1
 Conversion rate kJ to fat. More...
 
static double m_GooseLeavingThreshold = -1
 The trigger for leaving as a 5 day average of body condition. More...
 
static double m_GooseMaxAppetiteScaler = -1
 Scaler to determine the max kJ possible to eat per day based on non-energy reserve weight. More...
 
static double m_GooseMaxEnergyReserveProportion = -1
 Max proportion of weight that can be energy reserve. More...
 
static double m_GooseMinForageOpenness = -1
 The minimum openness value a goose will tolerate for forage. More...
 
static double m_mingooseforagerate [gs_foobar] = { -1, -1, -1 }
 The minimum tolerable forage rate in kJ/minute for the species. More...
 
static double m_SnowDepth = 0.0
 The current snow depth. Held here for speed optimization. More...
 

Detailed Description

A class to describe the Barnacle goose base.

Definition at line 46 of file GooseBarnacle_All.h.

Constructor & Destructor Documentation

◆ Goose_Barnacle_Base()

Goose_Barnacle_Base::Goose_Barnacle_Base ( Landscape p_L,
Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
APoint  a_roost 
)

Goose_Barnacle_Base constructor.

Definition at line 68 of file GooseBarnacle_All.cpp.

68  : Goose_Base( p_L, p_NPM, a_weight, a_sex, a_roost ) {
69  Init(p_NPM, a_weight, a_sex, a_roost);
70  }

References Init().

◆ ~Goose_Barnacle_Base()

Goose_Barnacle_Base::~Goose_Barnacle_Base ( )
virtual

Goose_Barnacle_Base destructor.

Definition at line 92 of file GooseBarnacle_All.cpp.

93 {
94  ;
95 }

Member Function Documentation

◆ ChangeRoost()

virtual void Goose_Barnacle_Base::ChangeRoost ( )
inlineprotectedvirtual

Find the closest roost.

Reimplemented from Goose_Base.

Definition at line 65 of file GooseBarnacle_All.h.

65 { m_OurPopulationManager->FindClosestRoost(m_Location_x, m_Location_y, (unsigned) gs_Barnacle); }

References Goose_Population_Manager::FindClosestRoost(), and Goose_Base::m_OurPopulationManager.

Referenced by st_ToRoost().

◆ ChooseHopLoc()

APoint Goose_Barnacle_Base::ChooseHopLoc ( )
protectedvirtual

Pick a hop location point within a_dist meters - must be overridden by descendent classes.

Chooses a location to hop to within pink-footed foraging distance. The foraging distance is different depending on where this method is called from. The point is returned after ensuring that the co-ordinates are valid.

Then automatically calls EvaluateForageToHopLoc to fill in the information between here and the hop location.

Reimplemented from Goose_Base.

Definition at line 121 of file GooseBarnacle_All.cpp.

122 {
127  APoint pt;
128  if (m_MyRoost.m_x == m_Location_x && m_MyRoost.m_y == m_Location_y)
129  {
130  pt.m_x = (int)((g_rand_uni() * m_GooseForageDistX2[gs_Barnacle]) - m_GooseForageDist[gs_Barnacle] + m_MyRoost.m_x);
131  pt.m_y = (int)((g_rand_uni() * m_GooseForageDistX2[gs_Barnacle]) - m_GooseForageDist[gs_Barnacle] + m_MyRoost.m_y);
132  }
133  else {
134  pt.m_x = (int)((g_rand_uni() * m_GooseFieldForageDistX2[gs_Barnacle]) - m_GooseFieldForageDist[gs_Barnacle] + m_Location_x);
135  pt.m_y = (int)((g_rand_uni() * m_GooseFieldForageDistX2[gs_Barnacle]) - m_GooseFieldForageDist[gs_Barnacle] + m_Location_y);
136  }
137 
138  m_OurLandscape->CorrectCoordsPointNoWrap(pt);
141  return pt;
142 }

References Goose_Base::EvaluateForageToHopLoc(), g_rand_uni, Goose_Base::m_GooseFieldForageDist, Goose_Base::m_GooseFieldForageDistX2, Goose_Base::m_GooseForageDist, Goose_Base::m_GooseForageDistX2, and Goose_Base::m_MyRoost.

◆ Init()

void Goose_Barnacle_Base::Init ( Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
APoint  a_roost 
)

Intitialise object.

Here we deal with intialisation that is common to all barnacles but different from other geese species Calculates the maximum daily intake possible

Definition at line 72 of file GooseBarnacle_All.cpp.

72  {
73  Goose_Base::Init(p_NPM, a_weight, a_sex, a_roost);
78  m_myspecies = gs_Barnacle;
79  double daylightprop = m_OurLandscape->SupplyDaylightProp();
80  double nighttimeprop = m_OurLandscape->SupplyNightProp();
81  double multiplier = cfg_goose_daytime_BMR_multiplier.value() * daylightprop + cfg_goose_nighttime_BMR_multiplier.value() * nighttimeprop;
84 }

References cfg_goose_daytime_BMR_multiplier, cfg_goose_nighttime_BMR_multiplier, Goose_Population_Manager::GetThermalCosts(), Goose_Base::Init(), Goose_Base::m_BMR, Goose_Base::m_DailyMaxAppetite, Goose_Base::m_DEB, Goose_Base::m_GooseMaxAppetiteScaler, Goose_Base::m_myspecies, Goose_Base::m_OurPopulationManager, and CfgFloat::value().

Referenced by Goose_Barnacle_Base(), Goose_Barnacle_FamilyGroup::Init(), Goose_Barnacle_NonBreeder::Init(), and ReInit().

◆ ReInit()

void Goose_Barnacle_Base::ReInit ( Landscape p_L,
Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
APoint  a_roost 
)

ReInit for object pool.

Definition at line 86 of file GooseBarnacle_All.cpp.

86  {
87  Goose_Base::ReInit(p_L, p_NPM, a_weight, a_sex, a_roost);
88  Init(p_NPM, a_weight, a_sex, a_roost);
89 }

References Init(), and Goose_Base::ReInit().

Referenced by Goose_Barnacle_FamilyGroup::ReInit(), and Goose_Barnacle_NonBreeder::ReInit().

◆ st_ToRoost()

TTypeOfGoose_BaseState Goose_Barnacle_Base::st_ToRoost ( )
protectedvirtual

Return to roost and assess whether to forage again that day.

If we have arrived in this method while at a forage location then the correct number of geese need to be removed from that location.

There may be multiple roosts possible, and the chance that we change roost if there is a nearer one is given by cfg_goose_roostchangechance This is first tested, if the test is passed then the goose will move to the nearest roost.

Reimplemented from Goose_Base.

Definition at line 98 of file GooseBarnacle_All.cpp.

99 {
103  if (m_myForageIndex != -1)
104  {
106  }
107  m_myForageIndex = -1;
113  {
114  ChangeRoost();
115  }
116  FlyTo(m_MyRoost.m_x, m_MyRoost.m_y);
117  return togs_Roost;
118 }

References cfg_goose_roostchangechance, ChangeRoost(), Goose_Base::FlyTo(), g_rand_uni, Goose_Base::m_groupsize, Goose_Base::m_myForageIndex, Goose_Base::m_myGooseSpeciesType, Goose_Base::m_MyRoost, Goose_Base::m_OurPopulationManager, Goose_Population_Manager::RemoveGeeseFromForageLocation(), togs_Roost, and CfgFloat::value().

Referenced by Goose_Barnacle_FamilyGroup::Step(), and Goose_Barnacle_NonBreeder::Step().


The documentation for this class was generated from the following files:
togs_Roost
Definition: Goose_Base.h:80
Goose_Base::m_myForageIndex
int m_myForageIndex
Temporary storage for a forage location index - this is a speed optimisation.
Definition: Goose_Base.h:291
Goose_Base::m_DEB
double m_DEB
The daily energy budget excluding flying (kJ)
Definition: Goose_Base.h:191
Goose_Base::m_groupsize
int m_groupsize
The size of the group this bird represents.
Definition: Goose_Base.h:171
Goose_Base::m_GooseFieldForageDist
static double m_GooseFieldForageDist[gs_foobar]
The maximum distance travelled from roost to forage sites for each species of goose (m)
Definition: Goose_Base.h:247
Goose_Base::ReInit
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
ReInit for object pool.
Definition: Goose_Base.cpp:168
cfg_goose_nighttime_BMR_multiplier
CfgFloat cfg_goose_nighttime_BMR_multiplier
To calculate daily energy budget. This is the multiple of BMR spent during nighttime.
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
A random number generator (0-1)
Goose_Base::m_GooseMaxAppetiteScaler
static double m_GooseMaxAppetiteScaler
Scaler to determine the max kJ possible to eat per day based on non-energy reserve weight.
Definition: Goose_Base.h:259
Goose_Base::m_GooseForageDistX2
static double m_GooseForageDistX2[gs_foobar]
Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this...
Definition: Goose_Base.h:243
Goose_Base::m_myspecies
GooseSpecies m_myspecies
Holds goose species.
Definition: Goose_Base.h:159
Goose_Population_Manager::FindClosestRoost
void FindClosestRoost(int &a_x, int &a_y, unsigned a_type)
Changes a_x & a_y to the location of the nearest roost of a_type to a_x, a_y.
Definition: Goose_Population_Manager.cpp:1000
Goose_Base::m_DailyMaxAppetite
double m_DailyMaxAppetite
The daily max kJ possible to get as intake.
Definition: Goose_Base.h:195
Goose_Base::Init
void Init(Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Intitialise object.
Definition: Goose_Base.cpp:111
Goose_Population_Manager::GetThermalCosts
double GetThermalCosts(GooseSpecies a_goose)
Get daily thermal costs const.
Definition: Goose_Population_Manager.h:556
Goose_Base::m_GooseForageDist
static double m_GooseForageDist[gs_foobar]
The maximum distance travelled from roost to forage sites for each species of goose (m)
Definition: Goose_Base.h:239
cfg_goose_daytime_BMR_multiplier
CfgFloat cfg_goose_daytime_BMR_multiplier
To calculate daily energy budget. This is the multiple of BMR spent during daytime.
CfgFloat::value
double value(void)
Definition: configurator.h:118
Goose_Base::FlyTo
void FlyTo(int a_x, int a_y)
The goose flys to the location specified by a_x, a_y.
Definition: Goose_Base.cpp:409
Goose_Base::m_BMR
double m_BMR
The daily BMR.
Definition: Goose_Base.h:187
Goose_Base::EvaluateForageToHopLoc
void EvaluateForageToHopLoc(APoint a_HopLoc)
Do a forage evaluation from current location to a_HopLoc.
Definition: Goose_Base.cpp:593
Goose_Base::m_myGooseSpeciesType
GooseSpeciesType m_myGooseSpeciesType
Holds the goose species type.
Definition: Goose_Base.h:163
Goose_Base::m_OurPopulationManager
Goose_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Goose_Base.h:151
Goose_Base::m_GooseFieldForageDistX2
static double m_GooseFieldForageDistX2[gs_foobar]
Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this...
Definition: Goose_Base.h:251
Goose_Population_Manager::RemoveGeeseFromForageLocation
void RemoveGeeseFromForageLocation(GooseSpeciesType a_type, int a_index, int a_number)
Removes a goose or geese to the forage location - requires an index.
Definition: Goose_Population_Manager.cpp:1812
Goose_Barnacle_Base::Init
void Init(Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Intitialise object.
Definition: GooseBarnacle_All.cpp:72
cfg_goose_roostchangechance
CfgFloat cfg_goose_roostchangechance
Chance of changing roost.
Goose_Barnacle_Base::ChangeRoost
virtual void ChangeRoost()
Find the closest roost.
Definition: GooseBarnacle_All.h:65
Goose_Base::m_MyRoost
APoint m_MyRoost
The current roost location.
Definition: Goose_Base.h:167
Goose_Base::Goose_Base
Goose_Base(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Goose_Base constructor.
Definition: Goose_Base.cpp:163