Goose Management Model ODdox  1.02
Goose_Base.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2013, Christopher John Topping, University of Aarhus
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 */
35 #include <iostream>
36 #include <fstream>
37 #include <list>
38 #include <vector>
39 #include "../Landscape/ls.h"
40 #include "../BatchALMaSS/PopulationManager.h"
41 #include "../GooseManagement/GooseMemoryMap.h"
42 #include "../GooseManagement/Goose_Base.h"
43 #include "../BatchALMaSS/CurveClasses.h"
44 #include "../Hunters/Hunters_all.h"
45 #include "../GooseManagement/Goose_Population_Manager.h"
46 #include "../BatchALMaSS/BoostRandomGenerators.h"
47 
49 extern boost::variate_generator<base_generator_type&, boost::uniform_real<> > g_rand_uni;
51 extern boost::variate_generator<base_generator_type&, boost::uniform_int<> > g_rand_uni2;
53 extern MapErrorMsg *g_msg;
56 
57 using namespace std;
58 
59 //*******************************************************************************************************
86 //*******************************************************************************************************
87 
88 //*******************************************************************************************************
89 // Initialise static members.
90 // Note that it is possible to do this only here - but the config variables have not been read in - so these need to be done again
91 // afterwards. This is done in the population manager by creating an instance of the Goose_Base and assinging these variables again
93 double Goose_Base::m_flightcost = -1;
94 double Goose_Base::m_mingooseforagerate[ 3 ] = { -1, -1, -1 };
101 double Goose_Base::m_GooseForageDistX2[3] = { -1, -1, -1 };
102 double Goose_Base::m_GooseForageDist[3] = { -1, -1, -1 };
103 double Goose_Base::m_GooseFieldForageDistX2[3] = { -1, -1, -1 };
104 double Goose_Base::m_GooseFieldForageDist[3] = { -1, -1, -1 };
105 int Goose_Base::m_followinglikelyhood [ gst_foobar ] = { -1, -1, -1 , -1, -1, -1 };
106 double Goose_Base::m_SnowDepth = 0.0;
107 //*******************************************************************************************************
108 //************************************* Goose_Base ******************************************************
109 //*******************************************************************************************************
110 
111 void Goose_Base::Init(Goose_Population_Manager* p_NPM, double a_weight, bool a_sex, APoint a_roost) {
113  m_OurPopulationManager = p_NPM;
115  CurrentGState = togs_InitialState;
117  SetSex(a_sex);
119  m_weight = a_weight;
120  m_DailyMaxAppetite = 0.0;
121  m_DailyMaxAppetiteHitTime = 0;
122  m_energyReserve = m_weight * cfg_goose_InitialEnergyReserveProportion.value();
123  int today = m_OurLandscape->SupplyDayInYear();
125  m_energyReserve = m_weight * 0.22;
126  }
127  m_weightTotal = m_weight + m_energyReserve;
129  m_BMR = pow(m_weightTotal / 1000, cfg_goose_BMRconstant2.value())*cfg_goose_BMRconstant1.value(); // BMR is used to scale other energetic costs on a daily basis
130  m_energyToday = 0.0;
131  m_BodyConditionCounter = 0;
132  m_TheBodyCondition = 0.0;
133  for (unsigned i = 0; i < 5; i++)
134  {
135  double condition = m_weightTotal / m_weight; // total weight divided by lean weight.
136  SetBodyCondition(condition, i);
137  AddBodyCondition(m_BodyCondition[i]);
138  }
139  m_LeaveRoostTime = 0; // intialisation
140  m_myForageIndex = -1; // -1 signals not currently foraging
141  m_MaxIntakeSource.m_maxintakesource = tomis_foobar; // The source of the max forage intake rate has not been determined yet.
142  // Assume a default groupsize of 1, if otherwise it needs setting in descendent classes
143  m_groupsize = 1;
144  // Set the roost and location
145  m_Location_x = a_roost.m_x;
146  m_Location_y = a_roost.m_y;
147  m_MyRoost.m_x = a_roost.m_x;
148  m_MyRoost.m_y = a_roost.m_y;
149 
150  // Any other intialisation will be done by descendent class constructors
151  m_MyMemory = new GooseMemoryMap(this);
152  // the species must be reset by the goose constructor
153  m_myspecies = gs_foobar;
154  // Must calculate the DEB now or risk use of an undefined m_DEB in StartDay
155  m_DEB = 0;
156  // Set the individual minimum forage rate acceptable. Overwritten later in StartDay
157  Set_Indivmingooseforagerate(0.0);
158  m_FlightNumber = 0;
159  m_FlightDistance = 0;
160  m_forageLocCount = 0;
161 }
162 
163 Goose_Base::Goose_Base(Landscape* p_L, Goose_Population_Manager* p_NPM, double a_weight, bool a_sex, APoint a_roost) : TAnimal(0, 0, p_L)
164 {
165  Init(p_NPM, a_weight, a_sex, a_roost);
166 }
167 
168 void Goose_Base::ReInit(Landscape* p_L, Goose_Population_Manager* p_NPM, double a_weight, bool a_sex, APoint a_roost) {
169  TAnimal::ReinitialiseObject(0, 0, p_L);
170  // Assign the pointer to the population manager
171  Init(p_NPM, a_weight, a_sex, a_roost);
172 }
173 
174 //-------------------------------------------------------------------------------------------------------
175 
177 {
178  if (m_MyMemory!=NULL) delete m_MyMemory;
179 }
180 //-------------------------------------------------------------------------------------------------------
182 {
183  // Adjust the energy reserves
184  if (m_OurPopulationManager->GetDayTime() == 0)
185  {
186  // Remove our DEB from our net energy collection for the day
187  m_energyToday -= m_DEB;
188  if (m_energyToday > 0)
189  {
191  }
193 
195  if (m_weightTotal < m_weight) {
197  }
198  // Some goose output recording
206  m_forageLocCount = 0;
207 
208  // Set the body condition as % by weight of fat. This is a running sum over the last 5 days.
211  double condition = m_weightTotal / m_weight;
214  // Here we limit the maximum growth possible
217  }
219  {
221  }
222  // Reset energy intake
223  m_energyToday = 0;
224  m_FlightNumber = 0;
225  m_FlightDistance = 0;
226  // Reset the roost leaving time
228  // Reset the time when m_DailyMaxAppetite was hit. If reaching dailymaxappetite takes less than a whole day, the time is recorded. Therefore we "reset" to 1440, not 0.
230  // Decay all memories before adding new information today
232  // Calculate the new DEB
233  double daylightprop = m_OurLandscape->SupplyDaylightProp();
234  double nighttimeprop = m_OurLandscape->SupplyNightProp();
235  double multiplier = cfg_goose_daytime_BMR_multiplier.value() * daylightprop + cfg_goose_nighttime_BMR_multiplier.value() * nighttimeprop;
237  double minforagerate = (m_DEB / (1440 * daylightprop)); // They accept forage rates so they can optain positive energy balance
238  Set_mingooseforagerate( minforagerate, m_myspecies );
239  Set_Indivmingooseforagerate( minforagerate ); // At the start of the day, give the individual the MFR for the species
240  m_SnowDepth = m_OurLandscape->SupplySnowDepth(); // We store the current snow depth here for speed optimization.
241  }
242 }
243 
245 {
246  m_OurLandscape->Warn("Goose_Base::Step()","attempt to instantiate and use the base class!");
247  exit(1);
248 }
249 //-------------------------------------------------------------------------------------------------------
250 
252 {
253  m_CurrentStateNo = -1; // this will kill the animal object and free up space
254  m_StepDone = true;
255  delete m_MyMemory; // this is reinitisalised in the object pool.
256 }
257 //-------------------------------------------------------------------------------------------------------
259 {
260  // Debugging
262  int today = m_OurLandscape->SupplyDayInYear();
263  int dtime = m_OurPopulationManager->GetDayTime();
264  int daylength = m_OurLandscape->SupplyDaylength();
265  if (dtime >= daylength + cfg_goose_AfterDarkTime.value())
266  {
267 #ifdef __DEBUG_GOOSE
268  if (m_myForageIndex != -1)
269  {
271  g_msg->Warn("Goose_Base::st_ChooseForageLocation - Removing negative geese from forage location", (double)(m_OurPopulationManager->GetBirdsAtForageLoc(m_myForageIndex, m_myGooseSpeciesType) - m_groupsize));
272  exit(0);
273  }
274  }
275 #endif
276  return togs_ToRoost;
277  }
278 
280  {
289 #ifdef __FOLLOW_FIELD
290  int index = -1;
291  int forageindex = m_OurPopulationManager->GetForageLocIndex( m_myspecies, m_Location_x, m_Location_y );
292  if (forageindex > -1) {
293  index = forageindex;
294  }
295 #endif
296 
297 #ifdef __FOLLOW_BIRD
299  if (leader != NULL) {
300  int index = leader->GetForageLocIndex();
301  }
302 #endif
303 
304  if (index > -1)
305  {
306 
308  FlyTo( m_OurLandscape->SupplyCentroid( gafl->GetPolygonref() ) );
309  Set_GooseLeavingRoost(false); // We've left the roost now, so reset
310  GooseMemoryLocation aThought;
311  int poly = gafl->GetPolygonref();
312  double grain = gafl->GetGrainDensity(); // grain/m2
313  double maize = gafl->GetMaizeDensity(); // kJ/m2
314  aThought.m_grain = m_OurPopulationManager->GetFeedingRate(grain, m_myspecies); // kJ/min
315  aThought.m_maize = m_OurPopulationManager->GetMaizeFeedingRate(maize, m_myspecies); // kJ/min
316  aThought.m_grazing = gafl->GetGrazing( (int)m_myspecies ); // kJ/min
317  aThought.m_foodresource = GetMaxIntakeRate(aThought.m_grain, aThought.m_maize, aThought.m_grazing);
318  aThought.m_polygonid = poly;
319  aThought.m_x = m_OurLandscape->SupplyCentroidX( poly );
320  aThought.m_y = m_OurLandscape->SupplyCentroidY( poly );
321  aThought.m_threat = 0;
322  int dist = g_AlmassMathFuncs.CalcDistPythagorasApprox( m_MyRoost.m_x, m_MyRoost.m_y, aThought.m_x, aThought.m_y );
323  aThought.m_score = m_MyMemory->CalcScore(dist, aThought.m_foodresource, aThought.m_threat);
324  if (!m_MyMemory->IsKnownArea( gafl->GetPolygonref() )) m_MyMemory->MemAdd( aThought );
325  // Once the goose arrives at a forage location it needs to add itself to the geese already there, or initiate a forage location if one does not exist
328  else {
329  g_msg->Warn( "TTypeOfGoose_BaseState Goose_Base::st_ChooseForageLocation() : No geese at foraging location when following", "" );
330  exit( 0 );
331  }
332  // some stats recording
334  m_myMemPolyID = aThought.m_polygonid;
335  return togs_Forage;
336  }
337  }
345  if (m_LeavingRoost) Explore(); // Go for an exploration trip to initialise the memory.
347  if (aThought.m_score<=0)
348  {
349  Explore(); // Go for an exploration trip
350  aThought = m_MyMemory->GetBestFeedingScore();
351  // Did we find anything suitable?:
352  if (aThought.m_score <= 0) {
353  // if not, start this method over again.
355  }
356  }
357  m_Location_x = aThought.m_x;
358  m_Location_y = aThought.m_y;
359  int polyref = m_OurLandscape->SupplyPolyRef(m_Location_x, m_Location_y);
360  double grazing = m_OurLandscape->GetActualGooseGrazingForage(polyref, m_myspecies); // kJ/min
361  double grain = m_OurLandscape->SupplyBirdSeedForage(polyref); // kJ/m2
362  double maize = m_OurLandscape->SupplyBirdMaizeForage(polyref); // kJ/m2
363  bool instubble = m_OurLandscape->SupplyInStubble(polyref);
364  TTypesOfVegetation veg = m_OurLandscape->SupplyVegType(polyref);
365  TTypesOfVegetation lastsowncrop = m_OurLandscape->SupplyLastSownVeg(polyref);
366  bool iscereal = m_OurLandscape->SupplyIsCereal2(lastsowncrop);
367  // Here we make a test to see if the forage location is in use before going further
369  // Here we do the forage calculation.The intake rate depends on :
370  // -1 The grain or grazing resource available in grain and grazing
371  double grain_intake = m_OurPopulationManager->GetFeedingRate(grain, m_myspecies); // kJ/min
372  double maize_intake = m_OurPopulationManager->GetMaizeFeedingRate(maize, m_myspecies); // kJ/min
373  m_MyMemory->ChangeSetFoodRes(aThought.m_polygonid, grain_intake, maize_intake, grazing); // Remember these
374 // -2 The relationship between resource and intake rate.This is dependent on the species and family or non - breeder. It also depends on the
375  // type of resource, i.e. the response for grain is different than for grazing.
376  // -3 The number of geese which will determine an interference competition factor, which reduces intake rate
377  double geese = m_groupsize; // if m_myForageIndex = -1, nobody else is there.
379  // -4 The interference factor is a look-up from a pre-calculated curve in the goose population manager
380  double interferenceComp = m_OurPopulationManager->GetForageRateDensity(geese);
381  // A simplification here is to assume that they either eat grain or graze but not both
382  double myforagerate;
383  myforagerate = GetMaxForageRate( grain_intake, maize_intake, grazing, interferenceComp, iscereal, veg, instubble, lastsowncrop); // GetMaxForageRate determines the source of max intake rate and adjust intake for snow cover if needed.
384  // Now decide if this is OK or not. The intake rate is compared to the current minimum intake rate for the individual.
385  if (myforagerate < m_Indivmingooseforagerate)
386  {
387  m_myForageIndex = -1; // If we don't do this we will get a negative number of geese on the forage location later unless they find somewhere else to go.
389  }
390  // OK we are staying
392  if (m_myForageIndex != -1){
394  }
395  else {
397  }
398  m_myMemPolyID = aThought.m_polygonid;
399  return togs_Forage;
400 }
401 //-------------------------------------------------------------------------------------------------------
402 
403 void Goose_Base::FlyTo(APoint a_pt )
404 {
405  FlyTo(a_pt.m_x,a_pt.m_y);
406 }
407 //-------------------------------------------------------------------------------------------------------
408 
409 void Goose_Base::FlyTo(int a_x, int a_y )
410 {
419  if ((m_Location_x == a_x) && (m_Location_y == a_y)) return;
420  int dist = g_AlmassMathFuncs.CalcDistPythagorasApprox( m_Location_x, m_Location_y, a_x, a_y );
421  double cost = dist * GetFlightCost();
422  m_energyToday-=cost;
424  m_Location_x = a_x;
425  m_Location_y = a_y;
427  m_FlightNumber++;
428  m_FlightDistance += dist;
429 
430 }
431 //-------------------------------------------------------------------------------------------------------
432 
434 {
456  int dtime = m_OurPopulationManager->GetDayTime();
457  int daylength = m_OurLandscape->SupplyDaylength();
458  if (dtime >= daylength + cfg_goose_AfterDarkTime.value())
459  {
460 #ifdef __DEBUG_GOOSE
461  if (m_myForageIndex != -1)
462  {
464  g_msg->Warn("Goose_Base::st_Forage - Removing negative geese from forage location", (double)(m_OurPopulationManager->GetBirdsAtForageLoc(m_myForageIndex, m_myGooseSpeciesType) - m_groupsize));
465  exit(0);
466  }
467  }
468 #endif
469  return togs_ToRoost;
470  }
472  {
473  if (m_DailyMaxAppetiteHitTime > dtime) {
475  }
476  return togs_Forage;
477  }
478  //
479  // Get the grain and forage density - NB grain/m2 and maize in kJ/m2, which needs to be to needs to be remembered.
480  //
481  int polyref = m_OurPopulationManager->m_GooseForageLocations[m_myForageIndex].GetPolygonref();
482  double grazing = m_OurLandscape->GetActualGooseGrazingForage(polyref, m_myspecies); // kJ/min
483  double grain = m_OurLandscape->SupplyBirdSeedForage(polyref); // kJ/m2
484  double maize = m_OurLandscape->SupplyBirdMaizeForage(polyref); // kJ/m2
485  bool instubble = m_OurLandscape->SupplyInStubble(polyref);
486  TTypesOfVegetation veg = m_OurLandscape->SupplyVegType(polyref);
487  TTypesOfVegetation lastsowncrop = m_OurLandscape->SupplyLastSownVeg(polyref);
488  bool iscereal = m_OurLandscape->SupplyIsCereal2(lastsowncrop);
489  // Here we do the forage calculation.The intake rate depends on :
490  // -1 The grain, maize or grazing resource available in grain, maize and grazing
491  double grain_intake = m_OurPopulationManager->GetFeedingRate( grain, m_myspecies ); // KJ/min
492  double maize_intake = m_OurPopulationManager->GetMaizeFeedingRate(maize, m_myspecies); // KJ/min
493  m_MyMemory->ChangeSetFoodRes(m_myMemPolyID, grain_intake, maize_intake, grazing); // Remember these
494  // -2 The relationship between resource and intake rate. This is dependent on the species and family or non-breeder. It also depends on the
495  // type of resource, i.e. the response for grain or maize is different than for grazing.
496  // -3 The number of geese which will determine an interference competition factor, which reduces intake rate
498  // -4 The interfence factor is a look-up from a pre-calculated curve in the goose population manager
499  double interferenceComp = m_OurPopulationManager->GetForageRateDensity(geese);
500  // A simplification here is to assume that they either eat grain, maize or graze but any combination
501  double myforagerate;
502  myforagerate = GetMaxForageRate( grain_intake, maize_intake, grazing, interferenceComp, iscereal, veg, instubble, lastsowncrop); // GetMaxForageRate determines the source of max intake rate and adjust intake for snow cover if needed.
503  // Now decide if this is OK or not. The simplest here is to compare to a standard intake rate threshold for the species/type combination.
504  if (myforagerate < m_Indivmingooseforagerate)
505  {
513 
519  m_myForageIndex = -1;
521  }
529  // We have lots of food, stay and eat until full.
530  double forage = myforagerate * 10; // 10 for 10 minutes
531  m_energyToday += forage;
532  // Scale the amount of forage removed from the field to the size of the group (1 for non-breeders)
533  forage = ScaleForageToGroupsize(forage);
535  if (dtime >= daylength + cfg_goose_AfterDarkTime.value())
536  {
537  Set_Indivmingooseforagerate( GetGooseMinForageRate(m_myspecies) ); // Okay, we found food today, so reset the minimum acceptable MFR.
538  return togs_ToRoost;
539  }
540  return togs_Forage;
541 }
542 //--------------------------------------------------------------------------------------------------------
543 
545 {
546  return togs_foobar;
547 }
548 //--------------------------------------------------------------------------------------------------------
549 
551 {
556  {
557  return togs_Roost;
558  }
563  {
564  return togs_Roost;
565  }
566  Set_GooseLeavingRoost( true ); // Indicate that we are coming from the roost. Used to trigger memory initialisation via explore.
568 }
569 //--------------------------------------------------------------------------------------------------------
570 
572 {
579  APoint HopLoc;
580  for (int i = 0; i < 1; i++)
581  {
582  HopLoc = ChooseHopLoc(); // The distance moved is dependent on the species and this is controlled by the inherited ChooseHopLoc code.
583  }
584  FlyTo( HopLoc );
585 }
586 //--------------------------------------------------------------------------------------------------------
587 
593 void Goose_Base::EvaluateForageToHopLoc( APoint a_HopLoc )
594 {
595  double dx = a_HopLoc.m_x - m_Location_x;
596  double dy = a_HopLoc.m_y - m_Location_y;
597  int dist = g_AlmassMathFuncs.CalcDistPythagoras( a_HopLoc.m_x, a_HopLoc.m_y, m_Location_x, m_Location_y );
598  double tx = m_Location_x;
599  double ty = m_Location_y;
600  // We are looking for big things, so no need to move at 1m steps
601  double ddx = (dx/dist)*100;
602  double ddy = (dy/dist)*100;
603  int lastpoly = m_OurLandscape->SupplyPolyRef(m_Location_x, m_Location_y);
604  for (int d=0; d<dist/100; d++)
605  {
606  tx += ddx;
607  ty += ddy;
608  if (m_OurLandscape->SupplyPolyRef((int)tx, (int)ty) != lastpoly)
609  {
610  lastpoly = m_OurLandscape->SupplyPolyRef((int)tx, (int)ty);
611  int openness = (int)m_OurLandscape->SupplyOpenness(lastpoly); // Score calculated by Landscape::CaclulateOpenness
612  if (openness >= m_GooseMinForageOpenness)
613  {
614  GooseMemoryLocation aThought;
615  double grain = m_OurLandscape->SupplyBirdSeedForage(lastpoly); // grain/m2
616  double maize = m_OurLandscape->SupplyBirdMaizeForage(lastpoly); // kJ/m2
617  aThought.m_grain = m_OurPopulationManager->GetFeedingRate(grain, m_myspecies); // kJ/min
618  aThought.m_maize = m_OurPopulationManager->GetMaizeFeedingRate(maize, m_myspecies); // kJ/min
619  aThought.m_grazing = m_OurLandscape->GetActualGooseGrazingForage(lastpoly, m_myspecies); // kJ/min
620  aThought.m_foodresource = GetMaxIntakeRate(aThought.m_grain, aThought.m_maize, aThought.m_grazing);
621  if (aThought.m_foodresource > 0) // don't remember poor food locations
622  {
623  aThought.m_polygonid = lastpoly;
624  aThought.m_x = m_OurLandscape->SupplyCentroidX(lastpoly);
625  aThought.m_y = m_OurLandscape->SupplyCentroidY(lastpoly);
626  aThought.m_threat = 0;
627  int the_dist = g_AlmassMathFuncs.CalcDistPythagorasApprox(m_MyRoost.m_x, m_MyRoost.m_y, aThought.m_x, aThought.m_y);
628  aThought.m_score = m_MyMemory->CalcScore(the_dist, aThought.m_foodresource, aThought.m_threat);
629  m_MyMemory->MemAdd(aThought);
630  }
631  }
632  }
633  }
634 
635 }
636 //--------------------------------------------------------------------------------------------------------
637 
638 void Goose_Base::On_Bang(int a_polyid )
639 {
646  if (m_CurrentStateNo == -1) return;
647  if (!m_MyMemory->ChangeAddThreat(a_polyid, 1.0))
648  {
649  GooseMemoryLocation aThought;
650  aThought.m_polygonid = a_polyid;
651  aThought.m_x = m_OurLandscape->SupplyCentroidX(a_polyid);
652  aThought.m_y = m_OurLandscape->SupplyCentroidY(a_polyid);
653  aThought.m_threat = 1;
654  int dist = g_AlmassMathFuncs.CalcDistPythagorasApprox( m_MyRoost.m_x, m_MyRoost.m_y, aThought.m_x, aThought.m_y );
655  aThought.m_score = m_MyMemory->CalcScore( dist, aThought.m_foodresource, aThought.m_threat );
656  m_MyMemory->MemAdd(aThought);
657  }
661  if (m_myForageIndex != -1)
662  {
664  }
665  m_myForageIndex = -1;
667 }
668 //--------------------------------------------------------------------------------------------------------
669 
670 void Goose_Base::On_Bang(int a_polyid, double a_scare )
671 {
679  if (m_CurrentStateNo == -1) return;
680  if (!m_MyMemory->ChangeAddThreat(a_polyid, a_scare))
681  {
682  GooseMemoryLocation aThought;
683  aThought.m_polygonid = a_polyid;
684  aThought.m_x = m_OurLandscape->SupplyCentroidX(a_polyid);
685  aThought.m_y = m_OurLandscape->SupplyCentroidY(a_polyid);
686  aThought.m_threat = a_scare;
687  int dist = g_AlmassMathFuncs.CalcDistPythagorasApprox( m_MyRoost.m_x, m_MyRoost.m_y, aThought.m_x, aThought.m_y );
688  aThought.m_score = m_MyMemory->CalcScore( dist, aThought.m_foodresource, aThought.m_threat );
689  m_MyMemory->MemAdd(aThought);
690  }
694  if (m_myForageIndex != -1)
695  {
697  }
698  m_myForageIndex = -1;
700 }
701 //--------------------------------------------------------------------------------------------------------
702 
704 {
708  if (m_myForageIndex != -1)
709  {
711  }
712  TAnimal::KillThis(); // Sets CurrentStateNo to -1, and StepDone to true
713 }
714 //--------------------------------------------------------------------------------------------------------
715 
723 {
726 }
727 //-------------------------
728 
729 
730 double Goose_Base::AdjustIntakeRateToSnowDepth(double a_intakerate) {
731  if (m_SnowDepth > 0.0) {
732  a_intakerate = a_intakerate * (1 - (m_SnowDepth * cfg_goose_snow_scaler.value()));
733  }
734  return a_intakerate;
735 }
736 //-------------------------
737 
738 int Goose_Base::GetForagingTime(int a_EndForagingTime, double a_RoostLeaveTime)
739 {
740  int foraging_time = -1;
741  int day_length = m_OurLandscape->SupplyDaylength();
742  int roost_leave_time = (int)a_RoostLeaveTime;
743  if (roost_leave_time < 0) {
744  roost_leave_time = 0;
745  }
746  // If they never hit their daily max, they are assigned 1440.
747  if (a_EndForagingTime == 1440)
748  {
749  foraging_time = day_length - roost_leave_time;
750  }
751  else
752  {
753  foraging_time = a_EndForagingTime - roost_leave_time;
754  }
755  if (foraging_time == -1)
756  {
757  m_OurLandscape->Warn("Goose_Base::CalcForagingTime()","error in foraging time calculation");
758  exit(0);
759  }
760  return foraging_time;
761 }
762 
763 /*********************************************************************************************************/
cfg_goose_nighttime_BMR_multiplier
CfgFloat cfg_goose_nighttime_BMR_multiplier
To calculate daily energy budget. This is the multiple of BMR spent during nighttime.
Goose_Base::m_LeavingRoost
bool m_LeavingRoost
Flag to indicate that we are coming from the roost. Used to control code for "following".
Definition: Goose_Base.h:219
Goose_Base::GetMaxIntakeRate
double GetMaxIntakeRate(double a_grain, double a_maize, double a_grass)
Returns the max intake rate of the three different types of intake.
Definition: Goose_Base.h:536
Goose_Base::m_energyToday
double m_energyToday
The bird's daily energy account (kJ)
Definition: Goose_Base.h:207
Goose_Base::m_FlightNumber
int m_FlightNumber
Counter for the number of flights per day.
Definition: Goose_Base.h:307
Goose_Base::GetFlightCost
double GetFlightCost()
Get the flight costs per m per g.
Definition: Goose_Base.h:568
togs_Roost
Definition: Goose_Base.h:80
GooseActiveForageLocation::GetGrazing
double GetGrazing(int gs)
Returns the current forage rate kJ/min assuming no other geese affect this.
Definition: Goose_Population_Manager.h:334
Goose_Base::st_Roost
TTypeOfGoose_BaseState st_Roost()
Roosting until next forage or next morning.
Definition: Goose_Base.cpp:550
Goose_Base::m_myForageIndex
int m_myForageIndex
Temporary storage for a forage location index - this is a speed optimisation.
Definition: Goose_Base.h:291
Goose_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
Goose_Base::m_DEB
double m_DEB
The daily energy budget excluding flying (kJ)
Definition: Goose_Base.h:191
Goose_Base::m_GooseLeavingThreshold
static double m_GooseLeavingThreshold
The trigger for leaving as a 5 day average of body condition.
Definition: Goose_Base.h:255
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
Goose_Base::m_groupsize
int m_groupsize
The size of the group this bird represents.
Definition: Goose_Base.h:171
GooseMemoryMap::MemDel
bool MemDel(int a_polyid)
Delete a memory location.
Definition: GooseMemoryMap.cpp:87
Goose_Base::m_LeaveRoostTime
double m_LeaveRoostTime
Controls the time when the goose will leave the roost.
Definition: Goose_Base.h:215
togs_Die
Definition: Goose_Base.h:81
GooseMemoryLocation
a data structure to hold goose memory location attributes
Definition: GooseMemoryMap.h:41
GooseMemoryLocation::m_score
double m_score
A score used to assess the location.
Definition: GooseMemoryMap.h:63
GooseMemoryLocation::m_grazing
double m_grazing
the grazing resource at the location as intake rate kJ/min
Definition: GooseMemoryMap.h:57
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_Base::GetForagingTime
int GetForagingTime(int a_EndForagingTime, double a_RoostLeaveTime)
Returns the time spent foraging.
Definition: Goose_Base.cpp:738
Goose_Population_Manager::RecordWeight
void RecordWeight(double a_weight, GooseSpecies a_species)
Record the weight.
Definition: Goose_Population_Manager.cpp:2164
togs_ToRoost
Definition: Goose_Base.h:79
Goose_Base::m_GooseFieldForageDist
static double m_GooseFieldForageDist[gs_foobar]
The maximum distance travelled from roost to forage sites for each species of goose (m)
Definition: Goose_Base.h:247
Goose_Base::m_GooseFattoKJConversion
static double m_GooseFattoKJConversion
Conversion rate fat to kJ.
Definition: Goose_Base.h:271
Goose_Base::m_BodyCondition
double m_BodyCondition[5]
A variable describing current body condition over the past 5 days.
Definition: Goose_Base.h:279
Goose_Base::st_ChooseForageLocation
TTypeOfGoose_BaseState st_ChooseForageLocation(void)
Selects a forage location based on past memory, or initiates an exploration.
Definition: Goose_Base.cpp:258
Goose_Base::m_GooseMaxEnergyReserveProportion
static double m_GooseMaxEnergyReserveProportion
Max proportion of weight that can be energy reserve.
Definition: Goose_Base.h:263
Goose_Base::Step
virtual void Step(void)
The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously...
Definition: Goose_Base.cpp:244
GooseActiveForageLocation::GetMaizeDensity
double GetMaizeDensity(void)
Returns the current maize forage density (kJ/m2)
Definition: Goose_Population_Manager.h:313
cfg_goose_RoostLeaveDistSD
CfgInt cfg_goose_RoostLeaveDistSD
The standard deviation for the normal distribution which determines roost leave time.
GooseMemoryMap::ChangeSetFoodRes
bool ChangeSetFoodRes(int a_polyid, double a_grain, double a_maize, double a_grazing)
Set food at a memory location.
Definition: GooseMemoryMap.cpp:159
Goose_Population_Manager::GetIsDaylight
int GetIsDaylight()
Is it daylight hours? Daylight starts at m_daytime == 0.
Definition: Goose_Population_Manager.h:416
TTypeOfLeaveReason
TTypeOfLeaveReason
Definition: Goose_Base.h:102
Goose_Base::SubtractBodyCondition
void SubtractBodyCondition(double a_condition)
Alters body conditon by subtraction of a double value.
Definition: Goose_Base.h:406
cfg_goose_snow_scaler
CfgFloat cfg_goose_snow_scaler
The decrease in intake rate resulting from snow.
Goose_Base::ReInit
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
ReInit for object pool.
Definition: Goose_Base.cpp:168
Goose_Population_Manager::RecordDailyEnergyBudget
void RecordDailyEnergyBudget(int a_deb, GooseSpecies a_species)
Record the daily energy budget.
Definition: Goose_Population_Manager.cpp:2231
Goose_Base::m_SnowDepth
static double m_SnowDepth
The current snow depth. Held here for speed optimization.
Definition: Goose_Base.h:199
tolr_bodycondition
Definition: Goose_Base.h:105
togs_ChooseForageLocation
Definition: Goose_Base.h:77
Goose_Population_Manager::GetMaizeFeedingRate
double GetMaizeFeedingRate(double a_maizedensity, GooseSpecies a_species)
Get the forage rate when feeding on maize.
Definition: Goose_Population_Manager.h:474
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
Goose_Base::AdjustIntakeRateToSnowDepth
double AdjustIntakeRateToSnowDepth(double a_intakerate)
When there is snow, the intake rate is decreased by 10 % per cm of snow.
Definition: Goose_Base.cpp:730
GooseActiveForageLocation::GetGrainDensity
double GetGrainDensity(void)
Returns the current forage density (grain/m2)
Definition: Goose_Population_Manager.h:303
GooseMemoryMap::ChangeAddThreat
bool ChangeAddThreat(int a_polyid, double a_threat)
Add to threat at a memory location.
Definition: GooseMemoryMap.cpp:123
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
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
Goose_Base::m_DailyMaxAppetiteHitTime
int m_DailyMaxAppetiteHitTime
The time of day when m_DailyMaxAppetite was hit.
Definition: Goose_Base.h:203
Goose_Base::m_myMemPolyID
int m_myMemPolyID
Temporary storage for a memory location polygon id.
Definition: Goose_Base.h:295
ALMaSS_MathFuncs
ALMaSS_MathFuncs constructor.
Definition: Misc.h:28
GooseMemoryMap::CalcScore
double CalcScore(int a_dist, double a_foodresource, double a_threat)
Inline function to calulate overall score for a distance, resource and threat.
Definition: GooseMemoryMap.cpp:273
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
Goose_Base::m_GooseMaxAppetiteScaler
static double m_GooseMaxAppetiteScaler
Scaler to determine the max kJ possible to eat per day based on non-energy reserve weight.
Definition: Goose_Base.h:259
Goose_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
Goose_Base::m_GooseForageDistX2
static double m_GooseForageDistX2[gs_foobar]
Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this...
Definition: Goose_Base.h:243
Landscape
The landscape class containing all environmental and topographical data.
Definition: landscape.h:112
Goose_Base::SetBodyCondition
void SetBodyCondition(double a_condition, unsigned a_index)
Sets the current body condition.
Definition: Goose_Base.h:398
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
Goose_Base::m_myspecies
GooseSpecies m_myspecies
Holds goose species.
Definition: Goose_Base.h:159
Goose_Base::m_FlightDistance
int m_FlightDistance
Storage for the total distance flown per day.
Definition: Goose_Base.h:311
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
MapErrorMsg
Definition: maperrormsg.h:43
cfg_goose_BMRconstant2
CfgFloat cfg_goose_BMRconstant2
The cost of BMR per kg goose - constant 2.
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
GooseMemoryLocation::m_foodresource
double m_foodresource
The max food intake rate (kJ/min) at the location.
Definition: GooseMemoryMap.h:59
Goose_Population_Manager::GetFeedingRate
double GetFeedingRate(double a_graindensity, GooseSpecies a_species)
Get the forage rate based on the grain density.
Definition: Goose_Population_Manager.h:457
GooseMemoryLocation::m_y
int m_y
y-coordinate
Definition: GooseMemoryMap.h:49
Goose_Base::GetGooseMinForageRate
double GetGooseMinForageRate(GooseSpecies a_species)
Returns the minimum forage rate for the species.
Definition: Goose_Base.h:471
TAnimal
g_AlmassMathFuncs
ALMaSS_MathFuncs g_AlmassMathFuncs
This variable provides access the to the internal ALMaSS math functions.
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
Goose_Base::m_DailyMaxAppetite
double m_DailyMaxAppetite
The daily max kJ possible to get as intake.
Definition: Goose_Base.h:195
togs_foobar
Definition: Goose_Base.h:83
Goose_Base::Init
void Init(Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Intitialise object.
Definition: Goose_Base.cpp:111
cfg_goose_MinForageRateDecayRate
CfgFloat cfg_goose_MinForageRateDecayRate
The decay rate for the minimum forage rate.
GooseMemoryMap::GetBestFeedingScore
GooseMemoryLocation GetBestFeedingScore()
Find the current best feeding location.
Definition: GooseMemoryMap.cpp:236
Goose_Base::m_GooseKJtoFatConversion
static double m_GooseKJtoFatConversion
Conversion rate kJ to fat.
Definition: Goose_Base.h:267
Goose_Base::CurrentGState
TTypeOfGoose_BaseState CurrentGState
Variable to record current behavioural state.
Definition: Goose_Base.h:147
Goose_Base::m_forageLocCount
int m_forageLocCount
The number of forage locations visited today.
Definition: Goose_Base.h:183
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
Goose_Base::st_Dying
void st_Dying(void)
Behavioural state dying.
Definition: Goose_Base.cpp:251
Goose_Population_Manager::GetThermalCosts
double GetThermalCosts(GooseSpecies a_goose)
Get daily thermal costs const.
Definition: Goose_Population_Manager.h:556
Goose_Base::m_GooseForageDist
static double m_GooseForageDist[gs_foobar]
The maximum distance travelled from roost to forage sites for each species of goose (m)
Definition: Goose_Base.h:239
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
Goose_Population_Manager::GetForageLocation
GooseActiveForageLocation * GetForageLocation(unsigned int a_index)
Returns a pointer to the forage location indexed by index.
Definition: Goose_Population_Manager.h:448
Goose_Population_Manager::RecordFlightDistance
void RecordFlightDistance(int a_distance, GooseSpecies a_species)
Record the flight distance.
Definition: Goose_Population_Manager.cpp:2217
gst_foobar
Definition: Goose_Base.h:66
g_rand_uni2
boost::variate_generator< base_generator_type &, boost::uniform_int<> > g_rand_uni2
A random number generator (0-9999)
Goose_Base::m_MyMemory
GooseMemoryMap * m_MyMemory
The Goose Memory.
Definition: Goose_Base.h:299
Goose_Population_Manager
The class to handle all goose population related matters.
Definition: Goose_Population_Manager.h:392
Goose_Base::On_Migrate
void On_Migrate(TTypeOfLeaveReason a_leavereason)
The goose is told to leave the simulation area (poss due to bad weather)
Definition: Goose_Base.cpp:722
Goose_Base::GetMaxForageRate
double GetMaxForageRate(double a_grain, double a_maize, double a_grass, double a_interferenceComp, bool a_iscereal, TTypesOfVegetation a_veg, bool a_stubble, TTypesOfVegetation a_prevcrop)
Returns the max forage rate of the three different types of forage The max rate is adjusted according...
Definition: Goose_Base.h:489
Goose_Population_Manager::GetBirdsAtForageLoc
int GetBirdsAtForageLoc(int a_index, GooseSpeciesType a_type)
Returns the number of birds at a forage location - given by a poly ref.
Definition: Goose_Population_Manager.h:530
Goose_Base::ScaleForageToGroupsize
double ScaleForageToGroupsize(double a_forage)
Scales forage to groupsize.
Definition: Goose_Base.h:414
cfg_goose_RoostLeaveDistMean
CfgInt cfg_goose_RoostLeaveDistMean
The mean for the normal distribution which determines roost leave time.
GooseMemoryLocation::m_maize
double m_maize
the maize resource at the location as intake rate kJ/min
Definition: GooseMemoryMap.h:55
cfg_goose_AfterDarkTime
CfgInt cfg_goose_AfterDarkTime
The number of minutes that geese will be foraging after sunset.
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
togs_InitialState
Definition: Goose_Base.h:76
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
GooseMemoryLocation::m_x
int m_x
x-coordinate
Definition: GooseMemoryMap.h:47
CfgFloat::value
double value(void)
Definition: configurator.h:118
Goose_Population_Manager::NewForageLocation
int NewForageLocation(GooseSpeciesType a_type, int a_number, int a_polyref)
Creates a new forage location and adds a goose or geese to the forage location. Returns an index to t...
Definition: Goose_Population_Manager.cpp:1773
Goose_Base::m_followinglikelyhood
static int m_followinglikelyhood[(int) gst_foobar]
An attribute used to determine the chance of following or exploring when foraging.
Definition: Goose_Base.h:303
cfg_goose_daytime_BMR_multiplier
CfgFloat cfg_goose_daytime_BMR_multiplier
To calculate daily energy budget. This is the multiple of BMR spent during daytime Default is based o...
cfg_goose_BMRconstant1
CfgFloat cfg_goose_BMRconstant1
The cost of BMR per kg goose - constant 1.
Goose_Base::m_MaxIntakeSource
TMaxIntakeSource m_MaxIntakeSource
Holds information about the food source which gave max intake rate.
Definition: Goose_Base.h:211
Goose_Base::FlyTo
void FlyTo(int a_x, int a_y)
The goose flys to the location specified by a_x, a_y.
Definition: Goose_Base.cpp:409
Goose_Base::m_BMR
double m_BMR
The daily BMR.
Definition: Goose_Base.h:187
Goose_Base::EvaluateForageToHopLoc
void EvaluateForageToHopLoc(APoint a_HopLoc)
Do a forage evaluation from current location to a_HopLoc.
Definition: Goose_Base.cpp:593
Goose_Population_Manager::GetForageGooseDensity
double GetForageGooseDensity(int a_index)
Returns the total goose density for a forage location.
Definition: Goose_Population_Manager.h:492
Goose_Base::m_BodyConditionCounter
unsigned m_BodyConditionCounter
A counter for the daily body condition.
Definition: Goose_Base.h:287
GooseMemoryMap::DecayAllMemory
void DecayAllMemory()
Decay all memory.
Definition: GooseMemoryMap.cpp:295
Goose_Population_Manager::RecordDailyEnergyBalance
void RecordDailyEnergyBalance(int a_balance, GooseSpecies a_species)
Record the daily energy balance.
Definition: Goose_Population_Manager.cpp:2245
cfg_goose_InitialEnergyReserveProportion
CfgFloat cfg_goose_InitialEnergyReserveProportion
The initial proportion of weight that can be stored as energy reserves.
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_Base::m_Indivmingooseforagerate
double m_Indivmingooseforagerate
The minimum tolerable forage rate in kJ/minute for the individual.
Definition: Goose_Base.h:231
Goose_Base::st_ToRoost
virtual TTypeOfGoose_BaseState st_ToRoost()
Return to roost and assess whether to forage again that day.
Definition: Goose_Base.cpp:544
Goose_Base::m_GooseMinForageOpenness
static double m_GooseMinForageOpenness
The minimum openness value a goose will tolerate for forage.
Definition: Goose_Base.h:275
Goose_Base::GetForageLocIndex
int GetForageLocIndex()
Gets for the forage location index.
Definition: Goose_Base.h:418
CfgInt
Integer configurator entry class.
Definition: configurator.h:87
Goose_Base
A class to describe the goose base.
Definition: Goose_Base.h:131
Goose_Base::m_TheBodyCondition
double m_TheBodyCondition
A variable describing current body condition averaged over 5 days.
Definition: Goose_Base.h:283
Goose_Base::ChooseHopLoc
virtual APoint ChooseHopLoc()
Pick a hop location point within a_dist meters - must be overridden by descendent classes.
Definition: Goose_Base.h:363
Goose_Base::Explore
void Explore()
Behavioural exploration of the area to find forage.
Definition: Goose_Base.cpp:571
Goose_Base::~Goose_Base
virtual ~Goose_Base()
Goose_Base destructor.
Definition: Goose_Base.cpp:176
g_msg
MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
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
GooseMemoryLocation::m_threat
double m_threat
the threat-level memory strength
Definition: GooseMemoryMap.h:61
GooseMemoryMap::IsKnownArea
bool IsKnownArea(int a_polyid)
Check if this location is known.
Definition: GooseMemoryMap.cpp:282
Goose_Base::st_Forage
TTypeOfGoose_BaseState st_Forage()
Behavioural forage.
Definition: Goose_Base.cpp:433
CfgFloat
Double configurator entry class.
Definition: configurator.h:106
Goose_Base::m_myGooseSpeciesType
GooseSpeciesType m_myGooseSpeciesType
Holds the goose species type.
Definition: Goose_Base.h:163
GooseMemoryLocation::m_polygonid
int m_polygonid
the unique polygon identification
Definition: GooseMemoryMap.h:51
tomis_foobar
Definition: Goose_Base.h:96
Goose_Base::m_OurPopulationManager
Goose_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Goose_Base.h:151
CfgInt::value
int value(void)
Definition: configurator.h:98
Goose_Base::m_GooseFieldForageDistX2
static double m_GooseFieldForageDistX2[gs_foobar]
Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this...
Definition: Goose_Base.h:251
Goose_Base::AddBodyCondition
void AddBodyCondition(double a_condition)
Alters body conditon by addition of a double value.
Definition: Goose_Base.h:402
Goose_Base::KillThis
virtual void KillThis()
The bird is dead of some external cause.
Definition: Goose_Base.cpp:703
Goose_Population_Manager::RecordState
void RecordState()
Record the state.
Definition: Goose_Population_Manager.cpp:2272
Goose_Base::m_mingooseforagerate
static double m_mingooseforagerate[gs_foobar]
The minimum tolerable forage rate in kJ/minute for the species.
Definition: Goose_Base.h:235
GooseMemoryMap::MemAdd
void MemAdd(GooseMemoryLocation a_gml)
Add a new memory location.
Definition: GooseMemoryMap.cpp:50
TTypeOfGoose_BaseState
TTypeOfGoose_BaseState
Definition: Goose_Base.h:74
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
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
A random number generator (0-1)
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_Base::m_weightTotal
double m_weightTotal
The weight of the bird in g including fat reserve.
Definition: Goose_Base.h:179
cfg_goose_pf_springmigdatestart
CfgInt cfg_goose_pf_springmigdatestart
Input: Date for onset of spring migration.
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_Base::StartDay
virtual void StartDay(void)
Do any 'housekeeping' associated with the start of day.
Definition: Goose_Base.cpp:181
cfg_goose_pf_springmigdateend
CfgInt cfg_goose_pf_springmigdateend
Input: Date for end of spring migration.
Goose_Base::m_MyRoost
APoint m_MyRoost
The current roost location.
Definition: Goose_Base.h:167
Goose_Population_Manager::GetForageRateDensity
double GetForageRateDensity(double a_foragedensity)
Get the forage intake rate for a forage density.
Definition: Goose_Population_Manager.h:488
togs_Forage
Definition: Goose_Base.h:78
GooseMemoryLocation::m_grain
double m_grain
the grain resource at the location as intake rate kJ/min
Definition: GooseMemoryMap.h:53
Goose_Base::m_energyReserve
double m_energyReserve
The bird's energy reserves in grams.
Definition: Goose_Base.h:223
Goose_Base::m_weight
double m_weight
The weight of the bird in gram excluding fat reserve.
Definition: Goose_Base.h:175
Goose_Base::Goose_Base
Goose_Base(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Goose_Base constructor.
Definition: Goose_Base.cpp:163
Goose_Base::m_flightcost
static double m_flightcost
The cost of flight per g per m in kJ.
Definition: Goose_Base.h:227
GooseMemoryMap
The class describing both local and seasonal goose memories and cognition.
Definition: GooseMemoryMap.h:93