Goose Management Model ODdox  1.02
Goose_Population_Manager Class Reference

The class to handle all goose population related matters. More...

#include <Goose_Population_Manager.h>

Public Member Functions

void AddGeeseToForageLocation (GooseSpeciesType a_type, int a_index, int a_number)
 Adds a goose or geese to the forage location - requires an index. More...
 
void AddGeeseToForageLocationP (GooseSpeciesType a_type, int a_polyref, int a_number)
 Adds a goose or geese to the forage location - uses polygon number as reference. More...
 
void BangAtPoly (int a_polyref)
 Passes a 'Bang' message to birds near to the location specified by the polygon reference. More...
 
void BirdsShot (int a_polyref, int a_numbershot, GooseHunter *a_Hunter)
 Passes the message to shoot a number of birds at a forage location. More...
 
int BirdsToShootAtPoly (int a_poly)
 Returns the number of birds at a forage location - given by a poly ref. More...
 
void CreateObjects (int ob_type, TAnimal *pvo, struct_Goose *data, int number)
 Method for creating a new individual Goose. More...
 
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. More...
 
int ForageLocationInUse (int a_polyref)
 Tests if a forage location is currently in use, if so returns the index to it. More...
 
int GetBirdsAtForageLoc (int a_index, GooseSpeciesType a_type)
 Returns the number of birds at a forage location - given by a poly ref. More...
 
int GetDaylightLeft ()
 Get the daylight minutes left today. More...
 
int GetDayTime ()
 Get the time of day (in minutes). For the goose model, sunrise is defined as m_daytime == 0. Hence this function returns the number of minutes since sunrise. More...
 
double GetDistToClosestRoost (int a_x, int a_y, unsigned a_type)
 Returns the distance in to the nearest roost of a_type in meters. More...
 
double GetFeedingRate (double a_graindensity, GooseSpecies a_species)
 Get the forage rate based on the grain density. More...
 
double GetForageGooseDensity (int a_index)
 Returns the total goose density for a forage location. More...
 
double GetForageGrazing (int a_index, int gs)
 Returns the forage density for a forage location and goose type. This is species specific. More...
 
GooseActiveForageLocationGetForageLocation (unsigned int a_index)
 Returns a pointer to the forage location indexed by index. More...
 
int GetForageLocIndex (GooseSpecies a_species, int a_x, int a_y)
 Get a forage location for my species (picked randomly among the active locations) More...
 
double GetForageRateDensity (double a_foragedensity)
 Get the forage intake rate for a forage density. More...
 
double GetGrainDensity (int a_index)
 Returns the forage density for a forage location. More...
 
int GetIsDaylight ()
 Is it daylight hours? Daylight starts at m_daytime == 0. More...
 
Goose_BaseGetLeader (APoint a_homeloc, GooseSpecies a_species)
 Asks for a pointer to a goose that can be followed. More...
 
double GetMaizeDensity (int a_index)
 Returns the maize forage density for a forage location. More...
 
double GetMaizeFeedingRate (double a_maizedensity, GooseSpecies a_species)
 Get the forage rate when feeding on maize. More...
 
int GetNumberOfForageLocs (void)
 Get the number of forage locations. More...
 
double GetThermalCosts (GooseSpecies a_goose)
 Get daily thermal costs const. More...
 
 Goose_Population_Manager (Landscape *L)
 Goose_Population_Manager Constructor. More...
 
void Graze (double a_kJ, int a_index)
 Removes KJ as grams veg biomass from a forage area. More...
 
bool InGreylagSeason ()
 Are we in the greylag hunting season? More...
 
bool InPinkfootSeason ()
 Are we in the pinkfoot hunting season? More...
 
int NewForageLocation (GooseSpeciesType a_type, int a_number, int a_polyref)
 Creates a new forage location and adds a goose or geese to the forage location. Returns an index to the forage location list. More...
 
void RecordDailyEnergyBalance (int a_balance, GooseSpecies a_species)
 Record the daily energy balance. More...
 
void RecordDailyEnergyBudget (int a_deb, GooseSpecies a_species)
 Record the daily energy budget. More...
 
void RecordFlightDistance (int a_distance, GooseSpecies a_species)
 Record the flight distance. More...
 
void RecordForagingTime (int a_time, GooseSpecies a_species)
 Record the time spent foraging. More...
 
void RecordHabitatUse (int a_habitatype, GooseSpecies a_species, int a_count)
 Record the habitat use. More...
 
void RecordHabitatUseFieldObs (int a_habitatype, GooseSpecies a_species, int a_count)
 Record the habitat use. More...
 
void RecordIndForageLoc (double a_count, int a_groupsize, GooseSpecies a_species)
 Record a forage location count. More...
 
void RecordLeaveReason (TTypeOfLeaveReason a_leavereason, GooseSpeciesType a_speciestype)
 Record the reason for leaving. More...
 
void RecordState ()
 Record the state. More...
 
void RecordWeight (double a_weight, GooseSpecies a_species)
 Record the weight. More...
 
void RemoveGeeseFromForageLocation (GooseSpeciesType a_type, int a_index, int a_number)
 Removes a goose or geese to the forage location - requires an index. More...
 
void RemoveGrainKJ (double a_kJ, int a_index)
 Removes kJ eaten as grains from a forage area. More...
 
void RemoveMaizeKJ (double a_kJ, int a_index)
 Removes KJ eaten as maize from a forage area. More...
 
void RemoveMaxForageKj (double a_forage, TTypeOfMaxIntakeSource a_maxintakesource, int m_myForageIndex)
 Removes the forage eaten from the field. More...
 
virtual ~Goose_Population_Manager (void)
 Goose_Population_Manager Destructor. More...
 

Public Attributes

std::vector< GooseActiveForageLocationm_GooseForageLocations
 Is a list of active goose forage locations where we have geese. More...
 
Variate_gen * m_variate_generator
 Function to be able to draw randomly from predefined distributions. More...
 

Protected Member Functions

void ClearGooseDailyEnergyBalanceStats ()
 Clear simple stats for daily energy balance in the population. More...
 
void ClearGooseDailyEnergyBudgetStats ()
 Clear simple stats for daily energy budget in the population. More...
 
void ClearGooseFlightDistanceStats ()
 Clear simple stats for flight distances in the population. More...
 
void ClearGooseForagingTimeStats ()
 Clear simple stats for foraging times in the population. More...
 
void ClearGooseHabitatUseFieldObsStats ()
 Clear simple stats for field obs habitat use. More...
 
void ClearGooseHabitatUseStats ()
 Clear simple stats for habitat use. More...
 
void ClearGooseLeaveReasonStats ()
 Clear simple stats for the reasons for leaving the simulation. More...
 
void ClearGooseWeightStats ()
 Clear simple stats for the weights in the population. More...
 
void ClearIndLocCountStats ()
 Clear simple stats for forage location counts. More...
 
void ClearStateStats ()
 Clear simple stats for the states. More...
 
virtual void CloseTheReallyBigOutputProbe ()
 Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used. More...
 
virtual void CloseTheRipleysOutputProbe ()
 Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used. More...
 
virtual void DoAfter ()
 Things to do before the EndStep. More...
 
virtual void DoBefore ()
 Things to do before the Step. More...
 
virtual void DoEmigration ()
 Controls emigration from the Danish simulation area. More...
 
virtual void DoFirst (void)
 Things to do before anything else at the start of a timestep. More...
 
virtual void DoImmigration ()
 Controls immigration to the Danish simulation area. More...
 
virtual void DoLast ()
 Things to do after the EndStep. More...
 
void GetImmigrationNumbers (GooseSpecies a_goose, bool a_season)
 Get the numbers to immigrate. More...
 
void GooseEnergyRecordOutput ()
 Produces output to a standard file describing the number of birds foraging at each field and the field conditions. More...
 
void GooseFieldForageInfoOutput ()
 Produces output to a standard file describing the energetic state of all individuals of the goose populations. More...
 
void GooseHabitatUseFieldObsOutput ()
 Outputs simple stats for the goose habitat use but using rules to mimic field observations. More...
 
void GooseHabitatUseOutput ()
 Outputs simple stats for the goose habitat use. More...
 
void GooseIndLocCountOutput ()
 Outputs simple stats for the number of forage locations visited per goose. More...
 
void GooseLeaveReasonStatOutput ()
 Outputs simple stats for the reasons for leaving the simulation. More...
 
void GoosePopulationDescriptionOutput ()
 Produces output to a standard file describing the state of the goose populations. More...
 
std::string GooseToString (GooseSpecies a_gs)
 Translates gs enum to string
More...
 
std::string GooseTypeToString (GooseSpeciesType a_gst)
 Translates gst enum to string
More...
 
void GooseWeightStatOutput ()
 Outputs simple stats for the weights in the population. More...
 
bool InHuntingSeason (int a_day, GooseSpecies a_species)
 Are we in the hunting season? More...
 
virtual void Init (void)
 Called upon initialization of the simulation. Sets up output files. More...
 
std::string IntakeSourceToString (TTypeOfMaxIntakeSource a_intake_source)
 Translates tomis enum to string
More...
 
std::string LeaveReasonToString (TTypeOfLeaveReason a_leave_reason)
 Translates tolr enum to string
More...
 
void ObservedOpennessQuery ()
 Writes a file with the openness scores on places where geese have been observed in the field. More...
 
void StateStatOutput ()
 Write simple stats for the states. More...
 
virtual void TheAOROutputProbe ()
 The modified goose version of the standard output for creating AOR statistics. More...
 
virtual void TheRipleysOutputProbe (FILE *)
 Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used. More...
 
void WriteConfig ()
 Writes a file the values of the config variables used. More...
 
void WriteHeaders (ofstream *a_file, std::vector< std::string > a_headers)
 Handy function for writing headers. More...
 
void XYDump ()
 Outputs x y data. More...
 

Protected Attributes

AOR_Probe_Goose * m_AOR_Barnacles
 AOR Probe for barnacles. More...
 
AOR_Probe_Goose * m_AOR_Greylags
 AOR Probe for greylags. More...
 
AOR_Probe_Goose * m_AOR_Pinkfeet
 AOR Probe for pinkfeet. More...
 
SimpleStatistics m_DailyEnergyBalanceStats [gs_foobar]
 Statistics for the daily energy balance in the population. More...
 
SimpleStatistics m_DailyEnergyBudgetStats [gs_foobar]
 Statistics for the daily energy budget in the population. More...
 
bool m_daylight
 Flag for in daylight hours. Sunrise is always at m_daytime == 0. More...
 
int m_daylightleft
 Number of daylight minutes left. More...
 
int m_daytime
 Holds the time of day. Note that sunrise is at m_daytime == 0. More...
 
SimpleStatistics m_FlightDistanceStats [gs_foobar]
 Statistics for the flight distances in the population. More...
 
PettiforFeedingTimeCurveClass * m_ForageRateVSGooseDensity
 Speed optimisation to hold all potential competition reductions in the range 0 - 1 goose/m2. More...
 
SimpleStatistics m_ForagingTimeStats [gs_foobar]
 Statistics for the time spent foraging for the population. More...
 
ofstream * m_GooseEnergeticsDataFile
 Pointer to an output file for goose energetics data. More...
 
ofstream * m_GooseFieldForageDataFile
 Pointer to an output file for goose field forage data. More...
 
ofstream * m_GooseGitVersionFile
 Pointer to an output file for almass version. More...
 
ofstream * m_GooseHabitatUseFieldObsFile
 Pointer to an output file for goose habitat use data, field observation mimic version. More...
 
ofstream * m_GooseHabitatUseFile
 Pointer to an output file for goose habitat use data. More...
 
ofstream * m_GooseIndLocCountFile
 Pointer to an output file for goose individual forage location count data. More...
 
ofstream * m_GooseLeaveReasonStatsFile
 Pointer to an output file for goose leave reason stats data. More...
 
ofstream * m_GoosePopDataFile
 Pointer to an output file for goose population data. More...
 
ofstream * m_GooseWeightStatsFile
 Pointer to an output file for goose weight stats data. More...
 
ofstream * m_GooseXYDumpFile
 Pointer to an output file for goose x y data. More...
 
bool m_GreylagSeason
 Flag to indicate if we are in the greylag hunting season. More...
 
int m_HabitatUseFieldObsStats [gs_foobar *tomis_foobar]
 Data for the habitat use, field observation mimic version. More...
 
int m_HabitatUseStats [gs_foobar *tomis_foobar]
 Data for the habitat use. More...
 
SimpleStatistics m_IndividualForageLocationData [gs_foobar]
 Statistics for the number of forage locations visited per goose of the population. More...
 
HollingsDiscCurveClass * m_IntakeRateVSGrainDensity_PF
 Speed optimisation to hold all potential forage rates in the range 0-X grain density per m2. More...
 
HollingsDiscCurveClass * m_IntakeRateVSMaizeDensity_BN
 Speed optimisation to hold all potential forage rates in the range 0-X maize density per m2. More...
 
SimpleStatistics m_LeaveReasonStats [gst_foobar][tolr_foobar]
 Statistics for reasons for leaving the simulation. More...
 
int m_migrationnumbers [3][2]
 Storage for goose numbers. Used when birds are immigrating. More...
 
bool m_PinkfootSeason
 Flag to indicate if we are in the pinkfoot hunting season? More...
 
std::vector< roostlistm_roosts
 The list of roosts
More...
 
SimpleStatistics m_StateStats
 Debugging code. Statistics for the number of times a state method is called. More...
 
ofstream * m_StateStatsFile
 Pointer to an output file for state stats data. More...
 
double m_thermalcosts [3]
 Temporary storage for daily goose energetic thermal costs constant for each species. More...
 
SimpleStatistics m_WeightStats [gs_foobar]
 Statistics for the weights of the population. More...
 
std::vector< int > m_youngdist
 The observed distribution of young for pink feet. More...
 

Detailed Description

The class to handle all goose population related matters.

Definition at line 392 of file Goose_Population_Manager.h.

Constructor & Destructor Documentation

◆ Goose_Population_Manager()

Goose_Population_Manager::Goose_Population_Manager ( Landscape L)

Goose_Population_Manager Constructor.

Set up before step action sorts This determines how we handle the arrays between steps

There is a mandatory file for goose populations that describe the roost locations for each goose type in the landscape - GooseRoosts.txt For each type of goose the x,y locations for roosts are listed

Read in a file with the distribution of the brood sizes as observed from the field. We only have data from Pinkfeet, so this distribution is recycled for the other species

Create curves for food intake rates and forage rates

Definition at line 550 of file Goose_Population_Manager.cpp.

550  : Population_Manager(L)
551 {
553  // Initialise member variables
554  m_thermalcosts[0] = 0.0;
555  m_thermalcosts[1] = 0.0;
556  m_thermalcosts[2] = 0.0;
557  // Set start of day - which is at sunrise. 10 is added to m_daytime in DoFirst. Therfore we start out with -10.
558  m_daytime = -10;
559  // Load List of Animal Classes
560  m_ListNames[0] = "Pinkfoot Family";
561  m_ListNames[1] = "Pinkfoot Nonbreeder";
562  m_ListNames[2] = "Barnacle Family";
563  m_ListNames[3] = "Barnacle Nonbreeder";
564  m_ListNames[4] = "Greylag Family";
565  m_ListNames[5] = "Greylag Nonbreeder";
566  m_ListNameLength = 6;
567  m_population_type = TOP_Goose;
568  // We need one vector for each life stage
569  for (unsigned i=0; i<(10-m_ListNameLength); i++)
570  {
571  TheArray.pop_back();
572  }
573  strcpy( m_SimulationName, "Goose Simulation" );
577  BeforeStepActions[0]=5; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3=SortXIndex, 4 = do nothing, 5 = shuffle 1 in 500 times
578  BeforeStepActions[1]=5; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3=SortXIndex, 4 = do nothing, 5 = shuffle 1 in 500 times
579  BeforeStepActions[2]=5; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3=SortXIndex, 4 = do nothing, 5 = shuffle 1 in 500 times
580  BeforeStepActions[3]=5; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3=SortXIndex, 4 = do nothing, 5 = shuffle 1 in 500 times
581  BeforeStepActions[4]=5; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3=SortXIndex, 4 = do nothing, 5 = shuffle 1 in 500 times
586  ifstream ifile("GooseRoosts.txt");
587  if (!ifile.is_open())
588  {
589  m_TheLandscape->Warn("Goose_Population_Manager::Goose_Population_Manager(Landscape* L) ","GooseRoosts.txt missing");
590  exit(1);
591  }
592  int no_entries;
593  ifile >> no_entries;
594  roostlist r;
595  for (unsigned i = 0; i < gs_foobar; i++) m_roosts.push_back(r);
596  for (int i=0; i< no_entries; i++)
597  {
598  int type;
599  APoint ap;
600  ifile >> type >> ap.m_x >> ap.m_y;
601  m_roosts[type].push_back(ap);
602  }
603 
608  ifstream jfile( "PfYoungDist.txt" );
609  if (!jfile.is_open()) {
610  m_TheLandscape->Warn( "Goose_Population_Manager::Goose_Population_Manager(Landscape* L) ", "PfYoungDist.txt missing" );
611  exit( 1 );
612  }
613  no_entries;
614  jfile >> no_entries;
615  for (int i = 0; i< no_entries; i++) {
616  int young;
617  jfile >> young;
618  m_youngdist.push_back( young );
619  }
620  // We dont start in the hunting season
621  m_PinkfootSeason = false;
622  m_GreylagSeason = false;
623  // We make one goose base just to access its static members
624  APoint pt;
625  pt.m_x = 0;
626  pt.m_y = 0;
627  Goose_Base gb(NULL,NULL,1,true, pt);
628  gb.SetFlightCost(cfg_goose_flightcost.value());
629  gb.Set_mingooseforagerate(0.0, gs_Pinkfoot);
630  gb.Set_mingooseforagerate(0.0, gs_Barnacle);
631  gb.Set_mingooseforagerate(0.0, gs_Greylag);
632  gb.Set_Indivmingooseforagerate( 0.0 );
633  gb.Set_GooseMaxAppetiteScaler(cfg_goose_MaxAppetiteScaler.value());
634  gb.Set_GooseMaxEnergyReserveProportion( cfg_goose_MaxEnergyReserveProportion.value() );
635  gb.Set_GooseKJtoFatConversion( 1.0/(cfg_goose_EnergyContentOfFat.value() + cfg_goose_MetabolicConversionCosts.value()));
636  gb.Set_GooseFattoKJConversion(1.0 / (cfg_goose_EnergyContentOfFat.value() - cfg_goose_MetabolicConversionCosts.value()));
637  gb.Set_GooseMinForageOpenness( cfg_goose_MinForageOpenness.value() );
638  gb.Set_GooseLeavingThreshold( cfg_goose_LeavingThreshold.value() * 5.0); // 5 because we use a 5-day running average
641 
642  gb.Set_GooseFollowingLikelyhood(cfg_goose_bn_followinglikelyhood.value(), gst_BarnacleFamilyGroup);
643  gb.Set_GooseFollowingLikelyhood(cfg_goose_pf_followinglikelyhood.value(), gst_PinkfootFamilyGroup);
644  gb.Set_GooseFollowingLikelyhood(cfg_goose_gl_followinglikelyhood.value(), gst_GreylagFamilyGroup);
645  // We use the value for families for NB also. Currently not possible to quantify a difference.
646  // At a later stage we might want to explore this more, so we keep the cfg for later.
647  gb.Set_GooseFollowingLikelyhood(cfg_goose_bn_followinglikelyhood.value(), gst_BarnacleNonBreeder);
648  gb.Set_GooseFollowingLikelyhood(cfg_goose_pf_followinglikelyhood.value(), gst_PinkfootNonBreeder);
649  gb.Set_GooseFollowingLikelyhood(cfg_goose_gl_followinglikelyhood.value(), gst_GreylagNonBreeder);
650 
651  gb.Set_GooseLeavingRoost( true );
655  m_IntakeRateVSMaizeDensity_BN = new HollingsDiscCurveClass( cfg_H2A.value(), cfg_H2B.value(), cfg_H2C.value(), cfg_H2D.value(), cfg_H2E.value(), cfg_H2F.value() );
656  if (cfg_WriteCurve.value()) {
657  m_ForageRateVSGooseDensity->WriteDataFile( 10 );
658  m_IntakeRateVSGrainDensity_PF->WriteDataFile( 10 );
659  m_IntakeRateVSMaizeDensity_BN->WriteDataFile( 10 );
660  }
661  // Set up a normal distribution which we can then draw from at random
662  Mersenne_Twister twister;
663  NormalDistDouble LeaveNormal( cfg_goose_RoostLeaveDistMean.value(), cfg_goose_RoostLeaveDistSD.value() ); // mean and std
664  m_variate_generator = new Variate_gen( twister, LeaveNormal );
665  Init();
666 }

References cfg_goose_bn_FieldForageDist, cfg_goose_bn_followinglikelyhood, cfg_goose_bn_ForageDist, cfg_goose_EnergyContentOfFat, cfg_goose_flightcost, cfg_goose_gl_FieldForageDist, cfg_goose_gl_followinglikelyhood, cfg_goose_gl_ForageDist, cfg_goose_LeavingThreshold, cfg_goose_MaxAppetiteScaler, cfg_goose_MaxEnergyReserveProportion, cfg_goose_MetabolicConversionCosts, cfg_goose_MinForageOpenness, cfg_goose_ModelExitDay, cfg_goose_pf_FieldForageDist, cfg_goose_pf_followinglikelyhood, cfg_goose_pf_ForageDist, cfg_goose_RoostLeaveDistMean, cfg_goose_RoostLeaveDistSD, cfg_H1A, cfg_H1B, cfg_H1C, cfg_H1D, cfg_H1E, cfg_H1F, cfg_H2A, cfg_H2B, cfg_H2C, cfg_H2D, cfg_H2E, cfg_H2F, cfg_Petti1A, cfg_Petti1B, cfg_Petti1C, cfg_Petti1D, cfg_Petti1E, cfg_Petti1F, cfg_Petti1G, cfg_WriteCurve, g_torun, gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, Init(), m_daytime, m_ForageRateVSGooseDensity, m_GreylagSeason, m_IntakeRateVSGrainDensity_PF, m_IntakeRateVSMaizeDensity_BN, m_PinkfootSeason, m_roosts, m_thermalcosts, m_variate_generator, m_youngdist, Goose_Base::Set_GooseFattoKJConversion(), Goose_Base::Set_GooseFieldForageDist(), Goose_Base::Set_GooseFollowingLikelyhood(), Goose_Base::Set_GooseForageDist(), Goose_Base::Set_GooseKJtoFatConversion(), Goose_Base::Set_GooseLeavingRoost(), Goose_Base::Set_GooseLeavingThreshold(), Goose_Base::Set_GooseMaxAppetiteScaler(), Goose_Base::Set_GooseMaxEnergyReserveProportion(), Goose_Base::Set_GooseMinForageOpenness(), Goose_Base::Set_Indivmingooseforagerate(), Goose_Base::Set_mingooseforagerate(), Goose_Base::SetFlightCost(), CfgInt::value(), CfgFloat::value(), CfgBool::value(), and CfgStr::value().

◆ ~Goose_Population_Manager()

Goose_Population_Manager::~Goose_Population_Manager ( void  )
virtual

Goose_Population_Manager Destructor.

Close files and delete pointers to them

Delete any memory constructs created by new

Definition at line 514 of file Goose_Population_Manager.cpp.

515 {
517  m_GoosePopDataFile->close();
518  delete m_GoosePopDataFile;
521  m_GooseEnergeticsDataFile->close();
523  m_GooseIndLocCountFile->close();
524  delete m_GooseIndLocCountFile;
525  m_GooseHabitatUseFile->close();
526  delete m_GooseHabitatUseFile;
529  m_GooseWeightStatsFile->close();
530  delete m_GooseWeightStatsFile;
535  delete m_variate_generator;
536  if (cfg_AOROutput_used.value()) {
537  delete m_AOR_Pinkfeet;
538  delete m_AOR_Greylags;
539  delete m_AOR_Barnacles;
540  }
541  m_GooseXYDumpFile->close();
542  delete m_GooseXYDumpFile;
544  m_GooseGitVersionFile ->close();
545  delete m_GooseGitVersionFile;
546  }
547 }

References cfg_AOROutput_used, l_map_print_git_version_info, m_AOR_Barnacles, m_AOR_Greylags, m_AOR_Pinkfeet, m_ForageRateVSGooseDensity, m_GooseEnergeticsDataFile, m_GooseFieldForageDataFile, m_GooseGitVersionFile, m_GooseHabitatUseFieldObsFile, m_GooseHabitatUseFile, m_GooseIndLocCountFile, m_GoosePopDataFile, m_GooseWeightStatsFile, m_GooseXYDumpFile, m_IntakeRateVSGrainDensity_PF, m_IntakeRateVSMaizeDensity_BN, m_variate_generator, and CfgBool::value().

Member Function Documentation

◆ AddGeeseToForageLocation()

void Goose_Population_Manager::AddGeeseToForageLocation ( GooseSpeciesType  a_type,
int  a_index,
int  a_number 
)

Adds a goose or geese to the forage location - requires an index.

Definition at line 1806 of file Goose_Population_Manager.cpp.

1807  {
1808  m_GooseForageLocations[a_index].AddGeese(a_type, a_number);
1809  }

References m_GooseForageLocations.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ AddGeeseToForageLocationP()

void Goose_Population_Manager::AddGeeseToForageLocationP ( GooseSpeciesType  a_type,
int  a_polyref,
int  a_number 
)

Adds a goose or geese to the forage location - uses polygon number as reference.

f First step is to get the forage location - then add the number of birds of a_type to it.

Definition at line 1819 of file Goose_Population_Manager.cpp.

1820  {
1824  int index = ForageLocationInUse( a_polyref );
1825  if (index == -1 )
1826  {
1827  NewForageLocation(a_type,a_number, a_polyref);
1828  }
1829  else m_GooseForageLocations[index].AddGeese(a_type, a_number);
1830  }

References ForageLocationInUse(), m_GooseForageLocations, and NewForageLocation().

