ALMaSS Partridge ODdox
1.1
The partridge model description following ODdox protocol
|
Go to the documentation of this file.
42 #include "../Landscape/ls.h"
43 #include "../BatchALMaSS/PopulationManager.h"
44 #include "../Partridge/Partridge_Communication.h"
45 #include "../Partridge/Partridge_All.h"
46 #include "../Partridge/Partridge_Population_Manager.h"
47 #include "../Partridge/Partridge_Covey.h"
48 #include "../BatchALMaSS/BoostRandomGenerators.h"
59 extern boost::variate_generator<base_generator_type&, boost::uniform_real<> >
g_rand_uni;
230 int chance = random( 100000 );
263 Partridge_Base( a_born_x, a_born_y, a_born_x, a_born_y, a_family_counter, a_covey, a_map, a_manager )
555 if ( clutchsize == 0 )
665 Partridge_Base( a_born_x, a_born_y, a_born_x, a_born_y, a_family_counter, a_covey, a_map, a_manager )
1000 if (
m_sex ==
false )
1030 Partridge_Chick( a_born_x, a_born_y, a_mother, a_covey, a_map, a_sex, a_family_counter, a_manager )
1336 Partridge_Base( a_born_x, a_born_y, a_x, a_y, a_family_counter, a_covey, a_map, a_manager )
1458 double extramort=1.0;
1692 const int clutchsize[19] =
1696 143, 385, 725, 1163, 1700, 2336, 3070, 3902, 4833, 5863, 6990, 8217, 9037, 9607, 9928, 10000, 10000, 10000
1703 int chance = random( 10000 );
1704 for (
int i = 0; i < 19; i++ )
1706 if ( clutchsize[i] > chance )
1805 const int clutchsize[19] =
1809 143, 385, 725, 1163, 1700, 2336, 3070, 3902, 4833, 5863, 6990, 8217, 9037, 9607, 9928, 10000, 10000, 10000
1815 int chance = random( 10000 );
1816 for (
int i = 0; i < 19; i++ ) {
1817 if ( clutchsize[i] > chance ) {
1874 todaysmortchance *= 100000;
1875 if ( random( 100000 ) < todaysmortchance )
1934 if ( q > terr_score )
1954 }
while ( ++steps < 50 );
2133 m_OurLandscape->
Warn(
"Partridge_Female::OnMateDying(): ""m_MyMate is not the mate that is dying",
"" );
2185 Partridge_Base( a_born_x, a_born_y, a_x, a_y, a_family_counter, a_covey, a_map, a_manager )
2450 double extramort=1.0;
2471 }
else return false;
2475 }
else return false;
2743 m_OurLandscape->
Warn(
"Partridge_Male::OnMating(): ""m_MyMate is not NULL on Mating",
"" );
2808 m_OurLandscape->
Warn(
"Partridge_Male::CheckMatePointers(): ""Non-mutual mate pointers",
"" );
2813 m_OurLandscape->
Warn(
"Partridge_Male::CheckMatePointers(): ""Mated & Flocking",
"" );
2835 m_OurLandscape->
Warn(
"Partridge_Female::CheckMatePointers(): ""Non-mutual mate pointers",
"" );
2840 m_OurLandscape->
Warn(
"Partridge_Female::CheckMatePointers(): ""Mated & Flocking",
"" );
2862 g_msg->
Warn(
"k_factors::k_factors()",
"Cannot open k_factors_output.txt" );
3010 double anum = 1 + NoBirdsAfterShoot;
3044 double HatchedChicks;
3053 double Broods = HatchedChicks / 13.8;
3078 FILE * idb = fopen(
"k_facInfoBase.txt",
"a" );
3080 g_msg->
Warn(
"k_factors::DumpInfoDatabase1",
"Cannot open k_facInfoBase.txt" );
3090 FILE * idb = fopen(
"k_facInfoBase.txt",
"a" );
3092 g_msg->
Warn(
"k_factors::DumpInfoDatabase",
"Cannot open k_facInfoBase.txt" );
3095 fprintf( idb,
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%g\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
3096 m_ThisYear->
m_NoClutches,
m_ThisYear->
m_NoClutchesHatched,
m_ThisYear->
m_NoHensPredated,
m_ThisYear->
m_NoChicksSixWeeks,
m_ThisYear->
m_NoChicksSept,
m_ThisYear->
m_NoMalesSept,
m_ThisYear->
m_NoFemalesSept,
m_ThisYear->
m_NoDeadFemales,
m_ThisYear->
m_NoDeadMales,
m_ThisYear->
m_NoShotBirds,
3147 FILE * idb = fopen(
"k_facInfoBase.txt",
"w" );
3149 g_msg->
Warn(
"k_factors::CreateInfoDatabaseFile",
"Cannot open k_facInfoBase.txt" );
Partridge_Object m_object_type
Type of pob object this is.
k_factors * m_Ourkfactors
Pointer to kfactors object.
population_attributes * m_ThisYear
void SetUncleStatus(bool a_Status)
Set uncle status.
double GetHabitatQuality(int a_day)
void OnEaten()
Message handler.
Partridge_Male(int a_born_x, int a_born_y, int a_x, int a_y, Partridge_Covey *a_flock, Landscape *a_map, int a_family_counter, Partridge_Population_Manager *a_manager)
Constructor.
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
void OnAddChick(Partridge_Female *a_pf)
Add a chick.
int m_family_counter
Family ID.
static CfgInt cfg_par_starve_threshold("PAR_STARVE_THRESHOLD", CFG_CUSTOM, 4)
Chick - no. days or negative energy before death.
Partridge_Chick(int a_x, int a_y, Partridge_Female *a_mother, Partridge_Covey *a_flock, Landscape *a_map, bool a_sex, int a_family_counter, Partridge_Population_Manager *a_manager)
Constructor.
Partridge_State m_state
Current behavioural state.
The partridge female class.
bool PassMessage(PartridgeCommunicationData *pc_data, TypeOfPartridge_Communication pc)
Pass a message.
void OnYouAreDead()
Message handler.
virtual bool OnFarmEvent(FarmToDo event)
Handle farm event.
void OnMating(PartridgeCommunicationData *pc_datae)
Message handler.
void OnGivenUp()
Message handler.
The population manager for partridge objects.
CfgInt cfg_par_max_terr_qual("PAR_MAX_TERR_QUAL", CFG_CUSTOM, 13000)
The minimum territory quality needed in early season.
Partridge_State MFindingMate(void)
State male finding mate.
static CfgFloat cfg_par_clutch_mortality("PAR_CLUTCH_MORTALITY", CFG_CUSTOM, 0.00135)
Clutch - daily probability of non-explicitly modelled mortality.
void MakeCovey()
Create our own covey.
int m_NoNonTerritorialFemalesMay
static CfgFloat cfg_par_days_per_egg("PAR_DAY_PER_EGG", CFG_CUSTOM, 1.5)
Days taken to lay 1 egg.
Partridge_State FFindingTerritory(void)
Female finding 'territory' state.
static CfgFloat cfg_par_ad_cut("PAR_AD_CUT_MORT", CFG_CUSTOM, 0.01)
Adult % mortality on cutting.
double m_geomeanBroodSize
int m_NoTerritorialFemalesApril
Partridge_Clutch * m_MyClutch
A pointer to any current clutch.
Partridge_Base(int a_born_x, int a_born_y, int a_x, int a_y, int a_family_counter, Partridge_Covey *a_covey, Landscape *a_map, Partridge_Population_Manager *a_manager)
Constructor for Partridge_Base.
static CfgInt cfg_buildupwait("PAR_BUILDUP_WAIT", CFG_CUSTOM, 130)
Time period after finding territory before making nest.
Partridge_State FLaying(void)
Female laying state.
void incNoAgDeadClutches()
virtual void EndStep(void)
Clutch EndStep.
void OnMateDying()
Message handler.
int m_lifespan
Physiological lifespan.
Partridge_State FCaringForYoung(void)
Female caring for young state.
CfgInt cfg_par_max_lifespan("PAR_MAX_LIFESPAN", CFG_CUSTOM, 3650)
Maximum physiological lifespan.
static CfgFloat cfg_par_adult_mortalityWinter("PAR_ADULT_MORTALITYWINTER", CFG_CUSTOM, 0.0217)
Adults - daily probability of non-explicitly modelled mortality in Winter.
double GetmaxFoodNeedToday()
Return the maximum food need today.
int ClutchDensity(int x, int y, int radius)
Returns clutch density at x,y with radius radius.
static CfgFloat cfg_par_female_incubation_mortality_const("PAR_FEMALE_INCUBATION_MORTALITY_CONST", CFG_CUSTOM, 1.00192)
Increasing hen predation with density (intercept)
void ChDying(void)
Chick Dying.
void DumpInfoDatabase1(int, int, double)
CfgInt cfg_par_start_dissolve("PAR_START_DISSOLVE", CFG_CUSTOM, 30)
The earliest covey dissolve date.
Landscape * m_OurLandscape
void RemoveExtraChick()
Decrement the chick number.
void OnChickDeath()
Remove a dead chick.
void SetClutchSize(int cs)
Set no. eggs.
void RemoveOldMate(bool a_knockon)
Forget any old mate.
PartridgeCommunicationData * m_comms_data
Message data.
static CfgInt cfg_par_triggerlaying("PAR_TRIGGERLAYING", CFG_CUSTOM, 850)
The number of minutes daylight as a minimum before triggering egg-laying behaviour.
double AssessHabitatQualityFaster()
Assess habitat quality (efficient)
Partridge_Male * m_MyMate
A pointer to the current mate if any.
Partridge_Covey * FindNeighbour()
Finds the closest other covey.
void OnChicksMatured()
Message handler.
static CfgFloat cfg_par_extraction_rate("PAR_EXTRACTION_RATE", CFG_CUSTOM, 0.0085)
Food extraction rate.
void MoveDistance(int a_max_distance, int a_step_size, double a_food_density_needed)
Entry point for movement.
Base class for all partridge classes.
int GetOurChicks()
Return the number of chicks.
bool m_clutchproduced
Flag for having produced a clutch.
Partridge_Covey * m_covey
void AgDying()
Killed by management.
Partridge_Female * GetMate(void)
Are we paired?
int GetChickAge()
Return chick age.
Partridge_Chick2(int a_x, int a_y, Partridge_Female *a_mother, Partridge_Covey *a_flock, Landscape *a_map, bool a_sex, int a_family_counter, Partridge_Population_Manager *a_manager)
Constructor.
int m_nest_counter
Days spent nest building.
void OnClutchMown()
Message handler.
Partridge_Female * FindMeAMateInCovey(int a_family_counter)
Is their a suitable female mate in the covey?
virtual void BeginStep(void)
Male BeginStep.
static CfgFloat cfg_female_mowing_chance("PAR_FEMALEMOWNMORTALITY", CFG_CUSTOM, 1)
Chance of female death if incubating a mown clutch.
int m_buildupwait
Delay before breeding can commence.
Partridge_Male * GetMate(void)
Supply mate pointer.
Partridge_Male * m_MyOldHusband
A record of the previous mate if any.
virtual void CheckMatePointers()
Debug.
void OnStartIncubating()
Flag under incubation.
virtual bool DailyMortality()
Background mortality check.
long m_id
Individual bird ID.
int GetmaxAllowedMove()
Return the max possible move distance today.
class MapErrorMsg * g_msg
void SetOldMate(Partridge_Female *pf)
Set old mate pointer.
virtual void Dying()
Generic dying handler.
Partridge_Female * FindMateInArea(int a_max_distance)
Find mate in area.
void OnMumDead()
Message handler.
void CreateObjects(int ob_type, Partridge_struct *data, int number)
int m_starve
Days spent starving.
bool PossibleMate(Partridge_Base *a_partridge)
Can we mate?
Struct to pass chick information.
The landscape class containing all environmental and topographical data.
virtual bool DailyMortality()
Background mortality test.
bool m_underincubation
Are we being incubated?
virtual bool DailyMortality()
Background mortality test.
void AddHatchSuccess(int sz)
Partridge_State FAttractingMate(void)
Female attracting mate state.
virtual void Step(void)
Male Step.
bool TooClose()
Test for another covey too close.
virtual void BeginStep(void)
Female BeginStep.
static CfgInt cfg_par_MaleMateSearchArea("PAR_MALEMATESEARCHAREA", CFG_CUSTOM, 500)
Male mate searching radius.
virtual void EndStep(void)
Female EndStep.
void WriteParClutches(int a_min, int a_num1, int a_num2)
Output method.
static CfgInt cfg_par_days_to_make_nest("PAR_DAYS_TO_MAKE_NEST", CFG_CUSTOM, 5)
Days used for nestbuilding.
Partridge_Clutch(int a_x, int a_y, Partridge_Female *a_mother, Partridge_Covey *a_flock, Landscape *a_map, int a_num_eggs, int a_family_counter, Partridge_Population_Manager *a_manager)
Constructor.
static CfgFloat cfg_par_infertile_eggs("PAR_INFERTILE_EGGS", CFG_CUSTOM, 0.08)
Proportion of infertile eggs.
Partridge_Female * m_female
Partridge_State ClDeveloping(void)
Development state.
unsigned int GetCoveySize()
Return the covey size.
Partridge_State MFollowingMate(void)
State male follow mate.
virtual Partridge_State ChDeveloping(void)
State developing.
int m_startlayingday
Records the day laying started.
virtual bool OnFarmEvent(FarmToDo event)
Farm event handler.
CfgInt cfg_par_min_terr_qual("PAR_MIN_TERR_QUAL", CFG_CUSTOM, 6900)
The minimum territory quality needed in late season.
static CfgInt cfg_par_base_mortality("PAR_BASE_MORTALITY", CFG_CUSTOM, 0)
Unused.
bool m_UncleStatus
If has uncle status in the covey.
virtual void Step(void)
ClutchStep.
int m_born_x
x-coord of birth
static CfgFloat cfg_par_cl_cut("PAR_CL_CUT_MORT", CFG_CUSTOM, 0.29)
Clutch % mortality on cutting.
virtual void Step(void)
Chick Step.
void copyself(population_attributes *a_population_attributes)
The base class for all ALMaSS animal classes.
Partridge_State MFlocking(void)
State male flocking.
The collective for a family of partridges
void OnEggsHatch()
Message handler.
int AmIaMember()
A debug function.
int m_signal
Used to pass information to outputs.
Partridge_State MCaringForYoung(void)
State male caring for young.
Partridge_State FMakingNest(void)
Female making nest state.
void OnClutchDeath()
Message handler.
int m_NoTerritorialFemalesMay
virtual void CheckMatePointers()
Debug function - checking mate consistency
virtual bool DailyMortality()
Background mortality test.
Partridge_Covey * m_covey
void SetFixed(bool a_is_fixed)
Prevent/enable peg drift.
void OnStoppingBreeding()
Message handler.
void OnWaitForMale()
Message handler.
population_attributes * m_LastYear
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Struct to pass adult partridge information.
int m_NoClutchesReplacements
static CfgFloat cfg_par_chick_mortality("PAR_CHICK_MORTALITY", CFG_CUSTOM, 0.02043)
Chick - daily probability of non-explicitly modelled mortality.
CfgInt cfg_par_min_lifespan("PAR_MIN_LIFESPAN", CFG_CUSTOM, 1825)
Minimum physiological lifespan.
int SupplyDayInYear(void)
Partridge_Communication m_messagecentre
Message class pointer.
int GetFamily(void)
Supply family ID.
static CfgFloat cfg_par_adult_mortalitySummer("PAR_ADULT_MORTALITYSUMMER", CFG_CUSTOM, 0.0001)
Adults - daily probability of non-explicitly modelled mortality in Summer.
virtual bool DailyMortality()
Background mortality check.
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
void OnMateDying(PartridgeCommunicationData *pc_data)
Message handler.
virtual void EndStep(void)
Chick EndStep.
int m_lifespan
Physiological lifespan in days.
Partridge_Female(int a_born_x, int a_born_y, int a_x, int a_y, Partridge_Covey *a_flock, Landscape *a_map, int a_family_counter, Partridge_Population_Manager *a_manager)
Constructor.
double GetNestingCoverDensity()
Calls Partridge_Population_Manager::GetNestingCoverDensity
static CfgInt cfg_par_triggerlayingvar("PAR_TRIGGERLAYINGVAR", CFG_CUSTOM, 48)
Generates variation around the laying trigger.
Struct to pass clutch information.
void OnMating(Partridge_Female *a_mate)
Message handler.
bool FillCoveyNeigbourList(Partridge_Covey *a_covey, int a_distance, int a_x, int a_y)
Get a list of neighbour covies.
void ClDying(void)
Dying state.
virtual void BeginStep(void)
Chick BeginStep.
virtual void BeginStep(void)
Clutch BeginStep.
virtual bool DailyMortality()
Background mortality check.
void SwitchCovey(Partridge_Covey *a_covey)
Swap coveys.
void ChickExtraMortality()
Apply extra chick mortality.
bool FlyTo(int a_distance)
Fly to
Partridge_Female * m_MyOldWife
Old mate pointer.
static CfgInt cfg_par_min_no_eggs("PAR_MIN_NO_EGGS", CFG_CUSTOM, 7)
Minimum clutch size.
void OnSetMyClutch(PartridgeCommunicationData *pc_data)
Message handler.
static CfgInt cfg_par_MaleFlyingDistance("PAR_MALEFLYINGDISTANCE", CFG_CUSTOM, 2000)
The maximum flying distance for males.
CfgInt cfg_par_male_gives_up("PAR_MALE_GIVES_UP", CFG_CUSTOM, 170)
Latest date a male will mate search.
int m_triggerlayingvar
Adds stochasticity to the light triggering of breeding.
virtual Partridge_State ChMaturing(void)
State maturing.
void SetChickAge(int age)
Set chick age.
std::string EventtypeToString(int a_event)
void SetFamily(unsigned int family)
Set family ID.
virtual void CopyMyself()
Partridge_Population_Manager * m_OurPopulationManager
Pointer to the population manager.
bool NestFindLocation(void)
Try to locate a suitable nesting location.
Partridge_Female * m_MyMate
Current mate pointer.
virtual ~Partridge_Base(void)
Destructor.
bool IsMember(Partridge_Base *a_possible_member)
void FixHabitat(void)
Accept this breeding location.
static CfgFloat cfg_par_adult_mortality_alone("PAR_ADULT_MORTALITY_ALONE", CFG_CUSTOM, 1.4)
Adults - extra mortality scaler if alone.
virtual void EndStep(void)
Chick2 EndSte[.
int m_clutch_size
No. of eggs.
bool m_HaveTerritory
Flag for having found a suitable breeding area.
void MDying(void)
State male dying.
Partridge_State FIncubating(void)
Female incubating state.
CfgInt cfg_par_last_brood_date("PAR_LAST_BROOD_DATE", CFG_CUSTOM, 180)
Latest date for a reproduction attempt.
static CfgFloat cfg_par_chick2_mortality("PAR_CHICK_TWO_MORTALITY", CFG_CUSTOM, 1.0)
Chick2 - scaler applied to adult mortalities.
virtual bool OnFarmEvent(FarmToDo event)
Management event handler.
void SetOldMate(Partridge_Male *pm)
Set old mate pointer.
Integer configurator entry class.
void OnLookAfterKids(void)
Message handler.
int m_clutch_size
Current clutch size.
Partridge_State FFlocking(void)
Female flocking state.
bool HaveTerritory(void)
Have we a breeding 'territory'?
int GetCurrentStateNo()
Returns the current state number.
int m_born_y
y-coord of birth
Partridge_State MGuardingMate(void)
State male guarding mate.
void CheckManagement(void)
Partridge_State FBuildingUpResources(void)
Female building up resources state.
virtual void BeginStep(void)
Chick2 BeginStep.
Data structure of a message.
Double configurator entry class.
static long g_partridge_id
void CreateCloneObjects(int ob_type, AdultPartridge_struct *as)
void AddMember(Partridge_Base *a_new_member)
virtual Partridge_State ChDeveloping(void)
Development.
void incNoClutchesPredated()
int m_clutch_number
Current clutch attempt.
void OnFemaleGivingUp()
Message handler.
Partridge_Clutch * m_clutch
virtual void Step(void)
Female Step.
double SupplyFoodToday(void)
Return the food obtained today.
virtual bool OnFarmEvent(FarmToDo event)
Management event handler.
Partridge_Covey * m_covey
Pointer to the covey.
static CfgFloat cfg_par_adult_mortalitySpring("PAR_ADULT_MORTALITYSPRING", CFG_CUSTOM, 0.0096)
Adults - daily probability of non-explicitly modelled mortality in Spring.
void CreateInfoDatabaseFile()
double GetNestingCoverDensity(int x, int y)
virtual bool OnFarmEvent(FarmToDo event)
Management event handler.
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
void StartBreedingBehaviour(void)
Message handler.
void OnChicksDead()
Message handler.
virtual void Step(void)
Chick2Step.
void OnMovingHome()
Message handler.
virtual void CheckMatePointers()
A debug function.
void Warn(std::string a_msg1, std::string a_msg2)
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
virtual void EndStep(void)
Male EndStep.
void incNoStarvedChicks()
void RemoveOldMate(bool a_knockon)
Forget old mate.
void OnChicksDead()
Message handler.
Partridge_Population_Manager * g_manager
Clutch mortality on soil cultivation.
int SupplyDaylength(void)
void OnChickMature()
Remove a matured chick.
void OnChicksMatured()
Message handler.
static CfgFloat cfg_par_female_incubation_mortality_slope("PAR_FEMALE_INCUBATION_MORTALITY_SLOPE", CFG_CUSTOM, -0.00122)
Increasing hen predation with density (slope)
CfgInt cfg_par_mature_threshold("PAR_MATURE_THRESHOLD", CFG_CUSTOM, 84)
Age at maturing in days.
Partridge_Female * m_mother
Pointer to mother.
virtual Partridge_State ChMaturing(void)
Maturation.
Partridge_State MPairing(void)
State male pairing.
long SupplyGlobalDate(void)
static CfgInt cfg_par_incubation_period("PAR_INCUBATION_PERIOD", CFG_CUSTOM, 24)
Lenght of incubation period.
static CfgInt cfg_par_female_movement_max("PAR_FEMALE_MOVEMENT_MAX", CFG_CUSTOM, 100)
Female max daily movement.
void NestLeave(void)
Leave the nest
static CfgFloat cfg_par_ch_cut("PAR_CH_CUT_MORT", CFG_CUSTOM, 0.05)
Chick % mortality on cutting.
Partridge_State FStartingNewBrood(bool a_waslaying)
Female starting new brood state.