![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
Class for infant hares (stationary, only milk inputs) More...
#include <Hare_All.h>
Public Member Functions | |
void | BeginStep (void) override |
BeginStep for the Hare_Infant. More... | |
void | Step (void) override |
Step for the Hare_Infant. More... | |
void | EndStep (void) override |
EndStep for the Hare_Infant. More... | |
Hare_Infant (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM) | |
Hare infant constructor. More... | |
void | ReInit (struct_Hare a_data) |
Infant object reinitiation. More... | |
void | Init () |
Object initiation. More... | |
~Hare_Infant () override | |
Hare infant destructor. More... | |
void | ON_Dead () override |
This hare has been killed. More... | |
void | ON_BeingFed (double a_someMilk) |
Get energy from milk given. More... | |
void | SetWeight (double w) |
Set the weight. More... | |
void | SetMum (Hare_Female *a_af) |
Set the mother pointer. More... | |
![]() | |
THare (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM) | |
Constructor. More... | |
void | THareInit (int p_x, int p_y, THare_Population_Manager *p_PPM) |
Object Initiation. More... | |
~THare () override | |
Destructor. More... | |
virtual TTypeOfHareState | st_Dispersal () |
Base implementation only - reimplemented. More... | |
double | GetWeight () |
double | GetTotalWeight () |
Provide the wet weight of the hare. More... | |
int | GetAge () |
Provide the age of the hare. More... | |
void | ON_MumDead (Hare_Female *a_Mum) |
Inform Mum that we are dead. More... | |
Hare_Female * | GetMum () |
Get the mother pointer. More... | |
double | GetRMR () |
Get todays RMR. More... | |
virtual bool | WasPredated () |
Test for predation. More... | |
int | GetRefNum () |
Get the refnum for this hare. More... | |
void | loadVegPalatability (void) |
Loads static member m_vegPalatability with data. More... | |
![]() | |
TAnimal (int x, int y, Landscape *L) | |
The TAnimal constructor saving the x,y, location and the landscape pointer. More... | |
TAnimal (int x, int y) | |
The TAnimal constructor saving the x,y used if landscape is already set. More... | |
void | SetGuardMapIndex (int a_index_x, int a_index_y) |
Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More... | |
unsigned | SupplyFarmOwnerRef () const |
Get the current location farm ref if any. More... | |
AnimalPosition | SupplyPosition () const |
Returns the objects location and habitat type and veg type. More... | |
APoint | SupplyPoint () const |
Returns the objects location in ALMaSS coordinates. More... | |
int | SupplyPolygonRef () const |
Returns the polygon reference where the object is located. More... | |
TTypesOfLandscapeElement | SupplyPolygonType () const |
Returns the polygon type where the object is located. More... | |
int | Supply_m_Location_x () const |
Returns the ALMaSS x-coordinate. More... | |
int | Supply_m_Location_y () const |
Returns the ALMaSS y-coordinate. More... | |
int | SupplyGuardCellX () const |
Returns the x-index to the guard cell. More... | |
int | SupplyGuardCellY () const |
Returns the y-index to the guard cell. More... | |
int | SupplyAge () const |
Returns the animals age in days. More... | |
void | SetAge (int a_age) |
Sets the animals age in days. More... | |
virtual void | KillThis () |
Sets all parameters ready for object destruction. More... | |
virtual void | CopyMyself () |
Used to copy the object details to another in descendent classes. More... | |
void | SetX (const int a_x) |
Sets the x-coordinate. More... | |
void | SetY (const int a_y) |
Sets the y-coordinate. More... | |
virtual void | ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr) |
virtual void | ReinitialiseObject (int a_x, int a_y) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual int | WhatState () |
Returns the objects current state number. More... | |
virtual void | Dying () |
A wrapped for KillThis - ideally should not be used. More... | |
void | CheckManagement () |
Used to start a check for any management related effects at the objects current location. More... | |
void | CheckManagementXY (int a_x, int a_y) |
Used to start a check for any management related effects at x,y. More... | |
![]() | |
int | GetCurrentStateNo () const |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () const |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
void | ReinitialiseObjectBase () |
Used to initialise an object. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject ()=default |
The destructor for TALMaSSObject. More... | |
Protected Member Functions | |
TTypeOfHareState | st_Developing () |
Developmental behaviour for the infant hare. More... | |
void | st_NextStage () |
'mature' to become a young More... | |
bool | OnFarmEvent (FarmToDo event) override |
Do we require a response to a farm event. More... | |
![]() | |
bool | Run (int a_dist, int a_direction) |
Run a distance in a direction. More... | |
void | EnergyBalance (TTypeOfActivity a_activity, int dist) |
Adjust energy balance for an activity. More... | |
void | TimeBudget (TTypeOfActivity a_activity, int dist) |
Adjust time budger for an activity. More... | |
void | st_Dying () |
Tidy up before removing the object on death. More... | |
virtual void | Running (int a_max_dist) |
Run. More... | |
void | Walking (int a_dist, int a_direction) |
Walking. More... | |
double | Forage (int &time) |
Foraging. More... | |
double | ForageP (int &time) |
Foraging but also incorporating pesticide exposure. More... | |
virtual void | InternalPesticideHandlingAndResponse () |
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More... | |
virtual void | GeneralEndocrineDisruptor (double) |
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More... | |
virtual void | GeneralOrganoPhosphate (double) |
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More... | |
double | ForageSquare (int a_x, int a_y) |
Forage from an area. More... | |
double | ForageSquareP (int a_x, int a_y, double *a_pestexposure) |
Forage from an area and resturn pesticide exposure as well as food. More... | |
int | GetPegDistance () |
Get peg distance. More... | |
int | GetPegPull () |
Get attractive force of peg. More... | |
int | GetPegDirection () |
Get direction of peg. More... | |
void | MovePeg () |
Move the peg according to attraction forces. More... | |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Additional Inherited Members | |
![]() | |
static void | SetMum (Hare_Female *) |
Set the mother pointer. Reimplemented in Hare_Infant. More... | |
![]() | |
static void | SetSimulationWidth (int a_value) |
Sets the simulation width. More... | |
static void | SetSimulationHeight (int a_value) |
Sets the simulation height. More... | |
static void | SetDayInYear (int a_value) |
Sets the day in year attribute. More... | |
static void | SetOurLandscape (Landscape *a_value) |
Sets the landscape pointer. More... | |
static void | SetTempToday (double a_value) |
Sets the temperature today attribute. More... | |
![]() | |
static void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
![]() | |
static double * | m_vegPalatability = nullptr |
Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here. More... | |
![]() | |
TTypeOfHareState | m_CurrentHState |
Defines the current activity. More... | |
int | m_Age = 0 |
State variale - hare age. More... | |
Hare_Object | m_Type |
State variale - the type of hare. More... | |
double | m_weight = 0.0 |
State variale - hare weight g. More... | |
double | m_old_weight = 0.0 |
State variale - last hare weight. More... | |
Hare_Female * | m_MyMum = nullptr |
Pointer to the hare's mum. More... | |
THare_Population_Manager * | m_OurPopulationManager |
Pointer to the hare population manager. More... | |
int | m_Lifespan = 0 |
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age) More... | |
int | m_ActivityTime = 0 |
Minutes of potential activity time per day. More... | |
int | m_StarvationDays = 0 |
State variable - the number of consecutive days in negative energy balance. More... | |
double | m_fatReserve = 0.0 |
State variable - the energy reserve of the hare. More... | |
double | m_TodaysEnergy = 0.0 |
State variable - the amount of energy available today, can be in deficit. More... | |
double | m_EnergyMax = 0.0 |
State variable - the amount of energy it is possible to eat as a multiplyer or RMR. More... | |
double | m_KJRunning = 0.0 |
KJ/m cost of running per kg hare. More... | |
double | m_KJWalking = 0.0 |
KJ/m cost of walking per kg hare. More... | |
double | m_KJForaging = 0.0 |
KJ/m cost of foraging per kg hare. More... | |
double | m_SpeedRunning = 0.0 |
m/min speed of running per kg hare More... | |
double | m_SpeedWalking = 0.0 |
m/min speed of walking per kg hare More... | |
double | m_foragingenergy = 0.0 |
Energy obtained from foraging/feeding. More... | |
int | m_peg_x = 0 |
peg x-coordinate More... | |
int | m_peg_y = 0 |
peg y-coordinate More... | |
int | m_RefNum = 0 |
Unique hare reference number, also functions as sex flag. More... | |
int | m_experiencedDensity = 0 |
State variable used in alternative density-dependent configurations. More... | |
int | m_lastYearsDensity = 0 |
State variable used in alternative density-dependent configurations. More... | |
int | m_ddindex = 0 |
State variable used in alternative density-dependent configurations. More... | |
int | m_expDensity [365] = {} |
State variable used in alternative density-dependent configurations. More... | |
int | m_DensitySum = 0 |
State variable used in alternative density-dependent configurations. More... | |
bool | m_IamSick = false |
flag for sickness - used in conjunction with disease configurations More... | |
double | m_pesticide_burden = 0.0 |
State variable used to hold the current body-burden of pesticide. More... | |
double | m_pesticidedegradationrate = 0.0 |
State variable used to hold the daily degredation rate of the pesticide in the body. More... | |
bool | m_pesticideInfluenced1 = false |
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). More... | |
![]() | |
int | m_Location_x |
The objects ALMaSS x coordinate. More... | |
int | m_Location_y |
The objects ALMaSS y coordinate. More... | |
int | m_guard_cell_x |
The index x to the guard cell. More... | |
int | m_guard_cell_y |
The index y to the guard cell. More... | |
int | m_AgeDays {0} |
To hold the age in days. More... | |
PesticideToxicity | m_my_pesticide |
![]() | |
int | m_CurrentStateNo |
The basic state number for all objects - '-1' indicates death. More... | |
bool | m_StepDone |
Indicates whether the iterative step code is done for this timestep. More... | |
![]() | |
static Landscape * | m_OurLandscape = nullptr |
A pointer to the landscape object shared with all TAnimal objects. More... | |
static int | m_SimulationWidth = 0 |
A static member for the simulation width because it is often used by descendent classes. More... | |
static int | m_SimulationHeight = 0 |
A static member for the simulation height because it is often used by descendent classes. More... | |
static double | m_TemperatureToday = 0.0 |
A holder for the temperature today shared with all TAnimal objects. More... | |
static int | m_DayInYear = 0 |
A holder for the day in year shared with all TAnimal objects. More... | |
Class for infant hares (stationary, only milk inputs)
Hare_Infant::Hare_Infant | ( | int | p_x, |
int | p_y, | ||
Landscape * | p_L, | ||
THare_Population_Manager * | p_PPM | ||
) |
|
overridevirtual |
BeginStep for the Hare_Infant.
Tests for mortality. Both standard mortality tests and optional density dependent mortality. NB this differs from all other ALMaSS models in that the farm events do not have any direct impact on any hare stage except this one. I assume that all other stages can run away - seems not to cause a problem with fitting to Illum�
Reimplemented from THare.
Reimplemented in Hare_Young.
References TAnimal::CheckManagement(), g_rand_uni_fnc(), THare_Population_Manager::GetInterference(), THare_Population_Manager::GetKJperM(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, TALMaSSObject::m_CurrentStateNo, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_MyMum, THare::m_old_weight, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, THare_Population_Manager::m_YoungMortRate, and ON_Dead().
|
overridevirtual |
EndStep for the Hare_Infant.
Reimplemented from THare.
Reimplemented in Hare_Young.
References THare::m_CurrentHState, THare::MovePeg(), ON_Dead(), st_Developing(), tohs_Developing, and tohs_Dying.
void Hare_Infant::Init | ( | void | ) |
Object initiation.
References hob_Infant, THare::m_Age, THare::m_old_weight, THare::m_Type, and THare::m_weight.
Referenced by Hare_Infant(), Hare_Young::Hare_Young(), ReInit(), and Hare_Young::ReInit().
void Hare_Infant::ON_BeingFed | ( | double | a_someMilk | ) |
Get energy from milk given.
The conversion efficiency is pre-calcualted in GetgperKJ so this function is quite simply a conversion from KJ to g
NOTE There are no limits here - the limit to growth has to be by the limited amount of milk supplied - the ultimate limit to this has got to be defined somewhere else (e.g. female forage).
References THare::m_TodaysEnergy.
|
overridevirtual |
This hare has been killed.
Do the housekeeping necessary before dying
Reimplemented from THare.
Reimplemented in Hare_Young.
References THare::st_Dying().
Referenced by BeginStep(), EndStep(), and OnFarmEvent().
|
overrideprotectedvirtual |
Do we require a response to a farm event.
Checks to see if any nasty farm event has caused the death of the infant.
Currently there is only one response to those events where death is possible. However, this may not always be the case so the code is structured as for the other ALMaSS animals (i.e. it could be a bit easier to overview if it were written differently).
Reimplemented from THare.
Reimplemented in Hare_Young.
References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, autumn_sow_with_ferti, bed_forming, biocide, bulb_harvest, burn_straw_stubble, burn_top, cattle_out, cattle_out_low, cfg_hare_i_cut, cfg_hare_i_tillage, cfg_hare_i_tractor, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_boron, fa_calcium, fa_cu, fa_greenmanure, fa_k, fa_manganesesulphate, fa_manure, fa_n, fa_nk, fa_npk, fa_npks, fa_p, fa_pk, fa_pks, fa_rsm, fa_sk, fa_sludge, fa_slurry, fiber_covering, fiber_removal, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_boron, fp_calcium, fp_cu, fp_greenmanure, fp_k, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_n, fp_nc, fp_nk, fp_npk, fp_npks, fp_ns, fp_p, fp_pk, fp_pks, fp_rsm, fp_sk, fp_sludge, fp_slurry, fungicide_treat, g_random_fnc(), glyphosate, green_harvest, growth_regulator, harvest, harvest_bushfruit, harvestshoots, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, last_treatment, TAnimal::m_OurLandscape, manual_weeding, molluscicide, mow, ON_Dead(), org_fungicide, org_herbicide, org_insecticide, pheromone, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, pruning, row_cultivation, shallow_harrow, shredding, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, suckering, summer_harrow, summer_plough, summer_sow, swathing, syninsecticide_treat, trial_control, trial_insecticidetreat, trial_toxiccontrol, CfgInt::value(), Landscape::Warn(), water, winter_harrow, and winter_plough.
void Hare_Infant::ReInit | ( | struct_Hare | a_data | ) |
Infant object reinitiation.
References struct_Hare::HM, Init(), struct_Hare::L, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, THare::THareInit(), struct_Hare::x, and struct_Hare::y.
|
inline |
Set the mother pointer.
References THare::m_MyMum.
Referenced by THare_Population_Manager::CreateObjects().
|
inline |
Set the weight.
This is only used when a hare is born, so no need to have it in the base class
References THare::m_weight.
Referenced by THare_Population_Manager::CreateObjects().
|
protected |
Developmental behaviour for the infant hare.
This code must be called by the EndStep.
To do this we need to add growth and energy requirements. The idea is to grow immediately on milk supply - handled via ON_someMilk()but if there are any other adjustments to be made they ought to be done here, e.g. if energy is needed for movement or thermoregululation. The easiest way to manage things is to use weight as a measure of energy, and convert freely between the two. This means that conversion efficiencies need to be applied to the energy inputs (done in on_BeingFed)
First remove our BMR
Make sure m_TodaysEnergy is zero before we run the risk of getting milk from Mum again during Step tomorrow.
If all is well then mature to become a Hare_Young
References cfg_infant_starvation_threshold, THare_Population_Manager::GetGrowthEfficiency(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare_Population_Manager::GetRMR(), THare::GetTotalWeight(), THare::m_Age, THare::m_old_weight, THare::m_OurPopulationManager, THare::m_StarvationDays, THare::m_TodaysEnergy, THare::m_weight, tohs_Developing, tohs_Dying, tohs_NextStage, and CfgInt::value().
Referenced by EndStep().
|
protected |
'mature' to become a young
This creats a Hare_Young object via a call to create objects then sets the flag for destruction of this object.
References THare_Population_Manager::CreateObjects(), struct_Hare::HM, THare::m_Age, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_MyMum, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_weight, and tohs_DestroyObject.
Referenced by Step().
|
overridevirtual |
Step for the Hare_Infant.
The step code is the main activity sub-stepfor each time-step. A dead animal will have m_CurrentStateNo set to -1 It is essential that before an animal is killed that it has sent all the necessary messages to others (in this case to its mother).
m_CurrentHState holds the current behavioural state
Reimplemented from THare.
Reimplemented in Hare_Young.
References THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_NextStage(), tohs_Developing, tohs_Dying, tohs_InitialState, tohs_NextStage, tohs_Running, and Landscape::Warn().