◆ BangAtPoly()

void Goose_Population_Manager::BangAtPoly ( int  a_polyref)

Passes a 'Bang' message to birds near to the location specified by the polygon reference.

Here we have to find all the geese that are near to this polygon - then tell them they are scared of this location. Unfortunately there is no easy way to do this except trawl through all geese and test the distance they are from the bang at the moment this method is called. We assume the bang occurs at the centroid since we do not have a particular location for this within the polygon. Centroid distance to the location of each bird is checked and if under the maximum threat distance then we tell the bird they are scared. An alternative approach would be to link the size of scare to the distance. This is provided as an alternative assuming __LINKGOOSESCARETODISTANCE is defined.

Definition at line 1947 of file Goose_Population_Manager.cpp.

1948 {
1957  int polyX = m_TheLandscape->SupplyCentroidX(a_polyref);
1958  int polyY = m_TheLandscape->SupplyCentroidY(a_polyref);
1959  int maxscaredist = cfg_goose_MaxScareDistance.value();
1960  for (unsigned i=0; i<(m_ListNameLength); i++)
1961  {
1962  unsigned sz = (unsigned) TheArray[i].size();
1963  for (unsigned j=0; j<sz; j++)
1964  {
1965  APoint ap = TheArray[i][j]->SupplyPoint();
1966  int dist = g_AlmassMathFuncs.CalcDistPythagorasApprox( polyX, polyY, ap.m_x, ap.m_y );
1967  if (dist < maxscaredist)
1968  {
1969  Goose_Base* gb = dynamic_cast<Goose_Base*>(TheArray[i][j]);
1970 #ifdef __LINKGOOSESCARETODISTANCE
1971 
1972  gb->On_Bang(a_polyref, 1.0-(double) (dist/maxscaredist));
1973 #else
1974  gb->On_Bang(a_polyref);
1975 #endif
1976  }
1977  }
1978  }
1979 }

References ALMaSS_MathFuncs::CalcDistPythagorasApprox(), cfg_goose_MaxScareDistance, g_AlmassMathFuncs, Goose_Base::On_Bang(), and CfgInt::value().

Referenced by GooseHunter::st_OutHunting().

◆ BirdsShot()

void Goose_Population_Manager::BirdsShot ( int  a_polyref,
int  a_numbershot,
GooseHunter a_Hunter 
)

Passes the message to shoot a number of birds at a forage location.

First step is to get the forage location - the we pick a_numbershot birds to kill. This is a bit problematic since we know the type of birds but not exactly which ones are here. To speed things up as much as possible we first determine which birds will be shot by picking randomly from the birds here. Next we need to make some 'BANG's and scare the birds away from this location and nearby locations. Note that barnacle geese cannot be shot and are excluded by the loop below.

Todo:
Add input parameter to docu

Definition at line 1862 of file Goose_Population_Manager.cpp.

1863  {
1872  int index = ForageLocationInUse(a_polyref);
1873  if (index == -1)
1874  {
1875  g_msg->Warn("Goose_Population_Manager::BirdsShot - No birds at this location to shoot. Tried to kill ", a_numbershot);
1876  exit(0);
1877  }
1878  int birds = (int)m_GooseForageLocations[index].GetHuntables(); // This is the number of geese not number of objects!
1879  if (birds < 1) return; // Other hunters have shot all the birds already
1881  int found = 0;
1882  int counter = 0;
1883  while (a_numbershot > 0)
1884  {
1885  counter++;
1886  if (counter > 25)
1887  {
1888  int pffg = m_GooseForageLocations[index].GetBirds(gst_PinkfootFamilyGroup);
1889  int pfnb = m_GooseForageLocations[index].GetBirds(gst_PinkfootNonBreeder);
1890  int glfg = m_GooseForageLocations[index].GetBirds(gst_GreylagFamilyGroup);
1891  int glnb = m_GooseForageLocations[index].GetBirds(gst_GreylagNonBreeder);
1892  //cout << "Goose_Population_Manager::BirdsShot() Been shooting like crazy all morning - something is not quite right here...";
1893  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - where are those damn birds?. Tried to kill ", a_numbershot);
1894  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - there where supposed to this many of them:", birds);
1895  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - consisting of pinkfoot familygroups:", pffg);
1896  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - consisting of pinkfoot nonbreeders:", pfnb);
1897  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - consisting of greylag familygroups:", glfg);
1898  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - consisting of greylag nonbreeders:", glnb);
1899  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - Today is day in year:", g_land->SupplyDayInYear());
1900  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - in year:", g_land->SupplyYear());
1901  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - Pinkfoot season?", m_PinkfootSeason);
1902  g_msg->Warn("Goose_Population_Manager::BirdsShot() - in while() - Greylag season?", m_GreylagSeason);
1903  exit(0);
1904  }
1905  found = 0;
1906  int deadbird = (int)(g_rand_uni() * birds);
1907  {
1908  found = m_GooseForageLocations[index].GetBirds(gst_PinkfootFamilyGroup);
1909  if (found > deadbird && InPinkfootSeason()) gst = gst_PinkfootFamilyGroup;
1910  else {
1911  deadbird -= found;
1912  found = m_GooseForageLocations[index].GetBirds(gst_PinkfootNonBreeder);
1913  if (found > deadbird && InPinkfootSeason()) gst = gst_PinkfootNonBreeder;
1914  else {
1915  deadbird -= found;
1916  found = m_GooseForageLocations[index].GetBirds(gst_GreylagNonBreeder);
1917  if (found > deadbird && InGreylagSeason()) gst = gst_GreylagNonBreeder;
1918  else {
1919  deadbird -= found;
1920  found = m_GooseForageLocations[index].GetBirds(gst_GreylagFamilyGroup);
1921  if (found > deadbird && InGreylagSeason()) gst = gst_GreylagFamilyGroup;
1922  }
1923  }
1924  }
1925  }
1926  // gst has the enum value identifying the type of shot bird.
1927  int sz = int(GetLiveArraySize(gst));
1928  for (int i = 0; i < sz; i++)
1929  {
1930  if (TheArray[gst][i]->SupplyPolygonRef() == a_polyref)
1931  {
1932  if (TheArray[gst][i]->GetCurrentStateNo() != -1)
1933  {
1934  // Kill the bird
1935  TheArray[gst][i]->KillThis();
1936  // Tell the hunter
1937  a_hunter->OnShotABird(gst, a_polyref);
1938  a_numbershot--;
1939  break;
1940  }
1941  }
1942  }
1943  }
1944 }

References ForageLocationInUse(), g_land, g_msg, g_rand_uni, gst_foobar, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, InGreylagSeason(), InPinkfootSeason(), m_GooseForageLocations, m_GreylagSeason, m_PinkfootSeason, GooseHunter::OnShotABird(), Landscape::SupplyDayInYear(), Landscape::SupplyYear(), and MapErrorMsg::Warn().

Referenced by GooseHunter::OnShoot(), and GooseHunter::st_OutHunting().

◆ BirdsToShootAtPoly()

int Goose_Population_Manager::BirdsToShootAtPoly ( int  a_poly)

Returns the number of birds at a forage location - given by a poly ref.

Assumes that a_protectedpct is initialised to 0.0 on entry. First step is to get the forage location - the find out how many birds are there.

Definition at line 1833 of file Goose_Population_Manager.cpp.

1834  {
1838  int index = ForageLocationInUse(a_polyref);
1839  if (index == -1) return 0;
1840  // There are birds here - so how many and what type?
1841  int geese = 0;
1842  if (InPinkfootSeason())
1843  {
1845  }
1846  if (InGreylagSeason())
1847  {
1849  }
1850 
1851  //int protectedgeese = m_GooseForageLocations[index].GetBirds(gst_BarnacleFamilyGroup) + m_GooseForageLocations[index].GetBirds(gst_BarnacleNonBreeder);
1852  //int birds = geese+protectedgeese;
1853  //if (protectedgeese> 0) a_protectedpct = protectedgeese / (double)(birds); // else a_protectedpct = 0.0; This is not necessary since a_protectedpct should be 0.0 on entry
1854  if (geese < 0) {
1855  g_msg->Warn("Goose_Population_Manager::BirdsToShootAtPoly 0 or less then 0 geese to shoot.", geese);
1856  exit(0);
1857  }
1858  return geese;
1859  }

References ForageLocationInUse(), g_msg, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, InGreylagSeason(), InPinkfootSeason(), m_GooseForageLocations, and MapErrorMsg::Warn().

Referenced by GooseHunter::OnShoot(), and GooseHunter::st_OutHunting().

◆ ClearGooseDailyEnergyBalanceStats()

void Goose_Population_Manager::ClearGooseDailyEnergyBalanceStats ( )
protected

Clear simple stats for daily energy balance in the population.

Definition at line 2250 of file Goose_Population_Manager.cpp.

2251 {
2252  for (unsigned i = 0; i < gs_foobar; i++)
2253  {
2254  m_DailyEnergyBalanceStats[(GooseSpecies)i].ClearData();
2255  }
2256 }

References m_DailyEnergyBalanceStats.

Referenced by DoLast().

◆ ClearGooseDailyEnergyBudgetStats()

void Goose_Population_Manager::ClearGooseDailyEnergyBudgetStats ( )
protected

Clear simple stats for daily energy budget in the population.

Definition at line 2236 of file Goose_Population_Manager.cpp.

2237 {
2238  for (unsigned i = 0; i < gs_foobar; i++)
2239  {
2240  m_DailyEnergyBudgetStats[(GooseSpecies)i].ClearData();
2241  }
2242 }

References m_DailyEnergyBudgetStats.

Referenced by DoLast().

◆ ClearGooseFlightDistanceStats()

void Goose_Population_Manager::ClearGooseFlightDistanceStats ( )
protected

Clear simple stats for flight distances in the population.

Definition at line 2222 of file Goose_Population_Manager.cpp.

2223 {
2224  for (unsigned i = 0; i < gs_foobar; i++)
2225  {
2226  m_FlightDistanceStats[(GooseSpecies)i].ClearData();
2227  }
2228 }

References m_FlightDistanceStats.

Referenced by DoLast().

◆ ClearGooseForagingTimeStats()

void Goose_Population_Manager::ClearGooseForagingTimeStats ( )
protected

Clear simple stats for foraging times in the population.

Definition at line 2208 of file Goose_Population_Manager.cpp.

2209 {
2210  for (unsigned i = 0; i < gs_foobar; i++)
2211  {
2212  m_ForagingTimeStats[(GooseSpecies)i].ClearData();
2213  }
2214 }

References m_ForagingTimeStats.

Referenced by DoLast().

◆ ClearGooseHabitatUseFieldObsStats()

void Goose_Population_Manager::ClearGooseHabitatUseFieldObsStats ( )
protected

Clear simple stats for field obs habitat use.

Definition at line 2195 of file Goose_Population_Manager.cpp.

2195  {
2196  for (unsigned i = 0; i < gs_foobar*tomis_foobar; i++)
2197  {
2199  }
2200 }

References m_HabitatUseFieldObsStats, and tomis_foobar.

Referenced by GooseHabitatUseFieldObsOutput(), and Init().

◆ ClearGooseHabitatUseStats()

void Goose_Population_Manager::ClearGooseHabitatUseStats ( )
protected

Clear simple stats for habitat use.

Definition at line 2188 of file Goose_Population_Manager.cpp.

2188  {
2189  for (unsigned i = 0; i < gs_foobar*tomis_foobar; i++)
2190  {
2191  m_HabitatUseStats[i] = 0;
2192  }
2193 }

References m_HabitatUseStats, and tomis_foobar.

Referenced by GooseHabitatUseOutput(), and Init().

◆ ClearGooseLeaveReasonStats()

void Goose_Population_Manager::ClearGooseLeaveReasonStats ( )
protected

Clear simple stats for the reasons for leaving the simulation.

Definition at line 2284 of file Goose_Population_Manager.cpp.

2284  {
2285  for (unsigned i = 0; i < gst_foobar; i++)
2286  {
2287  for (unsigned j = 0; j < tolr_foobar; j++)
2288  {
2290  }
2291  }
2292 }

References gst_foobar, m_LeaveReasonStats, and tolr_foobar.

Referenced by DoLast().

◆ ClearGooseWeightStats()

void Goose_Population_Manager::ClearGooseWeightStats ( )
protected

Clear simple stats for the weights in the population.

Definition at line 2169 of file Goose_Population_Manager.cpp.

2169  {
2170  for (unsigned i = 0; i < gs_foobar; i++)
2171  {
2172  m_WeightStats[(GooseSpecies)i].ClearData();
2173  }
2174 }

References m_WeightStats.

Referenced by DoLast().

◆ ClearIndLocCountStats()

void Goose_Population_Manager::ClearIndLocCountStats ( )
protected

Clear simple stats for forage location counts.

Definition at line 2264 of file Goose_Population_Manager.cpp.

2264  {
2265  for (unsigned i = 0; i < gs_foobar; i++)
2266  {
2267  m_IndividualForageLocationData[(GooseSpecies)i].ClearData();
2268  }
2269 }

References m_IndividualForageLocationData.

Referenced by DoLast().

◆ ClearStateStats()

void Goose_Population_Manager::ClearStateStats ( )
protected

Clear simple stats for the states.

Definition at line 2276 of file Goose_Population_Manager.cpp.

2276  {
2277  m_StateStats.ClearData();
2278 }

References m_StateStats.

Referenced by DoLast().

◆ CloseTheReallyBigOutputProbe()

virtual void Goose_Population_Manager::CloseTheReallyBigOutputProbe ( )
inlineprotectedvirtual

Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used.

Definition at line 832 of file Goose_Population_Manager.h.

832 { ; }

◆ CloseTheRipleysOutputProbe()

virtual void Goose_Population_Manager::CloseTheRipleysOutputProbe ( )
inlineprotectedvirtual

Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used.

Definition at line 830 of file Goose_Population_Manager.h.

830 { ; }

◆ CreateObjects()

void Goose_Population_Manager::CreateObjects ( int  ob_type,
TAnimal pvo,
struct_Goose data,
int  number 
)

Method for creating a new individual Goose.

Definition at line 898 of file Goose_Population_Manager.cpp.

899 {
900  for (int i = 0; i<a_number; i++)
901  {
902  switch (a_ob_type)
903  {
905  Goose_Pinkfoot_FamilyGroup* new_PFFamilyGoose;
906  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
907  // We need to reuse an object
908  new_PFFamilyGoose = dynamic_cast<Goose_Pinkfoot_FamilyGroup*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
909  new_PFFamilyGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
910  IncLiveArraySize(a_ob_type);
911  }
912  else {
913  new_PFFamilyGoose = new Goose_Pinkfoot_FamilyGroup(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
914  TheArray[a_ob_type].push_back(new_PFFamilyGoose);
915  IncLiveArraySize(a_ob_type);
916  }
917  break;
919  Goose_Pinkfoot_NonBreeder* new_PFNonbreederGoose;
920  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
921  // We need to reuse an object
922  new_PFNonbreederGoose = dynamic_cast<Goose_Pinkfoot_NonBreeder*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
923  new_PFNonbreederGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
924  IncLiveArraySize(a_ob_type);
925  }
926  else {
927  new_PFNonbreederGoose = new Goose_Pinkfoot_NonBreeder(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
928  TheArray[a_ob_type].push_back(new_PFNonbreederGoose);
929  IncLiveArraySize(a_ob_type);
930  }
931  break;
933  Goose_Barnacle_FamilyGroup* new_BFamilyGoose;
934  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
935  // We need to reuse an object
936  new_BFamilyGoose = dynamic_cast<Goose_Barnacle_FamilyGroup*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
937  new_BFamilyGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
938  IncLiveArraySize(a_ob_type);
939  }
940  else {
941  new_BFamilyGoose = new Goose_Barnacle_FamilyGroup(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
942  TheArray[a_ob_type].push_back(new_BFamilyGoose);
943  IncLiveArraySize(a_ob_type);
944  }
945  break;
947  Goose_Barnacle_NonBreeder* new_BNonbreederGoose;
948  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
949  // We need to reuse an object
950  new_BNonbreederGoose = dynamic_cast<Goose_Barnacle_NonBreeder*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
951  new_BNonbreederGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
952  IncLiveArraySize(a_ob_type);
953  }
954  else {
955  new_BNonbreederGoose = new Goose_Barnacle_NonBreeder(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
956  TheArray[a_ob_type].push_back(new_BNonbreederGoose);
957  IncLiveArraySize(a_ob_type);
958  }
959  break;
961  Goose_Greylag_NonBreeder* new_GNonbreederGoose;
962  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
963  // We need to reuse an object
964  new_GNonbreederGoose = dynamic_cast<Goose_Greylag_NonBreeder*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
965  new_GNonbreederGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
966  IncLiveArraySize(a_ob_type);
967  }
968  else {
969  new_GNonbreederGoose = new Goose_Greylag_NonBreeder(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_roost);
970  TheArray[a_ob_type].push_back(new_GNonbreederGoose);
971  IncLiveArraySize(a_ob_type);
972  }
973  break;
975  Goose_Greylag_FamilyGroup* new_GFamilyGoose;
976  if (unsigned(TheArray[a_ob_type].size())>GetLiveArraySize(a_ob_type)) {
977  // We need to reuse an object
978  new_GFamilyGoose = dynamic_cast<Goose_Greylag_FamilyGroup*>(TheArray[a_ob_type][GetLiveArraySize(a_ob_type)]);
979  new_GFamilyGoose->ReInit(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
980  IncLiveArraySize(a_ob_type);
981  }
982  else {
983  new_GFamilyGoose = new Goose_Greylag_FamilyGroup(a_data->m_L, a_data->m_GPM, a_data->m_weight, a_data->m_sex, a_data->m_grpsize, a_data->m_roost);
984  TheArray[a_ob_type].push_back(new_GFamilyGoose);
985  IncLiveArraySize(a_ob_type);
986  }
987  break;
988  default:
989  char ob[255];
990  sprintf(ob, "%d", (int)a_ob_type);
991  m_TheLandscape->Warn("Goose_Population_Manager::CreateObjects() unknown object type - ", ob);
992  exit(1);
993  break;
994  }
995  }
996 }

References gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, struct_Goose::m_GPM, struct_Goose::m_grpsize, struct_Goose::m_L, struct_Goose::m_roost, struct_Goose::m_sex, struct_Goose::m_weight, Goose_Pinkfoot_FamilyGroup::ReInit(), Goose_Barnacle_FamilyGroup::ReInit(), Goose_Greylag_FamilyGroup::ReInit(), Goose_Barnacle_NonBreeder::ReInit(), Goose_Pinkfoot_NonBreeder::ReInit(), and Goose_Greylag_NonBreeder::ReInit().

Referenced by DoImmigration().

◆ DoAfter()

virtual void Goose_Population_Manager::DoAfter ( )
inlineprotectedvirtual

Things to do before the EndStep.

Definition at line 724 of file Goose_Population_Manager.h.

724 { ; }

◆ DoBefore()

virtual void Goose_Population_Manager::DoBefore ( )
inlineprotectedvirtual

Things to do before the Step.

Definition at line 720 of file Goose_Population_Manager.h.

720 { ; }

◆ DoEmigration()

void Goose_Population_Manager::DoEmigration ( )
protectedvirtual

Controls emigration from the Danish simulation area.

Definition at line 1651 of file Goose_Population_Manager.cpp.

1652 {
1653  double emigrationchance;
1654  // Get the date as day in year
1655  int today = m_TheLandscape->SupplyDayInYear();
1656  // Pink foot emigration?
1657  if ((today >= cfg_goose_pf_leavingdatestart.value()) && (today <= cfg_goose_pf_leavingdateend.value()))
1658  {
1659  // Should do some emigration. The chance of this is determined by the date. This is a linearly scaling probability
1660  // equal to 1/(1+lastdate-today)
1661  emigrationchance = 1.0 / (1 + cfg_goose_pf_leavingdateend.value() - today);
1662  // Now we loop through all geese and set the behaviour to emigrate
1663  int sz = int(GetLiveArraySize(gst_PinkfootFamilyGroup));
1664  for (int j = 0; j<sz; j++)
1665  {
1666  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->On_Emigrate();
1667  }
1668  sz = int(GetLiveArraySize(gst_PinkfootNonBreeder));
1669  for (int j = 0; j<sz; j++)
1670  {
1671  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootNonBreeder][j])->On_Emigrate();
1672  }
1673  }
1674  // Pinkfoot fall migration?
1676  emigrationchance = cfg_goose_pf_fallmig_probability.value();
1677  // Now we loop through all geese and set the behaviour to emigrate
1678  int sz = int(GetLiveArraySize(gst_PinkfootFamilyGroup));
1679  for (int j = 0; j<sz; j++) {
1680  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->On_Emigrate();
1681  }
1682  sz = int(GetLiveArraySize(gst_PinkfootNonBreeder));
1683  for (int j = 0; j<sz; j++) {
1684  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootNonBreeder][j])->On_Emigrate();
1685  }
1686  }
1687  // Barnacle emigration?
1688  if ((today >= cfg_goose_bn_leavingdatestart.value()) && (today <= cfg_goose_bn_leavingdateend.value()))
1689  {
1690  // Should do some emigration. The chance of this is determined by the date. This is a linearly scaling probability
1691  // equal to 1/(1+lastdate-today)
1692  emigrationchance = 1.0 / (1 + cfg_goose_bn_leavingdateend.value() - today);
1693  // Now we loop through all geese and set the behaviour to emigrate
1694  int sz = int(GetLiveArraySize(gst_BarnacleFamilyGroup));
1695  for (int j = 0; j<sz; j++)
1696  {
1697  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_BarnacleFamilyGroup][j])->On_Emigrate();
1698  }
1699  sz = int(GetLiveArraySize(gst_BarnacleNonBreeder));
1700  for (int j = 0; j<sz; j++)
1701  {
1702  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_BarnacleNonBreeder][j])->On_Emigrate();
1703  }
1704  }
1705  // Barnacle fall migration?
1707  emigrationchance = cfg_goose_bn_fallmig_probability.value();
1708  // Now we loop through all geese and set the behaviour to emigrate
1709  int sz = int(GetLiveArraySize(gst_BarnacleFamilyGroup));
1710  for (int j = 0; j<sz; j++) {
1711  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_BarnacleFamilyGroup][j])->On_Emigrate();
1712  }
1713  sz = int(GetLiveArraySize(gst_BarnacleNonBreeder));
1714  for (int j = 0; j<sz; j++) {
1715  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_BarnacleNonBreeder][j])->On_Emigrate();
1716  }
1717  }
1718  // Greylag emigration?
1719  if ((today >= cfg_goose_gl_leavingdatestart.value()) && (today <= cfg_goose_gl_leavingdateend.value()))
1720  {
1721  // Should do some emigration. The chance of this is determined by the date. This is a linearly scaling probability
1722  // equal to 1/(1+lastdate-today)
1723  emigrationchance = 1.0 / (1 + cfg_goose_gl_leavingdateend.value() - today);
1724  // Now we loop through all geese and set the behaviour to emigrate
1725  int sz = int(GetLiveArraySize(gst_GreylagFamilyGroup));
1726  for (int j = 0; j<sz; j++)
1727  {
1728  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_GreylagFamilyGroup][j])->On_Emigrate();
1729  }
1730  sz = int(GetLiveArraySize(gst_GreylagNonBreeder));
1731  for (int j = 0; j<sz; j++)
1732  {
1733  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_GreylagNonBreeder][j])->On_Emigrate();
1734  }
1735  }
1736  // Greylag fall migration?
1738  emigrationchance = cfg_goose_gl_fallmig_probability.value();
1739  // Now we loop through all geese and set the behaviour to emigrate
1740  int sz = int(GetLiveArraySize(gst_GreylagFamilyGroup));
1741  for (int j = 0; j<sz; j++) {
1742  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_GreylagFamilyGroup][j])->On_Emigrate();
1743  }
1744  sz = int(GetLiveArraySize(gst_GreylagNonBreeder));
1745  for (int j = 0; j<sz; j++) {
1746  if (g_rand_uni() <= emigrationchance) dynamic_cast<Goose_Base*>(TheArray[gst_GreylagNonBreeder][j])->On_Emigrate();
1747  }
1748  }
1749 }

References cfg_goose_bn_fallmig_probability, cfg_goose_bn_fallmigdateend, cfg_goose_bn_fallmigdatestart, cfg_goose_bn_fallmigrate, cfg_goose_bn_leavingdateend, cfg_goose_bn_leavingdatestart, cfg_goose_gl_fallmig_probability, cfg_goose_gl_fallmigdateend, cfg_goose_gl_fallmigdatestart, cfg_goose_gl_fallmigrate, cfg_goose_gl_leavingdateend, cfg_goose_gl_leavingdatestart, cfg_goose_pf_fallmig_probability, cfg_goose_pf_fallmigdateend, cfg_goose_pf_fallmigdatestart, cfg_goose_pf_fallmigrate, cfg_goose_pf_leavingdateend, cfg_goose_pf_leavingdatestart, g_rand_uni, gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, CfgInt::value(), CfgFloat::value(), and CfgBool::value().

Referenced by DoFirst().

◆ DoFirst()

void Goose_Population_Manager::DoFirst ( void  )
protectedvirtual

Things to do before anything else at the start of a timestep.

The Goose_Population_Manager DoFirst has three main functions. The first is to control the variables related to the goose timestep of 10 minutes. Here we assume the daylight hours start at time 0 and go on until the end of the daylength at any given date.
Then, if we are at start of day, then max goose numbers are relayed to the field elements.
Next checks the date and determines if we need to either migrate out of the area or into the area. If so calls the appropriate immigration or emigration code. Otherwise if we are in normal Danish simulation mode then at the start of each day the list of active forage locations is emptied ready to be refilled as the geese start foraging and some global energetic constants are calculated (thermal regulation costs).

Definition at line 1018 of file Goose_Population_Manager.cpp.

