Goose Management Model ODdox  1.02
Goose_Population_Manager.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2013, Christopher John Topping, Aarhus University
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 ********************************************************************************************************
23 */
32 //---------------------------------------------------------------------------
33 
34 #include <string.h>
35 #include <math.h>
36 #include <iostream>
37 #include <fstream>
38 #include <vector>
39 #include <list>
40 #include "../Landscape/ls.h"
41 #include "../BatchALMaSS/PopulationManager.h"
42 #include "../BatchALMaSS/AOR_Probe.h"
43 #include "../GooseManagement/GooseMemoryMap.h"
44 #include "../GooseManagement/Goose_Base.h"
45 #include "../BatchALMaSS/CurveClasses.h"
46 #include "../Hunters/Hunters_all.h"
47 #include "../GooseManagement/Goose_Population_Manager.h"
48 #include "GoosePinkFooted_All.h"
49 #include "GooseGreylag_All.h"
50 #include "GooseBarnacle_All.h"
51 
52 #include "../BatchALMaSS/BoostRandomGenerators.h"
53 #include <boost/io/ios_state.hpp>
54 
56 extern boost::variate_generator<base_generator_type &, boost::uniform_real<>> g_rand_uni;
58 extern boost::variate_generator<base_generator_type &, boost::uniform_int<>> g_rand_uni2;
60 extern Landscape* g_land;
64 extern int g_torun;
67 
68 
77 
78 //---------------------------------------------------------------------------------------
79 
81 static CfgInt cfg_goose_bn_followinglikelyhood( "GOOSE_FOLLOWINGLIKELYHOOD_BN", CFG_CUSTOM, 0, 0, 10000);
83 static CfgInt cfg_goose_pf_followinglikelyhood("GOOSE_FOLLOWINGLIKELYHOOD_PF", CFG_CUSTOM, 0, 0, 10000);
85 static CfgInt cfg_goose_gl_followinglikelyhood("GOOSE_FOLLOWINGLIKELYHOOD_GL", CFG_CUSTOM, 0, 0, 10000);
89 CfgFloat cfg_goose_pf_baseweight("GOOSE_PINKFOOTWEIGHT", CFG_CUSTOM, 2307, 2000, 3000);
91 CfgFloat cfg_goose_bn_baseweight("GOOSE_BARNACLEWEIGHT", CFG_CUSTOM, 1708, 1500, 2000);
94 CfgFloat cfg_goose_gl_baseweight( "GOOSE_GREYLAGWEIGHT", CFG_CUSTOM, 2795, 2500, 3000);
99 static CfgFloat cfg_goose_flightcost( "GOOSE_FLIGHTCOST", CFG_CUSTOM, 0.000002079, 0, 1);
101 CfgFloat cfg_goose_pf_ForageDist("GOOSE_FORAGEDIST_PF", CFG_CUSTOM, 35000, 1000, 35000);
103 CfgFloat cfg_goose_bn_ForageDist("GOOSE_FORAGEDIST_BN", CFG_CUSTOM, 35000, 1000, 35000);
105 CfgFloat cfg_goose_pf_FieldForageDist("GOOSE_FIELDFORAGEDIST_PF", CFG_CUSTOM, 5000, 1000, 35000);
107 CfgFloat cfg_goose_bn_FieldForageDist("GOOSE_FIELDFORAGEDIST_BN", CFG_CUSTOM, 5000, 1000, 35000);
109 CfgFloat cfg_goose_gl_FieldForageDist("GOOSE_FIELDFORAGEDIST_GL", CFG_CUSTOM, 5000, 1000, 35000);
111 CfgFloat cfg_goose_gl_ForageDist("GOOSE_FORAGEDIST_GL", CFG_CUSTOM, 35000, 1000, 35000);
113 CfgFloat cfg_goose_BMRconstant1("GOOSE_BMRCONSTANTA", CFG_CUSTOM, 4.19*78.30, 1, 500);
115 CfgFloat cfg_goose_BMRconstant2("GOOSE_BMRCONSTANTB", CFG_CUSTOM, 0.72, 0, 1);
118 CfgFloat cfg_goose_pf_Thermalconstant("GOOSE_THERMALCONSTANTA_PF", CFG_CUSTOM, 11.4, 1, 25);
121 CfgFloat cfg_goose_bn_Thermalconstant( "GOOSE_THERMALCONSTANTA_BN", CFG_CUSTOM, 12.1, 1, 25);
124 CfgFloat cfg_goose_gl_Thermalconstant( "GOOSE_THERMALCONSTANTA_GL", CFG_CUSTOM, 10.8, 1, 25);
127 CfgFloat cfg_goose_Thermalconstantb("GOOSE_THERMALCONSTANTB", CFG_CUSTOM, 1.272 * 24, 1, 100); // kJ per day
131 CfgFloat cfg_goose_MaxAppetiteScaler("GOOSE_MAXAPPETITESCALER",CFG_CUSTOM, 4.82, 1, 10);
134 CfgFloat cfg_goose_MaxEnergyReserveProportion("GOOSE_MAXENERGYRESERVEPROPORTION",CFG_CUSTOM, 0.27, 0.1, 1);
136 CfgFloat cfg_goose_InitialEnergyReserveProportion("GOOSE_INITIALENERGYRESERVEPROPORTION", CFG_CUSTOM, 0.1, 0.0, 1);
138 CfgFloat cfg_goose_EnergyContentOfFat("GOOSE_ENERGYCONTENTOFFAT",CFG_CUSTOM, 39.8, 1, 100);
140 CfgFloat cfg_goose_MetabolicConversionCosts("GOOSE_METABOLICCONVCOSTS",CFG_CUSTOM, 11.4, 1, 100);
143 CfgFloat cfg_goose_MinForageOpenness( "GOOSE_MINFORAGEOPENNESS", CFG_CUSTOM, 100.0, 10, 10000);
146 CfgInt cfg_goose_MaxScareDistance("GOOSE_MAXSCAREDIST",CFG_CUSTOM, 500, 1, 5000);
149 static CfgFloat cfg_goose_LeavingThreshold("GOOSE_LEAVINGTHRESHOLD", CFG_CUSTOM, 1.0, 1.0, 5.0);
151 CfgInt cfg_goose_AfterDarkTime( "GOOSE_AFTERDARKTIME", CFG_CUSTOM, 30, 0, 180 );
155 CfgFloat cfg_goose_daytime_BMR_multiplier("GOOSE_DAYTIMEBMRMULTIPLIER", CFG_CUSTOM, 1.65, 1.0, 10.0);
157 CfgFloat cfg_goose_nighttime_BMR_multiplier("GOOSE_NIGHTTIMEBMRMULTIPLIER", CFG_CUSTOM, 1.3, 1.0, 10.0);
159 CfgFloat cfg_goose_roostchangechance("GOOSE_ROOSTCHANGECHANCE", CFG_CUSTOM, 0.0, 0.0, 1.0); // Default is no change of roost
160 
161 
162 
166 CfgInt cfg_goose_ModelExitDay( "GOOSE_MODELEXITDAY", CFG_CUSTOM, 9999, 1, 100000 );
168 CfgInt cfg_goose_grain_and_maize_reset_day("GOOSE_GRAINANDMAIZERESETDAY", CFG_CUSTOM, 59, 0, 364);
169 
171 static CfgInt cfg_gooseHabitatUsetime("GOOSE_HABUSERECORDTIME", CFG_CUSTOM, 120, 0, 12 * 60);
173 static CfgInt cfg_gooseAORtime("GOOSE_AORRECORDTIME", CFG_CUSTOM, 120, 0, 12 * 60);
175 static CfgBool cfg_goose_PopulationDescriptionON( "GOOSE_POPULATIONDESCRIPTIONON", CFG_CUSTOM, true );
177 static CfgBool cfg_goose_EnergyRecord("GOOSE_ENERGYRECORD", CFG_CUSTOM, false);
179 static CfgBool cfg_goose_IndLocCounts("GOOSE_INDLOCCOUNTSTATS", CFG_CUSTOM, false);
181 static CfgBool cfg_goose_WeightStats("GOOSE_WEIGHTSTATS", CFG_CUSTOM, false);
183 static CfgBool cfg_goose_StateStats("GOOSE_STATESTATS", CFG_CUSTOM, false);
185 static CfgBool cfg_goose_LeaveReasonStats("GOOSE_LEAVEREASONSTATS", CFG_CUSTOM, false);
187 static CfgBool cfg_goose_FieldForageInfo( "GOOSE_FIELDFORAGEINFO", CFG_CUSTOM, false );
189 static CfgBool cfg_goose_ObservedOpennessQuery( "GOOSE_OBSERVEDOPENNESS", CFG_CUSTOM, false );
191 static CfgBool cfg_goose_WriteConfig( "GOOSE_WRITECONFIG", CFG_CUSTOM, true );
193 static CfgBool cfg_goose_runtime_reporting("GOOSE_RUNTIMEREPORTING", CFG_CUSTOM, true);
194 
196 CfgInt cfg_goose_pf_startnos("GOOSE_PF_STARTNOS", CFG_CUSTOM, 13440);
198 CfgFloat cfg_goose_pf_young_proportion("GOOSE_PF_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0);
199 // Barnacle geese
201 CfgInt cfg_goose_bn_startnos("GOOSE_BN_STARTNOS", CFG_CUSTOM, 5600);
203 CfgFloat cfg_goose_bn_young_proportion("GOOSE_BN_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0);
204 // Greylag geese
206 CfgInt cfg_goose_gl_startnos("GOOSE_GL_STARTNOS", CFG_CUSTOM, 8960);
208 CfgFloat cfg_goose_gl_young_proportion("GOOSE_GL_YOUNG_PROPORTION", CFG_CUSTOM, 0.21, 0.0, 1.0);
209 
211 CfgBool cfg_goose_pf_springmigrate( "GOOSE_PF_SPRING_MIGRATE", CFG_CUSTOM, true );
213 CfgInt cfg_goose_pf_springmigdatestart( "GOOSE_PF_SPRING_MIG_START", CFG_CUSTOM, 7, 1, 365 );
215 CfgInt cfg_goose_pf_springmigdateend( "GOOSE_PF_SPRING_MIG_END", CFG_CUSTOM, 59, 1, 365 );
217 CfgInt cfg_goose_pf_springmignos("GOOSE_PF_SPRING_MIG_NOS", CFG_CUSTOM, 5600);
219 CfgBool cfg_goose_pf_fallmigrate( "GOOSE_PF_FALL_MIGRATE", CFG_CUSTOM, true );
221 CfgInt cfg_goose_pf_fallmigdatestart( "GOOSE_PF_FALL_MIGRATION_START", CFG_CUSTOM, 274, 1, 365);
223 CfgInt cfg_goose_pf_fallmigdateend( "GOOSE_PF_FALL_MIGRATION_END", CFG_CUSTOM, 304, 1, 365);
225 CfgFloat cfg_goose_pf_fallmig_probability("GOOSE_PF_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.03, 0.0, 1.0);
226 
228 CfgBool cfg_goose_gl_springmigrate( "GOOSE_GL_SPRING_MIGRATE", CFG_CUSTOM, true );
230 CfgInt cfg_goose_gl_springmigdatestart( "GOOSE_GL_SPRING_MIG_START", CFG_CUSTOM, 15, 1, 365 );
232 CfgInt cfg_goose_gl_springmigdateend( "GOOSE_GL_SPRING_MIG_END", CFG_CUSTOM, 75, 1, 365 );
234 CfgInt cfg_goose_gl_springmignos("GOOSE_GL_SPRING_MIG_NOS", CFG_CUSTOM, 2240);
236 CfgBool cfg_goose_gl_fallmigrate( "GOOSE_GL_FALL_MIGRATE", CFG_CUSTOM, true );
238 CfgInt cfg_goose_gl_fallmigdatestart( "GOOSE_GL_FALL_MIGRATION_START", CFG_CUSTOM, 232, 1, 365 );
240 CfgInt cfg_goose_gl_fallmigdateend( "GOOSE_GL_FALL_MIGRATION_END", CFG_CUSTOM, 334, 1, 365 );
242 CfgFloat cfg_goose_gl_fallmig_probability("GOOSE_GL_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.0083, 0.0, 1.0);
243 
245 CfgBool cfg_goose_bn_springmigrate( "GOOSE_BN_SPRING_MIGRATE", CFG_CUSTOM, true );
247 CfgInt cfg_goose_bn_springmigdatestart( "GOOSE_BN_SPRING_MIG_START", CFG_CUSTOM, 15, 1, 365 );
249 CfgInt cfg_goose_bn_springmigdateend( "GOOSE_BN_SPRING_MIG_END", CFG_CUSTOM, 75, 1, 365 );
251 CfgInt cfg_goose_bn_springmignos("GOOSE_BN_SPRING_MIG_NOS", CFG_CUSTOM, 8960);
253 CfgBool cfg_goose_bn_fallmigrate( "GOOSE_BN_FALL_MIGRATE", CFG_CUSTOM, true );
255 CfgInt cfg_goose_bn_fallmigdatestart( "GOOSE_BN_FALL_MIGRATION_START", CFG_CUSTOM, 318, 1, 365 );
257 CfgInt cfg_goose_bn_fallmigdateend( "GOOSE_BN_FALL_MIGRATION_END", CFG_CUSTOM, 348, 1, 365 );
259 CfgFloat cfg_goose_bn_fallmig_probability("GOOSE_BN_FALLMIG_PROBABILITY", CFG_CUSTOM, 0.0083, 0.0, 1.0);
260 
262 CfgFloat cfg_goose_pf_sexratio("GOOSE_PF_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0);
264 CfgFloat cfg_goose_bn_sexratio("GOOSE_BN_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0);
266 CfgFloat cfg_goose_gl_sexratio("GOOSE_GL_SEXRATIO", CFG_CUSTOM, 0.5, 0.0, 1.0);
267 
269 CfgInt cfg_goose_pf_arrivedatestart("GOOSE_PF_ARRIVEDATESTART", CFG_CUSTOM, 265); // 23/09
271 CfgInt cfg_goose_pf_arrivedateend("GOOSE_PF_ARRIVEDATEEND", CFG_CUSTOM, 280); // 08/10
273 CfgInt cfg_goose_bn_arrivedatestart("GOOSE_BN_ARRIVEDATESTART", CFG_CUSTOM, 277); // 05/10
275 CfgInt cfg_goose_bn_arrivedateend("GOOSE_BN_ARRIVEDATEEND", CFG_CUSTOM, 298); // 26/10
277 CfgInt cfg_goose_gl_arrivedatestart("GOOSE_GL_ARRIVEDATESTART", CFG_CUSTOM, 212); // 01/08
279 CfgInt cfg_goose_gl_arrivedateend("GOOSE_GL_ARRIVEDATEEND", CFG_CUSTOM, 231); // 20/08
281 CfgInt cfg_goose_pf_leavingdatestart("GOOSE_PF_LEAVINGDATESTART", CFG_CUSTOM, 78); // 20/03
283 CfgInt cfg_goose_pf_leavingdateend("GOOSE_PF_LEAVINGDATEEND", CFG_CUSTOM, 104); // 15/04
285 CfgInt cfg_goose_bn_leavingdatestart("GOOSE_BN_LEAVINGDATESTART", CFG_CUSTOM, 90); // 01/04
287 CfgInt cfg_goose_bn_leavingdateend("GOOSE_BN_LEAVINGDATEEND", CFG_CUSTOM, 134); // 15/05
289 CfgInt cfg_goose_gl_leavingdatestart("GOOSE_GL_LEAVINGDATESTART", CFG_CUSTOM, 58); // 28/02
291 CfgInt cfg_goose_gl_leavingdateend("GOOSE_GL_LEAVINGDATEEND", CFG_CUSTOM, 68); // 10/03
292 
294 CfgFloat cfg_goose_GrainDecayRateWinter("GOOSE_GRAINDECAYRATEWINTER", CFG_CUSTOM, 0.9985, 0.0, 1.0);// Halflife of 463 days
296 CfgFloat cfg_goose_GrainDecayRateSpring("GOOSE_GRAINDECAYRATESPRING", CFG_CUSTOM, 0.95, 0.0, 1.0); // Halflife of approx 17 days
299 CfgFloat cfg_goose_grass_to_winter_cereal_scaler("GOOSE_GRASS_TO_WINTER_CEREAL_SCALER", CFG_CUSTOM, 1.0325, 0.0, 10.0);
301 CfgFloat cfg_goose_MinForageRateDecayRate("GOOSE_MINFORAGEDECAYRATE", CFG_CUSTOM, 0.72, 0.0, 1.0);
303 CfgInt cfg_goose_RoostLeaveDistMean( "GOOSE_ROOSTLEAVEDISTMEAN", CFG_CUSTOM, 30 );
305 CfgInt cfg_goose_RoostLeaveDistSD( "GOOSE_ROOSTLEAVEDISTSD", CFG_CUSTOM, 10 );
306 
309 CfgInt cfg_goose_TimedCounts("GOOSE_TIMEDCOUNTS", CFG_CUSTOM, 2, 1, 12);
310 
312  CfgInt cfg_goose_pinkfootopenseasonstart("GOOSE_PF_OPENSEASONSTART", CFG_CUSTOM, 243);
314  CfgInt cfg_goose_pinkfootopenseasonend("GOOSE_PF_OPENSEASONEND", CFG_CUSTOM, 364);
316  CfgInt cfg_goose_greylagopenseasonstart("GOOSE_GL_OPENSEASONSTART", CFG_CUSTOM, 243);
318  CfgInt cfg_goose_greylagopenseasonend("GOOSE_GL_OPENSEASONEND", CFG_CUSTOM, 31);
320  CfgFloat cfg_goose_dist_weight_power("GOOSE_DIST_WEIGHTING_POWER", CFG_CUSTOM, 1.0, -10.0, 10.0);
322  CfgFloat cfg_goose_snow_scaler("GOOSE_SNOW_SCALER", CFG_CUSTOM, 0.1, 0.0, 1.0);
323 
336  CfgFloat cfg_P1A("POLYNOMIALTWO_ONE_A", CFG_CUSTOM, -0.1884);
338  CfgFloat cfg_P1B("POLYNOMIALTWO_ONE_B", CFG_CUSTOM, 3.1349);
340  CfgFloat cfg_P1C("POLYNOMIALTWO_ONE_C", CFG_CUSTOM, 0.0);
343  CfgFloat cfg_P1D("POLYNOMIALTWO_ONE_D", CFG_CUSTOM, 0.404);
345  CfgBool cfg_P1E("POLYNOMIALTWO_ONE_E", CFG_CUSTOM, false);
347  CfgFloat cfg_P1F("POLYNOMIALTWO_ONE_F", CFG_CUSTOM, 16.63);
349  CfgFloat cfg_P1G("POLYNOMIALTWO_ONE_G", CFG_CUSTOM, 0.00);
351  CfgStr cfg_P1H("POLYNOMIALTWO_ONE_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_PF");
352 
354  CfgFloat cfg_G6A("POLYNOMIALTWO_TWO_A", CFG_CUSTOM, -0.1094);
356  CfgFloat cfg_G6B("POLYNOMIALTWO_TWO_B", CFG_CUSTOM, 2.6695);
358  CfgFloat cfg_G6C("POLYNOMIALTWO_TWO_C", CFG_CUSTOM, 0.0);
361  CfgFloat cfg_G6D("POLYNOMIALTWO_TWO_D", CFG_CUSTOM, 0.404);
363  CfgBool cfg_G6E("POLYNOMIALTWO_TWO_E", CFG_CUSTOM, false);
365  CfgFloat cfg_G6F("POLYNOMIALTWO_TWO_F", CFG_CUSTOM, 24.4013);
367  CfgFloat cfg_G6G("POLYNOMIALTWO_TWO_G", CFG_CUSTOM, 0.00);
369  CfgStr cfg_G6H("POLYNOMIALTWO_TWO_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_GL");
370 
372  CfgFloat cfg_B6A("POLYNOMIALTWO_THREE_A", CFG_CUSTOM, -0.066);
374  CfgFloat cfg_B6B("POLYNOMIALTWO_THREE_B", CFG_CUSTOM, 0.88);
376  CfgFloat cfg_B6C("POLYNOMIALTWO_THREE_C", CFG_CUSTOM, 5.0);
379  CfgFloat cfg_B6D("POLYNOMIALTWO_THREE_D", CFG_CUSTOM, 0.404);
381  CfgBool cfg_B6E("POLYNOMIALTWO_THREE_E", CFG_CUSTOM, false);
383  CfgFloat cfg_B6F("POLYNOMIALTWO_THREE_F", CFG_CUSTOM, 13.4761);
385  CfgFloat cfg_B6G("POLYNOMIALTWO_THREE_B", CFG_CUSTOM, 0.00);
387  CfgStr cfg_B6H("POLYNOMIALTWO_THREE_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_BG");
388 
389  // ---- Grain functional response calculated by Kevin on 13/10/2017 ---- //
391  CfgFloat cfg_H1A("HOLLINGS_ONE_A", CFG_CUSTOM, 0.04217666);
393  CfgFloat cfg_H1B("HOLLINGS_ONE_B", CFG_CUSTOM, 0.0840075);
395  CfgBool cfg_H1C("HOLLINGS_ONE_C", CFG_CUSTOM, false);
397  CfgFloat cfg_H1D("HOLLINGS_ONE_D", CFG_CUSTOM, 2500);
399  CfgFloat cfg_H1E("HOLLINGS_ONE_E", CFG_CUSTOM, 0);
401  CfgStr cfg_H1F("HOLLINGS_ONE_G", CFG_CUSTOM, "KJIntakeAtDiffGrainDensities_PF");
402 
403  // ---- Maize functional response Calculated by Kevin on 29/06/2018 ---- //
405  CfgFloat cfg_H2A("HOLLINGS_TWO_A", CFG_CUSTOM, 0.04294186);
407  CfgFloat cfg_H2B("HOLLINGS_TWO_B", CFG_CUSTOM, 0.05844966);
409  CfgBool cfg_H2C("HOLLINGS_TWO_C", CFG_CUSTOM, false);
411  CfgFloat cfg_H2D("HOLLINGS_TWO_D", CFG_CUSTOM, 2100);
413  CfgFloat cfg_H2E("HOLLINGS_TWO_E", CFG_CUSTOM, 0);
415  CfgStr cfg_H2F("HOLLINGS_TWO_G", CFG_CUSTOM, "KJIntakeAtDiffMaizeDensities_BN");
416 
417  // ---- Pettifor feeding time curve ---- //
419  CfgFloat cfg_Petti1A("PETTIFOR_ONE_A", CFG_CUSTOM, 0.88);
421  CfgFloat cfg_Petti1B("PETTIFOR_ONE_B", CFG_CUSTOM, 0.57);
423  CfgFloat cfg_Petti1C("PETTIFOR_ONE_C", CFG_CUSTOM, 280);
425  CfgBool cfg_Petti1D("PETTIFOR_ONE_D", CFG_CUSTOM, false);
427  CfgFloat cfg_Petti1E("PETTIFOR_ONE_E", CFG_CUSTOM, 1000);
429  CfgFloat cfg_Petti1F("PETTIFOR_ONE_F", CFG_CUSTOM, 0);
431  CfgStr cfg_Petti1G("PETTIFOR_ONE_G", CFG_CUSTOM, "FeedingTimePettifor_PF");
432 
434  CfgBool cfg_WriteCurve("CURVE_WRITE", CFG_CUSTOM, false);
435 
436  //---------------------------------------------------------------------------
437 
439  int a_area, double a_graindensity, double a_maizedensity, double *a_grazing,
441  {
443  SetPolygonref(a_polyref);
444  SetArea(a_area);
445  SetGrainDensity(a_graindensity); // grain/m2
446  SetMaizeDensity(a_maizedensity); // kJ/m2
451  m_grainKJ_total = a_area * a_graindensity * 17.67 * 0.04;
452  m_maizeKJ_total = a_area * a_maizedensity; // Already in kJ/m2
453  for (int i = 0; i < gs_foobar; i++)
454  {
455  SetGrazing(i, a_grazing[i]);
456  }
457  for (int i = 0; i < gst_foobar; i++)
458  {
459  m_BirdsPresent[i] = 0;
460  m_MaxBirdsPresent[i] = 0;
461  }
462  UpdateKJ(); // Scales m_xxxxKJ_total to area. Used also when recalculating after consumption by geese.
463  AddGeese(a_type, a_number);
464  m_OurPopulationManager = p_NPM;
465 }
466 //---------------------------------------------------------------------------
467 
469 {
470  for (int i = 0; i < gst_foobar; i++)
471  {
472  if (m_BirdsPresent[i] != 0)
473  {
474  g_land->Warn("GooseActiveForageLocation::ClearBirds() - still birds on field", "");
475  std::exit(1);
476  break;
477  }
478  m_MaxBirdsPresent[i] = 0;
479  }
480 }
481 //---------------------------------------------------------------------------
482 
484 {
485  int huntables = 0;
488  }
491  }
492  return huntables;
493 }
494 //---------------------------------------------------------------------------
495 
496 double Goose_Population_Manager::GetDistToClosestRoost(int a_x, int a_y, unsigned a_type)
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 }
512 
513 
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 }
548 //---------------------------------------------------------------------------
549 
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);
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 );
638  gb.Set_GooseLeavingThreshold( cfg_goose_LeavingThreshold.value() * 5.0); // 5 because we use a 5-day running average
641 
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.
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 }
667 
668 //---------------------------------------------------------------------------
669 
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 }
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 }
834 
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 }
897 
898 void Goose_Population_Manager::CreateObjects(int a_ob_type, TAnimal *, struct_Goose * a_data, int a_number)
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 }
997 
998 //---------------------------------------------------------------------------
999 
1000 void Goose_Population_Manager::FindClosestRoost(int &a_x, int &a_y, unsigned a_type)
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 }
1016 //---------------------------------------------------------------------------
1017 
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 }
1083 //---------------------------------------------------------------------------
1084 
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 }
1242 //---------------------------------------------------------------------------
1243 
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 }
1271 //---------------------------------------------------------------------------
1272 
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 }
1300 //---------------------------------------------------------------------------
1301 
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 }
1369 //---------------------------------------------------------------------------
1370 
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 }
1393 //---------------------------------------------------------------------------
1394 
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 }
1410 //---------------------------------------------------------------------------
1411 
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 }
1427 //---------------------------------------------------------------------------
1428 
1431  int Day = m_TheLandscape->SupplyGlobalDate();
1432  (*m_StateStatsFile) << m_SeasonNumber << '\t' << Day << '\t' << m_StateStats.get_N() << endl;
1433 }
1434 //---------------------------------------------------------------------------
1435 
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 }
1455 
1456 //---------------------------------------------------------------------------
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 }
1492 //---------------------------------------------------------------------------
1493 
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 }
1649 //---------------------------------------------------------------------------
1650 
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 }
1750 //---------------------------------------------------------------------------
1751 
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 }
1771 //---------------------------------------------------------------------------
1772 
1773 int Goose_Population_Manager::NewForageLocation(GooseSpeciesType a_type, int a_number, int a_polyref )
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 }
1804 //---------------------------------------------------------------------------
1805 
1807  {
1808  m_GooseForageLocations[a_index].AddGeese(a_type, a_number);
1809  }
1810  //---------------------------------------------------------------------------
1811 
1813  {
1814  m_GooseForageLocations[a_index].RemoveGeese(a_type, a_number);
1815  }
1816  //---------------------------------------------------------------------------
1817 
1818 
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  }
1831  //---------------------------------------------------------------------------
1832 
1833  int Goose_Population_Manager::BirdsToShootAtPoly(int a_polyref /*, double &a_protectedpct */)
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  }
1860 //---------------------------------------------------------------------------
1861 
1862 void Goose_Population_Manager::BirdsShot(int a_polyref, int a_numbershot, GooseHunter* a_hunter)
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 }
1945 //---------------------------------------------------------------------------
1946 
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 }
1980 //---------------------------------------------------------------------------
1989 Goose_Base* Goose_Population_Manager::GetLeader(APoint a_roost, GooseSpecies a_species)
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 }
2037 
2039 int Goose_Population_Manager::GetForageLocIndex( GooseSpecies a_species, int a_x, int a_y ) {
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 }
2071 
2072 
2073 void Goose_Population_Manager::RemoveMaxForageKj( double forage, TTypeOfMaxIntakeSource a_maxintakesource, int m_myForageIndex ) {
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 }
2091 
2092 void Goose_Population_Manager::GetImmigrationNumbers(GooseSpecies a_goose, bool fall)
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 }
2161 
2162 
2163 // Weight stats
2164 void Goose_Population_Manager::RecordWeight(double a_weight, GooseSpecies a_species)
2165 {
2166  m_WeightStats[a_species].add_variable(a_weight);
2167 }
2168 
2170  for (unsigned i = 0; i < gs_foobar; i++)
2171  {
2172  m_WeightStats[(GooseSpecies)i].ClearData();
2173  }
2174 }
2175 
2176 // Habitat use stats
2177 void Goose_Population_Manager::RecordHabitatUse(int a_habitatype, GooseSpecies a_species, int a_count)
2178 {
2179  m_HabitatUseStats[a_species * tomis_foobar + a_habitatype] += a_count;
2180 }
2181 
2182 // Habitat use stats
2183 void Goose_Population_Manager::RecordHabitatUseFieldObs(int a_habitatype, GooseSpecies a_species, int a_count)
2184 {
2185  m_HabitatUseFieldObsStats[a_species * tomis_foobar + a_habitatype] += a_count;
2186 }
2187 
2189  for (unsigned i = 0; i < gs_foobar*tomis_foobar; i++)
2190  {
2191  m_HabitatUseStats[i] = 0;
2192  }
2193 }
2194 
2196  for (unsigned i = 0; i < gs_foobar*tomis_foobar; i++)
2197  {
2199  }
2200 }
2201 
2202 // Foraging time stats
2203 void Goose_Population_Manager::RecordForagingTime(int a_time, GooseSpecies a_species)
2204 {
2205  m_ForagingTimeStats[a_species].add_variable(a_time);
2206 }
2207 
2209 {
2210  for (unsigned i = 0; i < gs_foobar; i++)
2211  {
2212  m_ForagingTimeStats[(GooseSpecies)i].ClearData();
2213  }
2214 }
2215 
2216 // Flight distance stats
2217 void Goose_Population_Manager::RecordFlightDistance(int a_distance, GooseSpecies a_species)
2218 {
2219  m_FlightDistanceStats[a_species].add_variable(a_distance);
2220 }
2221 
2223 {
2224  for (unsigned i = 0; i < gs_foobar; i++)
2225  {
2226  m_FlightDistanceStats[(GooseSpecies)i].ClearData();
2227  }
2228 }
2229 
2230 // Daily energy budget stats
2231 void Goose_Population_Manager::RecordDailyEnergyBudget(int a_deb, GooseSpecies a_species)
2232 {
2233  m_DailyEnergyBudgetStats[a_species].add_variable(a_deb);
2234 }
2235 
2237 {
2238  for (unsigned i = 0; i < gs_foobar; i++)
2239  {
2240  m_DailyEnergyBudgetStats[(GooseSpecies)i].ClearData();
2241  }
2242 }
2243 
2244 // Daily energy balance stats
2245 void Goose_Population_Manager::RecordDailyEnergyBalance(int a_balance, GooseSpecies a_species)
2246 {
2247  m_DailyEnergyBalanceStats[a_species].add_variable(a_balance);
2248 }
2249 
2251 {
2252  for (unsigned i = 0; i < gs_foobar; i++)
2253  {
2254  m_DailyEnergyBalanceStats[(GooseSpecies)i].ClearData();
2255  }
2256 }
2257 
2258 // Forage location stats
2259 void Goose_Population_Manager::RecordIndForageLoc(double a_count, int a_groupsize, GooseSpecies a_species)
2260 {
2261  for (int i=0; i<a_groupsize; i++) m_IndividualForageLocationData[a_species].add_variable(a_count);
2262 }
2263 
2265  for (unsigned i = 0; i < gs_foobar; i++)
2266  {
2267  m_IndividualForageLocationData[(GooseSpecies)i].ClearData();
2268  }
2269 }
2270 
2271 // State stats
2273  m_StateStats.add_variable(1);
2274 }
2275 
2277  m_StateStats.ClearData();
2278 }
2279 
2281  m_LeaveReasonStats[a_speciestype][a_leavereason].add_variable(1);
2282 }
2283 
2285  for (unsigned i = 0; i < gst_foobar; i++)
2286  {
2287  for (unsigned j = 0; j < tolr_foobar; j++)
2288  {
2290  }
2291  }
2292 }
2293 
2294 bool Goose_Population_Manager::InHuntingSeason(int a_day, GooseSpecies a_species) {
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 }
2350 
2351 
2352 void Goose_Population_Manager::WriteHeaders(ofstream *a_file, std::vector<std::string> a_headers)
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 }
2368 
2369 
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 }
2385 
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 }
2441 
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 }
2462 
2463 std::string Goose_Population_Manager::GooseToString(GooseSpecies a_gs)
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 }
2477 
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 }
2494 
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 }
2511 
cfg_G6B
CfgFloat cfg_G6B("POLYNOMIALTWO_TWO_B", CFG_CUSTOM, 2.6695)
Coefficient B in a second order polynomial function.
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
cfg_P1D
CfgFloat cfg_P1D("POLYNOMIALTWO_ONE_D", CFG_CUSTOM, 0.404)
Scaler for assimilation of energy from grass for pinkfeet. Madsen 1985 Vol 16 p. 222 - 228 Ornis Scan...
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
cfg_B6A
CfgFloat cfg_B6A("POLYNOMIALTWO_THREE_A", CFG_CUSTOM, -0.066)
Coefficient A in a second order polynomial function.
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...
GoosePinkFooted_All.h
PinkFootedGoose_All.h This is the header file for the pink footed goose classes
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
GooseActiveForageLocation::UpdateKJ
void UpdateKJ()
Updates the grain or maize density based on the current total grain or maize amount.
Definition: Goose_Population_Manager.h:382
Goose_Population_Manager::GetForageLocIndex
int GetForageLocIndex(GooseSpecies a_species, int a_x, int a_y)
Get a forage location for my species (picked randomly among the active locations)
Definition: Goose_Population_Manager.cpp:2039
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::BangAtPoly
void BangAtPoly(int a_polyref)
Passes a 'Bang' message to birds near to the location specified by the polygon reference.
Definition: Goose_Population_Manager.cpp:1947
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
GooseActiveForageLocation::m_grainKJ_total
double m_grainKJ_total
The total grain kJ.
Definition: Goose_Population_Manager.h:140
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_P1F
CfgFloat cfg_P1F("POLYNOMIALTWO_ONE_F", CFG_CUSTOM, 16.63)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
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.
GooseActiveForageLocation::GetHuntables
int GetHuntables(void)
Returns the number of huntable birds at the location.
Definition: Goose_Population_Manager.cpp:483
Goose_Population_Manager::Goose_Population_Manager
Goose_Population_Manager(Landscape *L)
Goose_Population_Manager Constructor.
Definition: Goose_Population_Manager.cpp:550
tomis_grass
Definition: Goose_Base.h:92
cfg_H2E
CfgFloat cfg_H2E("HOLLINGS_TWO_E", CFG_CUSTOM, 0)
Min x-value.
g_rand_uni2
boost::variate_generator< base_generator_type &, boost::uniform_int<> > g_rand_uni2
A random number generator (0-9999)
cfg_B6E
CfgBool cfg_B6E("POLYNOMIALTWO_THREE_E", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
Goose_Population_Manager::XYDump
void XYDump()
Outputs x y data.
Definition: Goose_Population_Manager.cpp:2386
cfg_P1E
CfgBool cfg_P1E("POLYNOMIALTWO_ONE_E", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
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
Goose_Population_Manager::AddGeeseToForageLocation
void AddGeeseToForageLocation(GooseSpeciesType a_type, int a_index, int a_number)
Adds a goose or geese to the forage location - requires an index.
Definition: Goose_Population_Manager.cpp:1806
Goose_Population_Manager::RecordWeight
void RecordWeight(double a_weight, GooseSpecies a_species)
Record the weight.
Definition: Goose_Population_Manager.cpp:2164
GooseActiveForageLocation::SetGrainDensity
void SetGrainDensity(double a_density)
Sets forage density (grain/m2)
Definition: Goose_Population_Manager.h:308
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?
CfgStr
String configurator entry class.
Definition: configurator.h:144
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
GooseActiveForageLocation::m_MaxBirdsPresent
int m_MaxBirdsPresent[gst_foobar]
An array holding the maximum number of geese of different types and total i.e. Pinkfoot families,...
Definition: Goose_Population_Manager.h:161
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
GooseActiveForageLocation::SetArea
void SetArea(int a_area)
Set the area in m.
Definition: Goose_Population_Manager.h:180
cfg_P1C
CfgFloat cfg_P1C("POLYNOMIALTWO_ONE_C", CFG_CUSTOM, 0.0)
The constant C in a second order polynomial function.
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.
Goose_Base::Set_GooseMinForageOpenness
void Set_GooseMinForageOpenness(double a_cost)
Set the min forage openess for all geese.
Definition: Goose_Base.h:604
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.
cfg_goose_AfterDarkTime
CfgInt cfg_goose_AfterDarkTime("GOOSE_AFTERDARKTIME", CFG_CUSTOM, 30, 0, 180)
The number of minutes that geese will be foraging after sunset.
Goose_Population_Manager::GooseWeightStatOutput
void GooseWeightStatOutput()
Outputs simple stats for the weights in the population.
Definition: Goose_Population_Manager.cpp:1395
Goose_Population_Manager::~Goose_Population_Manager
virtual ~Goose_Population_Manager(void)
Goose_Population_Manager Destructor.
Definition: Goose_Population_Manager.cpp:514
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.
GooseGreylag_All.h
GreylagGoose_All.h This is the header file for the greylag goose classes
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
Goose_Population_Manager::RecordDailyEnergyBudget
void RecordDailyEnergyBudget(int a_deb, GooseSpecies a_species)
Record the daily energy budget.
Definition: Goose_Population_Manager.cpp:2231
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_MinForageRateDecayRate
CfgFloat cfg_goose_MinForageRateDecayRate("GOOSE_MINFORAGEDECAYRATE", CFG_CUSTOM, 0.72, 0.0, 1.0)
The decay rate for the minimum forage rate.
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)
cfg_G6F
CfgFloat cfg_G6F("POLYNOMIALTWO_TWO_F", CFG_CUSTOM, 24.4013)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
cfg_G6A
CfgFloat cfg_G6A("POLYNOMIALTWO_TWO_A", CFG_CUSTOM, -0.1094)
Coefficient A in a second order polynomial function.
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.
Goose_Population_Manager::RecordLeaveReason
void RecordLeaveReason(TTypeOfLeaveReason a_leavereason, GooseSpeciesType a_speciestype)
Record the reason for leaving.
Definition: Goose_Population_Manager.cpp:2280
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
cfg_P1G
CfgFloat cfg_P1G("POLYNOMIALTWO_ONE_G", CFG_CUSTOM, 0.00)
Min x-value.
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_Base::Set_Indivmingooseforagerate
void Set_Indivmingooseforagerate(double a_cost)
Set the mimimum tolerated forage rate for the individual goose.
Definition: Goose_Base.h:578
GooseActiveForageLocation::GooseActiveForageLocation
GooseActiveForageLocation(GooseSpeciesType a_type, int a_number, int a_polyref, int a_area, double a_graindensity, double a_maizedensity, double *a_grazing, Goose_Population_Manager *p_NPM)
Constructor for GooseActiveForageLocation.
Definition: Goose_Population_Manager.cpp:438
Goose_Population_Manager::ClearGooseHabitatUseStats
void ClearGooseHabitatUseStats()
Clear simple stats for habitat use.
Definition: Goose_Population_Manager.cpp:2188
Goose_Base::Set_mingooseforagerate
void Set_mingooseforagerate(double a_cost, GooseSpecies a_species)
Set the mimimum tolerated forage rate for all geese.
Definition: Goose_Base.h:574
ALMaSS_MathFuncs
ALMaSS_MathFuncs constructor.
Definition: Misc.h:28
GooseActiveForageLocation::m_HabitatType
TTypeOfMaxIntakeSource m_HabitatType
Whether it is a cereal crop, grass etc.
Definition: Goose_Population_Manager.h:150
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
Goose_Population_Manager::GetLeader
Goose_Base * GetLeader(APoint a_homeloc, GooseSpecies a_species)
Asks for a pointer to a goose that can be followed.
Definition: Goose_Population_Manager.cpp:1989
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.
Landscape
The landscape class containing all environmental and topographical data.
Definition: landscape.h:112
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
Goose_Population_Manager::RecordForagingTime
void RecordForagingTime(int a_time, GooseSpecies a_species)
Record the time spent foraging.
Definition: Goose_Population_Manager.cpp:2203
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_B6D
CfgFloat cfg_B6D("POLYNOMIALTWO_THREE_D", CFG_CUSTOM, 0.404)
Scaler for assimilation of energy from grass for pinkfeet. Madsen 1985 Vol 16 p. 222 - 228 Ornis Scan...
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_Base::Set_GooseFieldForageDist
void Set_GooseFieldForageDist(double sp1, double sp2, double sp3)
Set the max forage distance from a field for all geese.
Definition: Goose_Base.h:622
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::FindClosestRoost
void FindClosestRoost(int &a_x, int &a_y, unsigned a_type)
Changes a_x & a_y to the location of the nearest roost of a_type to a_x, a_y.
Definition: Goose_Population_Manager.cpp:1000
Goose_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::RecordIndForageLoc
void RecordIndForageLoc(double a_count, int a_groupsize, GooseSpecies a_species)
Record a forage location count.
Definition: Goose_Population_Manager.cpp:2259
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
cfg_G6C
CfgFloat cfg_G6C("POLYNOMIALTWO_TWO_C", CFG_CUSTOM, 0.0)
The constant C in a second order polynomial function.
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::TheAOROutputProbe
virtual void TheAOROutputProbe()
The modified goose version of the standard output for creating AOR statistics.
Definition: Goose_Population_Manager.cpp:2370
CfgBool
Bool configurator entry class.
Definition: configurator.h:127
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.
TAnimal
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::Set_GooseMaxEnergyReserveProportion
void Set_GooseMaxEnergyReserveProportion(double a_prop)
Set the maximum energy reserve proportion allowed for all geese.
Definition: Goose_Base.h:592
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_pf_springmigdateend
CfgInt cfg_goose_pf_springmigdateend("GOOSE_PF_SPRING_MIG_END", CFG_CUSTOM, 59, 1, 365)
Input: Date for end of spring migration.
cfg_goose_PopulationDescriptionON
static CfgBool cfg_goose_PopulationDescriptionON("GOOSE_POPULATIONDESCRIPTIONON", CFG_CUSTOM, true)
The cfg variable determining whether to print goose population stats.
TTypeOfMaxIntakeSource
TTypeOfMaxIntakeSource
Definition: Goose_Base.h:90
gst_BarnacleNonBreeder
Definition: Goose_Base.h:63
Goose_Population_Manager::AddGeeseToForageLocationP
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.
Definition: Goose_Population_Manager.cpp:1819
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
Goose_Base::Set_GooseForageDist
void Set_GooseForageDist(double sp1, double sp2, double sp3)
Set the max forage distance from roost for all geese.
Definition: Goose_Base.h:608
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::GetImmigrationNumbers
void GetImmigrationNumbers(GooseSpecies a_goose, bool a_season)
Get the numbers to immigrate.
Definition: Goose_Population_Manager.cpp:2092
Goose_Population_Manager::ClearGooseFlightDistanceStats
void ClearGooseFlightDistanceStats()
Clear simple stats for flight distances in the population.
Definition: Goose_Population_Manager.cpp:2222
cfg_G6D
CfgFloat cfg_G6D("POLYNOMIALTWO_TWO_D", CFG_CUSTOM, 0.404)
Scaler for assimilation of energy from grass for pinkfeet. Madsen 1985 Vol 16 p. 222 - 228 Ornis Scan...
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
Goose_Population_Manager::RecordFlightDistance
void RecordFlightDistance(int a_distance, GooseSpecies a_species)
Record the flight distance.
Definition: Goose_Population_Manager.cpp:2217
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_B6G
CfgFloat cfg_B6G("POLYNOMIALTWO_THREE_B", CFG_CUSTOM, 0.00)
Min x-value.
Goose_Population_Manager::BirdsShot
void BirdsShot(int a_polyref, int a_numbershot, GooseHunter *a_Hunter)
Passes the message to shoot a number of birds at a forage location.
Definition: Goose_Population_Manager.cpp:1862
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.
Goose_Population_Manager
The class to handle all goose population related matters.
Definition: Goose_Population_Manager.h:392
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_P1H
CfgStr cfg_P1H("POLYNOMIALTWO_ONE_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_PF")
File name for grass functional response for pinkfeet.
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_Base::Set_GooseLeavingRoost
void Set_GooseLeavingRoost(bool a_leaving)
Set the flag to indicate if we are coming from the roost.
Definition: Goose_Base.h:636
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
GooseActiveForageLocation::m_maizeKJ_total
double m_maizeKJ_total
The total maize kJ.
Definition: Goose_Population_Manager.h:145
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
GooseActiveForageLocation::ClearBirds
void ClearBirds()
Empties the bird recording arrays.
Definition: Goose_Population_Manager.cpp:468
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_CUSTOM
Definition: configurator.h:60
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
Goose_Population_Manager::RecordDailyEnergyBalance
void RecordDailyEnergyBalance(int a_balance, GooseSpecies a_species)
Record the daily energy balance.
Definition: Goose_Population_Manager.cpp:2245
cfg_AOROutput_used
CfgBool cfg_AOROutput_used
This config variable controls whether we should make AOR output.
cfg_G6E
CfgBool cfg_G6E("POLYNOMIALTWO_TWO_E", CFG_CUSTOM, false)
Logical config to control if the curve should be reversed (i.e. 1 - value)
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
GooseActiveForageLocation::SetPolygonref
void SetPolygonref(int a_polyref)
Set the landscape element ( LE ) reference number used by the Landscape class to identify this locati...
Definition: Goose_Population_Manager.h:225
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
CfgInt
Integer configurator entry class.
Definition: configurator.h:87
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
cfg_G6G
CfgFloat cfg_G6G("POLYNOMIALTWO_TWO_G", CFG_CUSTOM, 0.00)
Min x-value.
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_B6B
CfgFloat cfg_B6B("POLYNOMIALTWO_THREE_B", CFG_CUSTOM, 0.88)
Coefficient B in a second order polynomial function.
GooseActiveForageLocation::m_OurPopulationManager
Goose_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Goose_Population_Manager.h:169
cfg_goose_BMRconstant2
CfgFloat cfg_goose_BMRconstant2("GOOSE_BMRCONSTANTB", CFG_CUSTOM, 0.72, 0, 1)
The cost of BMR per kg goose - constant 2.
Goose_Base::Set_GooseFattoKJConversion
void Set_GooseFattoKJConversion(double a_cost)
Set the fat to kJ conversion constant for all geese.
Definition: Goose_Base.h:600
cfg_G6H
CfgStr cfg_G6H("POLYNOMIALTWO_TWO_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_GL")
File name for grass functional response for greylags.
CfgFloat
Double configurator entry class.
Definition: configurator.h:106
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_Base::Set_GooseKJtoFatConversion
void Set_GooseKJtoFatConversion(double a_cost)
Set the kJ to fat conversion constant for all geese.
Definition: Goose_Base.h:596
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?
Goose_Population_Manager::RecordState
void RecordState()
Record the state.
Definition: Goose_Population_Manager.cpp:2272
Goose_Population_Manager::DoFirst
virtual void DoFirst(void)
Things to do before anything else at the start of a timestep.
Definition: Goose_Population_Manager.cpp:1018
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_Base::Set_GooseMaxAppetiteScaler
void Set_GooseMaxAppetiteScaler(double a_cost)
Set the goose appetite scale used to calculate max intake for all geese.
Definition: Goose_Base.h:588
Goose_Population_Manager::RemoveGeeseFromForageLocation
void RemoveGeeseFromForageLocation(GooseSpeciesType a_type, int a_index, int a_number)
Removes a goose or geese to the forage location - requires an index.
Definition: Goose_Population_Manager.cpp:1812
Goose_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::RemoveMaxForageKj
void RemoveMaxForageKj(double a_forage, TTypeOfMaxIntakeSource a_maxintakesource, int m_myForageIndex)
Removes the forage eaten from the field.
Definition: Goose_Population_Manager.cpp:2073
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
Goose_Base::SetFlightCost
void SetFlightCost(double a_cost)
Set the flight cost per m per g.
Definition: Goose_Base.h:564
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.
Goose_Base::Set_GooseLeavingThreshold
void Set_GooseLeavingThreshold(double a_threshold)
Set the body condition threshold for leaving for all geese.
Definition: Goose_Base.h:584
cfg_goose_pinkfootopenseasonstart
CfgInt cfg_goose_pinkfootopenseasonstart("GOOSE_PF_OPENSEASONSTART", CFG_CUSTOM, 243)
The start of the pinkfoot hunting season.
Goose_Population_Manager::BirdsToShootAtPoly
int BirdsToShootAtPoly(int a_poly)
Returns the number of birds at a forage location - given by a poly ref.
Definition: Goose_Population_Manager.cpp:1833
GooseActiveForageLocation::SetMaizeDensity
void SetMaizeDensity(double a_density)
Sets maize forage density (kJ/m2)
Definition: Goose_Population_Manager.h:327
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
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
cfg_goose_RoostLeaveDistMean
CfgInt cfg_goose_RoostLeaveDistMean("GOOSE_ROOSTLEAVEDISTMEAN", CFG_CUSTOM, 30)
The mean for the normal distribution which determines roost leave time.
cfg_B6H
CfgStr cfg_B6H("POLYNOMIALTWO_THREE_H", CFG_CUSTOM, "KJIntakeAtVaryingGrassHeights_BG")
File name for grass functional response for barnacles.
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_P1A
CfgFloat cfg_P1A("POLYNOMIALTWO_ONE_A", CFG_CUSTOM, -0.1884)
Coefficient A in a second order polynomial function.
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_B6C
CfgFloat cfg_B6C("POLYNOMIALTWO_THREE_C", CFG_CUSTOM, 5.0)
The constant C in a second order polynomial function.
GooseHunter
The class for goose hunters encompsassing all their specific behaviours.
Definition: Hunters_all.h:268
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.
GooseActiveForageLocation::m_BirdsPresent
int m_BirdsPresent[gst_foobar]
An array holding the number of geese of different type i.e. Pinkfoot families, juvs,...
Definition: Goose_Population_Manager.h:155
GooseActiveForageLocation::AddGeese
void AddGeese(GooseSpeciesType a_type, int a_number)
Adds geese to the location.
Definition: Goose_Population_Manager.h:277
cfg_goose_pinkfootopenseasonend
CfgInt cfg_goose_pinkfootopenseasonend("GOOSE_PF_OPENSEASONEND", CFG_CUSTOM, 364)
The end of the pinkfoot hunting season.
GooseHunter::OnShotABird
void OnShotABird(int a_birdtype, int a_poly)
Message received when a goose is successully shot.
Definition: Hunters_all.cpp:1413
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
GooseActiveForageLocation::SetGrazing
void SetGrazing(int gs, double a_density)
Sets forage density (kJ/m2)
Definition: Goose_Population_Manager.h:349
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
cfg_B6F
CfgFloat cfg_B6F("POLYNOMIALTWO_THREE_F", CFG_CUSTOM, 13.4761)
Max x-value - at this point the curve tends to 0, must stop here to avoid negative values.
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_Population_Manager::DoLast
virtual void DoLast()
Things to do after the EndStep.
Definition: Goose_Population_Manager.cpp:1085
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?
GooseBarnacle_All.h
BarnacleGoose_All.h This is the header file for the greylag goose classes
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_Base::Set_GooseFollowingLikelyhood
void Set_GooseFollowingLikelyhood(int a_likelyhood, GooseSpeciesType a_speciestype)
Set the followinglikelyhood.
Definition: Goose_Base.h:634
Goose_Population_Manager::DoEmigration
virtual void DoEmigration()
Controls emigration from the Danish simulation area.
Definition: Goose_Population_Manager.cpp:1651
cfg_P1B
CfgFloat cfg_P1B("POLYNOMIALTWO_ONE_B", CFG_CUSTOM, 3.1349)
Coefficient B in a second order polynomial function.