1019 {
1029  int dlt = m_TheLandscape->SupplyDaylength();
1030  m_daytime = ( m_daytime + 10 ) % 1440; // We have 10 minutes timesteps. This resets m_daytime to 0 when it hits 1440.
1031  if (m_daytime < dlt ) m_daylight = true; else m_daylight = false;
1032  m_daylightleft = dlt - m_daytime;
1033  /*
1034  * Next checks the date and determines if we need to either migrate out of the area or into the area. If so calls the appropriate immigration or emigration code.
1035  * Otherwise if we are in normal Danish simulation mode then at the start of each day the list of active forage locations is emptied ready to be refilled
1036  * as the geese start foraging.
1037  */
1038  if (m_daytime == 0)
1039  {
1040  DoImmigration();
1041  DoEmigration();
1042  m_GooseForageLocations.clear();
1043  // Calculate energetic constants for each species
1044  double temp = m_TheLandscape->SupplyTemp();
1045  if (temp < cfg_goose_pf_Thermalconstant.value())
1046  {
1047  double dt = cfg_goose_pf_Thermalconstant.value() - temp;
1048  m_thermalcosts[gs_Pinkfoot] = cfg_goose_Thermalconstantb.value() * dt;
1049  }
1050  if (temp < cfg_goose_bn_Thermalconstant.value())
1051  {
1052  double dt = cfg_goose_bn_Thermalconstant.value() - temp;
1053  m_thermalcosts[ gs_Barnacle ] = cfg_goose_Thermalconstantb.value() * dt;
1054  }
1055  if (temp < cfg_goose_gl_Thermalconstant.value())
1056  {
1057  double dt = cfg_goose_gl_Thermalconstant.value() - temp;
1058  m_thermalcosts[ gs_Greylag ] = cfg_goose_Thermalconstantb.value() * dt;
1059  }
1060  }
1061  /*
1062  * Then we check if we are in the hunting season of any of the legal quarry species
1063  */
1064  int today = m_TheLandscape->SupplyDayInYear();
1065  if (InHuntingSeason(today, gs_Pinkfoot))
1066  {
1067  m_PinkfootSeason = true;
1068  }
1069  else m_PinkfootSeason = false;
1070  if (InHuntingSeason(today, gs_Greylag))
1071  {
1072  m_GreylagSeason = true;
1073  }
1074  else m_GreylagSeason = false;
1075  /*
1076  * By March first we reset all grain and maize resources to make sure we don't get
1077  * problems in the following season
1078  */
1079  if (today == cfg_goose_grain_and_maize_reset_day.value()) {
1080  m_TheLandscape->ResetGrainAndMaize();
1081  }
1082 }

References cfg_goose_bn_Thermalconstant, cfg_goose_gl_Thermalconstant, cfg_goose_grain_and_maize_reset_day, cfg_goose_pf_Thermalconstant, cfg_goose_Thermalconstantb, DoEmigration(), DoImmigration(), InHuntingSeason(), m_daylight, m_daylightleft, m_daytime, m_GooseForageLocations, m_GreylagSeason, m_PinkfootSeason, m_thermalcosts, CfgInt::value(), and CfgFloat::value().

◆ DoImmigration()

void Goose_Population_Manager::DoImmigration ( )
protectedvirtual

Controls immigration to the Danish simulation area.

Here we need to determine the inputs in terms of birds to the Danish simulation area and create all the necessary objects and object relationships. This is a tiny bit tricky since it is important that all birds start the simulation with a sensible and complete characteristics.

The first step is to determine whether there are birds of each type to immigrate today, and if so how many. We have the numbers to immigrate and the range of days over which this happens. For sake of simplicity and because we don't have other information we will assume an even distribution of birds over this period.

Pinkfoot spring migration

Barnacle spring migration

Greylag spring migration

Definition at line 1494 of file Goose_Population_Manager.cpp.

1495 {
1505  for (int i = 0; i < gs_foobar; ++i)
1506  {
1507  m_migrationnumbers[i][0] = 0;
1508  m_migrationnumbers[i][1] = 0;
1509  }
1510 
1511  // Get the date as day in year
1512  int today = m_TheLandscape->SupplyDayInYear();
1513  // Pink foot immigration?
1514  if ((today >= cfg_goose_pf_arrivedatestart.value()) && (today <= cfg_goose_pf_arrivedateend.value()))
1515  {
1516  // there are some birds to come in today
1517  GetImmigrationNumbers(gs_Pinkfoot, true); // true is fall immigration
1518  }
1521  if (cfg_goose_pf_leavingdateend.value() > today) {
1522  if ((today >= cfg_goose_pf_springmigdatestart.value()) && (today <= cfg_goose_pf_springmigdateend.value()) && m_SeasonNumber > 0) {
1523  // there are some birds to come in today
1524  GetImmigrationNumbers(gs_Pinkfoot, false); // false is spring immigration
1525  }
1526  }
1527  }
1528  // Barnacle immigration?
1529  if ((today >= cfg_goose_bn_arrivedatestart.value()) && (today <= cfg_goose_bn_arrivedateend.value()))
1530  {
1531  // there are some birds to come in today
1532  GetImmigrationNumbers(gs_Barnacle, true);
1533  }
1536  if (cfg_goose_bn_leavingdateend.value() > today) {
1537  if ((today >= cfg_goose_bn_springmigdatestart.value()) && (today <= cfg_goose_bn_springmigdateend.value()) && m_SeasonNumber > 0) {
1538  // there are some birds to come in today
1539  GetImmigrationNumbers(gs_Barnacle, false);
1540  }
1541  }
1542  }
1543  // Greylag immigration?
1544  if ((today >= cfg_goose_gl_arrivedatestart.value()) && (today <= cfg_goose_gl_arrivedateend.value()))
1545  {
1546  // there are some birds to come in today
1547  GetImmigrationNumbers(gs_Greylag, true);
1548  }
1551  if (cfg_goose_gl_leavingdateend.value() > today) {
1552  if ((today >= cfg_goose_gl_springmigdatestart.value()) && (today <= cfg_goose_gl_springmigdateend.value()) && m_SeasonNumber > 0) {
1553  // there are some birds to come in today
1554  GetImmigrationNumbers(gs_Greylag, false);
1555  }
1556  }
1557  }
1558 
1559  struct_Goose* gs;
1560  gs = new struct_Goose;
1561  gs->m_GPM = this;
1562  gs->m_L = m_TheLandscape;
1563 
1564  int youngno = (int) m_youngdist.size(); // The length of the vector with brood sizes
1565 
1566  // Create the pinkfooted families
1567  for (int i=0; i<m_migrationnumbers[gs_Pinkfoot][0]; i++)
1568  {
1569  // Find the roost location
1570  int index = random((int) m_roosts[gs_Pinkfoot].size());
1571  gs->m_roost = m_roosts[gs_Pinkfoot][index];
1572  gs->m_x = gs->m_roost.m_x;
1573  gs->m_y = gs->m_roost.m_y;
1574  gs->m_sex = true;
1576  gs->m_family = true;
1577  gs->m_grpsize = 2 + m_youngdist[ random(youngno) ];
1579  }
1580  // Create the pink footed non-breeders
1581  for (int i = 0; i<m_migrationnumbers[gs_Pinkfoot][1]; i++)
1582  {
1583  // Find the roost location
1584  int index = random((int) m_roosts[gs_Pinkfoot].size());
1585  gs->m_roost = m_roosts[gs_Pinkfoot][index];
1586  gs->m_x = gs->m_roost.m_x;
1587  gs->m_y = gs->m_roost.m_y;
1588  if (g_rand_uni() < cfg_goose_pf_sexratio.value()) gs->m_sex = true; else gs->m_sex = false; // true = male, false = female
1590  gs->m_family = false;
1592  }
1593  // Create the barnacle families
1594  for (int i = 0; i<m_migrationnumbers[gs_Barnacle][0]; i++)
1595  {
1596  // Find the roost location
1597  int index = random((int) m_roosts[gs_Barnacle].size());
1598  gs->m_roost = m_roosts[gs_Barnacle][index];
1599  gs->m_x = gs->m_roost.m_x;
1600  gs->m_y = gs->m_roost.m_y;
1601  gs->m_sex = true;
1603  gs->m_family = true;
1604  gs->m_grpsize = 2 + m_youngdist[ random( youngno) ]; // Values for Pinkfeet in lack of better data
1605  CreateObjects(gst_BarnacleFamilyGroup, NULL, gs, 1);
1606  }
1607  // Create the barnacle non-breeders
1608  for (int i = 0; i<m_migrationnumbers[gs_Barnacle][1]; i++)
1609  {
1610  // Find the roost location
1611  int index = random((int) m_roosts[gs_Barnacle].size());
1612  gs->m_roost = m_roosts[gs_Barnacle][index];
1613  gs->m_x = gs->m_roost.m_x;
1614  gs->m_y = gs->m_roost.m_y;
1615  if (g_rand_uni() < cfg_goose_bn_sexratio.value()) gs->m_sex = true; else gs->m_sex = false; // true = male, false = female
1617  gs->m_family = false;
1619  }
1620  // Create the greylag families
1621  for (int i = 0; i<m_migrationnumbers[gs_Greylag][0]; i++)
1622  {
1623  // Find the roost location
1624  int index = random((int) m_roosts[gs_Greylag].size());
1625  gs->m_roost = m_roosts[gs_Greylag][index];
1626  gs->m_x = gs->m_roost.m_x;
1627  gs->m_y = gs->m_roost.m_y;
1628  gs->m_sex = true;
1630  gs->m_family = true;
1631  gs->m_grpsize = 2 + m_youngdist[ random( youngno) ]; // Values for Pinkfeet in lack of better data
1632  CreateObjects(gst_GreylagFamilyGroup, NULL, gs, 1);
1633  }
1634  // Create the greylag non-breeders
1635  for (int i = 0; i<m_migrationnumbers[gs_Greylag][1]; i++)
1636  {
1637  // Find the roost location
1638  int index = random((int) m_roosts[gs_Greylag].size());
1639  gs->m_roost = m_roosts[gs_Greylag][index];
1640  gs->m_x = gs->m_roost.m_x;
1641  gs->m_y = gs->m_roost.m_y;
1642  if (g_rand_uni() < cfg_goose_gl_sexratio.value()) gs->m_sex = true; else gs->m_sex = false; // true = male, false = female
1644  gs->m_family = false;
1646  }
1647  delete gs;
1648 }

References cfg_goose_bn_arrivedateend, cfg_goose_bn_arrivedatestart, cfg_goose_bn_baseweight, cfg_goose_bn_leavingdateend, cfg_goose_bn_sexratio, cfg_goose_bn_springmigdateend, cfg_goose_bn_springmigdatestart, cfg_goose_bn_springmigrate, cfg_goose_gl_arrivedateend, cfg_goose_gl_arrivedatestart, cfg_goose_gl_baseweight, cfg_goose_gl_leavingdateend, cfg_goose_gl_sexratio, cfg_goose_gl_springmigdateend, cfg_goose_gl_springmigdatestart, cfg_goose_gl_springmigrate, cfg_goose_pf_arrivedateend, cfg_goose_pf_arrivedatestart, cfg_goose_pf_baseweight, cfg_goose_pf_leavingdateend, cfg_goose_pf_sexratio, cfg_goose_pf_springmigdateend, cfg_goose_pf_springmigdatestart, cfg_goose_pf_springmigrate, CreateObjects(), g_rand_uni, GetImmigrationNumbers(), gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, struct_Goose::m_family, struct_Goose::m_GPM, struct_Goose::m_grpsize, struct_Goose::m_L, m_migrationnumbers, struct_Goose::m_roost, m_roosts, struct_Goose::m_sex, struct_Goose::m_weight, struct_Goose::m_x, struct_Goose::m_y, m_youngdist, CfgInt::value(), CfgFloat::value(), and CfgBool::value().

Referenced by DoFirst().

◆ DoLast()

void Goose_Population_Manager::DoLast ( )
protectedvirtual

Things to do after the EndStep.

The first job of DoLast is to update grain status in the forage locations.
If it is end of day, then max goose numbers are relayed to the field elements, then to inform the landscape of changes in grain and maize densities as a result of goose feeding. This is done here rather than have the geese interact directly with the landscape elements for efficiency, since landscape elements will only be updated once a day, and after the geese are finished. This also means fewer calculations and indirections.
If there is no grain or maize to deplete this does nothing.

Todo:
Where is the grazing resource depleted?
Once that is done then we need to produce output - we produce three output files here - the first with the goose information at individual level. The second is field information about where the geese forage. In both cases the data is written to these files when between start and end year, and start and end day (inclusive).
The third output is the a description of the population sizes of each type of goose we simulate (these are numbers extant in the area being simulated).

Definition at line 1085 of file Goose_Population_Manager.cpp.

1085  {
1099  for (unsigned i = 0; i < m_GooseForageLocations.size(); i++) {
1100  m_GooseForageLocations[ i ].UpdateKJ();
1101  }
1102  int daylength = m_TheLandscape->SupplyDaylength();
1103  // Since the daylight starts at m_daytime == 0 and the daylength varies, we are recording geese at a timepoint by dividing the day by a specified value. E.g. to get noon, we divide by 2
1104  int rectime = int(round( daylength / cfg_goose_TimedCounts.value() ));
1105  rectime -= rectime % 10; // To get a timestep point
1106  if (rectime == m_daytime) {
1107  int sz = (int)m_GooseForageLocations.size();
1108  for (int i = 0; i < sz; i++) {
1109  int pref = m_GooseForageLocations[i].GetPolygonref();
1110  int goose_numbers = m_GooseForageLocations[i].GetGooseNumbers();
1111  m_TheLandscape->RecordGooseNumbersTimed(pref, goose_numbers);
1112  for (unsigned j = 0; j < gs_foobar; j++) {
1113  int goose_numbers_timed = m_GooseForageLocations[i].GetBirds((GooseSpecies)j);
1114  m_TheLandscape->RecordGooseSpNumbersTimed(pref, goose_numbers_timed, (GooseSpecies)j);
1115  int roost_dist = int( m_GooseForageLocations[i].GetRoostDist((GooseSpecies)j));
1116  m_TheLandscape->RecordGooseRoostDist(pref, roost_dist, (GooseSpecies)j);
1117  }
1118  }
1119  }
1120  int day = m_TheLandscape->SupplyDayInYear();
1121  if (day == 300)
1122  {
1123  rectime = int(round(daylength / cfg_goose_TimedCounts.value()));
1124  rectime -= rectime % 10; // To get a timestep point
1125  if (rectime == m_daytime)
1126  {
1127  XYDump();
1128  }
1129  }
1130  if (m_daytime == 1430) // Last chance before sunrise (start of next day)
1131  {
1132  day = m_TheLandscape->SupplyDayInYear(); // **CJT** This looks to be superfluous
1133  if (day == 183) m_SeasonNumber++;
1134 
1135  int sz = (int)m_GooseForageLocations.size();
1136  for (int i = 0; i < sz; i++) {
1137  m_TheLandscape->RecordGooseNumbers( m_GooseForageLocations[ i ].GetPolygonref(), m_GooseForageLocations[ i ].GetMaxBirdsPresent() );
1138  for (unsigned j = 0; j < gs_foobar; j++) {
1139  m_TheLandscape->RecordGooseSpNumbers( m_GooseForageLocations[ i ].GetPolygonref(), m_GooseForageLocations[ i ].GetMaxSpBirdsPresent( (GooseSpecies)j ), (GooseSpecies)j );
1140  }
1141  // Remove bird records from the location and do a debug check on any birds remaining.
1142  m_GooseForageLocations[ i ].ClearBirds();
1143  }
1144  // If there are any geese and the output is required we record output:
1145  int anygeese = 0;
1146  for (int i = 0; i < gst_foobar; ++i) {
1147  anygeese = (int) GetLiveArraySize( i );
1148  if (anygeese > 0) {
1149  break;
1150  }
1151  }
1152  if (anygeese > 0) {
1155  }
1156  if (cfg_goose_EnergyRecord.value()) {
1162  }
1163  if (cfg_goose_WeightStats.value()) {
1164  if ((day + 1) % 7 == 0) // Only do weekly mean of the weights. +1 to avoid day 0 problems
1165  {
1166  GooseWeightStatOutput(); // Here we record the weight stats for the day
1167  ClearGooseWeightStats(); // and here we reset them.
1168  }
1169  }
1170  if (cfg_goose_IndLocCounts.value()) {
1171  GooseIndLocCountOutput(); // Here we record the individual forage location counts stats for the day
1172  ClearIndLocCountStats(); // and here we reset them.
1173  }
1175  {
1176  StateStatOutput();
1177  ClearStateStats();
1178  }
1181  }
1185  }
1186  }
1187  // Update forage:
1188  for (int i = 0; i < sz; i++) {
1189  int TheForageLocationPolyref = m_GooseForageLocations[ i ].GetPolygonref();
1190  double poly_grain = m_TheLandscape->SupplyBirdSeedForage( TheForageLocationPolyref );
1191  if (poly_grain > 0) {
1192  m_TheLandscape->SetBirdSeedForage( TheForageLocationPolyref, m_GooseForageLocations[ i ].GetGrainDensity() );
1193  }
1194  double poly_maize = m_TheLandscape->SupplyBirdMaizeForage( TheForageLocationPolyref );
1195  if (poly_maize > 0) {
1196  m_TheLandscape->SetBirdMaizeForage( TheForageLocationPolyref, m_GooseForageLocations[ i ].GetMaizeDensity() );
1197  }
1198  if (m_GooseForageLocations[ i ].GetGrazedBiomass() > 0) {
1199  m_TheLandscape->GrazeVegetationTotal( TheForageLocationPolyref, m_GooseForageLocations[ i ].GetGrazedBiomass() );
1200  m_GooseForageLocations[ i ].ResetGrazing();
1201  }
1202  }
1203  }
1204  // Record habitat use
1206  {
1207  // Need to cycle through all the geese and ask where they foraged last
1208  for (int i = 0; i < gst_foobar; i++)
1209  {
1210  Goose_Base* gb;
1211  int sz = int(GetLiveArraySize(i));
1212  for (int j = 0; j < sz; j++)
1213  {
1214  // This records what the geese fed on - provides the habitat use output
1215  gb = (dynamic_cast<Goose_Base*>(TheArray[i][j]));
1217  if (src.m_maxintakesource != tomis_foobar)
1218  {
1220  // Below the same kind of output, but now mimicing the field observations
1222  // If it is maize it is maize if in stubble
1224  else if ((((src.m_prevsowncrop == tov_Maize) || (src.m_prevsowncrop == tov_MaizeSilage))) && (src.m_instubble)) res = tomis_maize;
1225  else if (src.m_instubble) {
1226  if (src.m_iscereal) res = tomis_grain;
1227  else if (m_TheLandscape->SupplyIsGrass2(src.m_veg)) res = tomis_grass; // post silage cut
1228  }
1229  else res = tomis_grass;
1231  }
1232  }
1233  }
1234  // Write the record
1235  if (g_date->GetDayInMonth() == 1)
1236  {
1239  }
1240  }
1241 }

References cfg_goose_EnergyRecord, cfg_goose_FieldForageInfo, cfg_goose_IndLocCounts, cfg_goose_LeaveReasonStats, cfg_goose_PopulationDescriptionON, cfg_goose_StateStats, cfg_goose_TimedCounts, cfg_goose_WeightStats, cfg_gooseHabitatUsetime, ClearGooseDailyEnergyBalanceStats(), ClearGooseDailyEnergyBudgetStats(), ClearGooseFlightDistanceStats(), ClearGooseForagingTimeStats(), ClearGooseLeaveReasonStats(), ClearGooseWeightStats(), ClearIndLocCountStats(), ClearStateStats(), g_date, Calendar::GetDayInMonth(), GetDayTime(), GetGrainDensity(), Goose_Base::GetGroupsize(), GetMaizeDensity(), Goose_Base::GetMaxIntakeSource(), Goose_Base::GetSpecies(), GooseEnergyRecordOutput(), GooseFieldForageInfoOutput(), GooseHabitatUseFieldObsOutput(), GooseHabitatUseOutput(), GooseIndLocCountOutput(), GooseLeaveReasonStatOutput(), GoosePopulationDescriptionOutput(), GooseWeightStatOutput(), gst_foobar, m_daytime, m_GooseForageLocations, TMaxIntakeSource::m_instubble, TMaxIntakeSource::m_iscereal, TMaxIntakeSource::m_maxintakesource, TMaxIntakeSource::m_prevsowncrop, TMaxIntakeSource::m_veg, RecordHabitatUse(), RecordHabitatUseFieldObs(), StateStatOutput(), tomis_foobar, tomis_grain, tomis_grass, tomis_maize, tomis_sowncrop, tov_Maize, tov_MaizeSilage, CfgInt::value(), CfgBool::value(), and XYDump().

◆ FindClosestRoost()

void Goose_Population_Manager::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 at line 1000 of file Goose_Population_Manager.cpp.

1001 {
1002  int answer = 0;
1003  int rx = m_roosts[a_type][0].m_x;
1004  int ry = m_roosts[a_type][0].m_y;
1005  int dist = g_AlmassMathFuncs.CalcDistPythagoras(rx, ry, a_x, a_y);
1006  for (unsigned i=1; i<m_roosts[a_type].size(); i++)
1007  {
1008  rx = m_roosts[a_type][i].m_x;
1009  ry = m_roosts[a_type][i].m_y;
1010  int di = g_AlmassMathFuncs.CalcDistPythagoras( rx, ry, a_x, a_y );
1011  if (di<dist) answer = i;
1012  }
1013  a_x = m_roosts[a_type][answer].m_x;
1014  a_y = m_roosts[a_type][answer].m_y;
1015 }

References ALMaSS_MathFuncs::CalcDistPythagoras(), g_AlmassMathFuncs, and m_roosts.

Referenced by Goose_Barnacle_Base::ChangeRoost(), Goose_Pinkfoot_Base::ChangeRoost(), and Goose_Greylag_Base::ChangeRoost().

◆ ForageLocationInUse()

int Goose_Population_Manager::ForageLocationInUse ( int  a_polyref)

Tests if a forage location is currently in use, if so returns the index to it.

Parameters
[in]a_polyrefis the polygon reference number that identifies the field for foraging
Returns
Returns and integer which is the index in the vector if the polyref is found, otherwise returns -1 Searches the whole m_GooseForageLocations vector for a match for a_polyref. Stops looking if one is found.

Definition at line 1752 of file Goose_Population_Manager.cpp.

1753 {
1759  int index = -1;
1760  int sz = (int) m_GooseForageLocations.size();
1761  for (int i=0; i< sz; i++)
1762  {
1763  if (m_GooseForageLocations[i].GetPolygonref() == a_polyref )
1764  {
1765  index = i;
1766  break;
1767  }
1768  }
1769  return index;
1770 }

References m_GooseForageLocations.

Referenced by AddGeeseToForageLocationP(), BirdsShot(), BirdsToShootAtPoly(), GetForageLocIndex(), and Goose_Base::st_ChooseForageLocation().

◆ GetBirdsAtForageLoc()

int Goose_Population_Manager::GetBirdsAtForageLoc ( int  a_index,
GooseSpeciesType  a_type 
)
inline

Returns the number of birds at a forage location - given by a poly ref.

Definition at line 530 of file Goose_Population_Manager.h.

530  {
531  return m_GooseForageLocations[a_index].GetBirds(a_type);
532  }

References m_GooseForageLocations.

Referenced by Goose_Base::st_ChooseForageLocation(), and Goose_Base::st_Forage().

◆ GetDaylightLeft()

int Goose_Population_Manager::GetDaylightLeft ( )
inline

Get the daylight minutes left today.

Definition at line 412 of file Goose_Population_Manager.h.

412 { return m_daylightleft; }

References m_daylightleft.

◆ GetDayTime()

int Goose_Population_Manager::GetDayTime ( )
inline

Get the time of day (in minutes). For the goose model, sunrise is defined as m_daytime == 0. Hence this function returns the number of minutes since sunrise.

Definition at line 408 of file Goose_Population_Manager.h.

408 { return m_daytime; }

References m_daytime.

Referenced by DoLast(), Goose_Base::st_ChooseForageLocation(), Goose_Base::st_Forage(), Goose_Base::st_Roost(), Goose_Base::StartDay(), and TheAOROutputProbe().

◆ GetDistToClosestRoost()

double Goose_Population_Manager::GetDistToClosestRoost ( int  a_x,
int  a_y,
unsigned  a_type 
)

Returns the distance in to the nearest roost of a_type in meters.

Definition at line 496 of file Goose_Population_Manager.cpp.

497 {
498  int rx = m_roosts[a_type][0].m_x;
499  int ry = m_roosts[a_type][0].m_y;
500  int dist = g_AlmassMathFuncs.CalcDistPythagoras(rx, ry, a_x, a_y);
501  for (unsigned i = 1; i<m_roosts[a_type].size(); i++)
502  {
503  rx = m_roosts[a_type][i].m_x;
504  ry = m_roosts[a_type][i].m_y;
505  int di = g_AlmassMathFuncs.CalcDistPythagoras(rx, ry, a_x, a_y);
506  if (di < dist) {
507  dist = di;
508  }
509  }
510  return dist;
511 }

References ALMaSS_MathFuncs::CalcDistPythagoras(), g_AlmassMathFuncs, and m_roosts.

Referenced by NewForageLocation().

◆ GetFeedingRate()

double Goose_Population_Manager::GetFeedingRate ( double  a_graindensity,
GooseSpecies  a_species 
)
inline

Get the forage rate based on the grain density.

Parameters
[in]a_graindensityThe grain density (grain/m2) on the forage location
[in]a_speciesThe type of goose species
Returns
The species specific intake rate (kJ/min) when feeding on grain

Unpublished curve from Nolet. o:/ST_GooseProject/Field data/Fugledata/Functional response pink-feet.xlsx This curve has already taken digestibility, energy content and assimilation into account.

Definition at line 457 of file Goose_Population_Manager.h.

458  {
464  if (a_species == gs_Greylag) return m_IntakeRateVSGrainDensity_PF->GetY(a_graindensity) * 1.21;
465  else if (a_species == gs_Pinkfoot) return m_IntakeRateVSGrainDensity_PF->GetY(a_graindensity);
466  else return m_IntakeRateVSGrainDensity_PF->GetY(a_graindensity) * 0.74;
467  }

References m_IntakeRateVSGrainDensity_PF.

Referenced by Goose_Base::EvaluateForageToHopLoc(), Goose_Base::st_ChooseForageLocation(), and Goose_Base::st_Forage().

◆ GetForageGooseDensity()

double Goose_Population_Manager::GetForageGooseDensity ( int  a_index)
inline

Returns the total goose density for a forage location.

Definition at line 492 of file Goose_Population_Manager.h.

492 { return m_GooseForageLocations[a_index].GetGooseDensity(); }

References m_GooseForageLocations.

Referenced by Goose_Base::st_ChooseForageLocation(), and Goose_Base::st_Forage().

◆ GetForageGrazing()

double Goose_Population_Manager::GetForageGrazing ( int  a_index,
int  gs 
)
inline

Returns the forage density for a forage location and goose type. This is species specific.

Definition at line 496 of file Goose_Population_Manager.h.

496 { return m_GooseForageLocations[a_index].GetGrazing(gs); }

References m_GooseForageLocations.

◆ GetForageLocation()

GooseActiveForageLocation* Goose_Population_Manager::GetForageLocation ( unsigned int  a_index)
inline

Returns a pointer to the forage location indexed by index.

Definition at line 448 of file Goose_Population_Manager.h.

448  {
449  if ((m_GooseForageLocations.size() == 0) || (m_GooseForageLocations.size() <= a_index)) return NULL; else return &m_GooseForageLocations[a_index];
450  }

References m_GooseForageLocations.

Referenced by Goose_Base::st_ChooseForageLocation(), and XYDump().

◆ GetForageLocIndex()

int Goose_Population_Manager::GetForageLocIndex ( GooseSpecies  a_species,
int  a_x,
int  a_y 
)

Get a forage location for my species (picked randomly among the active locations)

Todo:
add documentation

Definition at line 2039 of file Goose_Population_Manager.cpp.

2039  {
2040  int forageindex = -1;
2041  std::vector<int> fields;
2042  int sz = (int)m_GooseForageLocations.size();
2043  if (sz > 0) {
2044  for (int i = 0; i < sz; i++) {
2045  int birds = m_GooseForageLocations[ i ].GetBirds( a_species );
2046  if (birds > 0) {
2047  int index = m_GooseForageLocations[ i ].GetPolygonref();
2048  fields.push_back( index );
2049  }
2050  }
2051  if (fields.size() != 0) {
2052  // Find the distances to those forage locations
2053  int answer = random(int(fields.size()));
2054  int max_dist = 43266; // diagonal of Vejlerne
2055  int fx, fy;
2056  for (int i = 0; i<fields.size(); i++) {
2057  fx = m_TheLandscape->SupplyCentroidX( fields[ i ] );
2058  fy = m_TheLandscape->SupplyCentroidY( fields[ i ] );
2059  int di = g_AlmassMathFuncs.CalcDistPythagoras( fx, fy, a_x, a_y );
2060  if (g_rand_uni() < exp(-(di / max_dist) * cfg_goose_dist_weight_power.value()))
2061  {
2062  answer = i;
2063  }
2064  }
2065  int polyref = fields[ answer ];
2066  forageindex = ForageLocationInUse( polyref );
2067  }
2068  }
2069  return forageindex;
2070 }

References ALMaSS_MathFuncs::CalcDistPythagoras(), cfg_goose_dist_weight_power, ForageLocationInUse(), g_AlmassMathFuncs, g_rand_uni, m_GooseForageLocations, and CfgFloat::value().

Referenced by Goose_Base::st_ChooseForageLocation().

◆ GetForageRateDensity()

double Goose_Population_Manager::GetForageRateDensity ( double  a_foragedensity)
inline

Get the forage intake rate for a forage density.

Definition at line 488 of file Goose_Population_Manager.h.

488 { return m_ForageRateVSGooseDensity->GetY(a_foragedensity); }

References m_ForageRateVSGooseDensity.

Referenced by Goose_Base::st_ChooseForageLocation(), and Goose_Base::st_Forage().

◆ GetGrainDensity()

double Goose_Population_Manager::GetGrainDensity ( int  a_index)
inline

Returns the forage density for a forage location.

Definition at line 500 of file Goose_Population_Manager.h.

500 { return m_GooseForageLocations[a_index].GetGrainDensity(); }

References m_GooseForageLocations.

Referenced by DoLast().

◆ GetImmigrationNumbers()

void Goose_Population_Manager::GetImmigrationNumbers ( GooseSpecies  a_goose,
bool  a_season 
)
protected

Get the numbers to immigrate.

Definition at line 2092 of file Goose_Population_Manager.cpp.

2093 {
2094  if (a_goose == gs_Pinkfoot && fall)
2095  {
2096  int pfnum = cfg_goose_pf_startnos.value();
2097  int pfyoung = (int)floor(pfnum * cfg_goose_pf_young_proportion.value());
2098  int pffam = (int)floor(pfyoung / 4); // On average the families have 4 young
2099  int pfnb = pfnum - (pffam + pfyoung); // The familes are then two adults plus their young
2100 
2101  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (pffam / ((1 + cfg_goose_pf_arrivedateend.value()) - cfg_goose_pf_arrivedatestart.value())));
2102  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (pfnb / ((1 + cfg_goose_pf_arrivedateend.value()) - cfg_goose_pf_arrivedatestart.value())));
2103  }
2104  if (a_goose == gs_Pinkfoot && !fall)
2105  {
2106  int pfnum = cfg_goose_pf_springmignos.value();
2107  int pfyoung = (int)floor(pfnum * cfg_goose_pf_young_proportion.value());
2108  int pffam = (int)floor(pfyoung / 4); // On average the families have 4 young
2109  int pfnb = pfnum - (pffam + pfyoung); // The familes are then two adults plus their young
2110 
2113  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (pffam / ((1 + end) - start)));
2114  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (pfnb / ((1 + end) - start)));
2115  }
2116  if (a_goose == gs_Barnacle && fall)
2117  {
2118  int bnnum = cfg_goose_bn_startnos.value();
2119  int bnyoung = (int)floor(bnnum * cfg_goose_bn_young_proportion.value());
2120  int bnfam = (int)floor(bnyoung / 4); // On average the families have 4 young
2121  int bnnb = bnnum - (bnfam + bnyoung); // The familes are then two adults plus their young
2122 
2123  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (bnfam / ((1 + cfg_goose_bn_arrivedateend.value()) - cfg_goose_bn_arrivedatestart.value())));
2124  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (bnnb / ((1 + cfg_goose_bn_arrivedateend.value()) - cfg_goose_bn_arrivedatestart.value())));
2125  }
2126  if (a_goose == gs_Barnacle && !fall)
2127  {
2128  int bnnum = cfg_goose_bn_springmignos.value();
2129  int bnyoung = (int)floor(bnnum * cfg_goose_bn_young_proportion.value());
2130  int bnfam = (int)floor(bnyoung / 4); // On average the families have 4 young
2131  int bnnb = bnnum - (bnfam + bnyoung); // The familes are then two adults plus their young
2132 
2135  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (bnfam / ((1 + end) - start)));
2136  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (bnnb / ((1 + end) - start)));
2137  }
2138  if (a_goose == gs_Greylag && fall)
2139  {
2140  int glnum = cfg_goose_gl_startnos.value();
2141  int glyoung = (int)floor(glnum * cfg_goose_gl_young_proportion.value());
2142  int glfam = (int)floor(glyoung / 4); // On average the families have 4 young
2143  int glnb = glnum - (glfam + glyoung); // The familes are then two adults plus their young
2144 
2145  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (glfam / ((1 + cfg_goose_gl_arrivedateend.value()) - cfg_goose_gl_arrivedatestart.value())));
2146  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (glnb / ((1 + cfg_goose_gl_arrivedateend.value()) - cfg_goose_gl_arrivedatestart.value())));
2147  }
2148  if (a_goose == gs_Greylag && !fall)
2149  {
2150  int glnum = cfg_goose_gl_springmignos.value();
2151  int glyoung = (int)floor(glnum * cfg_goose_gl_young_proportion.value());
2152  int glfam = (int)floor(glyoung / 4); // On average the families have 4 young
2153  int glnb = glnum - (glfam + glyoung); // The familes are then two adults plus their young
2154 
2157  m_migrationnumbers[a_goose][0] = (int)floor(0.5 + (glfam / ((1 + end) - start)));
2158  m_migrationnumbers[a_goose][1] = (int)floor(0.5 + (glnb / ((1 + end) - start)));
2159  }
2160 }

References cfg_goose_bn_arrivedateend, cfg_goose_bn_arrivedatestart, cfg_goose_bn_springmigdateend, cfg_goose_bn_springmigdatestart, cfg_goose_bn_springmignos, cfg_goose_bn_startnos, cfg_goose_bn_young_proportion, cfg_goose_gl_arrivedateend, cfg_goose_gl_arrivedatestart, cfg_goose_gl_springmigdateend, cfg_goose_gl_springmigdatestart, cfg_goose_gl_springmignos, cfg_goose_gl_startnos, cfg_goose_gl_young_proportion, cfg_goose_pf_arrivedateend, cfg_goose_pf_arrivedatestart, cfg_goose_pf_springmigdateend, cfg_goose_pf_springmigdatestart, cfg_goose_pf_springmignos, cfg_goose_pf_startnos, cfg_goose_pf_young_proportion, m_migrationnumbers, start, CfgInt::value(), and CfgFloat::value().

Referenced by DoImmigration().

◆ GetIsDaylight()

int Goose_Population_Manager::GetIsDaylight ( )
inline

Is it daylight hours? Daylight starts at m_daytime == 0.

Definition at line 416 of file Goose_Population_Manager.h.

416 { return m_daylight; }

References m_daylight.

Referenced by Goose_Base::st_Roost().

◆ GetLeader()

Goose_Base * Goose_Population_Manager::GetLeader ( APoint  a_roost,
GooseSpecies  a_species 
)

Asks for a pointer to a goose that can be followed.

When leaving the roost in the morning we have the option to either follow another bird or go exploring on our own./n If we follow another bird this function will find a bird to follow (a leader). It is a prerequisite that the leader is from the same roost as the bird following and that the leader have found a suitable forage location.

Parameters
[in]a_roostThe roost of the follower as a point.
[in]a_speciesThe species of the follower.
Returns
A pointer to the leader.

Definition at line 1989 of file Goose_Population_Manager.cpp.

1990 {
1991  // Need to start a random point in our list of birds
1992  // We know the total number of bird objects of the species, so assume they are one circular long list
1993  //
1994  Goose_Base* GBp;
1995  int sz1 = 0;
1996  int sz2 = 0;
1997  int base = (int)a_species * 2; // To get the position of the speciesFamilyGroup in TheArray
1998  int base1 = 1 + ((int)a_species * 2); // the speciesNonBreeder is always the next one
1999  switch (a_species) {
2000  case gs_Pinkfoot:
2001  sz1 = int(GetLiveArraySize(gst_PinkfootFamilyGroup));
2002  sz2 = int(GetLiveArraySize(gst_PinkfootNonBreeder));
2003  break;
2004  case gs_Barnacle:
2005  sz1 = int(GetLiveArraySize(gst_BarnacleFamilyGroup));
2006  sz2 = int(GetLiveArraySize(gst_BarnacleNonBreeder));
2007  break;
2008  case gs_Greylag:
2009  sz1 = int(GetLiveArraySize(gst_GreylagFamilyGroup));
2010  sz2 = int(GetLiveArraySize(gst_GreylagNonBreeder));
2011  break;
2012  };
2013  int total = sz1 + sz2;
2014  int start = random(total);
2015  for (int g = 0; g < total; g++) // Loops until a goose which does not return -1 for the forage location index is found
2016  {
2017  int index;
2018  if (start == total) start = 0;
2019  if (start < sz1) {
2020  index = start;
2021  GBp = dynamic_cast<Goose_Base*>(TheArray[base][index]);
2022  if ((GBp->GetRoost().m_x == a_roost.m_x) && (GBp->GetRoost().m_y == a_roost.m_y) && (GBp->GetForageLocIndex() != -1)) {
2023  return GBp;
2024  }
2025  }
2026  else {
2027  index = start - sz1;
2028  GBp = dynamic_cast<Goose_Base*>(TheArray[base1][index]);
2029  if ((GBp->GetRoost().m_x == a_roost.m_x) && (GBp->GetRoost().m_y == a_roost.m_y) && (GBp->GetForageLocIndex() != -1)) {
2030  return GBp;
2031  }
2032  }
2033  start++;
2034  }
2035  return NULL;
2036 }

References Goose_Base::GetForageLocIndex(), Goose_Base::GetRoost(), gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, and start.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ GetMaizeDensity()

double Goose_Population_Manager::GetMaizeDensity ( int  a_index)
inline

Returns the maize forage density for a forage location.

Definition at line 504 of file Goose_Population_Manager.h.

504  {
505  return m_GooseForageLocations[a_index].GetMaizeDensity();
506  }

References m_GooseForageLocations.

Referenced by DoLast().

◆ GetMaizeFeedingRate()

double Goose_Population_Manager::GetMaizeFeedingRate ( double  a_maizedensity,
GooseSpecies  a_species 
)
inline

Get the forage rate when feeding on maize.

Parameters
[in]a_maizedensityThe maize density in kJ/m2
[in]a_speciesThe type of goose species
Returns
The species specific intake rate when feeding on maize

Functional response for geese feeding on maize is currently lacking. The curve used here is based on field observations of barnacle geese made with wildlife cameras in Jutland in 2015. Assimilation for energy is accounted for in the functional response curce. Value found for Bewick's swans from Nolet, B. unpubl. For greylag and pinkfeet the value is scaled based on the relationship between

Definition at line 474 of file Goose_Population_Manager.h.

474  {
481  if (a_species == gs_Greylag) return m_IntakeRateVSMaizeDensity_BN->GetY(a_maizedensity) * 1.64;
482  else if (a_species == gs_Pinkfoot) return m_IntakeRateVSMaizeDensity_BN->GetY(a_maizedensity) * 1.35;
483  else return m_IntakeRateVSMaizeDensity_BN->GetY(a_maizedensity);
484  }

References m_IntakeRateVSMaizeDensity_BN.

Referenced by Goose_Base::EvaluateForageToHopLoc(), Goose_Base::st_ChooseForageLocation(), and Goose_Base::st_Forage().

◆ GetNumberOfForageLocs()

int Goose_Population_Manager::GetNumberOfForageLocs ( void  )
inline

Get the number of forage locations.

Definition at line 560 of file Goose_Population_Manager.h.

560 { return int(m_GooseForageLocations.size()); }

References m_GooseForageLocations.

◆ GetThermalCosts()

double Goose_Population_Manager::GetThermalCosts ( GooseSpecies  a_goose)
inline

Get daily thermal costs const.

Definition at line 556 of file Goose_Population_Manager.h.

556 { return m_thermalcosts[a_goose]; }

References m_thermalcosts.

Referenced by Goose_Barnacle_Base::Init(), Goose_Pinkfoot_Base::Init(), Goose_Greylag_Base::Init(), and Goose_Base::StartDay().

◆ GooseEnergyRecordOutput()

void Goose_Population_Manager::GooseEnergyRecordOutput ( )
protected

Produces output to a standard file describing the number of birds foraging at each field and the field conditions.

Definition at line 1371 of file Goose_Population_Manager.cpp.

1372 {
1373  int day = m_TheLandscape->SupplyGlobalDate();
1374  int day_length = m_TheLandscape->SupplyDaylength();
1375  for (int i = 0; i < gs_foobar; ++i)
1376  {
1377  std::string gs = GooseToString((GooseSpecies)i);
1378  (*m_GooseEnergeticsDataFile)
1379  << m_SeasonNumber << '\t'
1380  << day << '\t'
1381  << gs << '\t'
1382  << m_ForagingTimeStats[i].get_meanvalue() << '\t'
1383  << m_ForagingTimeStats[i].get_SE() << '\t'
1384  << m_FlightDistanceStats[i].get_meanvalue() << '\t'
1385  << m_FlightDistanceStats[i].get_SE() << '\t'
1386  << m_DailyEnergyBudgetStats[i].get_meanvalue() << '\t'
1387  << m_DailyEnergyBudgetStats[i].get_SE() << '\t'
1388  << m_DailyEnergyBalanceStats[i].get_meanvalue() << '\t'
1389  << m_DailyEnergyBalanceStats[i].get_SE() << '\t'
1390  << day_length << endl;
1391  }
1392 }

References GooseToString(), m_DailyEnergyBalanceStats, m_DailyEnergyBudgetStats, m_FlightDistanceStats, and m_ForagingTimeStats.

Referenced by DoLast().

◆ GooseFieldForageInfoOutput()

void Goose_Population_Manager::GooseFieldForageInfoOutput ( )
protected

Produces output to a standard file describing the energetic state of all individuals of the goose populations.

The information needed here is in the landscape. We need to trawl through all the fields and record those that have suitable openness scores and food for geese

Definition at line 1302 of file Goose_Population_Manager.cpp.

1303 {
1308  int Day = m_TheLandscape->SupplyGlobalDate();
1309 
1310  GooseFieldList* afieldlist = m_TheLandscape->GetGooseFields(cfg_goose_MinForageOpenness.value());
1311  unsigned sz = (unsigned) afieldlist->size();
1313  {
1314  for (unsigned f = 0; f < sz; f++)
1315  {
1316  // Only write if there were any geese
1317  if ((*afieldlist)[f].geese > 0) {
1318  (*m_GooseFieldForageDataFile)
1319  << m_SeasonNumber << '\t'
1320  << Day << '\t'
1321  << (*afieldlist)[f].geese << '\t';
1322  for (int i = 0; i < gs_foobar; ++i)
1323  {
1324  (*m_GooseFieldForageDataFile)
1325  << (*afieldlist)[f].geesesp[i] << '\t'
1326  << (*afieldlist)[f].geesespTimed[i] << '\t'
1327  << (*afieldlist)[f].roostdists[i] << '\t';
1328  }
1329  (*m_GooseFieldForageDataFile) << (*afieldlist)[f].polyref << endl;
1330  }
1331  }
1332  }
1334  for (unsigned f = 0; f < sz; f++)
1335  {
1336  int pref = (*afieldlist)[f].polyref;
1337  int utm_x = 484378 + m_TheLandscape->SupplyCentroidX(pref);
1338  int utm_y = 6335161 - m_TheLandscape-> SupplyCentroidY(pref);
1339  (*m_GooseFieldForageDataFile)
1340  << m_SeasonNumber << '\t'
1341  << Day << '\t'
1342  << pref << '\t'
1343  << utm_x << '\t'
1344  << utm_y << '\t'
1345  << (*afieldlist)[f].geese << '\t'
1346  << (*afieldlist)[f].geeseTimed << '\t'
1347  << (*afieldlist)[f].openness << '\t';
1348  for (int i = 0; i < gs_foobar; ++i)
1349  {
1350  (*m_GooseFieldForageDataFile)
1351  << (*afieldlist)[f].geesesp[i] << '\t'
1352  << (*afieldlist)[f].geesespTimed[i] << '\t'
1353  << (*afieldlist)[f].roostdists[i] << '\t'
1354  << (*afieldlist)[f].grass[i] << '\t';
1355  }
1356  (*m_GooseFieldForageDataFile)
1357  << (*afieldlist)[f].grain << '\t'
1358  << (*afieldlist)[f].maize << '\t'
1359  << (*afieldlist)[f].vegtypechr << '\t'
1360  << (*afieldlist)[f].vegheight << '\t'
1361  << (*afieldlist)[f].digestability << '\t'
1362  << (*afieldlist)[f].vegphase << '\t'
1363  << (*afieldlist)[f].previouscrop << '\t'
1364  << (*afieldlist)[f].lastsownveg << endl;
1365  }
1366  }
1367  delete afieldlist;
1368 }

References cfg_goose_MinForageOpenness, cfg_goose_runtime_reporting, CfgFloat::value(), and CfgBool::value().

Referenced by DoLast().

◆ GooseHabitatUseFieldObsOutput()

void Goose_Population_Manager::GooseHabitatUseFieldObsOutput ( )
protected

Outputs simple stats for the goose habitat use but using rules to mimic field observations.

Definition at line 1273 of file Goose_Population_Manager.cpp.

1274 {
1275  for (int i = 0; i < gs_foobar; ++i)
1276  {
1277  double pct[tomis_foobar];
1278  int count = 0;
1279  for (int h = 0; h < tomis_foobar; h++) {
1280  count += m_HabitatUseFieldObsStats[i* tomis_foobar + h];
1281  pct[h] = 0;
1282  }
1283  for (int h = 0; h < tomis_foobar; h++) {
1284  if (count > 0) pct[h] = m_HabitatUseFieldObsStats[i* tomis_foobar + h] / double(count); else pct[h] = 0;
1285  }
1286 
1287  std::string gs = GooseToString((GooseSpecies)i);
1288  (*m_GooseHabitatUseFieldObsFile)
1289  << m_SeasonNumber << '\t'
1290  << m_TheLandscape->SupplyGlobalDate() << '\t'
1291  << m_TheLandscape->SupplyDayInYear() << '\t'
1292  << gs << '\t';
1293  for (int h = 0; h < tomis_foobar; h++) {
1294  (*m_GooseHabitatUseFieldObsFile) << pct[h] << '\t';
1295  }
1296  (*m_GooseHabitatUseFieldObsFile) << count << endl;
1297  }
1299 }

References ClearGooseHabitatUseFieldObsStats(), GooseToString(), m_HabitatUseFieldObsStats, and tomis_foobar.

Referenced by DoLast().

◆ GooseHabitatUseOutput()

void Goose_Population_Manager::GooseHabitatUseOutput ( )
protected

Outputs simple stats for the goose habitat use.

Definition at line 1244 of file Goose_Population_Manager.cpp.

1245 {
1246  for (int i = 0; i < gs_foobar; ++i)
1247  {
1248  double pct[tomis_foobar];
1249  int count = 0;
1250  for (int h = 0; h < tomis_foobar; h++) {
1251  count += m_HabitatUseStats[i* tomis_foobar + h];
1252  pct[h] = 0;
1253  }
1254  for (int h = 0; h < tomis_foobar; h++) {
1255  if (count > 0) pct[h] = m_HabitatUseStats[i* tomis_foobar + h] / double(count); else pct[h] = 0;
1256  }
1257 
1258  std::string gs = GooseToString((GooseSpecies)i);
1259  (*m_GooseHabitatUseFile)
1260  << m_SeasonNumber << '\t'
1261  << m_TheLandscape->SupplyGlobalDate() << '\t'
1262  << m_TheLandscape->SupplyDayInYear() << '\t'
1263  << gs << '\t';
1264  for (int h = 0; h < tomis_foobar; h++) {
1265  (*m_GooseHabitatUseFile) << pct[h] << '\t';
1266  }
1267  (*m_GooseHabitatUseFile) << count << endl;
1268  }
1270 }

References ClearGooseHabitatUseStats(), GooseToString(), m_HabitatUseStats, and tomis_foobar.

Referenced by DoLast().

◆ GooseIndLocCountOutput()

void Goose_Population_Manager::GooseIndLocCountOutput ( )
protected

Outputs simple stats for the number of forage locations visited per goose.

Definition at line 1412 of file Goose_Population_Manager.cpp.

1413 {
1414  for (int i = 0; i < gs_foobar; ++i)
1415  {
1416  std::string gs = GooseToString((GooseSpecies)i);
1417  (*m_GooseIndLocCountFile)
1418  << m_SeasonNumber << '\t'
1419  << m_TheLandscape->SupplyGlobalDate() << '\t'
1420  << m_TheLandscape->SupplyDayInYear() << '\t'
1421  << gs << '\t'
1422  << m_IndividualForageLocationData[i].get_meanvalue() << '\t'
1423  << m_IndividualForageLocationData[i].get_SE() << '\t'
1424  << m_IndividualForageLocationData[i].get_N() << endl;
1425  }
1426 }

References GooseToString(), and m_IndividualForageLocationData.

Referenced by DoLast().

◆ GooseLeaveReasonStatOutput()

void Goose_Population_Manager::GooseLeaveReasonStatOutput ( )
protected

Outputs simple stats for the reasons for leaving the simulation.

Definition at line 1436 of file Goose_Population_Manager.cpp.

1437 {
1438  int day = m_TheLandscape->SupplyGlobalDate();
1439  int day_in_year = m_TheLandscape->SupplyDayInYear();
1440  for (int i = 0; i < gst_foobar; ++i)
1441  {
1442  std::string gst = GooseTypeToString((GooseSpeciesType)i);
1443  for (int j = 0; j < tolr_foobar; ++j)
1444  {
1445  (*m_GooseLeaveReasonStatsFile)
1446  << m_SeasonNumber << '\t'
1447  << day << '\t'
1448  << day_in_year << '\t'
1449  << gst << '\t'
1451  << m_LeaveReasonStats[i][j].get_N() << endl;
1452  }
1453  }
1454 }

References GooseTypeToString(), gst_foobar, LeaveReasonToString(), m_LeaveReasonStats, and tolr_foobar.

Referenced by DoLast().

◆ GoosePopulationDescriptionOutput()

void Goose_Population_Manager::GoosePopulationDescriptionOutput ( )
protected

Produces output to a standard file describing the state of the goose populations.

Here the first job is to correct the standard output and produce a more detailed description of the population, ie not counting families as one.

Definition at line 1457 of file Goose_Population_Manager.cpp.

1458 {
1463  int sz = int(GetLiveArraySize(gst_PinkfootFamilyGroup));
1464  int pff = 0;
1465  for (int j = 0; j<sz; j++)
1466  {
1467  pff += dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->GetGroupsize();
1468  }
1469  sz = int(GetLiveArraySize(gst_BarnacleFamilyGroup));
1470  int bf = 0;
1471  for (int j = 0; j<sz; j++)
1472  {
1473  bf += dynamic_cast<Goose_Base*>(TheArray[gst_BarnacleFamilyGroup][j])->GetGroupsize();
1474  }
1475  sz = int(GetLiveArraySize(gst_GreylagFamilyGroup));
1476  int gf = 0;
1477  for (int j = 0; j<sz; j++)
1478  {
1479  gf += dynamic_cast<Goose_Base*>(TheArray[gst_GreylagFamilyGroup][j])->GetGroupsize();
1480  }
1481  (*m_GoosePopDataFile)
1482  << m_SeasonNumber << '\t'
1483  << m_TheLandscape->SupplyGlobalDate() << '\t'
1484  << pff << '\t'
1485  << int(GetLiveArraySize(gst_PinkfootNonBreeder)) << '\t'
1486  << bf << '\t'
1487  << int(GetLiveArraySize(gst_BarnacleNonBreeder)) << '\t'
1488  << gf << '\t'
1489  << int(GetLiveArraySize(gst_GreylagNonBreeder)) << '\t'
1490  << m_TheLandscape->SupplySnowDepth() << endl;
1491 }

References gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, and gst_PinkfootNonBreeder.

Referenced by DoLast().

◆ GooseToString()

std::string Goose_Population_Manager::GooseToString ( GooseSpecies  a_gs)
protected

Translates gs enum to string

Definition at line 2463 of file Goose_Population_Manager.cpp.

2464 {
2465  switch (a_gs)
2466  {
2467  case gs_Pinkfoot:
2468  return "pinkfoot";
2469  case gs_Barnacle:
2470  return "barnacle";
2471  case gs_Greylag:
2472  return "greylag";
2473  default:
2474  return "gs_foobar";
2475  }
2476 }

Referenced by GooseEnergyRecordOutput(), GooseHabitatUseFieldObsOutput(), GooseHabitatUseOutput(), GooseIndLocCountOutput(), and GooseWeightStatOutput().

◆ GooseTypeToString()

std::string Goose_Population_Manager::GooseTypeToString ( GooseSpeciesType  a_gst)
protected

Translates gst enum to string

Definition at line 2442 of file Goose_Population_Manager.cpp.

2443 {
2444  switch (a_gst)
2445  {
2447  return "pinkfoot_family";
2449  return "pinkfoot_nonbreeder";
2451  return "barnacle_family";
2453  return "barnacle_nonbreeder";
2455  return "greylag_family";
2456  case gst_GreylagNonBreeder:
2457  return "greylag_nonbreeder";
2458  default:
2459  return "gst_foobar";
2460  }
2461 }

References gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, and gst_PinkfootNonBreeder.

Referenced by GooseLeaveReasonStatOutput().

◆ GooseWeightStatOutput()

void Goose_Population_Manager::GooseWeightStatOutput ( )
protected

Outputs simple stats for the weights in the population.

Definition at line 1395 of file Goose_Population_Manager.cpp.

1396 {
1397  for (int i = 0; i < gs_foobar; ++i)
1398  {
1399  std::string gs = GooseToString((GooseSpecies)i);
1400  (*m_GooseWeightStatsFile)
1401  << m_SeasonNumber << '\t'
1402  << m_TheLandscape->SupplyGlobalDate() << '\t'
1403  << m_TheLandscape->SupplyDayInYear() << '\t'
1404  << gs << '\t'
1405  << m_WeightStats[i].get_meanvalue() << '\t'
1406  << m_WeightStats[i].get_SE() << '\t'
1407  << m_WeightStats[i].get_N() << endl;
1408  }
1409 }

References GooseToString(), and m_WeightStats.

Referenced by DoLast().

◆ Graze()

void Goose_Population_Manager::Graze ( double  a_kJ,
int  a_index 
)
inline

Removes KJ as grams veg biomass from a forage area.

Definition at line 519 of file Goose_Population_Manager.h.

519 { m_GooseForageLocations[a_index].Graze(a_kJ); }

References m_GooseForageLocations.

Referenced by RemoveMaxForageKj().

◆ InGreylagSeason()

bool Goose_Population_Manager::InGreylagSeason ( )
inline

Are we in the greylag hunting season?

Definition at line 420 of file Goose_Population_Manager.h.

420 { return m_GreylagSeason; }

References m_GreylagSeason.

Referenced by BirdsShot(), BirdsToShootAtPoly(), and GooseActiveForageLocation::GetHuntables().

◆ InHuntingSeason()

bool Goose_Population_Manager::InHuntingSeason ( int  a_day,
GooseSpecies  a_species 
)
protected

Are we in the hunting season?

The goose hunting season is complicated because it runs over a year boundary (or it can) Particularly the first year of the simulation is tricky, because we start out in January which can be legal hunting season, but the geese don't arrive until the fall.

Definition at line 2294 of file Goose_Population_Manager.cpp.

2294  {
2300  if (GetSeasonNumber() == 0) {
2301 
2302  return false; // We don't want them to start in January in the first year of the sim.
2303  }
2304  if (a_species == gs_Pinkfoot)
2305  {
2306  int pfstart = cfg_goose_pinkfootopenseasonstart.value();
2307  int pfend = cfg_goose_pinkfootopenseasonend.value();
2308  if (pfstart > pfend) {
2309  if (a_day < pfstart && a_day > pfend) return false;
2310  else {
2311  return true; // must be in the first year after the start of season
2312  }
2313  }
2314  else {
2315  // Season all in one year
2316  if (a_day < pfstart || a_day > pfend) {
2317  return false;
2318  }
2319  else {
2320  return true;
2321  }
2322  }
2323  }
2324  else if (a_species == gs_Greylag)
2325  {
2326  int glstart = cfg_goose_greylagopenseasonstart.value();
2327  int glend = cfg_goose_greylagopenseasonend.value();
2328  if (glstart > glend) {
2329  if (a_day < glstart && a_day > glend) return false;
2330  else {
2331  return true; // must be in the first year after the start of season
2332  }
2333  }
2334  else {
2335  // Season all in one year
2336  if (a_day < glstart || a_day > glend) {
2337  return false;
2338  }
2339  else {
2340  return true;
2341  }
2342  }
2343  }
2344  else
2345  {
2346  g_msg->Warn(WARN_FILE, "Goose_Population_Manager::InHuntingSeason: ""Species error", "");
2347  exit(1);
2348  }
2349 }

References cfg_goose_greylagopenseasonend, cfg_goose_greylagopenseasonstart, cfg_goose_pinkfootopenseasonend, cfg_goose_pinkfootopenseasonstart, g_msg, CfgInt::value(), MapErrorMsg::Warn(), and WARN_FILE.

Referenced by DoFirst().

◆ Init()

void Goose_Population_Manager::Init ( void  )
protectedvirtual

Called upon initialization of the simulation. Sets up output files.

Finally opens any output files needed

Definition at line 670 of file Goose_Population_Manager.cpp.

671 {
676  OpenTheReallyBigProbe();
677  }
678  else ReallyBigOutputPrb = 0;
679  if (cfg_AOROutput_used.value()) {
680  m_AOR_Pinkfeet = new AOR_Probe_Goose(this, m_TheLandscape, "AOR_pinkfoot.txt");
681  m_AOR_Barnacles = new AOR_Probe_Goose(this, m_TheLandscape, "AOR_barnacle.txt");
682  m_AOR_Greylags = new AOR_Probe_Goose(this, m_TheLandscape, "AOR_greylag.txt");
683  }
684  m_GooseXYDumpFile = new ofstream("GooseXYDump.txt", ios::out);
685  std::vector<std::string> xy_headers;
686  xy_headers = { "X", "Y", "poly_ref", "fl_x", "fl_y", "fl_poly" };
687  WriteHeaders(m_GooseXYDumpFile, xy_headers);
688 
689  m_GoosePopDataFile = new ofstream("GoosePopulationData.txt", ios::out);
690  std::vector<std::string> pd_headers;
691  pd_headers = { "season", "day", "pf_families", "pf_non_breeders", "bn_families",
692  "bn_non_breeders", "gl_families", "gl_non_breeders", "snow_depth" };
693  WriteHeaders(m_GoosePopDataFile, pd_headers);
694 
695  m_GooseWeightStatsFile = new ofstream("GooseWeightStats.txt", ios::out);
696  std::vector<std::string> ws_headers = { "season", "day", "day_in_year", "species", "mean_weight", "mean_weight_se", "n" };
698 
699  m_GooseIndLocCountFile = new ofstream("GooseIndLocCountStats.txt", ios::out);
700  std::vector<std::string> ilc_headers = { "season", "day", "day_in_year", "species",
701  "n_forage_locs", "n_forage_locs_se", "n" };
702  WriteHeaders(m_GooseIndLocCountFile, ilc_headers);
703 
704  m_GooseHabitatUseFile = new ofstream("GooseHabitatUseStats.txt", ios::out);
705  std::vector<std::string> ghu_headers = { "season", "day", "day_in_year", "species" };
706  for (int h = 0; h < tomis_foobar; h++)
707  {
709  ghu_headers.push_back(str1);
710  }
711  ghu_headers.push_back("count");
712  WriteHeaders(m_GooseHabitatUseFile, ghu_headers);
714 
715  m_GooseHabitatUseFieldObsFile = new ofstream("GooseHabitatUseFieldObsStats.txt", ios::out);
716  std::vector<std::string> ghufo_headers = { "season", "day", "day_in_year", "species" };
717  for (int h = 0; h < tomis_foobar; h++)
718  {
720  ghufo_headers.push_back(str1);
721  }
722  ghufo_headers.push_back("count");
725 
726  m_GooseLeaveReasonStatsFile = new ofstream("GooseLeaveReasonStats.txt", ios::out);
727  std::vector<std::string> lr_headers = { "season", "day", "day_in_year", "species_type", "leave_reason", "n" };
729 
730  m_StateStatsFile = new ofstream("GooseStateStats.txt", ios::out);
731  std::vector<std::string> ss_headers = { "season", "day", "n" };
732  WriteHeaders(m_StateStatsFile, ss_headers);
733 
734  m_GooseEnergeticsDataFile = new ofstream("GooseEnergeticsData.txt", ios::out);
735  std::vector<std::string> ed_headers;
736  ed_headers = { "season", "day", "species", "foraging_time", "foraging_time_se",
737  "flight_distance", "flight_distance_se", "daily_energy_budget",
738  "daily_energy_budget_se", "daily_energy_balance",
739  "daily_energy_balance_se", "day_length" };
741  m_GooseFieldForageDataFile = new ofstream("GooseFieldForageData.txt", ios::out);
742  // We use two different versions dependent on whether we are testing of just running
744  {
745  std::vector<std::string> fd_headers;
746  fd_headers = {
747  "season",
748  "day",
749  "geese",
750  "pinkfoot",
751  "pinkfoot_timed",
752  "roost_dist_pinkfoot",
753  "barnacle",
754  "barnacle_timed",
755  "roost_dist_barnacle",
756  "greylag",
757  "greylag_timed",
758  "roost_dist_greylag",
759  "polyref"
760  };
762  }
764  {
765  std::vector<std::string> fd_headers;
766  fd_headers = {"season", "day", "polyref", "utm_x", "utm_y", "geese",
767  "geese_timed", "openness", "pinkfoot", "pinkfoot_timed",
768  "roost_dist_pinkfoot", "grass_pinkfoot", "barnacle",
769  "barnacle_timed", "roost_dist_barnacle", "grass_barnacle",
770  "greylag", "greylag_timed", "roost_dist_greylag", "grass_greylag",
771  "grain", "maize", "veg_type_chr", "veg_height", "digestability",
772  "veg_phase", "previous_crop", "last_sown_veg" };
774  }
776  {
778  }
780  WriteConfig();
781  }
782 #ifdef __GITVERSION
784  {
785  m_GooseGitVersionFile = new ofstream("almass-version.txt", ios::out);
786  (*m_GooseGitVersionFile) << "hash=" << GIT_HASH << std::endl;
787  (*m_GooseGitVersionFile) << "time=" << COMPILE_TIME << std::endl;
788  (*m_GooseGitVersionFile) << "branch=" << GIT_BRANCH << std::endl;
789  }
790 #endif
791 }

References cfg_AOROutput_used, cfg_goose_ObservedOpennessQuery, cfg_goose_runtime_reporting, cfg_goose_WriteConfig, cfg_ReallyBigOutput_used, ClearGooseHabitatUseFieldObsStats(), ClearGooseHabitatUseStats(), IntakeSourceToString(), l_map_print_git_version_info, m_AOR_Barnacles, m_AOR_Greylags, m_AOR_Pinkfeet, m_GooseEnergeticsDataFile, m_GooseFieldForageDataFile, m_GooseGitVersionFile, m_GooseHabitatUseFieldObsFile, m_GooseHabitatUseFile, m_GooseIndLocCountFile, m_GooseLeaveReasonStatsFile, m_GoosePopDataFile, m_GooseWeightStatsFile, m_GooseXYDumpFile, m_StateStatsFile, ObservedOpennessQuery(), tomis_foobar, CfgBool::value(), WriteConfig(), and WriteHeaders().

Referenced by Goose_Population_Manager().

◆ InPinkfootSeason()

bool Goose_Population_Manager::InPinkfootSeason ( )
inline

Are we in the pinkfoot hunting season?

Definition at line 418 of file Goose_Population_Manager.h.

418 { return m_PinkfootSeason; }

References m_PinkfootSeason.

Referenced by BirdsShot(), BirdsToShootAtPoly(), and GooseActiveForageLocation::GetHuntables().

◆ IntakeSourceToString()

std::string Goose_Population_Manager::IntakeSourceToString ( TTypeOfMaxIntakeSource  a_intake_source)
protected

Translates tomis enum to string

Definition at line 2478 of file Goose_Population_Manager.cpp.

2479 {
2480  switch (a_intake_source)
2481  {
2482  case tomis_grass:
2483  return "grass";
2484  case tomis_sowncrop:
2485  return "winter_cereal";
2486  case tomis_maize:
2487  return "maize";
2488  case tomis_grain:
2489  return "grain";
2490  default:
2491  return "tomis_foobar";
2492  }
2493 }

References tomis_grain, tomis_grass, tomis_maize, and tomis_sowncrop.

Referenced by Init().

◆ LeaveReasonToString()

std::string Goose_Population_Manager::LeaveReasonToString ( TTypeOfLeaveReason  a_leave_reason)
protected

Translates tolr enum to string

Definition at line 2495 of file Goose_Population_Manager.cpp.

2496 {
2497  switch (a_leave_reason)
2498  {
2499  case tolr_migration:
2500  return "migration";
2501  case tolr_bodycondition:
2502  return "body_condition";
2503  case tolr_leanweight:
2504  return "lean_weight";
2505  case tomis_grain:
2506  return "grain";
2507  default:
2508  return "tolr_foobar";
2509  }
2510 }

References tolr_bodycondition, tolr_leanweight, tolr_migration, and tomis_grain.

Referenced by GooseLeaveReasonStatOutput().

◆ NewForageLocation()

int Goose_Population_Manager::NewForageLocation ( GooseSpeciesType  a_type,
int  a_number,
int  a_polyref 
)

Creates a new forage location and adds a goose or geese to the forage location. Returns an index to the forage location list.

Parameters
[in]a_typeis type of goose species to forage here in this first forage group
[in]a_numberis the number of geese in this first forarge group
[in]a_polyrefis the polygon reference number that identifies the field for foraging

Adds the new forage location to the m_GooseForageLocations vector and adds the starting number of geese of the type specified. Calculates the distance to the closest roost for each species.

Definition at line 1773 of file Goose_Population_Manager.cpp.

1774 {
1783  double grain = m_TheLandscape->SupplyBirdSeedForage( a_polyref ); // grain/m2
1784  double maize = m_TheLandscape->SupplyBirdMaizeForage( a_polyref ); // kJ/m2
1785  double grazing[gs_foobar];
1786  // NB GooseSpeciesType >> 1 becomes a GooseSpecies
1787  for (int g = 0; g < gs_foobar; g++)
1788  {
1789  grazing[g] = m_TheLandscape->GetActualGooseGrazingForage(a_polyref, (GooseSpecies) g);
1790  }
1791  GooseActiveForageLocation aFL(a_type, a_number, a_polyref, (int) m_TheLandscape->SupplyPolygonArea(a_polyref), grain, maize, grazing, this);
1792  aFL.ResetGrazing();
1793  // Calculate the distance to the closest roost for each species
1794  int x = m_TheLandscape->SupplyCentroidX(a_polyref);
1795  int y = m_TheLandscape->SupplyCentroidY(a_polyref);
1796  for (int i = 0; i < gs_foobar; i++) {
1797  double dist = GetDistToClosestRoost(x, y, i);
1798  aFL.SetDistToClosestRoost(i, dist);
1799  }
1800  m_GooseForageLocations.push_back(aFL);
1801  int ind = (int)m_GooseForageLocations.size() - 1;
1802  return ind;
1803 }

References GetDistToClosestRoost(), m_GooseForageLocations, and GooseActiveForageLocation::ResetGrazing().

Referenced by AddGeeseToForageLocationP(), and Goose_Base::st_ChooseForageLocation().

◆ ObservedOpennessQuery()

void Goose_Population_Manager::ObservedOpennessQuery ( )
protected

Writes a file with the openness scores on places where geese have been observed in the field.

Here locations of geese observed in the field are read in from a file and the openness score for those locations are written to a file.

Todo:
The string is padded by blank spaces - can this be fixed?

Definition at line 796 of file Goose_Population_Manager.cpp.

797 {
798  ofstream ofile("GooseObservedOpenness.txt", ios::out);
799  ofile << "Polyref" << '\t' << "Openness" << '\t' << "ElementType" << '\t'<< "CentroidX" << '\t' << "CentroidY" << endl;
800 
801  ifstream ifile( "GooseObservations.txt" );
802  if (!ifile.is_open())
803  {
804  m_TheLandscape->Warn( "Goose_Population_Manager::Goose_Population_Manager(Landscape* L) ", "GooseObservations.txt missing" );
805  exit( 1 );
806  }
807 
808  int no_entries;
809  ifile >> no_entries; // Read in the first line (number of lines)
810 
811  for (int i = 0; i < no_entries; i++)
812  {
813  int x;
814  int y;
815  string thetype;
816  int centroidx;
817  int centroidy;
818  int thepolyref;
819  int theopenness;
820 
821  ifile >> x >> y; // Read in the first and second column as x and y
822  thetype = m_TheLandscape->PolytypeToString(m_TheLandscape->SupplyElementType(x, y));
823  centroidx = m_TheLandscape->SupplyCentroidX(x, y);
824  centroidy = m_TheLandscape->SupplyCentroidY(x, y);
825  thepolyref = m_TheLandscape->SupplyPolyRef( x, y );
826  theopenness = m_TheLandscape->SupplyOpenness( x, y );
827 
828  //Write out the stuff to a file.
829  ofile << thepolyref << '\t' << theopenness << '\t' << thetype << '\t' << centroidx << '\t' << centroidy << endl;
830  }
831  ifile.close();
832  ofile.close();
833 }

Referenced by Init().

◆ RecordDailyEnergyBalance()

void Goose_Population_Manager::RecordDailyEnergyBalance ( int  a_balance,
GooseSpecies  a_species 
)

Record the daily energy balance.

Definition at line 2245 of file Goose_Population_Manager.cpp.

2246 {
2247  m_DailyEnergyBalanceStats[a_species].add_variable(a_balance);
2248 }

References m_DailyEnergyBalanceStats.

Referenced by Goose_Base::StartDay().

◆ RecordDailyEnergyBudget()

void Goose_Population_Manager::RecordDailyEnergyBudget ( int  a_deb,
GooseSpecies  a_species 
)

Record the daily energy budget.

Definition at line 2231 of file Goose_Population_Manager.cpp.

2232 {
2233  m_DailyEnergyBudgetStats[a_species].add_variable(a_deb);
2234 }

References m_DailyEnergyBudgetStats.

Referenced by Goose_Base::StartDay().

◆ RecordFlightDistance()

void Goose_Population_Manager::RecordFlightDistance ( int  a_distance,
GooseSpecies  a_species 
)

Record the flight distance.

Definition at line 2217 of file Goose_Population_Manager.cpp.

2218 {
2219  m_FlightDistanceStats[a_species].add_variable(a_distance);
2220 }

References m_FlightDistanceStats.

Referenced by Goose_Base::StartDay().

◆ RecordForagingTime()

void Goose_Population_Manager::RecordForagingTime ( int  a_time,
GooseSpecies  a_species 
)

Record the time spent foraging.

Definition at line 2203 of file Goose_Population_Manager.cpp.

2204 {
2205  m_ForagingTimeStats[a_species].add_variable(a_time);
2206 }

References m_ForagingTimeStats.

Referenced by Goose_Base::StartDay().

◆ RecordHabitatUse()

void Goose_Population_Manager::RecordHabitatUse ( int  a_habitatype,
GooseSpecies  a_species,
int  a_count 
)

Record the habitat use.

Definition at line 2177 of file Goose_Population_Manager.cpp.

2178 {
2179  m_HabitatUseStats[a_species * tomis_foobar + a_habitatype] += a_count;
2180 }

References m_HabitatUseStats, and tomis_foobar.

Referenced by DoLast().

◆ RecordHabitatUseFieldObs()

void Goose_Population_Manager::RecordHabitatUseFieldObs ( int  a_habitatype,
GooseSpecies  a_species,
int  a_count 
)

Record the habitat use.

Definition at line 2183 of file Goose_Population_Manager.cpp.

2184 {
2185  m_HabitatUseFieldObsStats[a_species * tomis_foobar + a_habitatype] += a_count;
2186 }

References m_HabitatUseFieldObsStats, and tomis_foobar.

Referenced by DoLast().

◆ RecordIndForageLoc()

void Goose_Population_Manager::RecordIndForageLoc ( double  a_count,
int  a_groupsize,
GooseSpecies  a_species 
)

Record a forage location count.

Definition at line 2259 of file Goose_Population_Manager.cpp.

2260 {
2261  for (int i=0; i<a_groupsize; i++) m_IndividualForageLocationData[a_species].add_variable(a_count);
2262 }

References m_IndividualForageLocationData.

Referenced by Goose_Base::StartDay().

◆ RecordLeaveReason()

void Goose_Population_Manager::RecordLeaveReason ( TTypeOfLeaveReason  a_leavereason,
GooseSpeciesType  a_speciestype 
)

Record the reason for leaving.

Definition at line 2280 of file Goose_Population_Manager.cpp.

2280  {
2281  m_LeaveReasonStats[a_speciestype][a_leavereason].add_variable(1);
2282 }

References m_LeaveReasonStats.

Referenced by Goose_Base::On_Migrate().

◆ RecordState()

void Goose_Population_Manager::RecordState ( )

Record the state.

Definition at line 2272 of file Goose_Population_Manager.cpp.

2272  {
2273  m_StateStats.add_variable(1);
2274 }

References m_StateStats.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ RecordWeight()

void Goose_Population_Manager::RecordWeight ( double  a_weight,
GooseSpecies  a_species 
)

Record the weight.

Definition at line 2164 of file Goose_Population_Manager.cpp.

2165 {
2166  m_WeightStats[a_species].add_variable(a_weight);
2167 }

References m_WeightStats.

Referenced by Goose_Base::StartDay().

◆ RemoveGeeseFromForageLocation()

void Goose_Population_Manager::RemoveGeeseFromForageLocation ( GooseSpeciesType  a_type,
int  a_index,
int  a_number 
)

◆ RemoveGrainKJ()

void Goose_Population_Manager::RemoveGrainKJ ( double  a_kJ,
int  a_index 
)
inline

Removes kJ eaten as grains from a forage area.

Definition at line 508 of file Goose_Population_Manager.h.

508 { m_GooseForageLocations[a_index].RemoveGrainKJ(a_kJ); }

References m_GooseForageLocations.

Referenced by RemoveMaxForageKj().

◆ RemoveMaizeKJ()

void Goose_Population_Manager::RemoveMaizeKJ ( double  a_kJ,
int  a_index 
)
inline

Removes KJ eaten as maize from a forage area.

Definition at line 513 of file Goose_Population_Manager.h.

513  {
514  m_GooseForageLocations[a_index].RemoveMaizeKJ(a_kJ);
515  }

References m_GooseForageLocations.

Referenced by RemoveMaxForageKj().

◆ RemoveMaxForageKj()

void Goose_Population_Manager::RemoveMaxForageKj ( double  a_forage,
TTypeOfMaxIntakeSource  a_maxintakesource,
int  m_myForageIndex 
)

Removes the forage eaten from the field.

Parameters
[in]a_forageThe forage to be removed in Kj
[in]a_maxintakesourceThe source of the max intake
[in]m_myForageIndexTemporary storage for a forage location index

Definition at line 2073 of file Goose_Population_Manager.cpp.

2073  {
2074  switch (a_maxintakesource) {
2075  case tomis_grain:
2076  RemoveGrainKJ( forage, m_myForageIndex );
2077  break;
2078  case tomis_maize:
2079  RemoveMaizeKJ( forage, m_myForageIndex );
2080  break;
2081  case tomis_grass:
2082  Graze( forage, m_myForageIndex );
2083  break;
2084  case tomis_foobar:
2085  m_TheLandscape->Warn( "Goose_Population_Manager::RemoveMaxForageKj", " - Somebody visited the foobar. Not allowed!" );
2086  exit( 0 );
2087  default:
2088  ;
2089  }
2090 }

References Graze(), RemoveGrainKJ(), RemoveMaizeKJ(), tomis_foobar, tomis_grain, tomis_grass, and tomis_maize.

Referenced by Goose_Base::st_Forage().

◆ StateStatOutput()

void Goose_Population_Manager::StateStatOutput ( )
protected

Write simple stats for the states.

Definition at line 1430 of file Goose_Population_Manager.cpp.

1430  {
1431  int Day = m_TheLandscape->SupplyGlobalDate();
1432  (*m_StateStatsFile) << m_SeasonNumber << '\t' << Day << '\t' << m_StateStats.get_N() << endl;
1433 }

References m_StateStats.

Referenced by DoLast().

◆ TheAOROutputProbe()

void Goose_Population_Manager::TheAOROutputProbe ( )
protectedvirtual

The modified goose version of the standard output for creating AOR statistics.

Here the problem is that we can't use the standard outputs because of the special goose population structures. So we need some special adaptions to the probe. This is done by extending the AOR_Probe class and using this, one for each species We also need to do this only once per day, so since the main calling loops use days as triggers we need to return doing nothing if the time is wrong.

Definition at line 2370 of file Goose_Population_Manager.cpp.

2370  {
2378  if (GetDayTime() == cfg_gooseAORtime.value())
2379  {
2380  m_AOR_Pinkfeet->DoProbe(gs_Pinkfoot);
2381  m_AOR_Barnacles->DoProbe(gs_Barnacle);
2382  m_AOR_Greylags->DoProbe(gs_Greylag);
2383  }
2384 }

References cfg_gooseAORtime, GetDayTime(), m_AOR_Barnacles, m_AOR_Greylags, m_AOR_Pinkfeet, and CfgInt::value().

◆ TheRipleysOutputProbe()

virtual void Goose_Population_Manager::TheRipleysOutputProbe ( FILE *  )
inlineprotectedvirtual

Does nothing, but we need it here because it automatically called by the Population_Manager if the NWordOutput is used.

Definition at line 828 of file Goose_Population_Manager.h.

828 { ; };

◆ WriteConfig()

void Goose_Population_Manager::WriteConfig ( )
protected

Writes a file the values of the config variables used.

Write out the values of the configs used Handy when compiling the result documents

Definition at line 839 of file Goose_Population_Manager.cpp.

839  {
840  ofstream ofile( "GooseConfig.txt", ios::out);
841  boost::io::ios_flags_saver ifs( ofile ); // Only use fixed within the scope of WriteConfig
842  ofile << fixed;
843  ofile << "Variable" << '\t' << "Value" << endl;
844  ofile << "GOOSE_PINKFOOTWEIGHT" << '\t' << cfg_goose_pf_baseweight.value() << endl;
845  ofile << "GOOSE_BARNACLEWEIGHT" << '\t' << cfg_goose_bn_baseweight.value() << endl;
846  ofile << "GOOSE_GREYLAGWEIGHT" << '\t' << cfg_goose_gl_baseweight.value() << endl;
847  ofile << "GOOSE_FLIGHTCOST" << '\t' << cfg_goose_flightcost.value() << endl;
848  ofile << "GOOSE_FORAGEDIST_PF" << '\t' << cfg_goose_pf_ForageDist.value() << endl;
849  ofile << "GOOSE_FORAGEDIST_BN" << '\t' << cfg_goose_bn_ForageDist.value() << endl;
850  ofile << "GOOSE_FORAGEDIST_GL" << '\t' << cfg_goose_gl_ForageDist.value() << endl;
851  ofile << "GOOSE_BMRCONSTANTA" << '\t' << cfg_goose_BMRconstant1.value() << endl;
852  ofile << "GOOSE_BMRCONSTANTB" << '\t' << cfg_goose_BMRconstant2.value() << endl;
853  ofile << "GOOSE_THERMALCONSTANTA_PF" << '\t' << cfg_goose_pf_Thermalconstant.value() << endl;
854  ofile << "GOOSE_THERMALCONSTANTA_BN" << '\t' << cfg_goose_bn_Thermalconstant.value() << endl;
855  ofile << "GOOSE_THERMALCONSTANTA_GL" << '\t' << cfg_goose_gl_Thermalconstant.value() << endl;
856  ofile << "GOOSE_THERMALCONSTANTB" << '\t' << cfg_goose_Thermalconstantb.value() << endl;
857  ofile << "GOOSE_MAXAPPETITESCALER" << '\t' << cfg_goose_MaxAppetiteScaler.value() << endl;
858  ofile << "GOOSE_MAXENERGYRESERVEPROPORTION" << '\t' << cfg_goose_MaxEnergyReserveProportion.value() << endl;
859  ofile << "GOOSE_ENERGYCONTENTOFFAT" << '\t' << cfg_goose_EnergyContentOfFat.value() << endl;
860  ofile << "GOOSE_METABOLICCONVCOSTS" << '\t' << cfg_goose_MetabolicConversionCosts.value() << endl;
861  ofile << "GOOSE_MINFORAGEOPENNESS" << '\t' << cfg_goose_MinForageOpenness.value() << endl;
862  ofile << "GOOSE_PF_SEXRATIO" << '\t' << cfg_goose_pf_sexratio.value() << endl;
863  ofile << "GOOSE_BN_SEXRATIO" << '\t' << cfg_goose_bn_sexratio.value() << endl;
864  ofile << "GOOSE_GL_SEXRATIO" << '\t' << cfg_goose_gl_sexratio.value() << endl;
865  ofile << "GOOSE_PF_ARRIVEDATESTART" << '\t' << cfg_goose_pf_arrivedatestart.value() << endl;
866  ofile << "GOOSE_PF_ARRIVEDATEEND" << '\t' << cfg_goose_pf_arrivedateend.value() << endl;
867  ofile << "GOOSE_BN_ARRIVEDATESTART" << '\t' << cfg_goose_bn_arrivedatestart.value() << endl;
868  ofile << "GOOSE_BN_ARRIVEDATEEND" << '\t' << cfg_goose_bn_arrivedateend.value() << endl;
869  ofile << "GOOSE_GL_ARRIVEDATESTART" << '\t' << cfg_goose_gl_arrivedatestart.value() << endl;
870  ofile << "GOOSE_GL_ARRIVEDATEEND" << '\t' << cfg_goose_gl_arrivedateend.value() << endl;
871  ofile << "GOOSE_PF_LEAVINGDATESTART" << '\t' << cfg_goose_pf_leavingdatestart.value() << endl;
872  ofile << "GOOSE_PF_LEAVINGDATEEND" << '\t' << cfg_goose_pf_leavingdateend.value() << endl;
873  ofile << "GOOSE_BN_LEAVINGDATESTART" << '\t' << cfg_goose_bn_leavingdatestart.value() << endl;
874  ofile << "GOOSE_BN_LEAVINGDATEEND" << '\t' << cfg_goose_bn_leavingdateend.value() << endl;
875  ofile << "GOOSE_GL_LEAVINGDATESTART" << '\t' << cfg_goose_gl_leavingdatestart.value() << endl;
876  ofile << "GOOSE_GL_LEAVINGDATEEND" << '\t' << cfg_goose_gl_leavingdateend.value() << endl;
877  ofile << "GOOSE_GRAINDECAYRATEWINTER" << '\t' << cfg_goose_GrainDecayRateWinter.value() << endl;
878  ofile << "GOOSE_GRAINDECAYRATESPRING" << '\t' << cfg_goose_GrainDecayRateSpring.value() << endl;
879  ofile << "GOOSE_MAXSCAREDIST" << '\t' << cfg_goose_MaxScareDistance.value() << endl;
880  ofile << "GOOSE_FOLLOWINGLIKELYHOOD_BN" << '\t' << cfg_goose_bn_followinglikelyhood.value() << endl;
881  ofile << "GOOSE_FOLLOWINGLIKELYHOOD_PF" << '\t' << cfg_goose_pf_followinglikelyhood.value() << endl;
882  ofile << "GOOSE_FOLLOWINGLIKELYHOOD_GL" << '\t' << cfg_goose_gl_followinglikelyhood.value() << endl;
883  ofile << "GOOSE_ROOSTLEAVEDISTSD" << '\t' << cfg_goose_RoostLeaveDistSD.value() << endl;
884  ofile << "GOOSE_ROOSTLEAVEDISTMEAN" << '\t' << cfg_goose_RoostLeaveDistMean.value() << endl;
885  ofile << "GOOSE_INITIALENERGYRESERVEPROPORTION" << '\t' << cfg_goose_InitialEnergyReserveProportion.value() << endl;
886  ofile << "GOOSE_ROOSTCHANGECHANCE" << '\t' << cfg_goose_roostchangechance.value() << endl;
887  ofile << "GOOSE_LEAVEREASONSTATS" << '\t' << cfg_goose_LeaveReasonStats.value() << endl;
888  ofile << "GOOSE_DIST_WEIGHTING_POWER" << '\t' << cfg_goose_dist_weight_power.value() << endl;
889  ofile << "GOOSE_GRASS_TO_WINTER_CEREAL_SCALER" << '\t' << cfg_goose_grass_to_winter_cereal_scaler.value() << endl;
890  ofile << "GOOSE_DAYTIMEBMRMULTIPLIER" << '\t' << cfg_goose_daytime_BMR_multiplier.value() << endl;
891  ofile << "GOOSE_NIGHTTIMEBMRMULTIPLIER" << '\t' << cfg_goose_nighttime_BMR_multiplier.value() << endl;
892  ofile << "GOOSE_SNOW_SCALER" << '\t' << cfg_goose_snow_scaler.value() << endl;
893  ofile << "VEG_GROWTHSCALERMAX" << '\t' << cfg_PermanentVegGrowthMaxScaler.value() << endl;
894  ofile << "VEG_GROWTHSCALERMIN" << '\t' << cfg_PermanentVegGrowthMinScaler.value() << endl;
895  ofile.close();
896 }

References cfg_goose_BMRconstant1, cfg_goose_BMRconstant2, cfg_goose_bn_arrivedateend, cfg_goose_bn_arrivedatestart, cfg_goose_bn_baseweight, cfg_goose_bn_followinglikelyhood, cfg_goose_bn_ForageDist, cfg_goose_bn_leavingdateend, cfg_goose_bn_leavingdatestart, cfg_goose_bn_sexratio, cfg_goose_bn_Thermalconstant, cfg_goose_daytime_BMR_multiplier, cfg_goose_dist_weight_power, cfg_goose_EnergyContentOfFat, cfg_goose_flightcost, cfg_goose_gl_arrivedateend, cfg_goose_gl_arrivedatestart, cfg_goose_gl_baseweight, cfg_goose_gl_followinglikelyhood, cfg_goose_gl_ForageDist, cfg_goose_gl_leavingdateend, cfg_goose_gl_leavingdatestart, cfg_goose_gl_sexratio, cfg_goose_gl_Thermalconstant, cfg_goose_GrainDecayRateSpring, cfg_goose_GrainDecayRateWinter, cfg_goose_grass_to_winter_cereal_scaler, cfg_goose_InitialEnergyReserveProportion, cfg_goose_LeaveReasonStats, cfg_goose_MaxAppetiteScaler, cfg_goose_MaxEnergyReserveProportion, cfg_goose_MaxScareDistance, cfg_goose_MetabolicConversionCosts, cfg_goose_MinForageOpenness, cfg_goose_nighttime_BMR_multiplier, cfg_goose_pf_arrivedateend, cfg_goose_pf_arrivedatestart, cfg_goose_pf_baseweight, cfg_goose_pf_followinglikelyhood, cfg_goose_pf_ForageDist, cfg_goose_pf_leavingdateend, cfg_goose_pf_leavingdatestart, cfg_goose_pf_sexratio, cfg_goose_pf_Thermalconstant, cfg_goose_roostchangechance, cfg_goose_RoostLeaveDistMean, cfg_goose_RoostLeaveDistSD, cfg_goose_snow_scaler, cfg_goose_Thermalconstantb, cfg_PermanentVegGrowthMaxScaler, cfg_PermanentVegGrowthMinScaler, CfgInt::value(), CfgFloat::value(), and CfgBool::value().

Referenced by Init().

◆ WriteHeaders()

void Goose_Population_Manager::WriteHeaders ( ofstream *  a_file,
std::vector< std::string >  a_headers 
)
protected

Handy function for writing headers.

Definition at line 2352 of file Goose_Population_Manager.cpp.

2353 {
2354  for (int i = 0; i < a_headers.size(); ++i)
2355  {
2356  if (i <= a_headers.size() - 2)
2357  {
2358  (*a_file) << a_headers[i];
2359  (*a_file) << '\t';
2360  }
2361  else
2362  {
2363  (*a_file) << a_headers[i];
2364  (*a_file) << endl;
2365  }
2366  }
2367 }

Referenced by Init().

◆ XYDump()

void Goose_Population_Manager::XYDump ( )
protected

Outputs x y data.

Definition at line 2386 of file Goose_Population_Manager.cpp.

2386  {
2387  // Families
2388  int total = int(GetLiveArraySize(gst_PinkfootFamilyGroup));
2389  int x, y, poly, index, gaflx, gafly, gaflpoly;
2390  //int w = m_TheLandscape->SupplySimAreaWidth();
2391  //int h = m_TheLandscape->SupplySimAreaHeight();
2392 
2393  for (int j = 0; j<total; j++)
2394  {
2395  int group_size = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->GetGroupsize();
2396  for (int k = 0; k < group_size; k++)
2397  {
2398  x = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->Supply_m_Location_x();
2399  y = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->Supply_m_Location_y();
2400  poly = m_TheLandscape->SupplyPolyRef(x, y);
2401  index = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootFamilyGroup][j])->GetForageLocIndex();
2402  if (index != -1) {
2404  gaflpoly = gafl->GetPolygonref();
2405  gaflx = m_TheLandscape->SupplyCentroidX(gaflpoly);
2406  gafly = m_TheLandscape->SupplyCentroidY(gaflpoly);
2407  }
2408  else {
2409  gaflpoly = -1;
2410  gaflx = -1;
2411  gafly = -1;
2412  }
2413  (*m_GooseXYDumpFile) << x << '\t' << y << '\t' << poly << '\t' <<
2414  gaflx << '\t' << gafly << '\t' << gaflpoly << endl;
2415  }
2416  }
2417  // Non-breeders
2418  total = int(GetLiveArraySize(gst_PinkfootNonBreeder));
2419 
2420  for (int j = 0; j<total; j++)
2421  {
2422  x = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootNonBreeder][j])->Supply_m_Location_x();
2423  y = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootNonBreeder][j])->Supply_m_Location_y();
2424  poly = m_TheLandscape->SupplyPolyRef(x, y);
2425  index = dynamic_cast<Goose_Base*>(TheArray[gst_PinkfootNonBreeder][j])->GetForageLocIndex();
2426  if (index != -1) {
2428  gaflpoly = gafl->GetPolygonref();
2429  gaflx = m_TheLandscape->SupplyCentroidX(gaflpoly);
2430  gafly = m_TheLandscape->SupplyCentroidY(gaflpoly);
2431  }
2432  else {
2433  gaflpoly = -1;
2434  gaflx = -1;
2435  gafly = -1;
2436  }
2437  (*m_GooseXYDumpFile) << x << '\t' << y << '\t' << poly << '\t' <<
2438  gaflx << '\t' << gafly << '\t' << gaflpoly << endl;
2439  }
2440 }

References GetForageLocation(), GooseActiveForageLocation::GetPolygonref(), gst_PinkfootFamilyGroup, and gst_PinkfootNonBreeder.

Referenced by DoLast().

Member Data Documentation

◆ m_AOR_Barnacles

AOR_Probe_Goose* Goose_Population_Manager::m_AOR_Barnacles
protected

AOR Probe for barnacles.

Definition at line 702 of file Goose_Population_Manager.h.

Referenced by Init(), TheAOROutputProbe(), and ~Goose_Population_Manager().

◆ m_AOR_Greylags

AOR_Probe_Goose* Goose_Population_Manager::m_AOR_Greylags
protected

AOR Probe for greylags.

Definition at line 706 of file Goose_Population_Manager.h.

Referenced by Init(), TheAOROutputProbe(), and ~Goose_Population_Manager().

◆ m_AOR_Pinkfeet

AOR_Probe_Goose* Goose_Population_Manager::m_AOR_Pinkfeet
protected

AOR Probe for pinkfeet.

Definition at line 698 of file Goose_Population_Manager.h.

Referenced by Init(), TheAOROutputProbe(), and ~Goose_Population_Manager().

◆ m_DailyEnergyBalanceStats

SimpleStatistics Goose_Population_Manager::m_DailyEnergyBalanceStats[gs_foobar]
protected

Statistics for the daily energy balance in the population.

Definition at line 686 of file Goose_Population_Manager.h.

Referenced by ClearGooseDailyEnergyBalanceStats(), GooseEnergyRecordOutput(), and RecordDailyEnergyBalance().

◆ m_DailyEnergyBudgetStats

SimpleStatistics Goose_Population_Manager::m_DailyEnergyBudgetStats[gs_foobar]
protected

Statistics for the daily energy budget in the population.

Definition at line 682 of file Goose_Population_Manager.h.

Referenced by ClearGooseDailyEnergyBudgetStats(), GooseEnergyRecordOutput(), and RecordDailyEnergyBudget().

◆ m_daylight

bool Goose_Population_Manager::m_daylight
protected

Flag for in daylight hours. Sunrise is always at m_daytime == 0.

Definition at line 590 of file Goose_Population_Manager.h.

Referenced by DoFirst(), and GetIsDaylight().

◆ m_daylightleft

int Goose_Population_Manager::m_daylightleft
protected

Number of daylight minutes left.

Definition at line 592 of file Goose_Population_Manager.h.

Referenced by DoFirst(), and GetDaylightLeft().

◆ m_daytime

int Goose_Population_Manager::m_daytime
protected

Holds the time of day. Note that sunrise is at m_daytime == 0.

Definition at line 588 of file Goose_Population_Manager.h.

Referenced by DoFirst(), DoLast(), GetDayTime(), and Goose_Population_Manager().

◆ m_FlightDistanceStats

SimpleStatistics Goose_Population_Manager::m_FlightDistanceStats[gs_foobar]
protected

Statistics for the flight distances in the population.

Definition at line 678 of file Goose_Population_Manager.h.

Referenced by ClearGooseFlightDistanceStats(), GooseEnergyRecordOutput(), and RecordFlightDistance().

◆ m_ForageRateVSGooseDensity

PettiforFeedingTimeCurveClass* Goose_Population_Manager::m_ForageRateVSGooseDensity
protected

Speed optimisation to hold all potential competition reductions in the range 0 - 1 goose/m2.

Speed optimisation to hold all potential feeding time increases as a function of flock size

Definition at line 620 of file Goose_Population_Manager.h.

Referenced by GetForageRateDensity(), Goose_Population_Manager(), and ~Goose_Population_Manager().

◆ m_ForagingTimeStats

SimpleStatistics Goose_Population_Manager::m_ForagingTimeStats[gs_foobar]
protected

Statistics for the time spent foraging for the population.

Definition at line 674 of file Goose_Population_Manager.h.

Referenced by ClearGooseForagingTimeStats(), GooseEnergyRecordOutput(), and RecordForagingTime().

◆ m_GooseEnergeticsDataFile

ofstream* Goose_Population_Manager::m_GooseEnergeticsDataFile
protected

Pointer to an output file for goose energetics data.

Definition at line 628 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseFieldForageDataFile

ofstream* Goose_Population_Manager::m_GooseFieldForageDataFile
protected

Pointer to an output file for goose field forage data.

Definition at line 652 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseForageLocations

◆ m_GooseGitVersionFile

ofstream* Goose_Population_Manager::m_GooseGitVersionFile
protected

Pointer to an output file for almass version.

Definition at line 654 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseHabitatUseFieldObsFile

ofstream* Goose_Population_Manager::m_GooseHabitatUseFieldObsFile
protected

Pointer to an output file for goose habitat use data, field observation mimic version.

Definition at line 636 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseHabitatUseFile

ofstream* Goose_Population_Manager::m_GooseHabitatUseFile
protected

Pointer to an output file for goose habitat use data.

Definition at line 632 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseIndLocCountFile

ofstream* Goose_Population_Manager::m_GooseIndLocCountFile
protected

Pointer to an output file for goose individual forage location count data.

Definition at line 640 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseLeaveReasonStatsFile

ofstream* Goose_Population_Manager::m_GooseLeaveReasonStatsFile
protected

Pointer to an output file for goose leave reason stats data.

Definition at line 648 of file Goose_Population_Manager.h.

Referenced by Init().

◆ m_GoosePopDataFile

ofstream* Goose_Population_Manager::m_GoosePopDataFile
protected

Pointer to an output file for goose population data.

Definition at line 624 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseWeightStatsFile

ofstream* Goose_Population_Manager::m_GooseWeightStatsFile
protected

Pointer to an output file for goose weight stats data.

Definition at line 644 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GooseXYDumpFile

ofstream* Goose_Population_Manager::m_GooseXYDumpFile
protected

Pointer to an output file for goose x y data.

Definition at line 710 of file Goose_Population_Manager.h.

Referenced by Init(), and ~Goose_Population_Manager().

◆ m_GreylagSeason

bool Goose_Population_Manager::m_GreylagSeason
protected

Flag to indicate if we are in the greylag hunting season.

Definition at line 602 of file Goose_Population_Manager.h.

Referenced by BirdsShot(), DoFirst(), Goose_Population_Manager(), and InGreylagSeason().

◆ m_HabitatUseFieldObsStats

int Goose_Population_Manager::m_HabitatUseFieldObsStats[gs_foobar *tomis_foobar]
protected

Data for the habitat use, field observation mimic version.

Definition at line 662 of file Goose_Population_Manager.h.

Referenced by ClearGooseHabitatUseFieldObsStats(), GooseHabitatUseFieldObsOutput(), and RecordHabitatUseFieldObs().

◆ m_HabitatUseStats

int Goose_Population_Manager::m_HabitatUseStats[gs_foobar *tomis_foobar]
protected

Data for the habitat use.

Definition at line 658 of file Goose_Population_Manager.h.

Referenced by ClearGooseHabitatUseStats(), GooseHabitatUseOutput(), and RecordHabitatUse().

◆ m_IndividualForageLocationData

SimpleStatistics Goose_Population_Manager::m_IndividualForageLocationData[gs_foobar]
protected

Statistics for the number of forage locations visited per goose of the population.

Definition at line 666 of file Goose_Population_Manager.h.

Referenced by ClearIndLocCountStats(), GooseIndLocCountOutput(), and RecordIndForageLoc().

◆ m_IntakeRateVSGrainDensity_PF

HollingsDiscCurveClass* Goose_Population_Manager::m_IntakeRateVSGrainDensity_PF
protected

Speed optimisation to hold all potential forage rates in the range 0-X grain density per m2.

Definition at line 608 of file Goose_Population_Manager.h.

Referenced by GetFeedingRate(), Goose_Population_Manager(), and ~Goose_Population_Manager().

◆ m_IntakeRateVSMaizeDensity_BN

HollingsDiscCurveClass* Goose_Population_Manager::m_IntakeRateVSMaizeDensity_BN
protected

Speed optimisation to hold all potential forage rates in the range 0-X maize density per m2.

Todo:
fix

Definition at line 612 of file Goose_Population_Manager.h.

Referenced by GetMaizeFeedingRate(), Goose_Population_Manager(), and ~Goose_Population_Manager().

◆ m_LeaveReasonStats

SimpleStatistics Goose_Population_Manager::m_LeaveReasonStats[gst_foobar][tolr_foobar]
protected

Statistics for reasons for leaving the simulation.

Definition at line 694 of file Goose_Population_Manager.h.

Referenced by ClearGooseLeaveReasonStats(), GooseLeaveReasonStatOutput(), and RecordLeaveReason().

◆ m_migrationnumbers

int Goose_Population_Manager::m_migrationnumbers[3][2]
protected

Storage for goose numbers. Used when birds are immigrating.

Definition at line 598 of file Goose_Population_Manager.h.

Referenced by DoImmigration(), and GetImmigrationNumbers().

◆ m_PinkfootSeason

bool Goose_Population_Manager::m_PinkfootSeason
protected

Flag to indicate if we are in the pinkfoot hunting season?

Definition at line 600 of file Goose_Population_Manager.h.

Referenced by BirdsShot(), DoFirst(), Goose_Population_Manager(), and InPinkfootSeason().

◆ m_roosts

std::vector<roostlist> Goose_Population_Manager::m_roosts
protected

The list of roosts

Definition at line 604 of file Goose_Population_Manager.h.

Referenced by DoImmigration(), FindClosestRoost(), GetDistToClosestRoost(), and Goose_Population_Manager().

◆ m_StateStats

SimpleStatistics Goose_Population_Manager::m_StateStats
protected

Debugging code. Statistics for the number of times a state method is called.

Definition at line 690 of file Goose_Population_Manager.h.

Referenced by ClearStateStats(), RecordState(), and StateStatOutput().

◆ m_StateStatsFile

ofstream* Goose_Population_Manager::m_StateStatsFile
protected

Pointer to an output file for state stats data.

Definition at line 688 of file Goose_Population_Manager.h.

Referenced by Init().

◆ m_thermalcosts

double Goose_Population_Manager::m_thermalcosts[3]
protected

Temporary storage for daily goose energetic thermal costs constant for each species.

Definition at line 594 of file Goose_Population_Manager.h.

Referenced by DoFirst(), GetThermalCosts(), and Goose_Population_Manager().

◆ m_variate_generator

Variate_gen* Goose_Population_Manager::m_variate_generator

Function to be able to draw randomly from predefined distributions.

Definition at line 564 of file Goose_Population_Manager.h.

Referenced by Goose_Population_Manager(), Goose_Base::StartDay(), and ~Goose_Population_Manager().

◆ m_WeightStats

SimpleStatistics Goose_Population_Manager::m_WeightStats[gs_foobar]
protected

Statistics for the weights of the population.

Definition at line 670 of file Goose_Population_Manager.h.

Referenced by ClearGooseWeightStats(), GooseWeightStatOutput(), and RecordWeight().

◆ m_youngdist

std::vector<int> Goose_Population_Manager::m_youngdist
protected

The observed distribution of young for pink feet.

Definition at line 596 of file Goose_Population_Manager.h.

Referenced by DoImmigration(), and Goose_Population_Manager().


The documentation for this class was generated from the following files:
cfg_Petti1E
CfgFloat cfg_Petti1E("PETTIFOR_ONE_E", CFG_CUSTOM, 1000)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
struct_Goose::m_weight
double m_weight
The weight.
Definition: Goose_Population_Manager.h:84
Goose_Population_Manager::m_GooseHabitatUseFieldObsFile
ofstream * m_GooseHabitatUseFieldObsFile
Pointer to an output file for goose habitat use data, field observation mimic version.
Definition: Goose_Population_Manager.h:636
Goose_Population_Manager::m_ForagingTimeStats
SimpleStatistics m_ForagingTimeStats[gs_foobar]
Statistics for the time spent foraging for the population.
Definition: Goose_Population_Manager.h:674
cfg_goose_daytime_BMR_multiplier
CfgFloat cfg_goose_daytime_BMR_multiplier("GOOSE_DAYTIMEBMRMULTIPLIER", CFG_CUSTOM, 1.65, 1.0, 10.0)
To calculate daily energy budget. This is the multiple of BMR spent during daytime Default is based o...
cfg_goose_ModelExitDay
CfgInt cfg_goose_ModelExitDay("GOOSE_MODELEXITDAY", CFG_CUSTOM, 9999, 1, 100000)
Input variable to control exit of the goose model The geese leave the simulation in spring,...
cfg_H2C
CfgBool cfg_H2C("HOLLINGS_TWO_C", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
Goose_Population_Manager::m_DailyEnergyBudgetStats
SimpleStatistics m_DailyEnergyBudgetStats[gs_foobar]
Statistics for the daily energy budget in the population.
Definition: Goose_Population_Manager.h:682
g_land
Landscape * g_land
This pointer provides access the to landscape module.
cfg_gooseAORtime
static CfgInt cfg_gooseAORtime("GOOSE_AORRECORDTIME", CFG_CUSTOM, 120, 0, 12 *60)
The time in minutes (multiple of ten) from sunrise when the AOR probe is recorded for geese.
cfg_goose_bn_fallmigrate
CfgBool cfg_goose_bn_fallmigrate("GOOSE_BN_FALL_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate a barnacle fall migration?
cfg_goose_WeightStats
static CfgBool cfg_goose_WeightStats("GOOSE_WEIGHTSTATS", CFG_CUSTOM, false)
Should we record goose weight statistics?
CfgStr::value
const char * value(void)
Definition: configurator.h:152
cfg_goose_MaxEnergyReserveProportion
CfgFloat cfg_goose_MaxEnergyReserveProportion("GOOSE_MAXENERGYRESERVEPROPORTION", CFG_CUSTOM, 0.27, 0.1, 1)
The maximum proportion of weight that can be stored as energy reserves.
Goose_Population_Manager::m_GoosePopDataFile
ofstream * m_GoosePopDataFile
Pointer to an output file for goose population data.
Definition: Goose_Population_Manager.h:624
cfg_goose_gl_springmigrate
CfgBool cfg_goose_gl_springmigrate("GOOSE_GL_SPRING_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate greylag a spring migration?
cfg_gooseHabitatUsetime
static CfgInt cfg_gooseHabitatUsetime("GOOSE_HABUSERECORDTIME", CFG_CUSTOM, 120, 0, 12 *60)
The time in minutes (multiple of ten) from sunrise when the habitat use is recorded for geese.
Goose_Population_Manager::m_youngdist
std::vector< int > m_youngdist
The observed distribution of young for pink feet.
Definition: Goose_Population_Manager.h:596
Goose_Population_Manager::RecordHabitatUse
void RecordHabitatUse(int a_habitatype, GooseSpecies a_species, int a_count)
Record the habitat use.
Definition: Goose_Population_Manager.cpp:2177
Goose_Population_Manager::GoosePopulationDescriptionOutput
void GoosePopulationDescriptionOutput()
Produces output to a standard file describing the state of the goose populations.
Definition: Goose_Population_Manager.cpp:1457
Goose_Population_Manager::m_WeightStats
SimpleStatistics m_WeightStats[gs_foobar]
Statistics for the weights of the population.
Definition: Goose_Population_Manager.h:670
Goose_Population_Manager::GetDayTime
int GetDayTime()
Get the time of day (in minutes). For the goose model, sunrise is defined as m_daytime == 0....
Definition: Goose_Population_Manager.h:408
tolr_leanweight
Definition: Goose_Base.h:106
cfg_goose_pf_sexratio
CfgFloat cfg_goose_pf_sexratio("GOOSE_PF_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0)
The sex ratio of pinkfoot non-breeders.
Goose_Population_Manager::InHuntingSeason
bool InHuntingSeason(int a_day, GooseSpecies a_species)
Are we in the hunting season?
Definition: Goose_Population_Manager.cpp:2294
cfg_goose_grass_to_winter_cereal_scaler
CfgFloat cfg_goose_grass_to_winter_cereal_scaler("GOOSE_GRASS_TO_WINTER_CEREAL_SCALER", CFG_CUSTOM, 1.0325, 0.0, 10.0)
The scaler to go from energy intake from grass forage to winter cereal The default value of 1....
Goose_Population_Manager::m_HabitatUseFieldObsStats
int m_HabitatUseFieldObsStats[gs_foobar *tomis_foobar]
Data for the habitat use, field observation mimic version.
Definition: Goose_Population_Manager.h:662
cfg_H1C
CfgBool cfg_H1C("HOLLINGS_ONE_C", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
struct_Goose::m_sex
bool m_sex
the sex
Definition: Goose_Population_Manager.h:59
cfg_goose_bn_baseweight
CfgFloat cfg_goose_bn_baseweight("GOOSE_BARNACLEWEIGHT", CFG_CUSTOM, 1708, 1500, 2000)
Lean weight of barnacle geese.
cfg_goose_gl_leavingdatestart
CfgInt cfg_goose_gl_leavingdatestart("GOOSE_GL_LEAVINGDATESTART", CFG_CUSTOM, 58)
Input: The initial starting date for greylags to leave the simulation area.
Goose_Barnacle_FamilyGroup
A class to describe the Barnacle family group.
Definition: GooseBarnacle_All.h:75
cfg_goose_pf_startnos
CfgInt cfg_goose_pf_startnos("GOOSE_PF_STARTNOS", CFG_CUSTOM, 13440)
Input: Pink-footed goose start numbers.
Goose_Population_Manager::m_GooseWeightStatsFile
ofstream * m_GooseWeightStatsFile
Pointer to an output file for goose weight stats data.
Definition: Goose_Population_Manager.h:644
struct_Goose::m_x
int m_x
x-coord
Definition: Goose_Population_Manager.h:71
cfg_goose_gl_leavingdateend
CfgInt cfg_goose_gl_leavingdateend("GOOSE_GL_LEAVINGDATEEND", CFG_CUSTOM, 68)
Input: The last date for greylags to leave the simulation area.
tomis_grass
Definition: Goose_Base.h:92
cfg_H2E
CfgFloat cfg_H2E("HOLLINGS_TWO_E", CFG_CUSTOM, 0)
Min x-value.
Goose_Population_Manager::XYDump
void XYDump()
Outputs x y data.
Definition: Goose_Population_Manager.cpp:2386
Goose_Greylag_FamilyGroup::ReInit
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
ReInit for object pool.
Definition: GooseGreylag_All.cpp:154
cfg_goose_ObservedOpennessQuery
static CfgBool cfg_goose_ObservedOpennessQuery("GOOSE_OBSERVEDOPENNESS", CFG_CUSTOM, false)
Should we query the map for openness scores on locations where geese have been observed in the field?
Goose_Population_Manager::GooseHabitatUseOutput
void GooseHabitatUseOutput()
Outputs simple stats for the goose habitat use.
Definition: Goose_Population_Manager.cpp:1244
cfg_goose_pf_FieldForageDist
CfgFloat cfg_goose_pf_FieldForageDist("GOOSE_FIELDFORAGEDIST_PF", CFG_CUSTOM, 5000, 1000, 35000)
The maximum forage range when already at a forage location for pink-footed geese (m)
roostlist
std::vector< APoint > roostlist
a list of goose roosts as points
Definition: Goose_Population_Manager.h:43
cfg_goose_bn_springmigdatestart
CfgInt cfg_goose_bn_springmigdatestart("GOOSE_BN_SPRING_MIG_START", CFG_CUSTOM, 15, 1, 365)
Input: Date for onset of barnacle spring migration.
Goose_Base::GetGroupsize
int GetGroupsize()
Returns the groupsize.
Definition: Goose_Base.h:410
cfg_H1D
CfgFloat cfg_H1D("HOLLINGS_ONE_D", CFG_CUSTOM, 2500)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
cfg_H1A
CfgFloat cfg_H1A("HOLLINGS_ONE_A", CFG_CUSTOM, 0.04217666)
Attack rate in a type II functional response curve (Hollings disc equation)
Goose_Population_Manager::m_GooseIndLocCountFile
ofstream * m_GooseIndLocCountFile
Pointer to an output file for goose individual forage location count data.
Definition: Goose_Population_Manager.h:640
cfg_goose_grain_and_maize_reset_day
CfgInt cfg_goose_grain_and_maize_reset_day("GOOSE_GRAINANDMAIZERESETDAY", CFG_CUSTOM, 59, 0, 364)
The day where all grain across the landscape is reset.
cfg_goose_gl_fallmig_probability
CfgFloat cfg_goose_gl_fallmig_probability("GOOSE_GL_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.0083, 0.0, 1.0)
Input: The greylag fall migration probability.
struct_Goose
Used for creation of a new Goose object.
Definition: Goose_Population_Manager.h:53
Goose_Population_Manager::StateStatOutput
void StateStatOutput()
Write simple stats for the states.
Definition: Goose_Population_Manager.cpp:1430
cfg_goose_bn_startnos
CfgInt cfg_goose_bn_startnos("GOOSE_BN_STARTNOS", CFG_CUSTOM, 5600)
Input: Barnacle goose start numbers.
Goose_Population_Manager::GooseWeightStatOutput
void GooseWeightStatOutput()
Outputs simple stats for the weights in the population.
Definition: Goose_Population_Manager.cpp:1395
cfg_goose_pf_young_proportion
CfgFloat cfg_goose_pf_young_proportion("GOOSE_PF_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0)
Input: Pink-footed goose proportion of young at start.
cfg_goose_bn_arrivedateend
CfgInt cfg_goose_bn_arrivedateend("GOOSE_BN_ARRIVEDATEEND", CFG_CUSTOM, 298)
Input: The last date for arrival for barnacles to the simulation area.
cfg_goose_gl_fallmigdateend
CfgInt cfg_goose_gl_fallmigdateend("GOOSE_GL_FALL_MIGRATION_END", CFG_CUSTOM, 334, 1, 365)
Input: Date for end of greylag fall migration.
cfg_goose_bn_leavingdatestart
CfgInt cfg_goose_bn_leavingdatestart("GOOSE_BN_LEAVINGDATESTART", CFG_CUSTOM, 90)
Input: The initial starting date for barnacles to leave the simulation area.
TTypeOfLeaveReason
TTypeOfLeaveReason
Definition: Goose_Base.h:102
Goose_Greylag_NonBreeder
A class to describe the Greylag non-breeder.
Definition: GooseGreylag_All.h:98
cfg_ReallyBigOutput_used
CfgBool cfg_ReallyBigOutput_used
Config to control if the Ripley probe is used or not.
cfg_goose_gl_springmigdatestart
CfgInt cfg_goose_gl_springmigdatestart("GOOSE_GL_SPRING_MIG_START", CFG_CUSTOM, 15, 1, 365)
Input: Date for onset of greylag spring migration.
cfg_Petti1F
CfgFloat cfg_Petti1F("PETTIFOR_ONE_F", CFG_CUSTOM, 0)
Min x-value.
cfg_goose_pf_springmignos
CfgInt cfg_goose_pf_springmignos("GOOSE_PF_SPRING_MIG_NOS", CFG_CUSTOM, 5600)
Input: Number of pinkfeet to immigrate in spring.
cfg_goose_pf_leavingdateend
CfgInt cfg_goose_pf_leavingdateend("GOOSE_PF_LEAVINGDATEEND", CFG_CUSTOM, 104)
Input: The last date for pink-foots to leave the simulation area.
Calendar::GetDayInMonth
int GetDayInMonth(void)
Definition: calendar.h:72
tolr_bodycondition
Definition: Goose_Base.h:105
start
Definition: treatment.h:32
cfg_goose_MinForageOpenness
CfgFloat cfg_goose_MinForageOpenness("GOOSE_MINFORAGEOPENNESS", CFG_CUSTOM, 100.0, 10, 10000)
The minimum openness score that a goose will tolerate for foraging.
cfg_goose_bn_leavingdateend
CfgInt cfg_goose_bn_leavingdateend("GOOSE_BN_LEAVINGDATEEND", CFG_CUSTOM, 134)
Input: The last date for barnacles to leave the simulation area.
Goose_Population_Manager::ClearGooseDailyEnergyBalanceStats
void ClearGooseDailyEnergyBalanceStats()
Clear simple stats for daily energy balance in the population.
Definition: Goose_Population_Manager.cpp:2250
cfg_Petti1B
CfgFloat cfg_Petti1B("PETTIFOR_ONE_B", CFG_CUSTOM, 0.57)
Minimum feeding time.
cfg_goose_gl_arrivedateend
CfgInt cfg_goose_gl_arrivedateend("GOOSE_GL_ARRIVEDATEEND", CFG_CUSTOM, 231)
Input: The last date for arrival for greylags to the simulation area.
cfg_goose_gl_arrivedatestart
CfgInt cfg_goose_gl_arrivedatestart("GOOSE_GL_ARRIVEDATESTART", CFG_CUSTOM, 212)
Input: The initial starting date for arrival for greylags to the simulation area.
cfg_goose_LeaveReasonStats
static CfgBool cfg_goose_LeaveReasonStats("GOOSE_LEAVEREASONSTATS", CFG_CUSTOM, false)
Should we record goose leaving reason statistics?
cfg_goose_gl_FieldForageDist
CfgFloat cfg_goose_gl_FieldForageDist("GOOSE_FIELDFORAGEDIST_GL", CFG_CUSTOM, 5000, 1000, 35000)
The maximum forage range when already at a forage location for greylag geese (m)
TMaxIntakeSource::m_veg
TTypesOfVegetation m_veg
The vegetation type.
Definition: Goose_Base.h:121
Goose_Population_Manager::GooseEnergyRecordOutput
void GooseEnergyRecordOutput()
Produces output to a standard file describing the number of birds foraging at each field and the fiel...
Definition: Goose_Population_Manager.cpp:1371
cfg_goose_gl_young_proportion
CfgFloat cfg_goose_gl_young_proportion("GOOSE_GL_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0)
Input: Greylag goose proportion of young at start.
GooseActiveForageLocation::GetPolygonref
int GetPolygonref()
Get the landscape element ( LE ) reference number used by the Landscape class to identify this locati...
Definition: Goose_Population_Manager.h:190
cfg_goose_StateStats
static CfgBool cfg_goose_StateStats("GOOSE_STATESTATS", CFG_CUSTOM, false)
Should we record state statistics?
Goose_Population_Manager::m_GooseEnergeticsDataFile
ofstream * m_GooseEnergeticsDataFile
Pointer to an output file for goose energetics data.
Definition: Goose_Population_Manager.h:628
cfg_goose_pf_fallmig_probability
CfgFloat cfg_goose_pf_fallmig_probability("GOOSE_PF_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.03, 0.0, 1.0)
Input: The pinkfoot fall migration probability.
cfg_goose_MaxScareDistance
CfgInt cfg_goose_MaxScareDistance("GOOSE_MAXSCAREDIST", CFG_CUSTOM, 500, 1, 5000)
The maximum distance in m that a goose can hear a scary bang.
tomis_maize
Definition: Goose_Base.h:94
Goose_Population_Manager::m_GooseFieldForageDataFile
ofstream * m_GooseFieldForageDataFile
Pointer to an output file for goose field forage data.
Definition: Goose_Population_Manager.h:652
cfg_goose_gl_springmignos
CfgInt cfg_goose_gl_springmignos("GOOSE_GL_SPRING_MIG_NOS", CFG_CUSTOM, 2240)
Input: Number of greylag to immigrate in spring.
Goose_Population_Manager::RecordHabitatUseFieldObs
void RecordHabitatUseFieldObs(int a_habitatype, GooseSpecies a_species, int a_count)
Record the habitat use.
Definition: Goose_Population_Manager.cpp:2183
Goose_Population_Manager::ClearGooseHabitatUseStats
void ClearGooseHabitatUseStats()
Clear simple stats for habitat use.
Definition: Goose_Population_Manager.cpp:2188
struct_Goose::m_L
Landscape * m_L
Landscape pointer.
Definition: Goose_Population_Manager.h:88
cfg_goose_pf_arrivedateend
CfgInt cfg_goose_pf_arrivedateend("GOOSE_PF_ARRIVEDATEEND", CFG_CUSTOM, 280)
Input: The last date for arrival for pink-foots to the simulation area.
struct_Goose::m_roost
APoint m_roost
Roost location.
Definition: Goose_Population_Manager.h:96
cfg_goose_snow_scaler
CfgFloat cfg_goose_snow_scaler("GOOSE_SNOW_SCALER", CFG_CUSTOM, 0.1, 0.0, 1.0)
The decrease in intake rate resulting from snow.
Goose_Population_Manager::m_variate_generator
Variate_gen * m_variate_generator
Function to be able to draw randomly from predefined distributions.
Definition: Goose_Population_Manager.h:564
TMaxIntakeSource
Definition: Goose_Base.h:113
cfg_goose_bn_followinglikelyhood
static CfgInt cfg_goose_bn_followinglikelyhood("GOOSE_FOLLOWINGLIKELYHOOD_BN", CFG_CUSTOM, 0, 0, 10000)
The likelyhood that a goose will follow another goose when going foraging - barnacle goose.
cfg_goose_pf_followinglikelyhood
static CfgInt cfg_goose_pf_followinglikelyhood("GOOSE_FOLLOWINGLIKELYHOOD_PF", CFG_CUSTOM, 0, 0, 10000)
The likelyhood that a goose will follow another goose when going foraging - pinkfooted goose.
cfg_goose_pf_fallmigrate
CfgBool cfg_goose_pf_fallmigrate("GOOSE_PF_FALL_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate a pinkfoot fall migration?
cfg_goose_gl_fallmigdatestart
CfgInt cfg_goose_gl_fallmigdatestart("GOOSE_GL_FALL_MIGRATION_START", CFG_CUSTOM, 232, 1, 365)
Input: Date for onset of greylag fall migration.
cfg_goose_pf_leavingdatestart
CfgInt cfg_goose_pf_leavingdatestart("GOOSE_PF_LEAVINGDATESTART", CFG_CUSTOM, 78)
Input: The initial starting date for pink-foots to the leave simulation area.
TMaxIntakeSource::m_maxintakesource
TTypeOfMaxIntakeSource m_maxintakesource
The intake source which gave the maximum intake.
Definition: Goose_Base.h:117
TMaxIntakeSource::m_iscereal
bool m_iscereal
Flag for whether the intake source is a cereal.
Definition: Goose_Base.h:119
tomis_sowncrop
Definition: Goose_Base.h:93
cfg_Petti1D
CfgBool cfg_Petti1D("PETTIFOR_ONE_D", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
cfg_goose_Thermalconstantb
CfgFloat cfg_goose_Thermalconstantb("GOOSE_THERMALCONSTANTB", CFG_CUSTOM, 1.272 *24, 1, 100)
Thermal regulation cost Constant b.
Goose_Population_Manager::ClearStateStats
void ClearStateStats()
Clear simple stats for the states.
Definition: Goose_Population_Manager.cpp:2276
Goose_Population_Manager::m_daylight
bool m_daylight
Flag for in daylight hours. Sunrise is always at m_daytime == 0.
Definition: Goose_Population_Manager.h:590
cfg_goose_bn_arrivedatestart
CfgInt cfg_goose_bn_arrivedatestart("GOOSE_BN_ARRIVEDATESTART", CFG_CUSTOM, 277)
Input: The initial starting date for arrival for barnacles to the simulation area.
Goose_Population_Manager::ClearGooseWeightStats
void ClearGooseWeightStats()
Clear simple stats for the weights in the population.
Definition: Goose_Population_Manager.cpp:2169
g_torun
int g_torun
This variable controls how long the simulation will run for.
Goose_Barnacle_FamilyGroup::ReInit
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
ReInit for object pool.
Definition: GooseBarnacle_All.cpp:165
cfg_H2A
CfgFloat cfg_H2A("HOLLINGS_TWO_A", CFG_CUSTOM, 0.04294186)
Attack rate in a type II functional response curve (Hollings disc equation)
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
A random number generator (0-1)
cfg_goose_bn_young_proportion
CfgFloat cfg_goose_bn_young_proportion("GOOSE_BN_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0)
Input: Barnacle goose proportion of young at start.
Goose_Population_Manager::m_StateStats
SimpleStatistics m_StateStats
Debugging code. Statistics for the number of times a state method is called.
Definition: Goose_Population_Manager.h:690
Goose_Population_Manager::GetMaizeDensity
double GetMaizeDensity(int a_index)
Returns the maize forage density for a forage location.
Definition: Goose_Population_Manager.h:504
cfg_PermanentVegGrowthMaxScaler
CfgFloat cfg_PermanentVegGrowthMaxScaler
Scales the growth of vegetation - max value.
gst_GreylagNonBreeder
Definition: Goose_Base.h:65
tomis_grain
Definition: Goose_Base.h:95
TMaxIntakeSource::m_instubble
bool m_instubble
Flag to indicate if the intake source was in stubble.
Definition: Goose_Base.h:123
Goose_Greylag_NonBreeder::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: GooseGreylag_All.cpp:247
cfg_PermanentVegGrowthMinScaler
CfgFloat cfg_PermanentVegGrowthMinScaler
Scales the growth of vegetation - min value.
Goose_Population_Manager::m_IntakeRateVSMaizeDensity_BN
HollingsDiscCurveClass * m_IntakeRateVSMaizeDensity_BN
Speed optimisation to hold all potential forage rates in the range 0-X maize density per m2.
Definition: Goose_Population_Manager.h:612
Goose_Population_Manager::m_StateStatsFile
ofstream * m_StateStatsFile
Pointer to an output file for state stats data.
Definition: Goose_Population_Manager.h:688
cfg_goose_bn_springmigrate
CfgBool cfg_goose_bn_springmigrate("GOOSE_BN_SPRING_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate barnacle a spring migration?
cfg_goose_gl_baseweight
CfgFloat cfg_goose_gl_baseweight("GOOSE_GREYLAGWEIGHT", CFG_CUSTOM, 2795, 2500, 3000)
Lean weight of greylag geese.
Goose_Population_Manager::m_IntakeRateVSGrainDensity_PF
HollingsDiscCurveClass * m_IntakeRateVSGrainDensity_PF
Speed optimisation to hold all potential forage rates in the range 0-X grain density per m2.
Definition: Goose_Population_Manager.h:608
cfg_goose_bn_sexratio
CfgFloat cfg_goose_bn_sexratio("GOOSE_BN_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0)
The sex ratio of barnacle non-breeders.
cfg_goose_bn_fallmigdatestart
CfgInt cfg_goose_bn_fallmigdatestart("GOOSE_BN_FALL_MIGRATION_START", CFG_CUSTOM, 318, 1, 365)
Input: Date for onset of barnacle fall migration.
cfg_H1B
CfgFloat cfg_H1B("HOLLINGS_ONE_B", CFG_CUSTOM, 0.0840075)
Handling time in a type II functional response curve (Hollings disc equation)
cfg_goose_RoostLeaveDistSD
CfgInt cfg_goose_RoostLeaveDistSD("GOOSE_ROOSTLEAVEDISTSD", CFG_CUSTOM, 10)
The standard deviation for the normal distribution which determines roost leave time.
Goose_Population_Manager::ForageLocationInUse
int ForageLocationInUse(int a_polyref)
Tests if a forage location is currently in use, if so returns the index to it.
Definition: Goose_Population_Manager.cpp:1752
cfg_goose_EnergyRecord
static CfgBool cfg_goose_EnergyRecord("GOOSE_ENERGYRECORD", CFG_CUSTOM, false)
Should we record goose energetics?
cfg_H1F
CfgStr cfg_H1F("HOLLINGS_ONE_G", CFG_CUSTOM, "KJIntakeAtDiffGrainDensities_PF")
File name for functional response on grain for pinkfeet.
Goose_Population_Manager::m_thermalcosts
double m_thermalcosts[3]
Temporary storage for daily goose energetic thermal costs constant for each species.
Definition: Goose_Population_Manager.h:594
cfg_goose_pf_springmigrate
CfgBool cfg_goose_pf_springmigrate("GOOSE_PF_SPRING_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate a spring migration?
Goose_Base::GetMaxIntakeSource
TMaxIntakeSource GetMaxIntakeSource()
Supply the current max intake source.
Definition: Goose_Base.h:349
Goose_Base::GetSpecies
GooseSpecies GetSpecies()
Returns the species.
Definition: Goose_Base.h:422
cfg_goose_gl_sexratio
CfgFloat cfg_goose_gl_sexratio("GOOSE_GL_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0)
The sex ratio of greylag non-breeders.
cfg_goose_gl_followinglikelyhood
static CfgInt cfg_goose_gl_followinglikelyhood("GOOSE_FOLLOWINGLIKELYHOOD_GL", CFG_CUSTOM, 0, 0, 10000)
The likelyhood that a goose will follow another goose when going foraging - graylag goose.
Goose_Population_Manager::m_GooseLeaveReasonStatsFile
ofstream * m_GooseLeaveReasonStatsFile
Pointer to an output file for goose leave reason stats data.
Definition: Goose_Population_Manager.h:648
Goose_Population_Manager::m_GooseForageLocations
std::vector< GooseActiveForageLocation > m_GooseForageLocations
Is a list of active goose forage locations where we have geese.
Definition: Goose_Population_Manager.h:558
cfg_goose_PopulationDescriptionON
static CfgBool cfg_goose_PopulationDescriptionON("GOOSE_POPULATIONDESCRIPTIONON", CFG_CUSTOM, true)
The cfg variable determining whether to print goose population stats.
cfg_goose_pf_springmigdateend
CfgInt cfg_goose_pf_springmigdateend("GOOSE_PF_SPRING_MIG_END", CFG_CUSTOM, 59, 1, 365)
Input: Date for end of spring migration.
TTypeOfMaxIntakeSource
TTypeOfMaxIntakeSource
Definition: Goose_Base.h:90
gst_BarnacleNonBreeder
Definition: Goose_Base.h:63
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
Goose_Population_Manager::GetForageLocation
GooseActiveForageLocation * GetForageLocation(unsigned int a_index)
Returns a pointer to the forage location indexed by index.
Definition: Goose_Population_Manager.h:448
Population_Manager
Goose_Population_Manager::m_GooseHabitatUseFile
ofstream * m_GooseHabitatUseFile
Pointer to an output file for goose habitat use data.
Definition: Goose_Population_Manager.h:632
Goose_Population_Manager::ClearGooseFlightDistanceStats
void ClearGooseFlightDistanceStats()
Clear simple stats for flight distances in the population.
Definition: Goose_Population_Manager.cpp:2222
Goose_Population_Manager::GetImmigrationNumbers
void GetImmigrationNumbers(GooseSpecies a_goose, bool a_season)
Get the numbers to immigrate.
Definition: Goose_Population_Manager.cpp:2092
gst_PinkfootNonBreeder
Definition: Goose_Base.h:61
Goose_Population_Manager::Graze
void Graze(double a_kJ, int a_index)
Removes KJ as grams veg biomass from a forage area.
Definition: Goose_Population_Manager.h:519
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: landscape.h:1596
cfg_goose_GrainDecayRateSpring
CfgFloat cfg_goose_GrainDecayRateSpring("GOOSE_GRAINDECAYRATESPRING", CFG_CUSTOM, 0.95, 0.0, 1.0)
The decay rate for spilled grain for Spring until 1st July.
cfg_goose_pf_ForageDist
CfgFloat cfg_goose_pf_ForageDist("GOOSE_FORAGEDIST_PF", CFG_CUSTOM, 35000, 1000, 35000)
The maximum forage range in m for pink-footed geese.
gst_foobar
Definition: Goose_Base.h:66
cfg_goose_EnergyContentOfFat
CfgFloat cfg_goose_EnergyContentOfFat("GOOSE_ENERGYCONTENTOFFAT", CFG_CUSTOM, 39.8, 1, 100)
The energy content of fat.
Goose_Population_Manager::InGreylagSeason
bool InGreylagSeason()
Are we in the greylag hunting season?
Definition: Goose_Population_Manager.h:420
cfg_goose_bn_fallmigdateend
CfgInt cfg_goose_bn_fallmigdateend("GOOSE_BN_FALL_MIGRATION_END", CFG_CUSTOM, 348, 1, 365)
Input: Date for end of barnacle fall migration.
cfg_goose_gl_ForageDist
CfgFloat cfg_goose_gl_ForageDist("GOOSE_FORAGEDIST_GL", CFG_CUSTOM, 35000, 1000, 35000)
The maximum forage range in m for greylag geese.
l_map_print_git_version_info
CfgBool l_map_print_git_version_info
Should git version info be printed to file and console?
cfg_WriteCurve
CfgBool cfg_WriteCurve("CURVE_WRITE", CFG_CUSTOM, false)
Controlling whether the functional response curves used are written to disk.
Goose_Population_Manager::RemoveGrainKJ
void RemoveGrainKJ(double a_kJ, int a_index)
Removes kJ eaten as grains from a forage area.
Definition: Goose_Population_Manager.h:508
cfg_goose_dist_weight_power
CfgFloat cfg_goose_dist_weight_power("GOOSE_DIST_WEIGHTING_POWER", CFG_CUSTOM, 1.0, -10.0, 10.0)
The exponent for the distance weighting curve.
cfg_goose_gl_startnos
CfgInt cfg_goose_gl_startnos("GOOSE_GL_STARTNOS", CFG_CUSTOM, 8960)
Input: Greylag geese start numbers.
Goose_Population_Manager::m_AOR_Greylags
AOR_Probe_Goose * m_AOR_Greylags
AOR Probe for greylags.
Definition: Goose_Population_Manager.h:706
TMaxIntakeSource::m_prevsowncrop
TTypesOfVegetation m_prevsowncrop
The previous sown crop on the forage location.
Definition: Goose_Base.h:125
GooseActiveForageLocation
A class to hold an active goose foraging location and the number of birds of different types there.
Definition: Goose_Population_Manager.h:103
tolr_migration
Definition: Goose_Base.h:104
Goose_Population_Manager::RemoveMaizeKJ
void RemoveMaizeKJ(double a_kJ, int a_index)
Removes KJ eaten as maize from a forage area.
Definition: Goose_Population_Manager.h:513
cfg_goose_MetabolicConversionCosts
CfgFloat cfg_goose_MetabolicConversionCosts("GOOSE_METABOLICCONVCOSTS", CFG_CUSTOM, 11.4, 1, 100)
The metabolic costs of converting tissue to energy or vice versa
Goose_Population_Manager::GetGrainDensity
double GetGrainDensity(int a_index)
Returns the forage density for a forage location.
Definition: Goose_Population_Manager.h:500
GooseSpeciesType
GooseSpeciesType
Definition: Goose_Base.h:58
tov_Maize
Definition: tov_declaration.h:36
Goose_Population_Manager::ClearIndLocCountStats
void ClearIndLocCountStats()
Clear simple stats for forage location counts.
Definition: Goose_Population_Manager.cpp:2264
cfg_goose_pf_springmigdatestart
CfgInt cfg_goose_pf_springmigdatestart("GOOSE_PF_SPRING_MIG_START", CFG_CUSTOM, 7, 1, 365)
Input: Date for onset of spring migration.
Goose_Greylag_FamilyGroup
A class to describe the Greylag family group.
Definition: GooseGreylag_All.h:76
CfgFloat::value
double value(void)
Definition: configurator.h:118
Goose_Population_Manager::m_LeaveReasonStats
SimpleStatistics m_LeaveReasonStats[gst_foobar][tolr_foobar]
Statistics for reasons for leaving the simulation.
Definition: Goose_Population_Manager.h:694
Goose_Population_Manager::m_GooseXYDumpFile
ofstream * m_GooseXYDumpFile
Pointer to an output file for goose x y data.
Definition: Goose_Population_Manager.h:710
Goose_Population_Manager::ClearGooseForagingTimeStats
void ClearGooseForagingTimeStats()
Clear simple stats for foraging times in the population.
Definition: Goose_Population_Manager.cpp:2208
Goose_Population_Manager::m_AOR_Barnacles
AOR_Probe_Goose * m_AOR_Barnacles
AOR Probe for barnacles.
Definition: Goose_Population_Manager.h:702
Goose_Population_Manager::m_IndividualForageLocationData
SimpleStatistics m_IndividualForageLocationData[gs_foobar]
Statistics for the number of forage locations visited per goose of the population.
Definition: Goose_Population_Manager.h:666
Goose_Population_Manager::NewForageLocation
int NewForageLocation(GooseSpeciesType a_type, int a_number, int a_polyref)
Creates a new forage location and adds a goose or geese to the forage location. Returns an index to t...
Definition: Goose_Population_Manager.cpp:1773
Goose_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, struct_Goose *data, int number)
Method for creating a new individual Goose.
Definition: Goose_Population_Manager.cpp:898
cfg_H2D
CfgFloat cfg_H2D("HOLLINGS_TWO_D", CFG_CUSTOM, 2100)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
gst_BarnacleFamilyGroup
Definition: Goose_Base.h:62
cfg_goose_GrainDecayRateWinter
CfgFloat cfg_goose_GrainDecayRateWinter("GOOSE_GRAINDECAYRATEWINTER", CFG_CUSTOM, 0.9985, 0.0, 1.0)
The decay rate for spilled grain for Harvest to Spring.
Goose_Population_Manager::m_migrationnumbers
int m_migrationnumbers[3][2]
Storage for goose numbers. Used when birds are immigrating.
Definition: Goose_Population_Manager.h:598
Goose_Population_Manager::m_GreylagSeason
bool m_GreylagSeason
Flag to indicate if we are in the greylag hunting season.
Definition: Goose_Population_Manager.h:602
cfg_goose_gl_springmigdateend
CfgInt cfg_goose_gl_springmigdateend("GOOSE_GL_SPRING_MIG_END", CFG_CUSTOM, 75, 1, 365)
Input: Date for end of greylag spring migration.
cfg_H2F
CfgStr cfg_H2F("HOLLINGS_TWO_G", CFG_CUSTOM, "KJIntakeAtDiffMaizeDensities_BN")
File name for functional response maize for barnacle.
cfg_goose_roostchangechance
CfgFloat cfg_goose_roostchangechance("GOOSE_ROOSTCHANGECHANCE", CFG_CUSTOM, 0.0, 0.0, 1.0)
Chance of changing roost.
cfg_goose_gl_Thermalconstant
CfgFloat cfg_goose_gl_Thermalconstant("GOOSE_THERMALCONSTANTA_GL", CFG_CUSTOM, 10.8, 1, 25)
Greylag goose lower critical temperature for calculating thermal regulation cost. Constant 1.
Goose_Population_Manager::IntakeSourceToString
std::string IntakeSourceToString(TTypeOfMaxIntakeSource a_intake_source)
Translates tomis enum to string
Definition: Goose_Population_Manager.cpp:2478
cfg_goose_InitialEnergyReserveProportion
CfgFloat cfg_goose_InitialEnergyReserveProportion("GOOSE_INITIALENERGYRESERVEPROPORTION", CFG_CUSTOM, 0.1, 0.0, 1)
The initial proportion of weight that can be stored as energy reserves.
Goose_Population_Manager::m_AOR_Pinkfeet
AOR_Probe_Goose * m_AOR_Pinkfeet
AOR Probe for pinkfeet.
Definition: Goose_Population_Manager.h:698
cfg_goose_bn_springmigdateend
CfgInt cfg_goose_bn_springmigdateend("GOOSE_BN_SPRING_MIG_END", CFG_CUSTOM, 75, 1, 365)
Input: Date for end of barnacle spring migration.
Goose_Population_Manager::ClearGooseHabitatUseFieldObsStats
void ClearGooseHabitatUseFieldObsStats()
Clear simple stats for field obs habitat use.
Definition: Goose_Population_Manager.cpp:2195
Goose_Population_Manager::m_ForageRateVSGooseDensity
PettiforFeedingTimeCurveClass * m_ForageRateVSGooseDensity
Speed optimisation to hold all potential competition reductions in the range 0 - 1 goose/m2.
Definition: Goose_Population_Manager.h:620
cfg_goose_pf_fallmigdateend
CfgInt cfg_goose_pf_fallmigdateend("GOOSE_PF_FALL_MIGRATION_END", CFG_CUSTOM, 304, 1, 365)
Input: Date for end of pinkfoot fall migration.
Goose_Population_Manager::ClearGooseLeaveReasonStats
void ClearGooseLeaveReasonStats()
Clear simple stats for the reasons for leaving the simulation.
Definition: Goose_Population_Manager.cpp:2284
cfg_AOROutput_used
CfgBool cfg_AOROutput_used
This config variable controls whether we should make AOR output.
Goose_Population_Manager::m_daytime
int m_daytime
Holds the time of day. Note that sunrise is at m_daytime == 0.
Definition: Goose_Population_Manager.h:588
Goose_Base::On_Bang
void On_Bang(int a_polyid)
The goose is scared by a bang at location.
Definition: Goose_Base.cpp:638
Goose_Barnacle_NonBreeder
A class to describe the Barnacle non-breeder.
Definition: GooseBarnacle_All.h:97
cfg_Petti1G
CfgStr cfg_Petti1G("PETTIFOR_ONE_G", CFG_CUSTOM, "FeedingTimePettifor_PF")
File name for density dependent functional response for pinkfeet.
Goose_Population_Manager::GooseTypeToString
std::string GooseTypeToString(GooseSpeciesType a_gst)
Translates gst enum to string
Definition: Goose_Population_Manager.cpp:2442
struct_Goose::m_grpsize
int m_grpsize
Size of family unit if any.
Definition: Goose_Population_Manager.h:67
Goose_Population_Manager::WriteHeaders
void WriteHeaders(ofstream *a_file, std::vector< std::string > a_headers)
Handy function for writing headers.
Definition: Goose_Population_Manager.cpp:2352
cfg_goose_nighttime_BMR_multiplier
CfgFloat cfg_goose_nighttime_BMR_multiplier("GOOSE_NIGHTTIMEBMRMULTIPLIER", CFG_CUSTOM, 1.3, 1.0, 10.0)
To calculate daily energy budget. This is the multiple of BMR spent during nighttime.
cfg_goose_gl_fallmigrate
CfgBool cfg_goose_gl_fallmigrate("GOOSE_GL_FALL_MIGRATE", CFG_CUSTOM, true)
Input: Should we simulate a greylag fall migration?
cfg_goose_pf_baseweight
CfgFloat cfg_goose_pf_baseweight("GOOSE_PINKFOOTWEIGHT", CFG_CUSTOM, 2307, 2000, 3000)
Lean weight of pinkfoot geese.
WARN_FILE
Definition: maperrormsg.h:37
Goose_Population_Manager::ClearGooseDailyEnergyBudgetStats
void ClearGooseDailyEnergyBudgetStats()
Clear simple stats for daily energy budget in the population.
Definition: Goose_Population_Manager.cpp:2236
Goose_Base::GetForageLocIndex
int GetForageLocIndex()
Gets for the forage location index.
Definition: Goose_Base.h:418
cfg_goose_FieldForageInfo
static CfgBool cfg_goose_FieldForageInfo("GOOSE_FIELDFORAGEINFO", CFG_CUSTOM, false)
Should we record goose field forage information?
gst_PinkfootFamilyGroup
Definition: Goose_Base.h:60
cfg_goose_pf_arrivedatestart
CfgInt cfg_goose_pf_arrivedatestart("GOOSE_PF_ARRIVEDATESTART", CFG_CUSTOM, 265)
Input: The initial starting date for arrival for pink-foots to the simulation area.
Goose_Base
A class to describe the goose base.
Definition: Goose_Base.h:131
cfg_goose_TimedCounts
CfgInt cfg_goose_TimedCounts("GOOSE_TIMEDCOUNTS", CFG_CUSTOM, 2, 1, 12)
The time when the geese are counted on fields. We divide the daylight hours by this cfg and add that ...
Goose_Population_Manager::GooseIndLocCountOutput
void GooseIndLocCountOutput()
Outputs simple stats for the number of forage locations visited per goose.
Definition: Goose_Population_Manager.cpp:1412
struct_Goose::m_GPM
Goose_Population_Manager * m_GPM
Goose_Population_Manager pointer.
Definition: Goose_Population_Manager.h:92
g_msg
MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
struct_Goose::m_family
bool m_family
is part of a family
Definition: Goose_Population_Manager.h:63
ALMaSS_MathFuncs::CalcDistPythagorasApprox
int CalcDistPythagorasApprox(int a_x, int a_y, int a_x1, int a_y1)
Calculate distance using the Pythagoras approximation.
Definition: misc.cpp:49
Goose_Population_Manager::GooseHabitatUseFieldObsOutput
void GooseHabitatUseFieldObsOutput()
Outputs simple stats for the goose habitat use but using rules to mimic field observations.
Definition: Goose_Population_Manager.cpp:1273
Goose_Population_Manager::m_PinkfootSeason
bool m_PinkfootSeason
Flag to indicate if we are in the pinkfoot hunting season?
Definition: Goose_Population_Manager.h:600
Goose_Population_Manager::m_daylightleft
int m_daylightleft
Number of daylight minutes left.
Definition: Goose_Population_Manager.h:592
cfg_goose_BMRconstant2
CfgFloat cfg_goose_BMRconstant2("GOOSE_BMRCONSTANTB", CFG_CUSTOM, 0.72, 0, 1)
The cost of BMR per kg goose - constant 2.
tov_MaizeSilage
Definition: tov_declaration.h:62
cfg_goose_greylagopenseasonend
CfgInt cfg_goose_greylagopenseasonend("GOOSE_GL_OPENSEASONEND", CFG_CUSTOM, 31)
The end of the greylag hunting season.
Goose_Pinkfoot_FamilyGroup
A class to describe the Pinkfoot family group.
Definition: GoosePinkFooted_All.h:75
tomis_foobar
Definition: Goose_Base.h:96
Goose_Population_Manager::WriteConfig
void WriteConfig()
Writes a file the values of the config variables used.
Definition: Goose_Population_Manager.cpp:839
cfg_H1E
CfgFloat cfg_H1E("HOLLINGS_ONE_E", CFG_CUSTOM, 0)
Min x-value.
CfgInt::value
int value(void)
Definition: configurator.h:98
cfg_goose_WriteConfig
static CfgBool cfg_goose_WriteConfig("GOOSE_WRITECONFIG", CFG_CUSTOM, true)
Should we write the values of the configs to a file?
cfg_goose_bn_FieldForageDist
CfgFloat cfg_goose_bn_FieldForageDist("GOOSE_FIELDFORAGEDIST_BN", CFG_CUSTOM, 5000, 1000, 35000)
The maximum forage range when already at a forage location for barnacle geese (m)
Goose_Population_Manager::GooseFieldForageInfoOutput
void GooseFieldForageInfoOutput()
Produces output to a standard file describing the energetic state of all individuals of the goose pop...
Definition: Goose_Population_Manager.cpp:1302
cfg_goose_pf_Thermalconstant
CfgFloat cfg_goose_pf_Thermalconstant("GOOSE_THERMALCONSTANTA_PF", CFG_CUSTOM, 11.4, 1, 25)
Pinkfooted goose lower critical temperature for calculating thermal regulation cost....
Goose_Population_Manager::GooseLeaveReasonStatOutput
void GooseLeaveReasonStatOutput()
Outputs simple stats for the reasons for leaving the simulation.
Definition: Goose_Population_Manager.cpp:1436
Goose_Population_Manager::LeaveReasonToString
std::string LeaveReasonToString(TTypeOfLeaveReason a_leave_reason)
Translates tolr enum to string
Definition: Goose_Population_Manager.cpp:2495
Goose_Population_Manager::GooseToString
std::string GooseToString(GooseSpecies a_gs)
Translates gs enum to string
Definition: Goose_Population_Manager.cpp:2463
Goose_Population_Manager::InPinkfootSeason
bool InPinkfootSeason()
Are we in the pinkfoot hunting season?
Definition: Goose_Population_Manager.h:418
g_AlmassMathFuncs
ALMaSS_MathFuncs g_AlmassMathFuncs
This variable provides access the to the internal ALMaSS math functions.
Goose_Population_Manager::m_DailyEnergyBalanceStats
SimpleStatistics m_DailyEnergyBalanceStats[gs_foobar]
Statistics for the daily energy balance in the population.
Definition: Goose_Population_Manager.h:686
struct_Goose::m_y
int m_y
y-coord
Definition: Goose_Population_Manager.h:75
GooseActiveForageLocation::ResetGrazing
void ResetGrazing()
Sets grazed biomass to zero.
Definition: Goose_Population_Manager.h:356
Landscape::SupplyYear
int SupplyYear(void)
Definition: landscape.h:1611
g_date
class Calendar * g_date
Definition: calendar.cpp:38
cfg_goose_bn_fallmig_probability
CfgFloat cfg_goose_bn_fallmig_probability("GOOSE_BN_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.0083, 0.0, 1.0)
Input: The barnacle fall migration probability.
GooseFieldList
std::vector< GooseFieldListItem > GooseFieldList
A list of GooseFieldListItem s.
Definition: landscape.h:103
tolr_foobar
Definition: Goose_Base.h:107
Goose_Population_Manager::GetDistToClosestRoost
double GetDistToClosestRoost(int a_x, int a_y, unsigned a_type)
Returns the distance in to the nearest roost of a_type in meters.
Definition: Goose_Population_Manager.cpp:496
Goose_Population_Manager::Init
virtual void Init(void)
Called upon initialization of the simulation. Sets up output files.
Definition: Goose_Population_Manager.cpp:670
gst_GreylagFamilyGroup
Definition: Goose_Base.h:64
cfg_goose_pf_fallmigdatestart
CfgInt cfg_goose_pf_fallmigdatestart("GOOSE_PF_FALL_MIGRATION_START", CFG_CUSTOM, 274, 1, 365)
Input: Date for onset of pinkfoot fall migration.
cfg_goose_pinkfootopenseasonstart
CfgInt cfg_goose_pinkfootopenseasonstart("GOOSE_PF_OPENSEASONSTART", CFG_CUSTOM, 243)
The start of the pinkfoot hunting season.
Goose_Pinkfoot_FamilyGroup::ReInit
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
ReInit for object pool.
Definition: GoosePinkFooted_All.cpp:170
ALMaSS_MathFuncs::CalcDistPythagoras
int CalcDistPythagoras(int a_x, int a_y, int a_x1, int a_y1)
Calculate distance using Pythagoras.
Definition: misc.cpp:42
Goose_Population_Manager::m_GooseGitVersionFile
ofstream * m_GooseGitVersionFile
Pointer to an output file for almass version.
Definition: Goose_Population_Manager.h:654
cfg_goose_RoostLeaveDistMean
CfgInt cfg_goose_RoostLeaveDistMean("GOOSE_ROOSTLEAVEDISTMEAN", CFG_CUSTOM, 30)
The mean for the normal distribution which determines roost leave time.
Goose_Population_Manager::m_FlightDistanceStats
SimpleStatistics m_FlightDistanceStats[gs_foobar]
Statistics for the flight distances in the population.
Definition: Goose_Population_Manager.h:678
cfg_goose_BMRconstant1
CfgFloat cfg_goose_BMRconstant1("GOOSE_BMRCONSTANTA", CFG_CUSTOM, 4.19 *78.30, 1, 500)
The cost of BMR per kg goose - constant 1.
cfg_goose_bn_ForageDist
CfgFloat cfg_goose_bn_ForageDist("GOOSE_FORAGEDIST_BN", CFG_CUSTOM, 35000, 1000, 35000)
The maximum forage range in m for barnacle geese.
cfg_goose_MaxAppetiteScaler
CfgFloat cfg_goose_MaxAppetiteScaler("GOOSE_MAXAPPETITESCALER", CFG_CUSTOM, 4.82, 1, 10)
The maximum a goose is allowed to eat in a day as a scaling of BMR.
CfgBool::value
bool value(void)
Definition: configurator.h:135
Goose_Population_Manager::ObservedOpennessQuery
void ObservedOpennessQuery()
Writes a file with the openness scores on places where geese have been observed in the field.
Definition: Goose_Population_Manager.cpp:796
cfg_H2B
CfgFloat cfg_H2B("HOLLINGS_TWO_B", CFG_CUSTOM, 0.05844966)
Handling time in a type II functional response curve (Hollings disc equation)
Goose_Base::GetRoost
APoint GetRoost()
Supply roost coords.
Definition: Goose_Base.h:345
cfg_goose_IndLocCounts
static CfgBool cfg_goose_IndLocCounts("GOOSE_INDLOCCOUNTSTATS", CFG_CUSTOM, false)
Should we record gooseindividual forage location count statistics?
cfg_goose_greylagopenseasonstart
CfgInt cfg_goose_greylagopenseasonstart("GOOSE_GL_OPENSEASONSTART", CFG_CUSTOM, 243)
The start of the greylag hunting season.
cfg_goose_LeavingThreshold
static CfgFloat cfg_goose_LeavingThreshold("GOOSE_LEAVINGTHRESHOLD", CFG_CUSTOM, 1.0, 1.0, 5.0)
The 5-day mean of body condition which triggers the bird to leave.
cfg_goose_pinkfootopenseasonend
CfgInt cfg_goose_pinkfootopenseasonend("GOOSE_PF_OPENSEASONEND", CFG_CUSTOM, 364)
The end of the pinkfoot hunting season.
cfg_goose_bn_Thermalconstant
CfgFloat cfg_goose_bn_Thermalconstant("GOOSE_THERMALCONSTANTA_BN", CFG_CUSTOM, 12.1, 1, 25)
Barnacle goose lower critical temperature for calculating thermal regulation cost....
Goose_Pinkfoot_NonBreeder::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: GoosePinkFooted_All.cpp:263
cfg_goose_flightcost
static CfgFloat cfg_goose_flightcost("GOOSE_FLIGHTCOST", CFG_CUSTOM, 0.000002079, 0, 1)
the cost of flight in kJ per m per gram
Goose_Pinkfoot_NonBreeder
A class to describe the Pinkfoot non-breeder.
Definition: GoosePinkFooted_All.h:97
Goose_Population_Manager::m_HabitatUseStats
int m_HabitatUseStats[gs_foobar *tomis_foobar]
Data for the habitat use.
Definition: Goose_Population_Manager.h:658
cfg_goose_bn_springmignos
CfgInt cfg_goose_bn_springmignos("GOOSE_BN_SPRING_MIG_NOS", CFG_CUSTOM, 8960)
Input: Number of barnacle to immigrate in spring.
Goose_Population_Manager::DoImmigration
virtual void DoImmigration()
Controls immigration to the Danish simulation area.
Definition: Goose_Population_Manager.cpp:1494
Goose_Barnacle_NonBreeder::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: GooseBarnacle_All.cpp:232
cfg_goose_runtime_reporting
static CfgBool cfg_goose_runtime_reporting("GOOSE_RUNTIMEREPORTING", CFG_CUSTOM, true)
Should we use stripped down output to optimize run time?
Goose_Population_Manager::m_roosts
std::vector< roostlist > m_roosts
The list of roosts
Definition: Goose_Population_Manager.h:604
cfg_Petti1A
CfgFloat cfg_Petti1A("PETTIFOR_ONE_A", CFG_CUSTOM, 0.88)
Maximum feeding time.
cfg_Petti1C
CfgFloat cfg_Petti1C("PETTIFOR_ONE_C", CFG_CUSTOM, 280)
Threshold flock size above which feeding time no longer increases.
Goose_Population_Manager::DoEmigration
virtual void DoEmigration()
Controls emigration from the Danish simulation area.
Definition: Goose_Population_Manager.cpp:1651