ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
Hare_all.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2011, 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 */
29 //---------------------------------------------------------------------------
30 
31 #include <string.h>
32 #include <iostream>
33 #include <fstream>
34 #include <cmath>
35 #include<vector>
36 #ifdef __UNIX
37 #undef max
38 #endif
39 #include "../Landscape/ls.h"
40 #include "../BatchALMaSS/PopulationManager.h"
41 #include "../BatchALMaSS/AOR_Probe.h"
42 #include "../Hare/hare_all.h"
43 
44 
45 
46 
47 //---------------------------------------------------------------------------
48 // Globals
49 
52 extern Landscape* g_land;
53 
54 //---------------------------------------------------------------------------
55 
56 
57 //---------------------------------------------------------------------------
58 
59 // externals
60 
61 extern void FloatToDouble(double &d, float f);
62 extern CfgBool cfg_RipleysOutput_used;
63 extern CfgBool cfg_AOROutput_used;
64 extern CfgBool cfg_ReallyBigOutput_used;
65 extern CfgInt cfg_pm_eventfrequency;
66 extern CfgInt cfg_pm_eventsize;
67 extern CfgBool cfg_BeetleBankInvert;
68 extern CfgInt cfg_BeetleBankMinX;
69 extern CfgInt cfg_BeetleBankMaxX;
70 extern CfgInt cfg_BeetleBankMinY;
71 extern CfgInt cfg_BeetleBankMaxY;
72 extern CfgFloat l_pest_daily_mort;
73 
74 #include "../BatchALMaSS/BoostRandomGenerators.h"
75 extern boost::variate_generator<base_generator_type&, boost::uniform_real<> > g_rand_uni;
76 
77 //---------------------------------------------------------------------------
78 CfgFloat cfg_HareWalkingPowerConst("HARE_WALKINGPOWERCONST", CFG_CUSTOM, -0.316);
79 CfgFloat cfg_VegHeightForageReduction("HARE_VEGHEIGHTFORAGEREDUCTION", CFG_CUSTOM, 0.0003);
80 CfgFloat cfg_FarmIntensiveness("HARE_FARMINTENSIVENESS", CFG_CUSTOM, 0.01);
81 CfgInt cfg_FarmIntensivenessH("HARE_FARMINTENSIVENESSH", CFG_CUSTOM, 10);
82 CfgFloat cfg_HareHunting("HARE_HUNTING", CFG_CUSTOM, 0.15);
83 CfgFloat cfg_HareHuntingBeetleBankArea("HARE_HUNTING_BEETLEBANKAREA",CFG_CUSTOM,0.95);
84 CfgInt cfg_HareHuntingThreshold("HARE_HUNTING_THRESHOLD",CFG_CUSTOM,0);
85 CfgInt cfg_HareHuntingType("HARE_HUNTING_TYPE",CFG_CUSTOM,0); // 1 = Threshold 2 = Differentiated for beetle bank areas.
86 CfgInt cfg_HareHuntingDate("HARE_HUNTING_DATE",CFG_CUSTOM,312); // Middle of DK hunting season
87 CfgInt cfg_fixadult_starve("HARE_FIXADULT_STARVE",CFG_CUSTOM,360);
88 CfgInt cfg_adult_starve("HARE_ADULT_STARVE",CFG_CUSTOM,5000);
89 CfgInt cfg_juv_starve("HARE_JUV_STARVE",CFG_CUSTOM,2500);
90 CfgInt cfg_young_ddepmort("HARE_YOUNGDDEPMORT",CFG_CUSTOM,16);
91 CfgFloat cfg_RMRrainFactor("HARE_RMRRAINFACTOR",CFG_CUSTOM,0.47);
92 CfgFloat cfg_JuvDDScale("HARE_JUVSCALEDD",CFG_CUSTOM,0.5);
93 CfgInt cfg_HareThresholdDD("HARE_THRESHOLDDD",CFG_CUSTOM,5);
94 CfgFloat cfg_min_growth_attain("HARE_MINGROWTHATTAIN",CFG_CUSTOM,0.475); // only used if __MINGROWTHATTAIN is defined
95 CfgFloat cfg_HareMortStochasticity("HARE_MORTSTOCHASTICITY",CFG_CUSTOM,1.0); // 1.0 gives +/- 100%
96 CfgFloat cfg_hare_foetusenergyproportion("HARE_FOETUSENERGYPROPORTION",CFG_CUSTOM,0.024);
97 CfgInt cfg_HareFemaleReproMortValue("HARE_FEMALEREPROMORT",CFG_CUSTOM,0); // zero means no mort
98 CfgInt cfg_HareFemaleSicknessDensityDepValue("HARE_FEMALESICKNESSDENDEPVALUE",CFG_CUSTOM,40); // can be any number, but 30-100 is probably right
99 CfgFloat cfg_HareFemaleDensityDepValue("HARE_FEMALEDENDEPVALUE",CFG_CUSTOM,0.1);
100 //CfgInt cfg_Hare_YoungDD_Value("HARE_YOUNGDENDEPVALUE",CFG_CUSTOM,1);
101 CfgFloat cfg_HareMaleDensityDepValue("HARE_MALEDENDEPVALUE", CFG_CUSTOM, 0.1);
102 // ********** PESTICIDE RESPONSE INPUTS **********
107 CfgBool cfg_hare_pesticideresponse_on("HARE_PESTICIDERESPONSE_ON", CFG_CUSTOM, false);
111 CfgFloat cfg_HarePesticideAccumulationThreshold("HARE_PESTICIDEACCUMULATIONTHRESHOLD", CFG_CUSTOM, 0.0);
112 // ********** END PESTICIDE RESPONSE INPUTS **********
113 
117 CfgInt cfg_hare_i_cut("HARE_CUTTING_MORT_INFANT", CFG_CUSTOM, 50);
121 CfgInt cfg_hare_y_cut( "HARE_CUTTING_MORT_YOUNG", CFG_CUSTOM, 10 );
122 //
123 CfgInt cfg_Hare_Recovery_Time("HARE_RECOVERY_TIME", CFG_CUSTOM, 10); // in minutes
124 // Physiological life-span
125 CfgInt cfg_hare_max_age("HARE_MAX_AGE", CFG_CUSTOM, (int)(365*12.5));
126 CfgInt cfg_hare_max_age_var("HARE_MAX_AGE_VAR",CFG_CUSTOM,180);
127 // Energetic values
128 // CfgFloat cfg_Hare_StdKJRunning("HARE_STDKJRUNNING",CFG_CUSTOM,99999);
129 // CfgFloat cfg_Hare_StdKJWalking("HARE_STDKJWALKING",CFG_CUSTOM,99999);
130 // CfgFloat cfg_Hare_StdKJForaging("HARE_STDKJFORAGING",CFG_CUSTOM,99999);
131 CfgFloat cfg_Hare_StdSpeedWalking("HARE_STD_SPEEDWALKING",CFG_CUSTOM,0.65*60); // Slow amble!!! Just a guess - is 1/20th of max run speed
132 CfgFloat cfg_Hare_StdSpeedRunning("HARE_STD_SPEEDRUNNING",CFG_CUSTOM,13*60); // http://hypertextbook.com/facts/2001/RobertCohen.shtml 13/m/sec
133 // Misc
134 static CfgInt cfg_hare_StartingNo("HARE_START_NO",CFG_CUSTOM,50);
135 static CfgFloat cfg_HareStartWeight("HARE_STARTWEIGHT",CFG_CUSTOM,121.0*0.88*0.33); // Hacklander et al, 2002 but in dry weight without ingesta
136 static CfgInt cfg_hare_sex_ratio("HARE_SEX_RATIO", CFG_CUSTOM, 50); // Default 50:50
137 // The next value is out of 10000 and gives the backround rate of disturbance due
138 // to proximity of predators/people. 1000 will result in one event per 10 days
139 // on a probabilistic basis
140 static CfgFloat cfg_hare_proximity_alert("HARE_PROXIMITY_ALERT",CFG_CUSTOM,0.05); // 0.05 once in 20 days
141 // Below are the background mortality rates for the different stages in terms
142 // of mortality chance out of 10000 per day
143 //static CfgFloat cfg_hare_infant_predation("HARE_INFANT_PREDATION",CFG_CUSTOM,0.0046);
144 static CfgFloat cfg_hare_young_predation("HARE_YOUNG_PREDATION",CFG_CUSTOM,0.002);
145 static CfgFloat cfg_hare_juvenile_predation("HARE_JUVENILE_PREDATION",CFG_CUSTOM,0.0016);
146 static CfgFloat cfg_hare_male_predation("HARE_MALE_PREDATION",CFG_CUSTOM,0.0023);
147 static CfgFloat cfg_hare_female_predation("HARE_FEMALE_PREDATION",CFG_CUSTOM,0.0023); // Daily predation per year is calculated by (1-(10/10000) ^365) * 1.0
148 CfgFloat cfg_hare_adult_predation("HARE_ADULT_PREDATION",CFG_CUSTOM,0.0023); // Daily predation per year is calculated by (1-(10/10000) ^365) * 1.0
149 
150 //**** MRR config variables
151 static CfgInt cfg_MRR_FirstYear("HARE_MRRFIRSTYEAR",CFG_CUSTOM,10000);
152 static CfgInt cfg_MRR_LastYear("HARE_MRRLASTYEAR",CFG_CUSTOM,0);
153 static CfgInt cfg_MRR1("HARE_MMRONE",CFG_CUSTOM,999); // 75
154 static CfgInt cfg_MRR2("HARE_MMRTWO",CFG_CUSTOM,999); // 270
155 static CfgInt cfg_MRR3("HARE_MMRTHREE",CFG_CUSTOM,999); // 285
156 static CfgInt cfg_MRR4("HARE_MMRFOUR",CFG_CUSTOM,999); // 315
157 static CfgInt cfg_MRR5("HARE_MMRFIVE",CFG_CUSTOM,270); // 345
158 
159 // Energetic values
160 /*
161 static CfgFloat cfg_Hare_YoungSpeedWalking("HARE_YOUNG_SPEEDWALKING",CFG_CUSTOM,99999);
162 static CfgFloat cfg_Hare_JuvenileSpeedWalking("HARE_JUVENILE_SPEEDWALKING",CFG_CUSTOM,99999);
163 static CfgFloat cfg_Hare_AdultSpeedWalking("HARE_ADULT_SPEEDWALKING",CFG_CUSTOM,99999);
164 static CfgFloat cfg_Hare_YoungSpeedRunning("HARE_YOUNG_SPEEDRUNNING",CFG_CUSTOM,99999);
165 static CfgFloat cfg_Hare_JuvenileSpeedRunning("HARE_JUVENILE_SPEEDRUNNING",CFG_CUSTOM,99999);
166 static CfgFloat cfg_Hare_AdultSpeedRunning("HARE_ADULT_SPEEDRUNNING",CFG_CUSTOM,99999);
167 */
168 static CfgFloat cfg_MaxEnergyIntakeScaler("HARE_MAXENERGYINTAKESCALER",CFG_CUSTOM, 3.0);
169 //static CfgFloat cfg_MaxGrowthEnergy("HARE_MAXGROWTHENERGY",CFG_CUSTOM, 82.0);
170 //static CfgFloat cfg_AdultPropGrowthEnergy("HARE_ADULT_PROPGROWTHENERGY",CFG_CUSTOM, 0.1);
172 static CfgFloat cfg_AdultMaxFat("HARE_ADULT_MAXFAT",CFG_CUSTOM, 0.04/(0.33*0.88));
173 //static CfgFloat cfg_KJpergLeveret("HARE_KJPERGLEVERET",CFG_CUSTOM,6.8); // Guessed - better value needed
174 //static CfgFloat cfg_milkconvrate("HARE_MILKCONVRATE",CFG_CUSTOM,0.58); // Hacklander et al
175 //static CfgFloat cfg_milkAsbsorption("HARE_MILKABSORPTION",CFG_CUSTOM, 0.99675); // Hacklander et al
176 //static CfgFloat cfg_solidAsbsorption("HARE_SOLIDABSORPTION",CFG_CUSTOM, 0.5); // Estimate
177 //static CfgFloat cfg_milktogLeveret("HARE_MILKTOLEVERET",CFG_CUSTOM, 0.704552); // Fitted EnergyCalcs.xls
178 //static CfgFloat cfg_solidtoghare("HARE_MILKTOLEVERET",CFG_CUSTOM, 0.5); // Estimate?
180 CfgFloat cfg_hare_ExtEff("HARE_EXTEFF",CFG_CUSTOM, 3.25);
181 // Reproduction parameters
182 static CfgInt cfg_DaysToOestrous("HARE_DAYSTOOESTROUS",CFG_CUSTOM,20); // This is rubbish, but to try to make the program work
183 static CfgInt cfg_hare_DaysToGestation("HARE_GESTATIONDAYS",CFG_CUSTOM,41);
184 //static CfgFloat cfg_hare_foetalConversionEff("HARE_FOETALCONVEFF",CFG_CUSTOM,(1/42.7) );
185 //static CfgFloat cfg_hare_foetusKJprop("HARE_FOETUSKJPROP",CFG_CUSTOM,0.029); // Fitting value
186 static CfgFloat cfg_maxLeveretBirthWeight("HARE_MAXLEVERETBIRTHWEIGHT",CFG_CUSTOM,125*0.88*0.33);
187 static CfgFloat cfg_minLeveretBirthWeight("HARE_MINLEVERETBIRTHWEIGHT",CFG_CUSTOM,95*0.88*0.33);
188 static CfgInt cfg_ReproStartDay("HARE_REPROSTARTDAY",CFG_CUSTOM,18);
189 static CfgInt cfg_ReproEndDay("HARE_REPROENDDAY",CFG_CUSTOM,240);
190 //
192 static CfgFloat cfg_hare_adult_dispersal_threshold("HARE_ADULT_DISP_THESHOLD",CFG_CUSTOM, 1600*0.02); // Arbitrary ca 2% of max body weight
194 static CfgFloat cfg_hare_adult_breed_threshold("HARE_ADULT_BREED_THESHOLD",CFG_CUSTOM, 1600*0.03); // Fitting parameter
195 // ditto juvenile
196 static CfgFloat cfg_hare_juvenile_dispersal_threshold("HARE_JUVENILE_DISP_THESHOLD",CFG_CUSTOM,99999);
197 // Starvation thresholds
198 static CfgInt cfg_infant_starvation_threshold("HARE_INFANT_STARVE_THRESHOLD",CFG_CUSTOM,4);
199 static CfgInt cfg_young_starvation_threshold("HARE_YOUNG_STARVE_THRESHOLD",CFG_CUSTOM,4);
200 static CfgInt cfg_juvenile_starvation_threshold("HARE_JUVENILE_STARVE_THRESHOLD",CFG_CUSTOM,16);
201 static CfgInt cfg_adult_starvation_threshold("HARE_ADULT_STARVE_THRESHOLD",CFG_CUSTOM,16);
202 CfgInt cfg_hare_minimum_breeding_weight("HARE_MIN_BREEDING_WT",CFG_CUSTOM,780);
203 //
204 // Movement
205 static CfgInt cfg_hare_max_dispersal("HARE_MAX_DISPERSAL",CFG_CUSTOM,1000); // m
206 // Maximum escape distances
207 CfgInt cfg_hare_escape_dist("HARE_ESCAPE_DIST",CFG_CUSTOM,100);
208 // Foraging
209 CfgFloat cfg_ForageRestingRatio("HARE_FORAGERESTRATIO",CFG_CUSTOM,0.67); // 2/3 forage time
210 CfgFloat cfg_HareInterferenceConstant("HARE_INTERFERENCECONSTANT",CFG_CUSTOM,-0.03);
211 CfgFloat cfg_AgeRelatedInterferenceScaling("HARE_AGERELATEDINTERFERENCESCALING",CFG_CUSTOM,1.0);
212 //
213 // Litter size From Hanson 1992, Acta Theriologica 37:27-40
214 /*
215 static CfgFloat cfg_littersize_mean1("HARE_LITTERSIZE_MEAN_A",CFG_CUSTOM,1.535);
216 static CfgFloat cfg_littersize_mean2("HARE_LITTERSIZE_MEAN_B",CFG_CUSTOM,2.508);
217 static CfgFloat cfg_littersize_mean3("HARE_LITTERSIZE_MEAN_C",CFG_CUSTOM,2.514);
218 static CfgFloat cfg_littersize_mean4("HARE_LITTERSIZE_MEAN_D",CFG_CUSTOM,1.72);
219 static CfgFloat cfg_littersize_mean5("HARE_LITTERSIZE_MEAN_E",CFG_CUSTOM,1.72);
220 static CfgFloat cfg_littersize_mean6("HARE_LITTERSIZE_MEAN_F",CFG_CUSTOM,1.72);
221 static CfgFloat cfg_littersize_SD1("HARE_LITTERSIZE_SD_A",CFG_CUSTOM,0.685);
222 static CfgFloat cfg_littersize_SD2("HARE_LITTERSIZE_SD_B",CFG_CUSTOM,0.957);
223 static CfgFloat cfg_littersize_SD3("HARE_LITTERSIZE_SD_C",CFG_CUSTOM,0.955);
224 static CfgFloat cfg_littersize_SD4("HARE_LITTERSIZE_SD_D",CFG_CUSTOM,0.6415);
225 static CfgFloat cfg_littersize_SD5("HARE_LITTERSIZE_SD_E",CFG_CUSTOM,0.6415);
226 static CfgFloat cfg_littersize_SD6("HARE_LITTERSIZE_SD_F",CFG_CUSTOM,0.6415);
227 */
228 
229 // From Kurt Hansens data mean litter size with year
230 //Mean 1.535 2.508 2.514 1.722
231 //SD 0.685 0.957 0.955 0.642
232 
233 static CfgFloat cfg_littersize_mean1("HARE_LITTERSIZE_MEAN_A",CFG_CUSTOM,1.535);
234 static CfgFloat cfg_littersize_mean2("HARE_LITTERSIZE_MEAN_B",CFG_CUSTOM,2.508);
235 static CfgFloat cfg_littersize_mean3("HARE_LITTERSIZE_MEAN_C",CFG_CUSTOM,2.514);
236 static CfgFloat cfg_littersize_mean4("HARE_LITTERSIZE_MEAN_D",CFG_CUSTOM,1.72);
237 static CfgFloat cfg_littersize_mean5("HARE_LITTERSIZE_MEAN_E",CFG_CUSTOM,1.72);
238 static CfgFloat cfg_littersize_mean6("HARE_LITTERSIZE_MEAN_F",CFG_CUSTOM,1.72);
239 static CfgFloat cfg_littersize_mean7("HARE_LITTERSIZE_MEAN_G",CFG_CUSTOM,2.17);
240 static CfgFloat cfg_littersize_mean8("HARE_LITTERSIZE_MEAN_H",CFG_CUSTOM,1.72);
241 static CfgFloat cfg_littersize_mean9("HARE_LITTERSIZE_MEAN_I",CFG_CUSTOM,1.72);
242 static CfgFloat cfg_littersize_mean10("HARE_LITTERSIZE_MEAN_J",CFG_CUSTOM,1.72);
243 static CfgFloat cfg_littersize_mean11("HARE_LITTERSIZE_MEAN_K",CFG_CUSTOM,1.72);
244 static CfgFloat cfg_littersize_mean12("HARE_LITTERSIZE_MEAN_L",CFG_CUSTOM,0.0);
245 static CfgFloat cfg_littersize_SD1("HARE_LITTERSIZE_SD_A",CFG_CUSTOM,0.685);
246 static CfgFloat cfg_littersize_SD2("HARE_LITTERSIZE_SD_B",CFG_CUSTOM,0.957);
247 static CfgFloat cfg_littersize_SD3("HARE_LITTERSIZE_SD_C",CFG_CUSTOM,0.955);
248 static CfgFloat cfg_littersize_SD4("HARE_LITTERSIZE_SD_D",CFG_CUSTOM,0.6415);
249 static CfgFloat cfg_littersize_SD5("HARE_LITTERSIZE_SD_E",CFG_CUSTOM,0.6415);
250 static CfgFloat cfg_littersize_SD6("HARE_LITTERSIZE_SD_F",CFG_CUSTOM,0.6415);
251 static CfgFloat cfg_littersize_SD7("HARE_LITTERSIZE_SD_G",CFG_CUSTOM,0.955);
252 static CfgFloat cfg_littersize_SD8("HARE_LITTERSIZE_SD_H",CFG_CUSTOM,0.6415);
253 static CfgFloat cfg_littersize_SD9("HARE_LITTERSIZE_SD_I",CFG_CUSTOM,0.6415);
254 static CfgFloat cfg_littersize_SD10("HARE_LITTERSIZE_SD_J",CFG_CUSTOM,0.6415);
255 static CfgFloat cfg_littersize_SD11("HARE_LITTERSIZE_SD_K",CFG_CUSTOM,0.6415);
256 static CfgFloat cfg_littersize_SD12("HARE_LITTERSIZE_SD_L",CFG_CUSTOM,0.0);
257 static CfgFloat cfg_hare_peg_inertia("HARE_PEG_INERTIA",CFG_CUSTOM,0.20);
258 
259 /* Female hare sterility
260 
261 No mechanism known but the following are Trines data for breeding and non-breeding females
262 
263 Alder med ar uden ar % uden ar
264 1 24 2 7.692307692
265 2 27 8 22.85714286
266 3 20 7 25.92592593
267 4 15 1 6.25
268 5+ 8 3 27.27272727
269 alle 94 21 18.26086957
270 
271 Mean without 1st year 20.57644901
272 
273 */
274 
275 static CfgInt cfg_hare_firstyearsterility("HARE_FIRSTYEARSTERILITY",CFG_CUSTOM,769); // out of 10000
276 static CfgInt cfg_hare_femalesterility("HARE_FEMALESTERILITY",CFG_CUSTOM,1401); // out of 10000 ( together with first year value gives a overall infertility of 20.57645%)
277 
278 
279 //---------------------------------------------------------------------------
280 
285 
289 const double g_PropSolidFood[36] = {
290  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0114, 0.0229, 0.0343,
291  0.0457, 0.0571, 0.0686, 0.0800, 0.0929, 0.1057, 0.1186, 0.1314,
292  0.1443, 0.1571, 0.1700, 0.1986, 0.2271, 0.2557, 0.2843, 0.3129,
293  0.3414, 0.3700, 0.5800, 0.7900, 1.0000
294 };
295 
300 const double g_MaxLeveretGrowthEnergy[36] = {
301  0,15.5,24.6,33.8,43.0,52.1,61.3,70.5,79.6,88.8,98.0,107.1,116.3,125.4,134.6,143.8,152.9,162.1,171.3,180.4,189.6,198.8,207.9,217.1,226.2,
302  235.4,244.6,253.7,262.9,272.1,281.2,290.4,299.5,308.7,317.9,327.0
303 };
304 
305 /*
306 // from EnergeticCalcs_cro.xls in KJ per day
307 const double g_MaxMilkEnergy[36] = {
308 156.66,
309 173.60,
310 190.20,
311 206.49,
312 222.53,
313 238.36,
314 253.99,
315 269.45,
316 284.75,
317 299.91,
318 314.94,
319 326.10,
320 336.77,
321 347.04,
322 356.88,
323 366.31,
324 375.28,
325 383.90,
326 391.47,
327 398.66,
328 405.38,
329 411.72,
330 417.61,
331 423.13,
332 428.20,
333 424.55,
334 420.12,
335 414.82,
336 408.69,
337 401.75,
338 394.06,
339 385.50,
340 262.69,
341 134.18,
342 0.00,
343 0.00
344 };
345 */
346 
350 const double g_hare_maxFoetalKJ[41] = {
351  1.714019512,1.671169024,1.628318537,1.585468049,1.542617561,1.499767073,1.456916585,1.414066098,1.37121561,1.328365122,1.285514634,1.242664146,
352  1.199813659,1.156963171,1.114112683,1.071262195,1.028411707,0.98556122,0.942710732,0.899860244,0.857009756,0.814159268,0.77130878,0.728458293,
353  0.685607805,0.642757317,0.599906829,0.557056341,0.514205854,0.471355366,0.428504878,0.38565439,0.342803902,0.299953415,0.257102927,0.214252439,
354  0.171401951,0.128551463,0.085700976,0.042850488,0.001
355  };
356 
357 // Static member intialisation
358 double* THare::m_vegPalatability = NULL;
359 
360 //---------------------------------------------------------------------------
361 
367 {
369  fclose(BodyBurdenPrb);
370  free(m_PolyFood);
371  delete m_OurMRRData;
372 }
373 //---------------------------------------------------------------------------
374 
384  : Population_Manager(L)
385 {
386  for (int i=0; i<5; i++)
387  {
388  TheArray.pop_back();
389  }
390  Init();
391 }
392 
393 //---------------------------------------------------------------------------
403 {
408  m_RefNums=0;
411  if ( cfg_RipleysOutput_used.value() ) {
413  }
414  if ( cfg_ReallyBigOutput_used.value() ) {
416  } else ReallyBigOutputPrb=0;
420  BodyBurdenPrb = fopen("HareBodyBurden.txt", "w");
421  if (!BodyBurdenPrb) {
422  g_msg->Warn(WARN_FILE, "Population_Manager::OpenBodyBurdenProbe(): ""Unable to open probe file", "HareBodyBurden.txt");
423  exit(1);
424  }
425  //-----------------------------------------------------------------------------
426  // Initialisation code for the hare population manager
427  strcpy(m_SimulationName,"Hare");
428  // Load List of Hare Classes
429  m_ListNames[0]="Infant";
430  m_ListNames[1]="Young";
431  m_ListNames[2]="Juvenile";
432  m_ListNames[3]="Male";
433  m_ListNames[4]="Female";
434  m_ListNameLength = 5;
436  // Create an instance of THare to set static members
437  THare* thare = new THare( 0, 0, m_TheLandscape, this );
438  thare->loadVegPalatability();
439  delete thare;
443  BeforeStepActions[0]=0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
444  BeforeStepActions[1]=0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
445  BeforeStepActions[2]=0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
446  BeforeStepActions[3]=0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
447  BeforeStepActions[4]=0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
448 
452  StateNames[tohs_InitialState] = "Initial State";
453  StateNames[ tohs_NextStage ] = "Next Stage";
454  StateNames[ tohs_Developing ] = "Development";
455  StateNames[ tohs_Dispersal ] = "Dispersal";
456  StateNames[ tohs_Foraging ] = "Foraging";
457  StateNames[ tohs_Resting ] = "Resting";
458  StateNames[ tohs_Running ] = "Running";
459  StateNames[ tohs_ReproBehaviour ] = "ReprodBehaviour";
460  StateNames[ tohs_Dying ] = "Dying";
461 
462  // Deal with peg global
464  // Create some hares
465  // This is only used when the simulation starts and puts a starting number of
466  // hares in the landscape at random positions
467  //
468  struct_Hare* sp;
469  sp = new struct_Hare;
470  sp->HM = this;
471  sp->L = m_TheLandscape;
472  sp->age=365;
473  sp->weight=3800/3;
474  sp->RefNum=0;
475  bool b;
476  for (int i=0; i<cfg_hare_StartingNo.value(); i++)
477  {
478  do {
479  sp->x = random(SimW);
480  sp->y = random(SimH);
482  switch (te)
483  {
484  case tole_Building:
485  case tole_Freshwater:
486  case tole_FishFarm:
487  case tole_Pond:
488  case tole_River:
489  case tole_Saltwater:
490  case tole_Coast:
491  case tole_BareRock:
492  case tole_AmenityGrass:
493  case tole_Parkland:
494  case tole_UrbanNoVeg:
495  case tole_UrbanPark:
497  case tole_SandDune:
498  case tole_Copse:
499  case tole_MetalledPath:
500  case tole_Carpark:
501  case tole_Churchyard:
502  case tole_Stream:
503  case tole_HeritageSite:
504  b=false;
505  break;
506  default:
507  b=true;
508  }
509  }
510  while (!b);
511  CreateObjects(3,NULL,NULL,sp,1); // 3 = Males
512  }
513  for (int i=0; i<cfg_hare_StartingNo.value(); i++)
514  {
515  do {
516  sp->x = random(SimW);
517  sp->y = random(SimH);
519  switch (te)
520  {
521  case tole_Building:
522  case tole_Pond:
523  case tole_Freshwater:
524  case tole_FishFarm:
525  case tole_River:
526  case tole_Saltwater:
527  case tole_Coast:
528  case tole_BareRock:
529  case tole_AmenityGrass:
530  case tole_Parkland:
531  case tole_UrbanNoVeg:
532  case tole_UrbanPark:
534  case tole_SandDune:
535  case tole_Copse:
536  case tole_MetalledPath:
537  case tole_Carpark:
538  case tole_Churchyard:
539  case tole_Stream:
540  case tole_HeritageSite:
541  b=false;
542  break;
543  default:
544  b=true;
545  }
546  }
547  while (!b);
548  CreateObjects(4,NULL,NULL,sp,1); // 4 = Females
549  }
550  delete sp;
555  double weightDM, rmr, f0, f1,f2,protcost,fatcost, totalgrowthcost;
556  ifstream* HareDataFile = new ifstream("Hare_GrowthALMaSS_Input.txt", ios::in);
557  if (!HareDataFile->is_open()) {
558  // This is an error since we are running hares - so say so.
559  m_TheLandscape->Warn("THare_Population_Manager::Init - Hare_GrowthALMaSS_Input.txt is missing or in use", "");
560  exit(1);
561  }
562  else {
563  // File format: "Age" "Ing-free dmBW (g,dm)" "Protein W-gain (g,dm)" "Fat W-gain (g,dm)"
564  // "KJcost prot" "KJ cost fat" "Energy cost (kJ) to achieve BW gain " "resting energy kJ"
565  for (int i = 0; i<5000; i++) {
566  (*HareDataFile) >> f0 >> weightDM >> f1 >> f2 >> protcost >> fatcost >> totalgrowthcost >> rmr;
567  // These arrays are little wasteful of space because many are only really used for the first 36 days, but
568  // if this is a problem it can be fixed later CJT 12-09-2006
569  m_MaxDailyGrowthEnergyP[i] = protcost; // How much energy for protein growth max at age i
570  if (protcost>0) m_GrowthEfficiencyP[i] = f1 / protcost; // KJ per g protein at age i
571  else m_GrowthEfficiencyP[i] = 0;
572  m_MaxDailyGrowthEnergyF[i] = fatcost; // How much energy for fat growth max at age i
573  if (fatcost>0) m_GrowthEfficiencyF[i] = f2 / fatcost; // KJ per g fat at age i
574  else m_GrowthEfficiencyF[i] = 0;
575  // No 366 is in fact the value for day 366 and rest of life and is about adding only fat
576  m_MaxDailyGrowthEnergy[i] = totalgrowthcost;
577  m_GrowthEfficiency[i] = (f1 + f2) / totalgrowthcost;
578  m_DMWeight[i] = weightDM*cfg_min_growth_attain.value(); // Used to test for falling behind in growth
579  }
580  HareDataFile->close();
581  }
582 
586  m_RMR[0][0]=0;
587  m_RMR[1][0]=0;
588  /* OLD CODE
589  for (int i=1; i<7001; i++) {
590  m_RMR[i]=((3.8*pow((double(i)/(0.88*0.33)),-0.27))*20.1*24)*((double(i)/(0.88*0.33))/1000.0); // KJ/day See energetics notes
591  }
592  */
593  for (int i=1; i<=37; i++) {
594  m_RMR[0][i]=(-1.5658*i + 58.487); // Slope KJ/day/degree See energetics notes
595  m_RMR[1][i]=1525.4*pow(i,-0.3997); // KJ/day See energetics notes
596  }
597 
598 
599  // Energy for walking dependent upon weight KJ per m
600  for (int i=1; i<7001; i++) {
601  //m_KJperM[i]=(9.08*pow(((double (i)/(0.88*0.33))/1000.0),0.77344))*0.001; // KJ/M for each weight
602  double fi=3.75*i/1000.0; // Corrected for dw to ww + ingesta
603  // m_KJperM[i]=(10.7*pow(fi,-0.316)*fi)/1000.0;
604  m_KJperM[i] = (10.7*pow(fi, cfg_HareWalkingPowerConst.value())*fi) / 1000.0;
605  }
606  m_KJperM[0]=0.0;
607 
608  double mean=cfg_littersize_mean1.value();
609  double SD=cfg_littersize_SD1.value();
610  CalcLitterSize(mean,SD,0);
611 
612  mean=cfg_littersize_mean2.value();
613  SD=cfg_littersize_SD2.value();
614  CalcLitterSize(mean,SD,1);
615 
616  mean=cfg_littersize_mean3.value();
617  SD=cfg_littersize_SD3.value();
618  CalcLitterSize(mean,SD,2);
619 
620  mean=cfg_littersize_mean4.value();
621  SD=cfg_littersize_SD4.value();
622  CalcLitterSize(mean,SD,3);
623 
624  mean=cfg_littersize_mean5.value();
625  SD=cfg_littersize_SD5.value();
626  CalcLitterSize(mean,SD,4);
627 
628  mean=cfg_littersize_mean6.value();
629  SD=cfg_littersize_SD6.value();
630  CalcLitterSize(mean,SD,5);
631 
632  mean=cfg_littersize_mean7.value();
633  SD=cfg_littersize_SD7.value();
634  CalcLitterSize(mean,SD,6);
635 
636  mean=cfg_littersize_mean8.value();
637  SD=cfg_littersize_SD8.value();
638  CalcLitterSize(mean,SD,7);
639 
640  mean=cfg_littersize_mean9.value();
641  SD=cfg_littersize_SD9.value();
642  CalcLitterSize(mean,SD,8);
643 
644  mean=cfg_littersize_mean10.value();
645  SD=cfg_littersize_SD10.value();
646  CalcLitterSize(mean,SD,9);
647 
648  mean=cfg_littersize_mean11.value();
649  SD=cfg_littersize_SD11.value();
650  CalcLitterSize(mean,SD,10);
651 
652  mean=cfg_littersize_mean12.value();
653  SD=cfg_littersize_SD12.value();
654  CalcLitterSize(mean,SD,11);
655 
656  for (int i=1; i<2500; i++) {
658  }
659  m_Interference[0]=1.0;
660 
664  for (int i=0; i<200; i++) {
665  for (int j=0; j<200; j++) {
666  m_DensityMap[0][i][j]=0;
667  m_DensityMap[1][i][j]=0;
668  m_DensityMap[2][i][j]=0;
669  m_DensityMap[3][i][j]=0;
670  m_DensityMap[4][i][j]=0;
671  m_DensityMap[5][i][j]=0;
672  m_DensityMap[6][i][j]=0;
673  m_DensityMap[7][i][j]=0;
674  }
675  }
676  m_PolyFood = (double*)malloc(sizeof(double)* (1+m_TheLandscape->SupplyLargestPolyNumUsed()) );
677  if ( m_PolyFood == NULL ) {
678  g_msg->Warn( WARN_FILE, "HarePopulationManager::Init: Out of memory!", "" );
679  exit( 1 );
680  }
684  FILE* fp;
685  fp=fopen("LitterProduction.txt","w");
686  fclose(fp);
687  fp=fopen("EnergyCheck.txt","w");
688  fclose(fp);
689  fp=fopen("POM_Hare.txt","w");
690  fprintf(fp,"1) Timestep,\n");
691  fprintf(fp,"2-6) Population Size of add stages,\n");
692  fprintf(fp,"7) Females < 365 days old,\n");
693  fprintf(fp,"8) Females >=1 & < 2 yrs old,\n");
694  fprintf(fp,"9) Females >=2 & < 3 yrs old,\n");
695  fprintf(fp,"10) Females >=3 & < 4 yrs old,\n");
696  fprintf(fp,"11) Females >=4 & < 5 yrs old,\n");
697  fprintf(fp,"12) Females >=4 yrs old,\n");
698  fprintf(fp,"13) Mean bodyweight of females (dw),\n");
699  fprintf(fp,"14) variance in bodyweight,\n");
700  fclose(fp);
701  fp=fopen("POM_FemaleHareWeights.txt","w");
702  fclose(fp);
703  // Mortality variables
704  m_variableDD=10;
705  // MRR
706  m_OurMRRData = new MRR_Data;
707 }
708 //---------------------------------------------------------------------------
709 void THare_Population_Manager::CalcLitterSize(double mean, double SD, int index)
710 {
714  double P;
715  double Distribution[7];
716  double total=0;
717  // Max 6 leverets
718  if (mean<=0) {
719  for (int i=0; i<7; i++) {
720  m_LitterSize[index][i]=10000;
721  }
722  } else {
723  // (from Zar page 79).
724  for (int i=0; i<7; i++) {
725  P=(1.0/SD*sqrt(2*3.14159265) );
726  P*=exp(-1*(((i-mean)*(i-mean))/(2*SD*SD)));
727  Distribution[i]=P;
728  total+=P;
729  }
730  int last=0;
731  for (int i=0; i<7; i++) {
732  m_LitterSize[index][i]=(int)(floor(0.5+((Distribution[i]/total)*10000)+last));
733  last=m_LitterSize[index][i];
734  }
735  }
736 }
737 //---------------------------------------------------------------------------
745 {
746  int testing=int(g_rand_uni()*10000);
747  for (int i=0; i<7; i++) {
748  if (testing<=m_LitterSize[litter][i]) return i;
749  }
750  // something wrong if the program gets to here
751  m_TheLandscape->Warn("THare_Population_Manager::GetLitterSize - litter size error",NULL);
752  exit(1);
753 }
754 //---------------------------------------------------------------------------
755 
764 {
766 
767 // Do our special end of time step actions here
768  // Clear the old data
769  for (int i=0; i<100; i++) {
770  for (int j=0; j<100; j++) {
771  m_DensityMap[0][i][j]=0;
772  m_DensityMap[1][i][j]=0;
773  m_DensityMap[2][i][j]=0;
774  m_DensityMap[3][i][j]=0;
775  m_DensityMap[4][i][j]=0;
776  m_DensityMap[5][i][j]=0;
777  }
778  }
779 
780  //Special hare debugging test
781  //if (m_TheLandscape->SupplyDayInMonth()==1) {
782  /*
783  if (TheArray[hob_Female].size()>0) {
784  Hare_Female* HF;
785  HF = dynamic_cast<Hare_Female*>(TheArray[hob_Female][0]);
786  HF->dumpEnergy();
787  }
788  */
789  /*
790  FILE* hareweights=fopen(hareweights,"HareWeights.txt","a");
791  for (unsigned listindex=0; listindex<5; listindex++)
792  {
793  unsigned size=TheArray[listindex].size();
794  if (size>0) {
795  for (unsigned j=0; j<size; j++)
796  {
797  int age=dynamic_cast < THare * > ( TheArray[listindex][j] )->GetAge();
798  double w=dynamic_cast < THare * > ( TheArray[listindex][j] )->GetWeight();
799  int weight=int (floor(0.5+w));
800  fprintf(hareweights,"%i\t%i\n",age, weight);
801  }
802  }
803  }
804  fclose(hareweights);
805  // End special
806 */
807  MRROutputs();
808 }
809 //---------------------------------------------------------------------------
810 
818 {
819 #ifdef __EXTRAPOPMORT
820  ExtraPopMort();
821 #endif
822  if (m_TheLandscape->SupplyDayInYear()==1) {
823 
824 #ifdef __VARIABLEDD
825  m_variableDD=random(21);
826 #endif
827 #ifdef __YEARLYVARIABLEFOODQUALITY
828  m_GoodYearBadYear = (float) (1.0 + float(random(40)-20)/100.0);
829 #endif
830 #ifdef __MORTSTOCHASTICITY
831  double MortStochasticity = ((random(200)/100.0)-1.0)* m_MortStochast; // -1.0 to +1.0 * m_MortStochast
832  m_YoungMortRate = cfg_hare_young_predation.value() + (cfg_hare_young_predation.value()*(MortStochasticity)); //
833  m_JuvMortRate = cfg_hare_juvenile_predation.value()+ (cfg_hare_juvenile_predation.value()*(MortStochasticity)); //
834  m_AdultMortRate = cfg_hare_adult_predation.value()+ (cfg_hare_adult_predation.value()*(MortStochasticity)); //
835 #else
839 #endif
840  }
841  //else if (m_TheLandscape->SupplyDayInYear()==(cfg_HareHuntingDate.value()-1)) {
842  AnimalPosition HP;
843  for (unsigned listindex=0; listindex<2;listindex++) {
844  unsigned size = GetLiveArraySize(listindex);
845  for (unsigned j=0; j<size; j++)
846  {
847 
848  HP=TheArray[listindex][j]->SupplyPosition();
849  AddHareDensity(HP.m_x, HP.m_y, (Hare_Object) listindex);
850  }
851  }
852  for (unsigned listindex=2; listindex<TheArray.size();listindex++) {
853  unsigned size= GetLiveArraySize(listindex);
854  for (unsigned j=0; j<size; j++)
855  {
856  HP=TheArray[listindex][j]->SupplyPosition();
857  int x=HP.m_x>>__DENSITYSHIFT;
858  int y=HP.m_y>>__DENSITYSHIFT;
859  m_DensityMap[listindex][x][y]++;
860  m_DensityMap[5][x][y]++;
861  m_DensityMap[7][x][y]++;
862  }
863  }
865  for (int i=0; i<100; i++) {
866  for (int j=0; j<100; j++) {
867  m_DensityMap[6][i][j]=m_DensityMap[7][i][j]/365;
868  m_DensityMap[7][i][j]=0;
869  }
870  }
871  }
872 
873  if (m_TheLandscape->SupplyDayInYear() == (270))
874  {
875  POMOutputs();
876 #ifdef __STERILITY
877  unsigned size = GetLiveArraySize(hob_Female);
878  for (unsigned j = 0; j<size; j++) {
879  Hare_Female* HF;
880  HF = dynamic_cast<Hare_Female*>(TheArray[hob_Female][j]);
881  if (HF->GetAge() < 730) {
882  int test = int(g_rand_uni() * 10000);
883  if (HF->GetAge() < 730) {
884  if (test<cfg_hare_firstyearsterility.value()) HF->SetSterile();
885  }
886  else {
887  if (test<cfg_hare_femalesterility.value()) HF->SetSterile();
888  }
889  }
890  }
891 #endif
892  }
893 
894  // Now do clear the forage food array
895  for (int i=0; i<=m_TheLandscape->SupplyLargestPolyNumUsed(); i++) {
896  m_PolyFood [i]=-1;
897  }
898 }
899 //---------------------------------------------------------------------------
900 
908 {
910  {
911  if (cfg_HareHuntingType.value()==1) HuntingGrid();
913  else Hunting();
914  }
915 }
916 //---------------------------------------------------------------------------
917 
918 
929  TAnimal* pvo, void* /* null */, struct_Hare * data, int number)
930 {
931  Hare_Infant* new_Infant;
932  Hare_Young* new_Young;
933  Hare_Juvenile* new_Juvenile;
934  Hare_Female* new_Female;
935  Hare_Female* Mum;
936  Hare_Male* new_Male;
937  for (int i = 0; i < number; i++)
938  {
939  if (unsigned(TheArray[ob_type].size()) > GetLiveArraySize(ob_type)) {
940  // We need to reuse an object
941  if (ob_type == 0) // Infant
942  {
943  new_Infant = dynamic_cast<Hare_Infant*>(TheArray[ob_type][GetLiveArraySize(ob_type)]);
944  new_Infant->ReInit((*data));
945  Mum = dynamic_cast<Hare_Female*>(pvo);
946  if (Mum) new_Infant->SetMum(Mum);
947  new_Infant->SetWeight(data->weight);
948  if (Mum) Mum->AddYoung(new_Infant);
949  }
950  if (ob_type == 1) // Young
951  {
952  new_Young = dynamic_cast<Hare_Young*>(TheArray[ob_type][GetLiveArraySize(ob_type)]);
953  new_Young->ReInit((*data));
954  new_Young->SetMum(data->Mum); // NB Mum may be NULL - this is OK
955  THare* old_Young = (THare*)pvo;
956  if (data->Mum) {
957  data->Mum->UpdateYoung(old_Young, new_Young);
958  }
959  }
960  if (ob_type == 2) // Juvenile
961  {
962  new_Juvenile = dynamic_cast<Hare_Juvenile*>(TheArray[ob_type][GetLiveArraySize(ob_type)]);
963  new_Juvenile->ReInit((*data));
964  new_Juvenile->SetMum(NULL);
965  }
966  if (ob_type == 3) // Male
967  {
968  new_Male = dynamic_cast<Hare_Male*>(TheArray[ob_type][GetLiveArraySize(ob_type)]);
969  new_Male->ReInit((*data));
970  }
971  if (ob_type == 4) // Female
972  {
973  new_Female = dynamic_cast<Hare_Female*>(TheArray[ob_type][GetLiveArraySize(ob_type)]);
974  new_Female->ReInit((*data));
975  }
976  }
977  else {
978 
979  if (ob_type == 0) // Infant
980  {
981  new_Infant = new Hare_Infant(data->x, data->y, data->L, data->HM);
982  TheArray[ob_type].push_back(new_Infant);
983  Mum = dynamic_cast<Hare_Female*>(pvo);
984  if (Mum) new_Infant->SetMum(Mum);
985  new_Infant->SetWeight(data->weight);
986  if (Mum) Mum->AddYoung(new_Infant);
987  }
988  if (ob_type == 1) // Young
989  {
990  new_Young = new Hare_Young(data->x, data->y, data->L, data->HM,
991  data->weight);
992  new_Young->SetMum(data->Mum); // NB Mum may be NULL - this is OK
993  // *** DeBug ***
994  //new_Young->m_MyOldMum=data->oldMum;
995  THare* old_Young = (THare*)pvo;
996  if (data->Mum) {
997  data->Mum->UpdateYoung(old_Young, new_Young);
998  }
999  TheArray[ob_type].push_back(new_Young);
1000  }
1001  if (ob_type == 2) // Juvenile
1002  {
1003  new_Juvenile = new Hare_Juvenile(data->x, data->y, data->L,
1004  data->HM, data->weight);
1005  new_Juvenile->SetMum(NULL);
1006  // *** DeBug ***
1007  //new_Juvenile->m_MyOldMum=data->oldMum;
1008 
1009  TheArray[ob_type].push_back(new_Juvenile);
1010  }
1011  if (ob_type == 3) // Male
1012  {
1013  new_Male = new Hare_Male(data->x, data->y, data->L, data->HM,
1014  data->weight, data->age, data->RefNum);
1015  TheArray[ob_type].push_back(new_Male);
1016  }
1017  if (ob_type == 4) // Female
1018  {
1019  new_Female = new Hare_Female(data->x, data->y, data->L, data->HM,
1020  data->weight, data->age, data->RefNum);
1021  TheArray[ob_type].push_back(new_Female);
1022  }
1023  }
1024  IncLiveArraySize(ob_type);
1025  }
1026 }
1027 
1028 //---------------------------------------------------------------------------
1029 
1034 double THare_Population_Manager::GetRMR(int a_age, double a_size) {
1035  double a_temp = m_TheLandscape->SupplyTemp();
1036  if (a_temp>20.0) a_temp=20.0;
1037  double tempdiff=18.0-a_temp;// 18 is used because this was the value where Hacklander
1038  //started his expts - 20 is assumed thermoneutral point and
1039  // a linear relationship between these two
1040  // Adjust for rainfall - assume that if we have a rainfall of >5mm then the temp diff is maximum - removing this might help add variation to juvenile survivorship!
1041  double rainfall = m_TheLandscape->SupplyRain();
1042  if (rainfall>5.0) rainfall=5.0;
1043  tempdiff*=1.0+(rainfall*g_RMRrainFactor);
1044  //tempdiff*=1.0+((rainfall*rainfall*rainfall*g_RMRrainFactor)/25); // Gives a curve sloping up
1045 
1046 #ifdef __BOUNDSCHECK
1047  if (a_age<0) {
1048  m_TheLandscape->Warn( "Hare GetRMR a_age range out of bounds", NULL );
1049  exit( 1 );
1050  }
1051 #endif
1052  a_size/=1000.0;
1053  double RMR;
1054  if (a_age<37) {
1055  RMR=((tempdiff*m_RMR[0][a_age])+m_RMR[1][a_age])*(a_size);
1056  } else
1057  {
1058  a_age=36;
1059  RMR=(69.1*4.1868)*pow(a_size,0.808);
1060  RMR=RMR+(tempdiff*m_RMR[0][a_age]*a_size);
1061  }
1062  return RMR;
1063 }
1064 //---------------------------------------------------------------------------
1065 
1074  //
1075  // Outputs are:
1076  // 1) Timestep
1077  // 2-6) Population Size of add stages
1078  // 7) Females < 2 yrs old
1079  // 8) Females >=2 & < 3 yrs old
1080  // 9) Females >=3 & < 4 yrs old
1081  // 10) Females >=4 & < 5 yrs old
1082  // 11) Females >=5 yrs old
1083  // 12) Mean bodyweight of females (dw)
1084  // 13) variance in bodyweight
1085  // 14) Mean yearlings
1086  // 14) Var yearlings
1087  // 16) m_shot
1088 
1089  int age0 = 0;
1090  int age1 = 0;
1091  int age2 = 0;
1092  int age3 = 0;
1093  int age4 = 0;
1094  int age5 = 0;
1095  int age6 = 0;
1096  int age7 = 0;
1097  double totweight = 0.0;
1098  double totweight2 = 0.0;
1099  double yearlingstotweight = 0.0;
1100  double yearlingstotweight2 = 0.0;
1101  FILE* POMOut = fopen("POM_Hare.txt", "a");
1102  FILE* POMOut2 = fopen("POM_FemaleHareWeights.txt", "a");
1103  if (!POMOut) {
1104  // something wrong if the program gets to here
1105  m_TheLandscape->Warn("THare_Population_Manager::POMOutputs - POM_Output.txt can't be opened", NULL);
1106  exit(1);
1107  }
1108  // Now sort out the data for the females
1109  int yearlingssize = 0;
1110  unsigned size = GetLiveArraySize(hob_Juvenile);
1111  for (unsigned j = 0; j<size; j += 2) { // Every other one, so assume 50% males
1112  Hare_Juvenile* HJ;
1113  HJ = dynamic_cast<Hare_Juvenile*>(TheArray[hob_Juvenile][j]);
1114  double bw = HJ->GetTotalWeight();
1115  if (bw>1000) {
1116  yearlingstotweight += bw; // This removes hares that are still almost leverets
1117  yearlingstotweight2 += (bw*bw);
1118  yearlingssize++;
1119  fprintf(POMOut2, "0\t%g\n", (float)bw);
1120  }
1121  }
1122  size = GetLiveArraySize(hob_Female);
1123  for (unsigned j = 0; j < size; j++) {
1124  Hare_Female* HF;
1125  HF = dynamic_cast<Hare_Female*>(TheArray[hob_Female][j]);
1126  double bw = HF->GetTotalWeight();
1127  if (HF->GetAge() < 365) {
1128  age0++;
1129  if (bw>333) {
1130  yearlingstotweight += bw; // This removes hares that are still almost leverets
1131  yearlingstotweight2 += (bw*bw);
1132  yearlingssize++;
1133  }
1134  fprintf(POMOut2, "0\t%g\n", (float)bw);
1135  }
1136  else {
1137  totweight += bw;
1138  totweight2 += (bw*bw);
1139  if (HF->GetAge() < 730) {
1140  age1++;
1141  fprintf(POMOut2, "1\t%g\n", (float)bw);
1142  }
1143  else if (HF->GetAge() < 1095) {
1144  age2++;
1145  fprintf(POMOut2, "2\t%g\n", (float)bw);
1146  }
1147  else if (HF->GetAge() < 1460) {
1148  age3++;
1149  fprintf(POMOut2, "3\t%g\n", (float)bw);
1150  }
1151  else if (HF->GetAge() < 1825) {
1152  age4++;
1153  fprintf(POMOut2, "4\t%g\n", (float)bw);
1154  }
1155  else if (HF->GetAge() < 2190) {
1156  age5++;
1157  fprintf(POMOut2, "5\t%g\n", (float)bw);
1158  }
1159  else if (HF->GetAge() < 2555) {
1160  age6++;
1161  fprintf(POMOut2, "6\t%g\n", (float)bw);
1162  }
1163  else {
1164  age7++;
1165  fprintf(POMOut2, "7\t%g\n", (float)bw);
1166  }
1167  }
1168  // Do the bodyweight stuff
1169  }
1170  double yearlingsvar = (yearlingstotweight2 - ((yearlingstotweight*yearlingstotweight) / double(yearlingssize))) / double(yearlingssize);
1171  double yearlingsmean = yearlingstotweight / double(yearlingssize);
1172  double var = (totweight2 - ((totweight*totweight) / double(size))) / double(size);
1173  double mean = totweight / double(size);
1174  float meanf = (float)mean;
1175  float varf = (float)var;
1176  float meany = (float)yearlingsmean;
1177  float vary = (float)yearlingsvar;
1178  /*
1179  // Lets test the density grid
1180  int den = 0;
1181  for (int i = 0; i < 200; i++)
1182  for (int j = 0; j < 200; j++)
1183  {
1184  for (int l = 0; l < hob_Foobar; l++)
1185  den += m_DensityMap[l][i][j];
1186  }
1187  */
1188  fprintf(POMOut, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%g\t%g\t%g\t%g\t%d\n", (int)m_TheLandscape->SupplyDayInYear(), GetLiveArraySize(hob_Infant), GetLiveArraySize(hob_Young), GetLiveArraySize(hob_Juvenile), GetLiveArraySize(hob_Male), GetLiveArraySize(hob_Female), age0, age1, age2, age3, age4, age5, age6, age7, meanf, varf, meany, vary, m_shot);
1189  fclose(POMOut);
1190  fclose(POMOut2);
1191 }
1192 
1193 //---------------------------------------------------------------------------
1194 
1199  // Currently just counts females
1200  Hare_Female* FH;
1201  unsigned totalF= GetLiveArraySize(hob_Female);
1202  int x,y;
1205  fprintf(a_prb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
1206  for (unsigned j=0; j<totalF; j++) //adult females
1207  {
1208  FH=dynamic_cast<Hare_Female*>(TheArray[hob_Female][j]);
1209  x=FH->Supply_m_Location_x();
1210  y=FH->Supply_m_Location_y();
1211  fprintf(a_prb,"%d\t%d\n", x,y);
1212  }
1213  fflush(a_prb);
1214 }
1215 //-----------------------------------------------------------------------------
1216 
1218  m_AOR_Probe->DoProbe(hob_Female);
1219 }
1220 //-----------------------------------------------------------------------------
1221 
1233  //
1234  // Step one - do we count today?
1236  int day=m_TheLandscape->SupplyDayInYear();
1237  if ((day!=cfg_MRR1.value()) && (day!=cfg_MRR2.value()) && (day!=cfg_MRR3.value()) && (day!=cfg_MRR4.value()) && (day!=cfg_MRR5.value())) return;
1238  // We want to count today
1239  // Loop through all Juvenile and Adult hares and put their details in the MRR data array
1240  unsigned size = GetLiveArraySize(hob_Juvenile);
1241  for (unsigned j=0; j<size; j++) { // Every other one, so assume 50% males
1242  Hare_Juvenile* HJ;
1243  HJ = dynamic_cast<Hare_Juvenile*>(TheArray[hob_Juvenile][j]);
1245  }
1246  size = GetLiveArraySize(hob_Female);
1247  for (unsigned j=0; j<size; j++) {
1248  Hare_Female* HF;
1249  HF = dynamic_cast<Hare_Female*>(TheArray[hob_Female][j]);
1251  }
1252  size= GetLiveArraySize(hob_Male);
1253  for (unsigned j=0; j<size; j++) {
1254  Hare_Male* HM;
1255  HM = dynamic_cast<Hare_Male*>(TheArray[hob_Male][j]);
1257  }
1258 
1259  // If we need to dump the results this time do this
1260  if ((day==cfg_MRR5.value() && (m_TheLandscape->SupplyYearNumber()==cfg_MRR_LastYear.value()))) m_OurMRRData->OutputToFile();
1262 }
1263 //---------------------------------------------------------------------------
1264 
1265 
1266 //---------------------------------------------------------------------------
1267 // Hare_Infant CODE
1268 //---------------------------------------------------------------------------
1269 
1270 Hare_Infant::Hare_Infant(int p_x, int p_y,
1271  Landscape * p_L, THare_Population_Manager* p_PPM)
1272  : THare(p_x,p_y,p_L,p_PPM)
1273 {
1274  Init();
1275 }
1277 {
1278  m_Location_x = a_data.x;
1279  m_Location_y = a_data.y;
1280  m_OurLandscape = a_data.L;
1281  m_CurrentStateNo = 0;
1282  THareInit(a_data.x, a_data.y, a_data.HM);
1283  Init();
1284 }
1286 {
1287  m_Type = hob_Infant;
1288  m_weight = -1; // just so we know we must set this somewhere else
1289  m_old_weight = 0;
1290  m_Age = 1; // We are 0 day old today
1291 }
1292 //---------------------------------------------------------------------------
1293 
1294 
1296 {
1297  //Nothing to do
1298 }
1299 //---------------------------------------------------------------------------
1309 {
1310  if (m_CurrentStateNo == -1) return;
1311  // These are all the same value - this may change to so I have kept all three
1312  // for now ver 00005
1316  m_ActivityTime=1440; // Start the day
1318 #ifdef __DDEPMORT
1320 #ifdef __THRESHOLD_DD
1321  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
1322 #endif
1323  double inter=m_OurPopulationManager->GetInterference(dens);
1324  if (g_rand_uni() > inter) {
1325  ON_Dead();
1326  m_StepDone=true; // We need to skip the step code, we are dead
1327  return;
1328  }
1329 #endif
1331  ON_Dead();
1332  m_StepDone=true; // We need to skip the step code, we are dead
1333  }
1334 
1335  if (m_MyMum==NULL) {
1336  ON_Dead();
1337  m_StepDone=true; // We need to skip the step code, we are dead
1338  }
1339  // Set out maximum intake possible
1340  CheckManagement();
1341 }
1342 //---------------------------------------------------------------------------
1356 {
1357  if (m_StepDone || m_CurrentStateNo == -1) return;
1358  // The next line causes a jump to the correct behavioural state
1359  switch (m_CurrentHState)
1360  {
1361  case tohs_InitialState: // Initial state
1363  break;
1364  case tohs_Developing:
1365  m_StepDone=true;
1366  break;
1367  case tohs_NextStage:
1368  // Legal returns are:
1369  // NONE
1370  st_NextStage();
1371  m_StepDone=true;
1372  break;
1373  case tohs_Running:
1375  break;
1376  case tohs_Dying:
1377  m_StepDone=true;
1378  break;
1379  default:
1380  m_OurLandscape->Warn("Hare_Infant::Step - unknown state",NULL);
1381  exit(1);
1382  }
1383 }
1384 //---------------------------------------------------------------------------
1385 
1391 {
1393  // Legal returns are:
1394  // tohs_Developing
1395  // tohs_NextStage
1396  // tohs_Dying
1398  }
1399  if (m_CurrentHState==tohs_Dying) {
1400  ON_Dead();
1401  } else MovePeg();
1402 }
1403 //---------------------------------------------------------------------------
1409 {
1410  bool result=false;
1411  switch ( event )
1412  {
1413  case sleep_all_day:
1414  case glyphosate:
1415  break;
1416  case autumn_plough:
1417  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1418  break;
1419  case stubble_plough:
1420  if (random(100) < cfg_hare_i_cut.value()) result = true;
1421  break;
1423  if (random(100) < cfg_hare_i_cut.value()) result = true;
1424  break;
1426  if (random(100) < cfg_hare_i_cut.value()) result = true;
1427  break;
1428  case autumn_harrow:
1429  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1430  break;
1431  case preseeding_cultivator:
1432  if (random(100) < cfg_hare_i_cut.value()) result = true;
1433  break;
1435  if (random(100) < cfg_hare_i_cut.value()) result = true;
1436  break;
1437  case autumn_roll:
1438  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1439  break;
1440  case autumn_sow:
1441  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1442  break;
1443  case winter_plough:
1444  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1445  break;
1446  case deep_ploughing:
1447  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1448  break;
1449  case spring_plough:
1450  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1451  break;
1452  case spring_harrow:
1453  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1454  break;
1455  case shallow_harrow:
1456  if (random(100) < cfg_hare_i_cut.value()) result = true;
1457  break;
1458  case spring_roll:
1459  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1460  break;
1461  case spring_sow:
1462  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1463  break;
1464  case spring_sow_with_ferti:
1465  if (random(100) < cfg_hare_i_cut.value()) result = true;
1466  break;
1467  case fp_npks:
1468  break;
1469  case fp_npk:
1470  break;
1471  case fp_pk:
1472  break;
1473  case fp_liquidNH3:
1474  break;
1475  case fp_slurry:
1476  break;
1477  case fp_ammoniumsulphate:
1478  break;
1479  case fp_manganesesulphate:
1480  break;
1481  case fp_manure:
1482  break;
1483  case fp_greenmanure:
1484  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1485  break;
1486  case fp_sludge:
1487  break;
1488  case fp_rsm:
1489  break;
1490  case fp_calcium:
1491  break;
1492  case fa_npks:
1493  break;
1494  case fa_npk:
1495  break;
1496  case fa_pk:
1497  break;
1498  case fa_slurry:
1499  break;
1500  case fa_ammoniumsulphate:
1501  break;
1502  case fa_manganesesulphate:
1503  break;
1504  case fa_manure:
1505  break;
1506  case fa_greenmanure:
1507  break;
1508  case fa_sludge:
1509  break;
1510  case fa_rsm:
1511  break;
1512  case fa_calcium:
1513  break;
1514  case herbicide_treat:
1515  break;
1516  case growth_regulator:
1517  break;
1518  case fungicide_treat:
1519  break;
1521  case trial_toxiccontrol:
1522  case trial_control:
1523  case syninsecticide_treat:
1524  case insecticide_treat:
1525  case product_treat:
1526  case biocide:
1527  break;
1528  case molluscicide:
1529  break;
1530  case row_cultivation:
1531  break;
1532  case strigling:
1533  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1534  break;
1535  case strigling_hill:
1536  if (random(100) < cfg_hare_i_cut.value()) result = true;
1537  break;
1538  case hilling_up:
1539  break;
1540  case water:
1541  break;
1542  case swathing:
1543  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1544  break;
1545  case harvest:
1546  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1547  break;
1548  case cattle_out:
1549  break;
1550  case cattle_out_low:
1551  break;
1552  case cut_to_hay:
1553  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1554  break;
1555  case cut_to_silage:
1556  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1557  break;
1558  case straw_chopping:
1559  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1560  break;
1561  case hay_turning:
1562  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1563  break;
1564  case hay_bailing:
1565  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1566  break;
1567 
1568  case stubble_harrowing:
1569  break;
1571  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1572  break;
1573  case burn_straw_stubble:
1574  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1575  break;
1576  case mow:
1577  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1578  break;
1579  case cut_weeds:
1580  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1581  break;
1582  case pigs_out:
1583  result=true;
1584  break;
1585  case strigling_sow:
1586  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1587  break;
1588  case bed_forming:
1589  if (random(100) < cfg_hare_i_cut.value()) result = true;
1590  break;
1591  case flower_cutting:
1592  if (random(100) < cfg_hare_i_cut.value()) result = true;
1593  break;
1594  case bulb_harvest:
1595  if (random(100) < cfg_hare_i_cut.value()) result = true;
1596  break;
1597  case straw_covering:
1598  break;
1599  case straw_removal:
1600  break;
1601  default:
1602  m_OurLandscape->Warn( "Hare_Infant::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
1603  exit( 1 );
1604  }
1605  if (result) {
1606  ON_Dead();
1607  }
1608  return result;
1609 }
1610 //---------------------------------------------------------------------------
1616 {
1622  //int weight=(int) (floor(m_weight+0.5));
1623  double lost = m_OurPopulationManager->GetRMR(m_Age,GetTotalWeight()); // Uses age, weight and ambient temperature
1625  //** Then grow if possible, or shrink if -ve energy
1626  double gained=(m_TodaysEnergy-lost);
1628  m_weight+=gained*eff;
1629 
1630  // We need to know whether the growth rate is positive or negative.
1631  // We could look at lost here, but it is probably easier to use the same
1632  // approach for Young as well, and they need the oldweight variable, so might as well use this.
1633 #ifdef __MINGROWTHATTAIN
1634  // Take a check on our growth - if we are below X% of the max expected weight then die
1635  if (m_weight< m_OurPopulationManager->m_DMWeight[m_Age]) return tohs_Dying;
1636 #else
1637  if (m_weight<m_old_weight) {
1638  m_StarvationDays++;
1639  }
1640  else m_StarvationDays=0;
1645  return tohs_Dying;
1646  }
1647 #endif
1648 
1650  m_TodaysEnergy=0;
1652  if (++m_Age>10) return tohs_NextStage;
1653  return tohs_Developing;
1654 }
1655 //---------------------------------------------------------------------------
1660 {
1664  struct_Hare* sp;
1665  sp = new struct_Hare;
1666  sp->HM = m_OurPopulationManager;
1667  sp->L = m_OurLandscape;
1668  sp->x = m_Location_x;
1669  sp->y = m_Location_y;
1670  sp->weight = m_weight;
1671  sp->age = m_Age;
1672  // Updating of Mum is done through the population manager
1673  sp->Mum = m_MyMum;
1674  // *** Debug ***
1675  //sp->oldMum = m_MyOldMum;
1676  //
1677  m_OurPopulationManager->CreateObjects(1,this,NULL,sp,1);
1678  // Clean-up
1679  m_CurrentStateNo=-1; // Destroys the object at the next opportunity
1681  m_MyMum=NULL;
1682  delete sp;
1683 }
1684 //---------------------------------------------------------------------------
1689 {
1690  st_Dying();
1691 }
1692 //---------------------------------------------------------------------------
1693 
1698 void Hare_Infant::ON_BeingFed(double a_someMilk)
1699 {
1704  m_TodaysEnergy+=a_someMilk;
1705 }
1706 //---------------------------------------------------------------------------
1707 
1708 //---------------------------------------------------------------------------
1709 // Hare_Young CODE
1710 //---------------------------------------------------------------------------
1711 
1716 Hare_Young::Hare_Young(int p_x, int p_y,
1717  Landscape * p_L, THare_Population_Manager* p_PPM, double p_weight)
1718  : Hare_Infant(p_x,p_y,p_L,p_PPM)
1719 {
1720  Init(p_weight);
1721 }
1723 {
1724  m_Location_x = a_data.x;
1725  m_Location_y = a_data.y;
1726  m_OurLandscape = a_data.L;
1727  m_CurrentStateNo = 0;
1728  THareInit(a_data.x, a_data.y, a_data.HM);
1729  Init(a_data.weight);
1730 }
1731 //---------------------------------------------------------------------------
1732 
1733 void Hare_Young::Init(double p_weight)
1734 {
1735  m_Type = hob_Young;
1736  m_weight = p_weight;
1737  m_Age = 11; // By definition we are 11 days old today
1738 }
1739 
1745 {
1746  //Nothing to do
1747 }
1748 //---------------------------------------------------------------------------
1749 
1755 {
1756  if (m_CurrentStateNo == -1) return;
1758  // These are all the same value - this may change to so I have kept all three
1759  // for now ver 00005
1767  m_ActivityTime=1440; // Start the day
1768 #ifdef __DDEPMORT
1770 #ifdef __THRESHOLD_DD
1771  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
1773 #endif
1774  double inter=m_OurPopulationManager->GetInterference(dens);
1775  if (g_rand_uni() > inter) {
1776  ON_Dead();
1777  m_StepDone=true; // We need to skip the step code, we are dead
1778  return;
1779  }
1780 #endif
1782  ON_Dead();
1783  m_StepDone=true; // We need to skip the step code, we are dead
1784  return;
1785  }
1786  // Set the maximum possible energy intake
1788  // Move the hares about if they get scared by a random proximity event
1789  if (g_rand_uni()<cfg_hare_proximity_alert.value()) {
1790  Running(cfg_hare_escape_dist.value());
1791  }
1792  CheckManagement();
1793 
1794 }
1795 //---------------------------------------------------------------------------
1796 
1802 {
1803  if (m_StepDone || m_CurrentStateNo == -1) return;
1804  switch (m_CurrentHState)
1805  {
1806  case tohs_InitialState: // Initial state
1808  break;
1809  case tohs_Dispersal:
1810  // Legal returns are:
1811  // tohs_YResting
1812  // tohs_YForaging
1814  break;
1815  case tohs_Foraging:
1816  // Legal returns are:
1817  // tohs_YResting
1819  break;
1820  case tohs_Resting:
1821  // Legal returns are:
1822  // tohs_YDeveloping
1824  break;
1825  case tohs_Developing:
1826  m_StepDone=true;
1827  break;
1828  case tohs_NextStage:
1829  // Legal returns are:
1830  // NONE
1831  st_NextStage();
1832  m_StepDone=true;
1833  break;
1834  case tohs_Dying:
1835  m_StepDone=true;
1836  break;
1837  default:
1838  m_OurLandscape->Warn("Hare_Young::Step - unknown state",NULL);
1839  exit(1);
1840  }
1841 }
1842 //---------------------------------------------------------------------------
1852 {
1855  // Legal returns are:
1856  // tohs_Developing
1857  // tohs_NextStage
1858  // tohs_Dying
1860  }
1861  if (m_CurrentHState==tohs_Dying) {
1862  ON_Dead();
1863  } else MovePeg();
1864 }
1865 //---------------------------------------------------------------------------
1866 
1877 {
1878 
1879  double time=m_ActivityTime;
1881  // We need to rest if there is no more time
1882  if (time < 30) return tohs_Resting;
1883  //time+=m_TimePerForageSquare;
1884  // time now has the time to use foraging
1885  // Given the time we have then we need to feed, which will return an energy
1886  // Value obtained.
1887  // m_TodaysEnergy is zero on entry, except in the case where the young were
1888  // created today. So we can't use m_TodaysEnergy directly
1889  int a_time = (int) time;
1890  double ForageEnergy;
1891  if (cfg_hare_pesticideresponse_on.value())
1892  {
1893  ForageEnergy = ForageP(a_time);
1894  }
1895  else
1896  {
1897  ForageEnergy = Forage(a_time);
1898  }
1899  // We need to spend energy on foraging and associated movement
1900  //
1901  TimeBudget(activity_Foraging, (int)time-a_time);
1902  //
1904  // If we got too much then cap it
1905  if (ForageEnergy>Target) ForageEnergy=Target;
1906 #ifdef __NOSTARVE
1907  ForageEnergy=Target;
1908 #endif
1909  m_TodaysEnergy+=ForageEnergy;// pre-calculated in the ForageEnergy // *cfg_solidAsbsorption.value();
1910  return tohs_Resting;
1911 }
1912 //---------------------------------------------------------------------------
1917 {
1918  // This behavioural state is not used at present
1919  return tohs_Foraging;
1920 }
1921 //---------------------------------------------------------------------------
1922 
1927 {
1928  // TODO Need to find a position - use some energy walking too?
1929  EnergyBalance(activity_Resting, 0); // Just removes a days BMR
1931  return tohs_Developing;
1932 }
1933 //---------------------------------------------------------------------------
1939 {
1940  // This code must be called by the EndStep
1941  // NB foraged food and milk are in the same energetic currency
1943  if (m_TodaysEnergy>me) m_TodaysEnergy=me;
1945  m_weight+=growth;
1946  // We need to know whether the growth rate is positive or negative
1947 //#ifndef __MINGROWTHATTAIN
1950  return tohs_Dying;
1951  }
1952 //#endif
1953  // Make sure m_TodaysEnergy is zero;
1954  m_TodaysEnergy=0;
1955  if (++m_Age>34) {
1956  return tohs_NextStage;
1957  }
1958 #ifdef __MINGROWTHATTAIN
1959  // Take a check on our growth - if we are below 90% of the min repro weight, assume we died
1960  //if (m_weight < (cfg_hare_minimum_breeding_weight.value()*cfg_min_growth_attain.value())) return tohs_Dying;
1961  if (m_weight< m_OurPopulationManager->m_DMWeight[m_Age]) return tohs_Dying;
1962 #endif
1963  return tohs_Foraging;
1964 }
1965 //---------------------------------------------------------------------------
1971 {
1976  struct_Hare* sp;
1977  sp = new struct_Hare;
1978  sp->HM = m_OurPopulationManager;
1979  sp->L = m_OurLandscape;
1980  sp->x = m_Location_x;
1981  sp->y = m_Location_y;
1982  sp->weight = m_weight;
1983  // Mum no longer cares about the young, it is too old
1984  // Removal of the young from Mum's list
1985  if (m_MyMum!=NULL) m_MyMum->ON_RemoveYoung(this);
1986  // If m_MyMum is NULL then it means that she deserted the young but they survived anyway
1987  m_MyMum=NULL;
1988  m_OurPopulationManager->CreateObjects(2,this,NULL,sp,1);
1989  // Clean-up
1990  m_CurrentStateNo=-1; // Destroys the object at the next opportunity
1992  delete sp;
1993 }
1994 //---------------------------------------------------------------------------
2000 {
2001  bool result = false;
2002  switch (event)
2003  {
2004  case sleep_all_day:
2005  case glyphosate:
2006  break;
2007  case autumn_plough:
2008  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2009  break;
2010  case stubble_plough:
2011  if (random(100) < cfg_hare_y_cut.value()) result = true;
2012  break;
2014  if (random(100) < cfg_hare_y_cut.value()) result = true;
2015  break;
2017  if (random(100) < cfg_hare_y_cut.value()) result = true;
2018  break;
2019  case autumn_harrow:
2020  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2021  break;
2022  case preseeding_cultivator:
2023  if (random(100) < cfg_hare_y_cut.value()) result = true;
2024  break;
2026  if (random(100) < cfg_hare_y_cut.value()) result = true;
2027  break;
2028  case autumn_roll:
2029  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2030  break;
2031  case autumn_sow:
2032  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2033  break;
2034  case winter_plough:
2035  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2036  break;
2037  case deep_ploughing:
2038  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2039  break;
2040  case spring_plough:
2041  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2042  break;
2043  case spring_harrow:
2044  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2045  break;
2046  case shallow_harrow:
2047  if (random(100) < cfg_hare_y_cut.value()) result = true;
2048  break;
2049  case spring_roll:
2050  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2051  break;
2052  case spring_sow:
2053  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2054  break;
2055  case spring_sow_with_ferti:
2056  if (random(100) < cfg_hare_y_cut.value()) result = true;
2057  break;
2058  case fp_npks:
2059  break;
2060  case fp_npk:
2061  break;
2062  case fp_pk:
2063  break;
2064  case fp_liquidNH3:
2065  break;
2066  case fp_slurry:
2067  break;
2068  case fp_ammoniumsulphate:
2069  break;
2070  case fp_manganesesulphate:
2071  break;
2072  case fp_manure:
2073  break;
2074  case fp_greenmanure:
2075  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2076  break;
2077  case fp_sludge:
2078  break;
2079  case fp_rsm:
2080  break;
2081  case fp_calcium:
2082  break;
2083  case fa_npk:
2084  break;
2085  case fa_npks:
2086  break;
2087  case fa_pk:
2088  break;
2089  case fa_slurry:
2090  break;
2091  case fa_ammoniumsulphate:
2092  break;
2093  case fa_manganesesulphate:
2094  break;
2095  case fa_manure:
2096  break;
2097  case fa_greenmanure:
2098  break;
2099  case fa_sludge:
2100  break;
2101  case fa_rsm:
2102  break;
2103  case fa_calcium:
2104  break;
2105  case herbicide_treat:
2106  break;
2107  case growth_regulator:
2108  break;
2109  case fungicide_treat:
2110  break;
2112  case trial_toxiccontrol:
2113  case trial_control:
2114  case syninsecticide_treat:
2115  case insecticide_treat:
2116  case product_treat:
2117  break;
2118  case biocide:
2119  break;
2120  case molluscicide:
2121  break;
2122  case row_cultivation:
2123  break;
2124  case strigling:
2125  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2126  break;
2127  case hilling_up:
2128  break;
2129  case water:
2130  break;
2131  case swathing:
2132  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2133  break;
2134  case harvest:
2135  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2136  break;
2137  case cattle_out:
2138  break;
2139  case cattle_out_low:
2140  break;
2141  case cut_to_hay:
2142  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2143  break;
2144  case cut_to_silage:
2145  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2146  break;
2147  case straw_chopping:
2148  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2149  break;
2150  case hay_turning:
2151  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2152  break;
2153  case hay_bailing:
2154  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2155  break;
2156  case stubble_harrowing:
2157  break;
2159  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2160  break;
2161  case burn_straw_stubble:
2162  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2163  break;
2164  case mow:
2165  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2166  break;
2167  case cut_weeds:
2168  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2169  break;
2170  case pigs_out:
2171  result = true;
2172  break;
2173  case strigling_sow:
2174  if (random( 100 ) < cfg_hare_y_cut.value()) result = true;
2175  break;
2176  case strigling_hill:
2177  if (random(100) < cfg_hare_y_cut.value()) result = true;
2178  break;
2179  case bed_forming:
2180  if (random(100) < cfg_hare_y_cut.value()) result = true;
2181  break;
2182  case flower_cutting:
2183  if (random(100) < cfg_hare_y_cut.value()) result = true;
2184  break;
2185  case bulb_harvest:
2186  if (random(100) < cfg_hare_y_cut.value()) result = true;
2187  break;
2188  case straw_covering:
2189  break;
2190  case straw_removal:
2191  break;
2192  default:
2193  m_OurLandscape->Warn( "Hare_Young::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
2194  exit( 1 );
2195  }
2196  if (result)
2197  {
2198  ON_Dead();
2199  }
2200  return result;
2201 }
2202 //---------------------------------------------------------------------------
2207 {
2208  st_Dying();
2209 }
2210 //---------------------------------------------------------------------------
2211 //---------------------------------------------------------------------------
2212 // Hare_Juvenile CODE
2213 //---------------------------------------------------------------------------
2214 
2220  Landscape * p_L, THare_Population_Manager* p_PPM, double p_weight)
2221  : THare(p_x,p_y,p_L,p_PPM)
2222 {
2223  Init(p_weight);
2224 }
2226 {
2227  m_Location_x = a_data.x;
2228  m_Location_y = a_data.y;
2229  m_OurLandscape = a_data.L;
2230  m_CurrentStateNo = 0;
2231  THareInit(a_data.x, a_data.y, a_data.HM);
2232  Init(a_data.weight);
2233 }
2234 //---------------------------------------------------------------------------
2235 
2236 void Hare_Juvenile::Init(double p_weight)
2237 {
2238  m_Type = hob_Juvenile;
2239  m_weight = p_weight;
2240  m_Age = 35; // By definition we are 35 days old today
2241 }
2242 
2248 {
2249  //Nothing to do
2250 }
2251 //---------------------------------------------------------------------------
2252 
2262 {
2263  if (m_CurrentStateNo == -1) return;
2264  m_ActivityTime=1440; // Start the day
2265  m_old_weight=m_weight-1; // we are not interested in tiny fluctuations
2269 
2270 #ifdef __DDEPMORT
2272 #ifdef __THRESHOLD_DD
2273  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
2275 #endif
2276  double inter=m_OurPopulationManager->GetInterference(dens);
2277  if (g_rand_uni() > inter) {
2278  ON_Dead();
2279  m_StepDone=true; // We need to skip the step code, we are dead
2280  return;
2281  }
2282 #endif
2283 
2285  ON_Dead();
2286  m_StepDone=true; // We need to skip the step code, we are dead
2287  return;
2288  }
2289 
2290  if (g_rand_uni()<cfg_hare_proximity_alert.value()) {
2291  Running(cfg_hare_escape_dist.value());
2292  }
2293 #ifdef __DISEASEDDM3
2294  m_ddindex++;
2295  if (m_ddindex==365) {
2296  m_ddindex=0;
2297  }
2301  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
2302 #endif
2303  // Set the maximum possible energy intake
2305  CheckManagement();
2306 }
2307 //---------------------------------------------------------------------------
2308 
2317 {
2318  if (m_StepDone || m_CurrentStateNo == -1) return;
2319  switch (m_CurrentHState)
2320  {
2321  case tohs_InitialState: // Initial state
2323  break;
2324  case tohs_Dispersal:
2325  // Dispersal is risky therefore take a test again
2326  // Legal returns are:
2327  // tohs_Foraging
2328 #ifdef __DISPERSALDDM
2329  if (g_rand_uni()<(cfg_hare_juvenile_predation.value())) {
2330  ON_Dead();
2331  m_StepDone=true; // We need to skip the step code, we are dead
2332  return;
2333  }
2334 #endif
2336  break;
2337  case tohs_Foraging:
2338  // Legal returns are:
2339  // tohs_JResting
2341  break;
2342  case tohs_Resting:
2343  // Legal returns are:
2344  // tohs_Developing
2346  break;
2347  case tohs_Developing:
2348  // Legal returns are:
2349  // tohs_Dispersal
2350  // tohs_NextStage
2351  // tohs_Resting
2354  break;
2355  case tohs_NextStage:
2356  // Legal returns are:
2357  // NONE
2358  st_NextStage();
2359  m_StepDone=true;
2360  break;
2361  case tohs_Dying:
2362  ON_Dead();
2363  m_StepDone=true;
2364  break;
2365  default:
2366  m_OurLandscape->Warn("Hare_Juvenile::Step - unknown state",NULL);
2367  exit(1);
2368  }
2369 }
2370 //---------------------------------------------------------------------------
2371 
2380 {
2381  MovePeg();
2383 }
2384 //---------------------------------------------------------------------------
2386 {
2390  double atime= m_ActivityTime*cfg_ForageRestingRatio.value();
2391  // We need to rest if there is no more time
2392  if (atime < 30) return tohs_Resting;
2393  // This version uses adult density for interference, other densities seem not to work so well
2394  //int hares=(m_OurPopulationManager->GetAdultDensity(m_Location_x, m_Location_y));
2395  //int hares=(m_OurPopulationManager->GetTotalDensity(m_Location_x, m_Location_y));
2396  int hares = 1;
2397 #ifdef __THRESHOLD_AD_DD
2398  if (hares<m_OurPopulationManager->m_HareThresholdDD) {
2399  hares=0;
2400  } else {
2402  }
2403 #endif
2404 #ifdef __THRESHOLD_DDJ
2405 // this section has been altered so many times it was not worth making it general - if it is used in release versions this can be implemented when we know how it should look - right now remember to change in code before compile-
2406  if (hares<6) hares=0;
2407  else hares*=hares;
2408 #endif
2409 
2410 #ifdef __SCALINGYOUNGDDM
2411  hares = (int) floor (0.5+(double)hares*cfg_JuvDDScale.value());
2412 #endif
2413 
2414  //interfer is between 1.0 and 0
2415  //double slope = 1.0+(cfg_AgeRelatedInterferenceScaling.value() * (1.0-(double(m_Age/365.0))));
2416  //double hs=hares*slope;
2417 #ifndef __DDEPMORT
2418  double inter = m_OurPopulationManager->GetInterference((int)(hares));
2419 #else
2420  double inter=1.0;
2421 #endif
2422  if ((inter<0.5) && (atime > 300)){
2423  if (g_rand_uni() > inter) // added to reduce rate of dispersal
2424  {
2425  //m_ActivityTime = (int)(atime / cfg_ForageRestingRatio.value());
2426  return tohs_Dispersal; // Added Sat 15th Dec 2007
2427  }
2428  }
2429  atime*= inter;
2430  int a_time = (int) atime;
2431  if (cfg_hare_pesticideresponse_on.value())
2432  {
2433  m_TodaysEnergy = ForageP(a_time);
2434  }
2435  else
2436  {
2437  m_TodaysEnergy = Forage(a_time);
2438  }
2439  // We need to spend energy on foraging and associated movement
2440  //
2441  TimeBudget(activity_Foraging, (int)atime-a_time);
2442  return tohs_Resting;
2443 }
2444 //---------------------------------------------------------------------------
2445 
2450 {
2451 #ifdef __DISPMORTALITY
2452  if (WasPredated()) return tohs_Dying;
2453 #endif
2454  // Now to make this a little more clever we need to test all 8 directions
2455  int ttx, tty;
2456  int tx=m_Location_x;
2457  int ty=m_Location_y;
2458  ttx=tx;
2459  tty=ty;
2460  double fv=0.0;
2461  double oldfv = -99999999.0;
2462  int dstart=random(8);
2463  int d2=0;
2464  for (int j=0; j<100; j++) {
2465  int dist=100+random(cfg_hare_max_dispersal.value());
2466  for (int d=dstart; d<8+dstart; d++) {
2467  // We need to avoid a bias movement now too
2468  int d1=d & 7; // 0-7
2469  Walking(dist, d1); // This modifies m_Location_x, m_Location_y
2470  // How much food here?
2473  if (oldfv<=fv) {
2474  oldfv=fv;
2475  ttx=m_Location_x;
2476  tty=m_Location_y;
2477  d2=dist;
2478  // The best we can ever get is 0.8 so we can speed things up by dropping out if we are close to this.
2479  if (fv>=0.75) {
2480  j=101;
2481  break;
2482  }
2483  }
2484  // Set the xy back before trying the next direction
2485  m_Location_x=tx;
2486  m_Location_y=ty;
2487  }
2488  }
2489  // Now do it for real
2490  // We need to update the density maps temporarily to stop all the animals responding to old data until the beginning of the next timestep
2492  m_Location_x = ttx;
2493  m_Location_y = tty;
2495  d2 *= 5; // Lets assume it is not a beeline, and 5x distance is needed to find the place.
2498  // Move the peg with us.
2499  //m_peg_x = m_Location_x; /** Testing whether the peg will be dragged anyway if we don't set this 31/7/2014 */
2500  //m_peg_y = m_Location_y;
2501  return tohs_Foraging;
2502 }
2503 //---------------------------------------------------------------------------
2508 {
2509  EnergyBalance(activity_Resting, 0); // Just removes a days BMR
2511  return tohs_Developing;
2512 }
2513 //---------------------------------------------------------------------------
2523 {
2524  // Test for the onset of reproductive activity
2525  // This should be done now because otherwise it is possible to skip this test and get too old
2526  if (ShouldMature()) {
2527  return tohs_NextStage;
2528  }
2529 #ifdef __MINGROWTHATTAIN
2530  // Take a check on our growth - if we are below X% of the min repro weight, assume we died
2531  //if (m_weight < (cfg_hare_minimum_breeding_weight.value()*cfg_min_growth_attain.value())) return tohs_Dying;
2532  if (m_weight< m_OurPopulationManager->m_DMWeight[m_Age]) {
2533  return tohs_Dying;
2534  }
2535 #endif
2536 
2543  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2544  double addedtoday=Target*m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
2545  m_weight+=addedtoday;
2546  m_TodaysEnergy-=Target;
2548  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2550  m_weight+=addedtoday;
2551  m_TodaysEnergy-=Target;
2552  if (m_TodaysEnergy>0) {
2553  // Put what remains back into fat reserve
2554  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2555  m_TodaysEnergy=0;
2556  // Cap the fat reserve and store surplus energy for today
2557  if (m_fatReserve>(cfg_AdultMaxFat.value() * m_weight)) {
2559  }
2560  m_StarvationDays=0; // Not starving
2561  return tohs_Foraging;
2562  }
2563  else {
2564  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2565  if (m_fatReserve<0) {
2567  m_fatReserve=0.0;
2568  }
2569  else m_TodaysEnergy=0;
2570  // What should the criteria for a starvation day be? Here chosen to be any negative energy balance.
2571  // Have also considered and rejected a proportion of rmr:
2572  //double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
2573 // if (m_TodaysEnergy<(0.0-(rmr*0.25)))
2574  if (m_TodaysEnergy<0.0)
2575  {
2576 #ifndef __NOJUVSTARVE
2577  // Oh oh, we are starving need to lose body weight and maybe we will die?
2578 #ifdef __ADULT_WT_STARVE_CHANCE
2580  if ((g_rand_uni() * 10000) > (cfg_juv_starve.value()))
2581  {
2582  return tohs_Dying;
2583  }
2584  }
2585 #else
2587  return tohs_Dying;
2588  }
2589 #endif
2590 #endif
2591  }
2592  else {
2593  m_StarvationDays--; // Not starving
2595  m_TodaysEnergy=0;
2596  }
2597  }
2598  return tohs_Foraging;
2599 
2600 }
2601 //---------------------------------------------------------------------------
2602 
2608 {
2609  struct_Hare* sp;
2610  sp = new struct_Hare;
2611  sp->HM = m_OurPopulationManager;
2612  sp->L = m_OurLandscape;
2613  sp->x = m_Location_x;
2614  sp->y = m_Location_y;
2615  sp->weight = m_weight;
2616  sp->Mum = NULL;
2617  sp->age = m_Age;
2618  sp->RefNum = m_RefNum;
2619  // Sex ratio is set to be 50:50 at birth
2620  if ((m_RefNum & 0x01) == 0) // Male
2621  m_OurPopulationManager->CreateObjects(3,this,NULL,sp,1);
2622  else m_OurPopulationManager->CreateObjects(4,this,NULL,sp,1);
2623  // Clean-up
2624  m_CurrentStateNo=-1; // Destroys the object at the next opportunity
2626  delete sp;
2627 }
2628 //---------------------------------------------------------------------------
2629 
2631 {
2636  if (++m_Age<180) return false;
2637  // Do not do it below six months
2638  // If 6mths old and it is before October, then can mature
2639  if (m_OurLandscape->SupplyDayInYear() < 270) return true;
2640  if (m_Age>364) return true;
2641  return true;
2642 }
2643 //---------------------------------------------------------------------------
2644 
2646  if (g_rand_uni()<m_OurPopulationManager->m_JuvMortRate) return true;
2647  return false;
2648 }
2649 //---------------------------------------------------------------------------
2650 
2655 {
2657  m_CurrentStateNo=-1;
2658  m_StepDone=true;
2659 }
2660 //---------------------------------------------------------------------------
2661 //---------------------------------------------------------------------------
2662 // Hare_Male CODE
2663 //---------------------------------------------------------------------------
2664 
2668 Hare_Male::Hare_Male(int p_x, int p_y,
2669  Landscape * p_L, THare_Population_Manager* p_PPM,
2670  double p_weight, int a_age, int a_Ref)
2671  : Hare_Juvenile(p_x,p_y,p_L,p_PPM,p_weight)
2672 {
2673  Init(p_weight, a_age, a_Ref);
2674 }
2676 {
2677  m_Location_x = a_data.x;
2678  m_Location_y = a_data.y;
2679  m_OurLandscape = a_data.L;
2680  m_CurrentStateNo = 0;
2681  THareInit(a_data.x, a_data.y, a_data.HM);
2682  Init(a_data.weight, a_data.age, a_data.RefNum);
2683 }
2684 //---------------------------------------------------------------------------
2685 
2686 void Hare_Male::Init(double p_weight, int a_age, int a_Ref)
2687 {
2688  m_Type = hob_Male;
2689  m_fatReserve = p_weight*0.04;
2690  m_weight = p_weight;
2691  m_Age=a_age;
2692  m_RefNum=a_Ref;
2693 }
2694 //---------------------------------------------------------------------------
2695 
2700 {
2701  // Nothing to do
2702 }
2703 //---------------------------------------------------------------------------
2704 
2716 {
2717  m_ActivityTime=1440; // Start the day
2721  m_foragingenergy=0;
2722 #ifdef __SIZERELATEDDEATH
2724  if (m_Age>365) {
2726  ON_Dead();
2727  m_StepDone=true; // We need to skip the step code, we are dead
2728  return;
2729  }
2730  }
2731  }
2732 #endif
2733 #ifdef __DISEASEDDMORTALITY
2734  if (m_IamSick) {
2735  ON_Dead();
2736  m_StepDone=true; // We need to skip the step code, we are dead
2737  return;
2738  }
2739 #endif
2740  if (WasPredated()) {
2741  ON_Dead();
2742  m_StepDone=true; // We need to skip the step code, we are dead
2743  return;
2744  }
2745  // Age physiolocally
2746  if (++m_Age > m_Lifespan) {
2747  ON_Dead();
2748  m_StepDone=true; // We need to skip the step code, we are dead
2749  return;
2750  }
2751 #ifdef __DISEASEDDM
2753  if (m_OurLandscape->SupplyDayInYear()==0) {
2756  // Now assume that if there are 100 hares on average that there is 100% chance of getting sick
2758  m_IamSick=true;
2759  }
2760  else m_IamSick=false;
2761  }
2762 #endif
2763  if (g_rand_uni()<cfg_hare_proximity_alert.value()) {
2764  Running(cfg_hare_escape_dist.value());
2765  }
2766 
2767 #ifdef __DISEASEDDM2
2769  if (m_OurLandscape->SupplyDayInYear()==0) {
2772  }
2773 #endif
2774 #ifdef __DISEASEDDM3
2775  m_ddindex++;
2776  if (m_ddindex==365) {
2777  m_ddindex=0;
2778  }
2782  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
2783 #endif
2784  // Set the maximum possible energy intake
2786  CheckManagement();
2787 }
2788 //---------------------------------------------------------------------------
2789 
2799 {
2800  if (m_StepDone || m_CurrentStateNo == -1) return;
2801  switch (m_CurrentHState)
2802  {
2803  case tohs_InitialState: // Initial state
2805  break;
2806  case tohs_Dispersal:
2807  // Legal returns are:
2808  // tohs_MResting
2809  // tohs_MReproBehaviour
2810  // Dispersal is risky therefore take a test again
2811 #ifdef __DISPERSALDDM
2812  if (g_rand_uni()<(cfg_hare_adult_predation.value())) {
2813  ON_Dead();
2814  m_StepDone=true; // We need to skip the step code, we are dead
2815  return;
2816  }
2817 #endif
2819  break;
2820  case tohs_Foraging:
2821  // Legal returns are:
2822  // tohs_MDispersal
2823  // tohs_MResting
2824  // tohs_MReproBehaviour
2826  break;
2827  case tohs_Resting:
2828  // Legal returns are:
2829  // tohs_MDeveloping
2831  break;
2832  case tohs_ReproBehaviour:
2833  // Legal returns are:
2834  // tohs_MResting
2835  // tohs_MDeveloping
2837  break;
2838  case tohs_Developing:
2839  // Legal returns are:
2840  // tohs_Dying
2841  // tohs_MForaging
2843  m_StepDone=true;
2844  break;
2845  case tohs_Dying:
2846  ON_Dead();
2847  m_StepDone=true;
2848  break;
2849  default:
2850  m_OurLandscape->Warn("Hare_Male::Step - unknown state",NULL);
2851  exit(1);
2852  }
2853 }
2854 //---------------------------------------------------------------------------
2860 {
2864  MovePeg();
2866 }
2867 //---------------------------------------------------------------------------
2873 {
2877  double time = (double)m_ActivityTime*cfg_ForageRestingRatio.value();;
2878  // We need to rest if there is no more time
2879  if (time < 30 ) return tohs_Resting;
2880  // If there are more hares here then interference reduces the activity time
2881 #ifdef __DELAYEDDD
2883 #else
2885 #endif
2886 #ifdef __THRESHOLD_AD_DD
2887  if (hares<m_OurPopulationManager->m_HareThresholdDD) hares=0;
2889 #endif
2890  //double interference=(1-(hares*hares)*cfg_HareMaleDensityDepValue.value());
2891  //if (interference<0) interference=0;
2892 #ifdef __DISEASEDDM2
2894 #else
2895 #ifdef __DISEASEDDM3
2897 #else
2898 #ifndef __DDEPMORT
2899  double inter=m_OurPopulationManager->GetInterference(hares);
2900 #else
2901  #ifndef __DISEASEDDM
2902  double inter=m_OurPopulationManager->GetInterference(hares);
2903  #else
2904  double inter=1.0;
2905  #endif
2906 #endif
2907 #endif
2908 #endif
2909  if ((inter<0.5) && (time > 300))
2910  {
2911  if (g_rand_uni() > inter*2) // added to reduce rate of dispersal
2912  {
2913  // m_ActivityTime = (int)(time / cfg_ForageRestingRatio.value()); removed because it is superfluous
2914  return tohs_Dispersal; // Added Sat 15th Dec 2007
2915  }
2916  }
2917  time*=inter;
2918  // Given the time we have then we need to feed, which will return an energy
2919  // Value obtained.
2920  int a_time = (int) time;
2921  if (cfg_hare_pesticideresponse_on.value())
2922  {
2923  m_TodaysEnergy = ForageP(a_time);
2924  }
2925  else
2926  {
2927  m_TodaysEnergy = Forage(a_time);
2928  }
2929  // We need to spend energy on foraging and associated movement - but this is done in ForageSquare()
2930  TimeBudget(activity_Foraging, (int)time-a_time);
2931  // We need to rest
2932  return tohs_Resting;
2933 }
2934 
2935 //---------------------------------------------------------------------------
2936 
2938 {
2942  return tohs_Developing;
2943 }
2944 //---------------------------------------------------------------------------
2945 
2947 {
2948  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2949  //
2950  // This is the last behaviour state called each day, so we can use this to sort out
2951  // the energetics
2952  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2953  //
2954 
2955  EnergyBalance(activity_Resting, 1440); // calculates the energy use by BMR
2956  if (m_TodaysEnergy<0) {
2957  m_fatReserve+=(m_TodaysEnergy * (1.0/42.7));
2958  m_TodaysEnergy=0;
2959  }
2960  // Grow
2961  // Solid food absorption is already taken into account by this time
2962  if (m_Age<365) {
2964  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2965  double addedtoday=Target*m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
2966  m_weight+=addedtoday;
2967  m_TodaysEnergy-=Target;
2969  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2971  m_weight+=addedtoday;
2972  m_TodaysEnergy-=Target;
2973  } else {
2975  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2977  double addedtoday=Target*gf;
2978  m_weight+=addedtoday;
2979  m_TodaysEnergy-=Target;
2980  }
2981  if (m_TodaysEnergy>0) {
2982  // Put what remains back into fat reserve
2983  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2984  m_TodaysEnergy=0;
2985  // Cap the fat reserve and store surplus energy for today
2986  if (m_fatReserve>(cfg_AdultMaxFat.value() * m_weight)) {
2988  }
2989  m_StarvationDays=0; // Not starving
2990  return tohs_Foraging;
2991  }
2992  else {
2993  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2994  if (m_fatReserve<0) {
2996  m_fatReserve=0.0;
2997  }
2998  else m_TodaysEnergy=0;
2999 // double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
3000 // if (m_TodaysEnergy<(0.0-(rmr*0.25)))
3001  if (m_TodaysEnergy<0.0)
3002  {
3003  // Oh oh, we are starving need to lose body weight and maybe we will die?
3004 #ifdef __ADULT_WT_STARVE_CHANCE
3005  int testval=0;
3006  if (m_Age<cfg_fixadult_starve.value()) {
3007  // Somewhere between juvenile and adult so use in between values
3008  int diff = cfg_adult_starve.value() - cfg_juv_starve.value();
3009  testval=cfg_adult_starve.value()-(int)((1.0-(cfg_fixadult_starve.value()/(double)m_Age))*diff);
3010 
3011  } else testval=cfg_adult_starve.value();
3013  if (random(10000)> testval) {
3014  return tohs_Dying;
3015  }
3016  }
3017 #else
3019  return tohs_Dying;
3020  }
3021 #endif
3022  }
3023  else {
3024  m_StarvationDays--; // Not starving
3026  m_TodaysEnergy=0;
3027  }
3028  if (random(3)==0) return tohs_Dispersal; // We are hungry, we need to disperse
3029  }
3030  return tohs_Foraging;
3031 }
3032 //---------------------------------------------------------------------------
3033 
3035 {
3036  // TODO - this will need implementing if we have to simulate male reproduction (e.g. for genetic effects) or if we find we need this to alter survival in some way.
3037  return tohs_Resting;
3038 }
3039 //---------------------------------------------------------------------------
3040 
3045 {
3047  m_CurrentStateNo=-1;
3048  m_StepDone=true;
3049 }
3050 //---------------------------------------------------------------------------
3052 {
3058  double pesticideInternalConc = m_pesticide_burden / m_weight;
3060 
3061  if (pesticideInternalConc > cfg_HarePesticideAccumulationThreshold.value())
3062  {
3063  switch (tp)
3064  {
3065  case ttop_NoPesticide:
3066  break;
3068  GeneralEndocrineDisruptor(pesticideInternalConc); // Calls the EndocrineDisruptor action code
3069  break;
3070  case ttop_AcuteEffects:
3071  GeneralOrganoPhosphate(pesticideInternalConc); // Calls the GeneralOrganophosphate action code
3072  break;
3073  default:
3074  exit(47);
3075  }
3076  }
3077  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
3078 }
3079 //---------------------------------------------------------------------------
3080 
3081 //*************************************************************************************
3082 //************************** PESTICIDE SPECIFIC EFFECT CODE ***************************
3083 //*************************************************************************************
3084 
3085 
3086 //-------------------------------------------------------------------------------------
3087 //-------------------- GENERAL ENDOCRINE DISRUPTOR EFFECT CODE ------------------------
3088 //-------------------------------------------------------------------------------------
3089 
3090 void Hare_Male::GeneralEndocrineDisruptor(double /* a_dose */)
3091 {
3092  return;
3093 }
3094 
3095 //-------------------------------------------------------------------------------------
3096 //------------------------ GENERAL ORGANOPHOSPHATE EFFECT CODE ------------------------
3097 //-------------------------------------------------------------------------------------
3098 
3099 void Hare_Male::GeneralOrganoPhosphate(double /* a_dose */)
3100 {
3101  if (g_rand_uni() > l_pest_daily_mort.value()) return;
3103  m_StepDone = true;
3104  return;
3105 }
3106 
3107 //#####################################################################################
3108 //########################### END PESTICIDE HANDLING CODE #############################
3109 //#####################################################################################
3110 
3111 
3112 //---------------------------------------------------------------------------
3113 // Hare_Female CODE
3114 //---------------------------------------------------------------------------
3115 
3116 
3117 Hare_Female::Hare_Female(int p_x, int p_y, Landscape * p_L, THare_Population_Manager* p_PPM, double p_weight, int a_age, int a_Ref) : Hare_Juvenile(p_x, p_y, p_L, p_PPM, p_weight)
3118 {
3119  Init(p_weight,a_age,a_Ref);
3120 }
3121 //---------------------------------------------------------------------------
3122 
3124 {
3125  m_Location_x = a_data.x;
3126  m_Location_y = a_data.y;
3127  m_OurLandscape = a_data.L;
3128  m_CurrentStateNo = 0;
3129  THareInit(a_data.x, a_data.y, a_data.HM);
3130  Init(a_data.weight, a_data.age, a_data.RefNum);
3131 }
3132 //---------------------------------------------------------------------------
3133 
3134 void Hare_Female::Init( double p_weight, int a_age, int a_Ref)
3135 {
3136 
3137  m_Type = hob_Female;
3138  m_fatReserve = p_weight * 3.8*0.04; // To get 4% of WW+ingesta
3139  m_sterile = false;
3140  m_weight = p_weight;
3141  m_old_weight = p_weight;
3142  m_Age = a_age;
3143  m_OestrousCounter = 0;
3144  m_GestationCounter = 0;
3145  m_LeveretMaterial = 0;
3147  m_litter_no = 0;
3148  m_KJWalking = m_OurPopulationManager->GetKJperM((int)floor(0.5 + m_weight));
3149  m_KJRunning = m_KJWalking * 2;
3151  m_IamSick = false;
3152  m_RefNum = a_Ref;
3153 }
3154 //---------------------------------------------------------------------------
3155 
3157 {
3158  //Nothing to do
3159 }
3160 //---------------------------------------------------------------------------
3161 
3163 {
3164  m_ActivityTime=1440; // Start the day
3165 #ifdef __SIZERELATEDDEATH
3167  if (m_Age>365) {
3169  ON_Dead();
3170  m_StepDone=true; // We need to skip the step code, we are dead
3171  return;
3172  }
3173  }
3174  }
3175 #endif
3176 #ifdef __DISEASEDDMORTALITY
3177  if (m_IamSick) {
3178  ON_Dead();
3179  m_StepDone=true; // We need to skip the step code, we are dead
3180  return;
3181  }
3182 #endif
3183  if (WasPredated()) {
3184  ON_Dead();
3185  m_StepDone=true; // We need to skip the step code, we are dead
3186  return;
3187  }
3188  // Age physiolocally
3189  if (++m_Age > m_Lifespan) {
3190  ON_Dead();
3191  m_StepDone=true; // We need to skip the step code, we are dead
3192  return;
3193  }
3197  if (g_rand_uni()<cfg_hare_proximity_alert.value()) {
3198  Running(cfg_hare_escape_dist.value());
3199  }
3200  // Checking code ***CJT***
3201  m_foragingenergy=0;
3202 #ifdef __DISEASEDDM
3204  if (m_OurLandscape->SupplyDayInYear()==0) {
3208  m_IamSick=true;
3209  }
3210  else m_IamSick=false;
3211  }
3212 #endif
3213 #ifdef __DISEASEDDM2
3215  if (m_OurLandscape->SupplyDayInYear()==0) {
3218  }
3219 #endif
3220 #ifdef __DISEASEDDM3
3221  m_ddindex++;
3222  if (m_ddindex==365) {
3223  m_ddindex=0;
3224  }
3228  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
3229 #endif
3230  // Set the maximum possible energy intake
3232  CheckManagement();
3233 }
3234 //---------------------------------------------------------------------------
3235 
3237 {
3238  if (m_StepDone || m_CurrentStateNo == -1) return;
3239  switch (m_CurrentHState)
3240  {
3241  case tohs_InitialState: // Initial state
3243  break;
3244  case tohs_Dispersal:
3245  // Legal returns are:
3246  // tohs_Foraging
3247  // Dispersal is risky therefore take a test again
3248 #ifdef __DISPERSALDDM
3249  if (g_rand_uni()<(cfg_hare_adult_predation.value())) {
3250  ON_Dead();
3251  m_StepDone=true; // We need to skip the step code, we are dead
3252  return;
3253  }
3254 #endif
3256  break;
3257  case tohs_Foraging:
3258  // Legal returns are:
3259  // tohs_ReproBehaviour
3261  break;
3262  case tohs_Resting:
3263  // Legal returns are:
3264  // tohs_Developing
3266  break;
3267  case tohs_ReproBehaviour:
3268  // Legal returns are:
3269  // tohs_Resting (& possibly dying)
3271  break;
3272  case tohs_Developing:
3273  // Legal returns are:
3274  // tohs_Dying
3275  // tohs_Foraging
3276  // tohs_Dispersal
3278  m_StepDone=true;
3279  break;
3280  case tohs_Dying:
3281  ON_Dead();
3282  m_StepDone=true;
3283  break;
3284  default:
3285  m_OurLandscape->Warn("Hare_Female::Step - unknown state",NULL);
3286  exit(1);
3287  }
3288 }
3289 //---------------------------------------------------------------------------
3290 
3292  MovePeg();
3294 }
3295 //---------------------------------------------------------------------------
3296 
3298 {
3299  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
3300  //
3301  // This is the last behaviour state called each day, so we can use this to sort out
3302  // the energetics
3303  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
3304  //
3305 
3306  EnergyBalance(activity_Resting, 1440); // calculates the energy use by BMR
3307  if (m_TodaysEnergy<0) {
3308  m_fatReserve+=(m_TodaysEnergy * (1.0/42.7));
3309  m_TodaysEnergy=0;
3310  }
3311  // Grow
3312  // Solid food absorption is already taken into account by this time
3313  if (m_Age<365)
3314  {
3316  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
3317  double addedtoday=Target*m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
3318  m_weight+=addedtoday;
3319  m_TodaysEnergy-=Target;
3321  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
3323  m_weight+=addedtoday;
3324  m_TodaysEnergy-=Target;
3325  }
3326  else
3327  {
3329  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
3331  double addedtoday=Target*gf;
3332  m_weight+=addedtoday;
3333  m_TodaysEnergy-=Target;
3334  }
3335  if (m_TodaysEnergy>0)
3336  {
3337  // Put what remains back into fat reserve
3338  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the adult fat conversion efficiency
3339  m_TodaysEnergy=0;
3340  // Cap the fat reserve and store surplus energy for today
3341  if (m_fatReserve>(cfg_AdultMaxFat.value() * m_weight)) {
3343  }
3344  m_StarvationDays=0; // Not starving
3345  return tohs_Foraging;
3346  }
3347  else {
3348  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the adult fat conversion efficiency
3349  if (m_fatReserve<0)
3350  {
3352  m_fatReserve=0.0;
3353  }
3354  else m_TodaysEnergy=0;
3355  // What should the criteria for a starvation day be?
3356  //double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
3357  //if (m_TodaysEnergy<(0.0-(rmr*0.25)))
3358  if (m_TodaysEnergy<0.0)
3359  {
3360  // Oh oh, we are starving need to lose body weight and maybe we will die?
3361 #ifdef __ADULT_WT_STARVE_CHANCE
3362  int testval=0;
3363  if (m_Age<cfg_fixadult_starve.value()) {
3364  // Somewhere between juvenile and adult so use in between values
3365  int diff = cfg_adult_starve.value() - cfg_juv_starve.value();
3366  testval=cfg_adult_starve.value()- (int)((1.0-((double)m_Age/cfg_fixadult_starve.value()))*diff);
3367 
3368  } else testval=cfg_adult_starve.value();
3370  if (random(10000)> testval) {
3371  return tohs_Dying;
3372  }
3373  }
3374  #ifdef __NOKNOCKONENERGYEFFECT
3375  else m_TodaysEnergy=0.0;
3376  #endif
3377 #else
3379  return tohs_Dying;
3380  }
3381 #endif
3382  }
3383  else {
3384  m_StarvationDays--; // Not starving
3386  m_TodaysEnergy=0;
3387  }
3388  // If we have kids then we expect this for a while, so only dispere if fat reserves are less than 0
3390  if (random(3)==0) return tohs_Dispersal; // We are hungry, we need to disperse
3391  }
3392  } // end if energy<0
3393  return tohs_Foraging;
3394 }
3395 //---------------------------------------------------------------------------
3396 
3398 {
3411  double time= (double) m_ActivityTime * cfg_ForageRestingRatio.value();
3412  // We need to rest if there is no more time
3413  if (time < 30 ) return tohs_Resting;
3414  // If there are more hares here then interference reduces the activity time
3415 #ifdef __DELAYEDDD
3417 #else
3419 #endif
3420 #ifdef __THRESHOLD_AD_DD
3421  if (hares<m_OurPopulationManager->m_HareThresholdDD) hares=0;
3423 #endif
3424 #ifdef __DISEASEDDM2
3426 #else
3427 #ifdef __DISEASEDDM3
3429 #else
3430 #ifndef __DDEPMORT
3431  double inter=m_OurPopulationManager->GetInterference(hares);
3432 #else
3433  #ifndef __DISEASEDDM
3434  double inter=m_OurPopulationManager->GetInterference(hares);
3435  #else
3436  double inter=1.0;
3437  #endif
3438 #endif
3439 #endif
3440 #endif
3441  if ((inter<0.5) && (time > 300))
3442  {
3443  if (m_reproActivity!=activity_lactation) { // Don't abandon kids just because others want to be here too
3444  if (g_rand_uni() > inter) // added to reduce rate of dispersal
3445  {
3446  //m_ActivityTime = (int)(time / cfg_ForageRestingRatio.value());
3447  return tohs_Dispersal; // Added Sat 15th Dec 2007
3448  }
3449  }
3450  }
3451  time*=inter;
3452  // Given the time we have then we need to feed, which will return an energy value obtained.
3453  int a_time = (int) time;
3454  if (cfg_hare_pesticideresponse_on.value())
3455  {
3456  m_TodaysEnergy = ForageP(a_time);
3457  }
3458  else
3459  {
3460  m_TodaysEnergy = Forage(a_time);
3461  }
3462  // We need to spend energy on foraging and associated movement - done in ForageSquare()
3463  //
3464  TimeBudget(activity_Foraging, (int)time-a_time);
3465  // Print the energy checking output
3466 #ifdef __saveEnergyInfo
3467  dumpEnergy();
3468 #endif
3469  return tohs_ReproBehaviour;
3470 }
3471 //---------------------------------------------------------------------------
3473  FILE* fp=fopen("EnergyCheck.txt","a");
3474  int wt=int(floor(0.5+m_weight));
3475  int fe=int(floor(0.5+m_foragingenergy));
3476  int fr=int(floor(0.5+m_fatReserve));
3477  int te=int(floor(0.5+m_TodaysEnergy));
3478  fprintf (fp,"%d\t%d\t%d\t%d\t%d\n",(int) m_OurLandscape->SupplyDayInYear(), wt, fe, fr, te);
3479  fclose(fp);
3480 }
3481 //---------------------------------------------------------------------------
3486 {
3488  if (tohs==tohs_Dying) return tohs_Dying;
3489  // If dispersal is called, then she must be deserting any young she has
3490  // The easiest way to do this is to lie, and tell them she is dead
3491  vector<THare*>::iterator current = m_MyYoung.begin();
3492  while (current != m_MyYoung.end()) {
3493  (*current)->ON_MumDead(this);
3494  current++;
3495  }
3496  // Now must clear the list.
3497  if (m_MyYoung.size()>=1) {
3498  m_MyYoung.erase(m_MyYoung.begin(),m_MyYoung.end()); // Remove all elements
3500  }
3503  return tohs_Foraging;
3504 }
3505 //---------------------------------------------------------------------------
3506 
3508 {
3512  return tohs_Developing;
3513 }
3514 //---------------------------------------------------------------------------
3515 
3521 {
3535  // First find out what kind of behaviour we are in:
3536 #ifdef __REPROMORTCHANCE
3537  // Repromortchance is a function of size, the bigger you are the less chance of mortality
3538  int mc=0;
3539 #endif
3540  switch(m_reproActivity)
3541  {
3543  UpdateOestrous();
3544  break;
3545  case activity_inoestrous:
3546  Mating();
3547  break;
3548  case activity_gestation:
3549  UpdateGestation();
3550  break;
3551  case activity_givebirth:
3552 #ifdef __REPROMORTCHANCE
3553  // Repromortchance is a function of size, the bigger you are the less chance of mortality
3554  mc=random(100+(int)m_weight-cfg_hare_minimum_breeding_weight.value());
3555  if (mc<cfg_HareFemaleReproMortValue.value()) {
3556  return tohs_Dying;
3557  }
3558 #endif
3559  GiveBirth();
3560  break;
3561  case activity_lactation:
3562  DoLactation();
3563  break;
3564  default:
3565  m_OurLandscape->Warn("Hare_Female::st_ReproBehaviour unknown activity"
3566  ,NULL);
3567  exit(1);
3568  }
3569  return tohs_Resting;
3570 }
3571 //---------------------------------------------------------------------------
3572 
3581 {
3582 #ifdef __DISEASEDDM
3583  if (m_IamSick) {
3584  return; // will loop each day until not sick
3585  }
3586 #endif
3587 #ifdef __MINREPWEIGHT
3588  if (m_weight<cfg_hare_minimum_breeding_weight.value()) return; // No breeding below this weight
3589 #endif
3590 
3591  // No breeding outside the breeding season
3592  int today=m_OurLandscape->SupplyDayInYear();
3593  if ((today<cfg_ReproStartDay.value()) || (today>cfg_ReproEndDay.value()) )
3594  {
3596  m_litter_no=0;
3597  return;
3598  }
3599  if (++m_OestrousCounter>cfg_DaysToOestrous.value()) {
3600  // No breeding if in -ve energy balance
3604  }
3605  }
3606 }
3607 //---------------------------------------------------------------------------
3611 {
3612  // Sigh, need to develop code to determine if a male is close - how does
3613  // she choose a mate?? TODO if we ever consider males limiting or need population genetics
3614  // This is complicated by multiple matings in real life too.
3615  //
3616  // Assuming she has a mate and is mated
3620 }
3621 //---------------------------------------------------------------------------
3627 {
3628  // Now are they ready to be born?
3629  if (--m_GestationCounter<1) {
3631  }
3641  // ALL the calcuations below are in g fat, this is just to save on unnecessary conversions
3642  // and divides later
3646  if (en>fe) en=fe;
3647  m_fatReserve-=en;
3648  m_LeveretMaterial+=en;
3649  }
3650 }
3651 //---------------------------------------------------------------------------
3657 {
3658  double leveret_size;
3659  int NoLeverets=0;
3669  {
3670  // Could do lots now, e.g. take a test to determine if we reduce repro or abandon it.
3671  // The option below reduces the energy for leveret development by 0-100%
3672  //m_LeveretMaterial *= g_rand_uni();
3673  // Here we take it all
3674  m_LeveretMaterial = 0;
3675  m_pesticideInfluenced1 = false;
3676  }
3677 
3678  // THIS CODE IS FOR DOING IT ON THE BASIS OF ENERGY
3679  double mi=cfg_minLeveretBirthWeight.value();
3680  if (m_LeveretMaterial/4.0 > mi) NoLeverets=4;
3681  else if (m_LeveretMaterial/3.0 > mi) NoLeverets=3;
3682  else if (m_LeveretMaterial/2.0 > mi) NoLeverets=2;
3683  else if (m_LeveretMaterial > mi) NoLeverets=1;
3684  if (NoLeverets==0) {
3685  // Can't produce a leveret - abort the pregnancy
3689  return;
3690  }
3691  leveret_size=m_LeveretMaterial/(double)NoLeverets;
3692  if (leveret_size>cfg_maxLeveretBirthWeight.value())
3693  {
3694  leveret_size=cfg_maxLeveretBirthWeight.value();
3695  }
3696  // END ENERGETIC
3697  /*
3698  // THIS IS THE ALTERNATIVE 1 _ GET THE NUMBER BASED ON WHETHER IT IS FIRST, 2ND, 3RD etc..
3699  NoLeverets=m_OurPopulationManager->GetLitterSize(m_litter_no++);
3700  if (NoLeverets<1) {
3701  AllYoungKilled();
3702  return;
3703  }
3704  leveret_size=cfg_HareStartWeight.value(); // NB No variability in start weight
3705  */
3706  // END ALTERNATE 1
3707  /* ALTERNATE 2 - Here we adjust for the weight of the female
3708 
3709  if (m_weight > cfg_hare_minimum_breeding_weight.value() ) {
3710  NoLeverets=m_OurPopulationManager->GetLitterSize(m_litter_no++);
3711  }
3712  else {
3713  }
3714  if (NoLeverets<1) {
3715  AllYoungKilled();
3716  return;
3717  }
3718  leveret_size=cfg_HareStartWeight.value(); // NB No variability in start weight
3719  */
3720 // END ALTERNATE 2
3721 
3722 
3723  // Create the data required
3724  struct_Hare* sp;
3725  sp = new struct_Hare;
3726  sp->HM = m_OurPopulationManager;
3727  sp->L = m_OurLandscape;
3728  sp->Mum=this;
3729  sp->weight=leveret_size;
3731  APoint pt = PlaceYoung();
3732  sp->x = pt.m_x;
3733  sp->y = pt.m_y;
3734  // Make the leverets
3735  m_OurPopulationManager->CreateObjects(0,this,NULL,sp,NoLeverets);
3736  delete sp;
3737  m_litter_no++;
3739 #ifdef __saveLitterInfo
3740  //Temporary Output Start
3741  FILE* fp=fopen("LitterProduction.txt","a");
3742  int month=m_OurLandscape->SupplyMonth();
3743  fprintf(fp,"%i\t%i\t%f\t%d\n",month, NoLeverets, leveret_size, m_litter_no);
3744  fclose(fp);
3745  // End
3746 #endif
3747  // Feed them today
3748  DoLactation();
3749 }
3750 //---------------------------------------------------------------------------
3756 {
3757  APoint pt;
3758  int loop = 0;
3759  while (loop++ < 500)
3760  {
3762  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3764  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3766  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3768  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3770  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3772  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3774  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3776  if (m_OurLandscape->SupplyVegHeight(pt.m_x, pt.m_y) >= 30) return pt;
3777  }
3778  pt.m_x = m_Location_x;
3779  pt.m_y = m_Location_y;
3780  return pt;
3781 }
3782  //---------------------------------------------------------------------------
3788  {
3797  double sz= (double) m_MyYoung.size();
3798  if (m_fatReserve>0) { // Zero is used here because it is possible to use all fat reserves on this
3799  double en=63.7*m_fatReserve;
3800  // en is the energy available for milk
3801  double rmr=m_MyYoung[0]->GetRMR();
3802  double maxMilk= (rmr+m_OurPopulationManager->GetMaxDailyGrowthEnergy(m_MyYoung[0]->GetAge())) * sz * (1-g_PropSolidFood[m_MyYoung[0]->GetAge()]);
3803  if (en>maxMilk){
3804  en=maxMilk;
3805  }
3806 #ifdef __NOSTARVE
3807  en=maxMilk;
3808 #endif
3809  // remove the energy used
3810  m_fatReserve-=en* (1.0/63.7); // 63.7 is the cost of 1g dw fat
3811  // KJ per young
3812  en/=(double) sz;
3813  vector<THare*>::iterator current = m_MyYoung.begin();
3814  while (current != m_MyYoung.end())
3815  {
3816  dynamic_cast<Hare_Infant*>(*current)->ON_BeingFed(en);
3817  current++;
3818  }
3819  }
3820 }
3821 //---------------------------------------------------------------------------
3822 
3824 {
3828 vector<THare*>::iterator current = m_MyYoung.begin();
3829 while (current != m_MyYoung.end())
3830 {
3831  if (*current == a_old)
3832  {
3833  *current=a_new;
3834  return true;
3835  }
3836  current++;
3837 }
3838 return false;
3839 }
3840 //---------------------------------------------------------------------------
3845 {
3846  m_MyYoung.push_back(a_new);
3847 }
3848 //---------------------------------------------------------------------------
3849 
3851 {
3855  m_NoYoung= (int) m_MyYoung.size();
3856  vector<THare*>::iterator current = m_MyYoung.begin();
3857  while (current != m_MyYoung.end())
3858  {
3859  if (*current == a_young)
3860  {
3861  m_MyYoung.erase(current);
3862  if (m_MyYoung.size()==0) {
3863  // All young eaten do something appropriate
3864  AllYoungKilled();
3865  }
3866  return;
3867  }
3868  current++;
3869  }
3870  // Should never get here...raise an error and duck out of the program.
3871  //
3872  m_OurLandscape->Warn("Hare_Female::ON_YoungKilled - unknown young",NULL);
3873  exit(1);
3874 }
3875 //---------------------------------------------------------------------------
3880 {
3881  switch (m_reproActivity) {
3883  break;
3884  case activity_inoestrous:
3885  break;
3886  case activity_gestation:
3887  break;
3888  case activity_givebirth:
3889  case activity_lactation:
3892  break;
3893  default:
3894  m_OurLandscape->Warn("Hare_Female::AllYoungKilled unknown activity"
3895  ,NULL);
3896  exit(1);
3897  }
3898 }
3899 //---------------------------------------------------------------------------
3900 
3902  {
3908  m_NoYoung= (int) m_MyYoung.size();
3909  vector<THare*>::iterator current = m_MyYoung.begin();
3910  while (current != m_MyYoung.end())
3911  {
3912  if (*current == a_young)
3913  {
3914  m_MyYoung.erase(current);
3915  if (m_MyYoung.size()==0) {
3916  // All young grown up do something appropriate
3917  AllYoungMatured();
3918  }
3919  m_NoYoung= (int) m_MyYoung.size();
3920  return;
3921  }
3922  current++;
3923  }
3924  // Should never get here...raise an error and duck out of the program.
3925  //
3926  m_OurLandscape->Warn("Hare_Female::ON_RemoveYoung - unknown young",NULL);
3927  exit(1);
3928 }
3929 //---------------------------------------------------------------------------
3930 
3932 {
3933  m_NoYoung=0;
3934  switch (m_reproActivity) {
3936  break;
3937  case activity_inoestrous:
3938  break;
3939  case activity_gestation:
3940  break;
3941  case activity_givebirth:
3942  break;
3943  case activity_lactation:
3946  break;
3947  default:
3948  m_OurLandscape->Warn("Hare_Female::AllYoungMatured unknown activity",NULL);
3949  exit(1);
3950  }
3951 }
3952 //---------------------------------------------------------------------------
3957 {
3958  // if she has young she must tell them she is dead
3959  vector<THare*>::iterator current = m_MyYoung.begin();
3960  while (current != m_MyYoung.end())
3961  {
3962  (*current)->ON_MumDead(this);
3963  current++;
3964  }
3965  m_MyYoung.clear(); // Needed because of the potential for object re-use
3967  m_CurrentStateNo=-1;
3968  m_StepDone=true;
3969 }
3970 //---------------------------------------------------------------------------
3975 {
3976  m_NoYoung= (int) m_MyYoung.size();
3977  vector<THare*>::iterator current = m_MyYoung.begin();
3978  while (current != m_MyYoung.end())
3979  {
3980  if (*current == a_young)
3981  {
3982  return true;
3983  }
3984  current++;
3985  }
3986  return false;
3987 }
3988 //---------------------------------------------------------------------------
3993 {
3994  m_NoYoung= (int) m_MyYoung.size();
3995  unsigned int current=0;
3996  while (current < m_MyYoung.size())
3997  {
3998  if (m_MyYoung[current]->GetMum()!=this)
3999  {
4000  return false;
4001  }
4002  current++;
4003  }
4004  return true;
4005 }
4006 //---------------------------------------------------------------------------
4007 
4009 {
4015  double pesticideInternalConc = m_pesticide_burden / m_weight;
4016 
4018 
4019  if (pesticideInternalConc > cfg_HarePesticideAccumulationThreshold.value())
4020  {
4021  switch (tp)
4022  {
4023  case ttop_NoPesticide:
4024  break;
4026  GeneralEndocrineDisruptor(pesticideInternalConc); // Calls the EndocrineDisruptor action code
4027  break;
4028  case ttop_AcuteEffects:
4029  GeneralOrganoPhosphate(pesticideInternalConc); // Calls the GeneralOrganophosphate action code
4030  break;
4031  default:
4032  exit(47);
4033  }
4034  }
4035  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
4036 }
4037 //---------------------------------------------------------------------------
4038 
4047  // First do we have the right day?
4048  int today = m_TheLandscape->SupplyDayInYear();
4049  if (today!=1) return;
4050  // First do we have the right year?
4052  if (year%cfg_pm_eventfrequency.value()!=0) return;
4053 
4054  THare* AH = NULL;
4055  // Now if the % decrease is higher or lower than 100 we need to do different things
4056  int esize=cfg_pm_eventsize.value();
4057  if (esize<100) {
4058  unsigned size2;
4059  size2 = GetLiveArraySize(hob_Juvenile);
4060  for ( unsigned j = 0; j < size2; j++ ) {
4061  if (random(100) > esize) {
4062  AH = dynamic_cast < THare * > ( TheArray[hob_Juvenile] [ j ] );
4063  AH->Dying(); // Kill it
4064  }
4065  }
4066  size2 = GetLiveArraySize(hob_Female);
4067  for ( unsigned j = 0; j < size2; j++ ) {
4068  if (random(100) > esize) {
4069  AH = dynamic_cast < THare * > ( TheArray[hob_Female] [ j ] );
4070  AH->Dying(); // Kill it
4071  }
4072  }
4073  size2 = GetLiveArraySize(hob_Male);
4074  for ( unsigned j = 0; j < size2; j++ ) {
4075  if (random(100) > esize) {
4076  AH = dynamic_cast < THare * > ( TheArray[hob_Male] [ j ] );
4077  AH->Dying(); // Kill it
4078  }
4079  }
4080  }
4081  else if (esize>100) {
4082 /*
4083  Not implemented or needed as of yet
4084 */
4085  }
4086  else return; // No change so do nothing
4087 }
4088 //-----------------------------------------------------------------------------
4094  THare* AH = NULL;
4095  // This version simply alters populations on 1st January
4096  int esize= random(50);
4097  // First do we have the right day?
4098  int today = m_TheLandscape->SupplyDayInYear();
4099  if (today!=1) return;
4100  // First do we have the right year?
4101  // First do we have the right year?
4102  int year = m_TheLandscape->SupplyYearNumber();
4103  if (year%1!=0) return;
4104  unsigned size2;
4105  size2 = GetLiveArraySize(hob_Juvenile);
4106  for ( unsigned j = 0; j < size2; j++ ) {
4107  if (random(100) < esize) {
4108  AH = dynamic_cast < THare * > ( TheArray[hob_Juvenile] [ j ] );
4109  AH->Dying(); // Kill it
4110  }
4111  }
4112  size2 = GetLiveArraySize(hob_Male);
4113  for ( unsigned j = 0; j < size2; j++ ) {
4114  if (random(100) < esize) {
4115  AH = dynamic_cast < THare * > ( TheArray[hob_Male] [ j ] );
4116  AH->Dying(); // Kill it
4117  }
4118  }
4119  size2 = GetLiveArraySize(hob_Female);
4120  for ( unsigned j = 0; j < size2; j++ ) {
4121  if (random(100) < esize) {
4122  AH = dynamic_cast < THare * > ( TheArray[hob_Female] [ j ] );
4123  AH->Dying(); // Kill it
4124  }
4125  }
4126 }
4127 //-----------------------------------------------------------------------------
4132  m_shot=0;
4133  double huntpercent=cfg_HareHunting.value();
4134  Hare_Juvenile* AJH = NULL;
4135  unsigned size2;
4136  size2 = GetLiveArraySize(hob_Young);
4137  for ( unsigned j = 0; j < size2; j++ ) {
4138  AJH = dynamic_cast < Hare_Juvenile * > ( TheArray[ hob_Juvenile ] [ j ] );
4139  if ( g_rand_uni()< huntpercent) {
4140  // Must check if it is already dead of some other cause - is so can't kill it again
4141  if (AJH->GetCurrentStateNo() != -1)
4142  {
4143  AJH->ON_Dead(); // Kill it
4144  m_shot++;
4145  }
4146  }
4147  }
4148  Hare_Male* AH = NULL;
4149  size2 = GetLiveArraySize(hob_Male);
4150  for ( unsigned j = 0; j < size2; j++ ) {
4151  AH = dynamic_cast < Hare_Male * > ( TheArray[ hob_Male ] [ j ] );
4152  if ( g_rand_uni()< huntpercent) {
4153  if (AH->GetCurrentStateNo() != -1)
4154  {
4155  AH->ON_Dead(); // Kill it
4156  m_shot++;
4157  }
4158  }
4159  }
4160  Hare_Female* AFH = NULL;
4161  size2 = GetLiveArraySize(hob_Female);
4162  for ( unsigned j = 0; j < size2; j++ ) {
4163  AFH = dynamic_cast < Hare_Female * > ( TheArray[ hob_Female ] [ j ] );
4164  if ( g_rand_uni()< huntpercent) {
4165  if (AFH->GetCurrentStateNo() != -1)
4166  {
4167  AFH->ON_Dead(); // Kill it
4168  m_shot++;
4169  }
4170  }
4171  }
4172 }
4173 
4179  m_shot=0;
4180  int tx1 = cfg_BeetleBankMinX.value();
4181  int tx2 = cfg_BeetleBankMaxX.value();
4182  int ty1 = cfg_BeetleBankMinY.value();
4183  int ty2 = cfg_BeetleBankMaxY.value();
4184  double huntpercent_out, huntpercent_in;
4185  if (!cfg_BeetleBankInvert.value())
4186  {
4187  huntpercent_out =cfg_HareHunting.value();
4188  huntpercent_in =cfg_HareHuntingBeetleBankArea.value();
4189  }
4190  else
4191  {
4192  huntpercent_in =cfg_HareHunting.value();
4193  huntpercent_out =cfg_HareHuntingBeetleBankArea.value();
4194  }
4195  THare* AH = NULL;
4196  unsigned size2;
4197  for (int ind =hob_Juvenile; ind < hob_Foobar; ind++)
4198  {
4199  size2 = (unsigned)GetLiveArraySize(ind);
4200  for ( unsigned j = 0; j < size2; j++ )
4201  {
4202  AH = dynamic_cast < THare * > ( TheArray[ ind ] [ j ] );
4203  APoint xy = AH->SupplyPoint();
4204  if ((xy.m_x >= tx1) && (xy.m_y >= ty1) && (xy.m_x <= tx2) && (xy.m_y <= ty2))
4205  {
4206  if ( g_rand_uni()< huntpercent_in)
4207  {
4208  AH->ON_Dead(); // Kill it
4209  m_shot++;
4210  }
4211  } else
4212  {
4213  if ( g_rand_uni()< huntpercent_out)
4214  {
4215  AH->ON_Dead(); // Kill it
4216  m_shot++;
4217  }
4218  }
4219  }
4220  }
4221 }
4222 
4228  int N;
4229  m_shot=0;
4230  for (int x=500; x<SimW; x+=1000) {
4231  for (int y=500; y<SimH; y+=1000) {
4232  // For each 1km square
4233  N=0;
4234  for (int xx=x-(256+128); xx<=x+(256+128); xx+=256) {
4235  for (int yy=y-(256+128); yy<=y+(256+128); yy+=256) {
4236  N+=GetTotalDensity(xx,yy);
4237  }
4238  }
4239  if (N>cfg_HareHuntingThreshold.value()) {
4240  double huntpercent=cfg_HareHunting.value();
4241  Hare_Juvenile* AJH = NULL;
4242  unsigned size2;
4243  size2 = GetLiveArraySize(hob_Juvenile);
4244  for ( unsigned j = 0; j < size2; j++ ) {
4245  AJH = dynamic_cast < Hare_Juvenile * > ( TheArray[ hob_Juvenile ] [ j ] );
4246  if ((AJH->Supply_m_Location_x() >=x-500) &&(AJH->Supply_m_Location_x()< x+500) && (AJH->Supply_m_Location_y() >=y-500) && (AJH->Supply_m_Location_y()< y+500)) {
4247  if ( g_rand_uni()< huntpercent) {
4248  if (AJH->GetCurrentStateNo() != -1) {
4249  AJH->ON_Dead(); // Kill it
4250  m_shot++;
4251  }
4252  }
4253  }
4254  }
4255  Hare_Male* AH = NULL;
4256  size2 = GetLiveArraySize(hob_Male);
4257  for ( unsigned j = 0; j < size2; j++ ) {
4258  AH = dynamic_cast < Hare_Male * > ( TheArray[ hob_Male ] [ j ] );
4259  if ((AH->Supply_m_Location_x() >=x-500) &&(AH->Supply_m_Location_x()< x+500) && (AH->Supply_m_Location_y() >=y-500) && (AH->Supply_m_Location_y()< y+500)) {
4260  if ( g_rand_uni()< huntpercent) {
4261  if (AH->GetCurrentStateNo() != -1) {
4262  AH->ON_Dead(); // Kill it
4263  m_shot++;
4264  }
4265  }
4266  }
4267  }
4268  Hare_Female* AFH = NULL;
4269  size2 = GetLiveArraySize(hob_Female);
4270  for ( unsigned j = 0; j < size2; j++ ) {
4271  AFH = dynamic_cast < Hare_Female * > ( TheArray[ hob_Female ] [ j ] );
4272  if ((AFH->Supply_m_Location_x() >=x-500) && (AFH->Supply_m_Location_x()< x+500) && (AFH->Supply_m_Location_y() >=y-500) && (AFH->Supply_m_Location_y()< y+500)) {
4273  if ( g_rand_uni()< huntpercent) {
4274  if (AFH->GetCurrentStateNo() != -1) {
4275  AFH->ON_Dead(); // Kill it
4276  m_shot++;
4277  }
4278  }
4279  }
4280  }
4281  }
4282  }
4283  }
4284 }
4285 //-----------------------------------------------------------------------------
4286 
4292  m_Entries.resize(0);
4293 }
4294 //-----------------------------------------------------------------------------
4298 void MRR_Data::AddEntry(int a_RefNum) {
4299  // First do we have this RefNum in the vector?
4300  vector<MRR_Entry>::iterator current = m_Entries.begin();
4301  vector<MRR_Entry>::iterator found = m_Entries.end();
4302  bool flag=false;
4303  while (current != found)
4304  {
4305  if ( (*current).m_HareRefNum==a_RefNum ) {
4306  found=current;
4307  flag=true;
4308  } else current++;
4309  }
4310  MRR_Entry mre;
4311  if (flag) {
4312  // Get the entry out to mre
4313 // mre=(*found);
4314  if (m_currenttrapping<32) {
4315  unsigned int mask = 0x01 << m_currenttrapping;
4316  (*found).m_trappings1 += mask;
4317  } else {
4318  unsigned int mask = 0x01 << (m_currenttrapping-32);
4319  (*found).m_trappings2 += mask;
4320  }
4321  } else {
4322  mre.m_HareRefNum=a_RefNum;
4323  mre.m_trappings1=0;
4324  mre.m_trappings2=0;
4325  if (m_currenttrapping<32) {
4326  unsigned int mask = 0x01 << m_currenttrapping;
4327  mre.m_trappings1 += mask;
4328  } else {
4329  unsigned int mask = 0x01 << (m_currenttrapping-32);
4330  mre.m_trappings2 += mask;
4331  }
4332  m_Entries.insert(m_Entries.begin(),mre); // Put at the beginning because this is the one most likely found next time
4333  }
4334 }
4335 //-----------------------------------------------------------------------------
4336 
4341  FILE* MRROut = fopen("MRR_Hare.txt","w");
4342  if (!MRROut) {
4343  // something wrong if the program gets to here
4344  g_land->Warn("THare_Population_Manager::MRROutputs - MRR_Hare.txt can't be opened",NULL);
4345  exit(1);
4346  }
4347  vector<MRR_Entry>::iterator current = m_Entries.begin();
4348  MRR_Entry mre;
4349  for (vector<MRR_Entry>::iterator i = m_Entries.begin(); i< m_Entries.end(); i++) {
4350  mre=(*i);
4351  unsigned int mask= 0x01;
4352  for (int j=0; j<32; j++) {
4353  if ((mask & mre.m_trappings1) > 0 ) {
4354  fprintf(MRROut,"%d\t",1);
4355  } else fprintf(MRROut,"%d\t",0);
4356  mask = mask << 1;
4357  }
4358  mask=0;
4359  for (int j=0; j<32; j++) {
4360  if ((mask & mre.m_trappings2) > 0 ) {
4361  fprintf(MRROut,"%d\t",1);
4362  } else fprintf(MRROut,"%d\t",0);
4363  mask = mask << 1;
4364  }
4365  fprintf(MRROut,"%d\n",mre.m_HareRefNum);
4366  }
4367  fclose(MRROut);
4368 }
4369 //-----------------------------------------------------------------------------
4370 
4371 //*************************************************************************************
4372 //************************** PESTICIDE SPECIFIC EFFECT CODE ***************************
4373 //*************************************************************************************
4374 
4375 
4376 //-------------------------------------------------------------------------------------
4377 //-------------------- GENERAL ENDOCRINE DISRUPTOR EFFECT CODE ------------------------
4378 //-------------------------------------------------------------------------------------
4379 
4381 {
4382  // May also wish to specify certain gestation days for the effects here
4383  if (m_GestationCounter > 0)
4384  {
4385  m_pesticideInfluenced1 = true;
4386  }
4387 }
4388 
4389 //-------------------------------------------------------------------------------------
4390 //------------------------ GENERAL ORGANOPHOSPHATE EFFECT CODE ------------------------
4391 //-------------------------------------------------------------------------------------
4392 
4393 void Hare_Female::GeneralOrganoPhosphate(double /* a_dose */)
4394 {
4395  if (g_rand_uni() > l_pest_daily_mort.value()) return;
4397  m_StepDone = true;
4398  return;
4399 }
4400 
4401 //#####################################################################################
4402 //########################### END PESTICIDE HANDLING CODE #############################
4403 //#####################################################################################
cfg_littersize_SD12
static CfgFloat cfg_littersize_SD12("HARE_LITTERSIZE_SD_L", CFG_CUSTOM, 0.0)
TTypesOfPesticide
TTypesOfPesticide
Definition: Landscape.h:65
insecticide_treat
Definition: treatment.h:74
Hare_Female::st_Developing
TTypeOfHareState st_Developing()
Female Developing.
Definition: Hare_all.cpp:3297
tole_UrbanNoVeg
Definition: tole_declaration.h:78
Hare_Male::ReInit
void ReInit(struct_Hare a_data)
Male object reinitiation.
Definition: Hare_all.cpp:2675
struct_Hare::x
int x
Definition: Hare_all.h:137
tole_Saltwater
Definition: tole_declaration.h:66
cfg_hare_female_predation
static CfgFloat cfg_hare_female_predation("HARE_FEMALE_PREDATION", CFG_CUSTOM, 0.0023)
THare_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, void *null, struct_Hare *data, int number)
Method used to create new hares.
Definition: Hare_all.cpp:928
Hare_Female::st_Foraging
TTypeOfHareState st_Foraging()
Female Foraging.
Definition: Hare_all.cpp:3397
Hare_Young::OnFarmEvent
bool OnFarmEvent(FarmToDo event)
Response to farm actions.
Definition: Hare_all.cpp:1999
THare::m_vegPalatability
static double * m_vegPalatability
Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetatio...
Definition: Hare_all.h:318
THare_Population_Manager::m_MaxDailyGrowthEnergyF
double m_MaxDailyGrowthEnergyF[5001]
Precalculated max growth energy requirement with size for fat
Definition: Hare_all.h:780
Hare_Female::UpdateYoung
bool UpdateYoung(THare *a_old, THare *a_new)
Swap a young list pointer.
Definition: Hare_all.cpp:3823
strigling
Definition: treatment.h:77
THare_Population_Manager
The class that handles all the population lists for hares.
Definition: Hare_all.h:529
Hare_Female::GiveBirth
void GiveBirth()
Produce a litter.
Definition: Hare_all.cpp:3656
hay_bailing
Definition: treatment.h:89
ttop_ReproductiveEffects
Definition: Landscape.h:69
flower_cutting
Definition: treatment.h:109
Hare_Female::Mating
void Mating()
Mate.
Definition: Hare_all.cpp:3610
Hare_Juvenile::~Hare_Juvenile
virtual ~Hare_Juvenile()
Destructor for the juvenile hare object.
Definition: Hare_all.cpp:2247
tohs_NextStage
Definition: Hare_all.h:72
THare_Population_Manager::Catastrophe
virtual void Catastrophe()
Annual global change in population numbers.
Definition: Hare_all.cpp:4046
autumn_roll
Definition: treatment.h:38
THare_Population_Manager::m_DensityMap
int m_DensityMap[8][200][200]
Array storing densities measured in different ways
Definition: Hare_all.h:762
spring_sow_with_ferti
Definition: treatment.h:103
Population_Manager::m_catastrophestartyear
int m_catastrophestartyear
Definition: PopulationManager.h:532
Landscape::SupplyTemp
double SupplyTemp(void)
Definition: Landscape.h:1386
tole_Building
Definition: tole_declaration.h:62
THare_Population_Manager::m_PolyFood
double * m_PolyFood
Temporary storage
Definition: Hare_all.h:768
cfg_HareHuntingType
CfgInt cfg_HareHuntingType("HARE_HUNTING_TYPE", CFG_CUSTOM, 0)
Population_Manager::DoLast
virtual void DoLast()
Definition: PopulationManager.cpp:530
tole_Freshwater
Definition: tole_declaration.h:64
Hare_Young::st_Dispersal
TTypeOfHareState st_Dispersal()
Not used.
Definition: Hare_all.cpp:1916
cfg_hare_adult_predation
CfgFloat cfg_hare_adult_predation("HARE_ADULT_PREDATION", CFG_CUSTOM, 0.0023)
THare_Population_Manager::GetLitterSize
int GetLitterSize(int noLitters)
Returns the litter size.
Definition: Hare_all.cpp:744
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: Landscape.h:1321
struct_Hare::y
int y
Definition: Hare_all.h:138
Hare_Young::st_Foraging
TTypeOfHareState st_Foraging()
Young foraging.
Definition: Hare_all.cpp:1876
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: Landscape.h:1110
cfg_littersize_mean6
static CfgFloat cfg_littersize_mean6("HARE_LITTERSIZE_MEAN_F", CFG_CUSTOM, 1.72)
tole_Parkland
Definition: tole_declaration.h:77
cfg_hare_minimum_breeding_weight
CfgInt cfg_hare_minimum_breeding_weight("HARE_MIN_BREEDING_WT", CFG_CUSTOM, 780)
Hare_Female::ON_Dead
virtual void ON_Dead()
The female is dead.
Definition: Hare_all.cpp:3956
cfg_hare_young_predation
static CfgFloat cfg_hare_young_predation("HARE_YOUNG_PREDATION", CFG_CUSTOM, 0.002)
hob_Female
Definition: Hare_all.h:61
THare_Population_Manager::THare_Population_Manager
THare_Population_Manager(Landscape *L)
This is the constructor for the hare population manager.
Definition: Hare_all.cpp:383
tole_FishFarm
Definition: tole_declaration.h:102
THare_Population_Manager::m_DMWeight
double m_DMWeight[5001]
Array for storing minimum acceptable size with age.
Definition: Hare_all.h:746
cfg_hare_escape_dist
CfgInt cfg_hare_escape_dist("HARE_ESCAPE_DIST", CFG_CUSTOM, 100)
cfg_HareFemaleDensityDepValue
CfgFloat cfg_HareFemaleDensityDepValue("HARE_FEMALEDENDEPVALUE", CFG_CUSTOM, 0.1)
hob_Foobar
Definition: Hare_all.h:62
cfg_hare_max_age_var
CfgInt cfg_hare_max_age_var("HARE_MAX_AGE_VAR", CFG_CUSTOM, 180)
Population_Manager::TheArray
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
cfg_hare_max_dispersal
static CfgInt cfg_hare_max_dispersal("HARE_MAX_DISPERSAL", CFG_CUSTOM, 1000)
ttop_NoPesticide
Definition: Landscape.h:67
THare::m_pesticidedegradationrate
double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: Hare_all.h:306
tohs_Foraging
Definition: Hare_all.h:75
tole_Churchyard
Definition: tole_declaration.h:86
cfg_hare_DaysToGestation
static CfgInt cfg_hare_DaysToGestation("HARE_GESTATIONDAYS", CFG_CUSTOM, 41)
Population_Manager::m_population_type
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
cfg_HarePesticideAccumulationThreshold
CfgFloat cfg_HarePesticideAccumulationThreshold("HARE_PESTICIDEACCUMULATIONTHRESHOLD", CFG_CUSTOM, 0.0)
This is the value that triggers pesticide response, which may be a threshold, or if simply set to 0....
Hare_Female::BeginStep
virtual void BeginStep(void)
Female BeginStep.
Definition: Hare_all.cpp:3162
fa_ammoniumsulphate
Definition: treatment.h:65
Hare_Female::SanityCheckYoungList
bool SanityCheckYoungList()
Debug function.
Definition: Hare_all.cpp:3992
autumn_harrow
Definition: treatment.h:37
cfg_HareThresholdDD
CfgInt cfg_HareThresholdDD("HARE_THRESHOLDDD", CFG_CUSTOM, 5)
preseeding_cultivator
Definition: treatment.h:39
tohs_Resting
Definition: Hare_all.h:76
tohs_Developing
Definition: Hare_all.h:73
cfg_littersize_SD2
static CfgFloat cfg_littersize_SD2("HARE_LITTERSIZE_SD_B", CFG_CUSTOM, 0.957)
Hare_Infant::st_NextStage
void st_NextStage()
'mature' to become a young
Definition: Hare_all.cpp:1659
cfg_RipleysOutput_used
CfgBool cfg_RipleysOutput_used
cfg_BeetleBankMaxX
CfgInt cfg_BeetleBankMaxX
g_PropSolidFood
const double g_PropSolidFood[36]
Definition: Hare_all.cpp:289
THare::GetRefNum
int GetRefNum()
Get the refnum for this hare.
Definition: Hare_all.h:419
THare_Population_Manager::GetKJperM
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: Hare_all.h:626
THare::m_EnergyMax
double m_EnergyMax
State variable - the amount of energy it is possible to eat as a multiplyer or RMR.
Definition: Hare_all.h:223
autumn_sow
Definition: treatment.h:41
THare_Population_Manager::m_GrowthEfficiencyF
double m_GrowthEfficiencyF[5001]
Precalculated growth efficiency for fat with size
Definition: Hare_all.h:784
tole_Copse
Definition: tole_declaration.h:82
cfg_MRR3
static CfgInt cfg_MRR3("HARE_MMRTHREE", CFG_CUSTOM, 999)
cfg_VegHeightForageReduction
CfgFloat cfg_VegHeightForageReduction("HARE_VEGHEIGHTFORAGEREDUCTION", CFG_CUSTOM, 0.0003)
cfg_hare_StartingNo
static CfgInt cfg_hare_StartingNo("HARE_START_NO", CFG_CUSTOM, 50)
THare_Population_Manager::m_MaxDailyGrowthEnergyP
double m_MaxDailyGrowthEnergyP[5001]
Precalculated max growth energy requirement with size for protein
Definition: Hare_all.h:778
struct_Hare::age
int age
Definition: Hare_all.h:139
cfg_hare_proximity_alert
static CfgFloat cfg_hare_proximity_alert("HARE_PROXIMITY_ALERT", CFG_CUSTOM, 0.05)
cfg_BeetleBankInvert
CfgBool cfg_BeetleBankInvert
glyphosate
Definition: treatment.h:102
THare::m_Lifespan
int m_Lifespan
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)
Definition: Hare_all.h:198
Hare_Juvenile::WasPredated
virtual bool WasPredated()
Test for mortality.
Definition: Hare_all.cpp:2645
harvest
Definition: treatment.h:82
cfg_littersize_mean3
static CfgFloat cfg_littersize_mean3("HARE_LITTERSIZE_MEAN_C", CFG_CUSTOM, 2.514)
Population_Manager::ReallyBigOutputPrb
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
cfg_hare_foetusenergyproportion
CfgFloat cfg_hare_foetusenergyproportion("HARE_FOETUSENERGYPROPORTION", CFG_CUSTOM, 0.024)
cfg_AgeRelatedInterferenceScaling
CfgFloat cfg_AgeRelatedInterferenceScaling("HARE_AGERELATEDINTERFERENCESCALING", CFG_CUSTOM, 1.0)
tole_BareRock
Definition: tole_declaration.h:75
Hare_Juvenile::Init
void Init(double p_weight)
Object initiation.
Definition: Hare_all.cpp:2236
THare_Population_Manager::m_AdultMortRate
double m_AdultMortRate
Input variable - Adult mortality rate.
Definition: Hare_all.h:734
Hare_Female::st_Dispersal
TTypeOfHareState st_Dispersal()
Female Dispersal.
Definition: Hare_all.cpp:3485
g_land
Landscape * g_land
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
cfg_littersize_SD5
static CfgFloat cfg_littersize_SD5("HARE_LITTERSIZE_SD_E", CFG_CUSTOM, 0.6415)
fp_slurry
Definition: treatment.h:52
cfg_AOROutput_used
CfgBool cfg_AOROutput_used
Hare_Young::ReInit
void ReInit(struct_Hare a_data)
Young object reinitiation.
Definition: Hare_all.cpp:1722
THare_Population_Manager::~THare_Population_Manager
virtual ~THare_Population_Manager(void)
THare_Population_Manager destructor.
Definition: Hare_all.cpp:366
THare_Population_Manager::m_variableDD
int m_variableDD
Used to vary the density dependence each year
Definition: Hare_all.h:764
cfg_JuvDDScale
CfgFloat cfg_JuvDDScale("HARE_JUVSCALEDD", CFG_CUSTOM, 0.5)
cfg_littersize_SD1
static CfgFloat cfg_littersize_SD1("HARE_LITTERSIZE_SD_A", CFG_CUSTOM, 0.685)
cfg_MRR1
static CfgInt cfg_MRR1("HARE_MMRONE", CFG_CUSTOM, 999)
activity_gestation
Definition: Hare_all.h:98
cfg_hare_max_age
CfgInt cfg_hare_max_age("HARE_MAX_AGE", CFG_CUSTOM,(int)(365 *12.5))
Hare_Male::st_Developing
TTypeOfHareState st_Developing()
Male Development.
Definition: Hare_all.cpp:2946
g_FarmIntensivenessH
double g_FarmIntensivenessH
Definition: Hare_all.cpp:284
cfg_littersize_mean11
static CfgFloat cfg_littersize_mean11("HARE_LITTERSIZE_MEAN_K", CFG_CUSTOM, 1.72)
THare::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: HareForagenPeg.cpp:551
Population_Manager::OpenTheRipleysOutputProbe
bool OpenTheRipleysOutputProbe(string a_NWordFilename)
Definition: PopulationManager.cpp:757
fp_rsm
Definition: treatment.h:58
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_all.h:203
Landscape::SupplyMonth
int SupplyMonth(void)
Definition: Landscape.h:1601
fa_sludge
Definition: treatment.h:68
fa_rsm
Definition: treatment.h:69
Hare_Male::~Hare_Male
virtual ~Hare_Male()
Destructor.
Definition: Hare_all.cpp:2699
cfg_adult_starve
CfgInt cfg_adult_starve("HARE_ADULT_STARVE", CFG_CUSTOM, 5000)
Hare_Juvenile::ON_Dead
virtual void ON_Dead()
Definition: Hare_all.cpp:2654
THare_Population_Manager::m_LitterSize
int m_LitterSize[12][7]
Storage for litter size distributions (not used in default config)
Definition: Hare_all.h:766
THare_Population_Manager::AddHareDensity
void AddHareDensity(int x, int y, Hare_Object a_type)
Density function - adds one to the density in the square containing by x,y. Each square is 256x256m i...
Definition: Hare_all.h:641
Hare_Female::ON_YoungKilled
void ON_YoungKilled(THare *a_young)
A leveret has been killed.
Definition: Hare_all.cpp:3850
Hare_Male::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_all.cpp:3051
fp_greenmanure
Definition: treatment.h:56
Population_Manager::m_SimulationName
char m_SimulationName[255]
Definition: PopulationManager.h:513
AnimalPosition::m_x
unsigned m_x
Definition: PopulationManager.h:172
struct_Hare::Mum
Hare_Female * Mum
Definition: Hare_all.h:142
TOP_Hare
Definition: PopulationManager.h:64
cfg_hare_femalesterility
static CfgInt cfg_hare_femalesterility("HARE_FEMALESTERILITY", CFG_CUSTOM, 1401)
cfg_HareStartWeight
static CfgFloat cfg_HareStartWeight("HARE_STARTWEIGHT", CFG_CUSTOM, 121.0 *0.88 *0.33)
THare::m_OurPopulationManager
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: Hare_all.h:194
struct_Hare::HM
THare_Population_Manager * HM
Definition: Hare_all.h:141
straw_removal
Definition: treatment.h:112
Hare_Female
Class for female hares.
Definition: Hare_all.h:1040
Population_Manager::GetLiveArraySize
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
hay_turning
Definition: treatment.h:88
bulb_harvest
Definition: treatment.h:110
TAnimal::Supply_m_Location_x
int Supply_m_Location_x()
Definition: PopulationManager.h:213
Hare_Infant::Init
void Init()
Object initiation.
Definition: Hare_all.cpp:1285
Hare_Juvenile::Step
virtual void Step(void)
Step for Hare_Juvenile.
Definition: Hare_all.cpp:2316
straw_covering
Definition: treatment.h:111
shallow_harrow
Definition: treatment.h:107
THare_Population_Manager::m_GrowthEfficiencyP
double m_GrowthEfficiencyP[5001]
Precalculated growth efficiency for protein with size
Definition: Hare_all.h:782
cfg_hare_firstyearsterility
static CfgInt cfg_hare_firstyearsterility("HARE_FIRSTYEARSTERILITY", CFG_CUSTOM, 769)
hob_Young
Definition: Hare_all.h:58
THare::loadVegPalatability
void loadVegPalatability(void)
Loads static member m_vegPalatability with data.
Definition: Hare_THare.cpp:116
THare::GetMum
Hare_Female * GetMum()
Get the mother pointer.
Definition: Hare_all.h:404
cfg_HareFemaleSicknessDensityDepValue
CfgInt cfg_HareFemaleSicknessDensityDepValue("HARE_FEMALESICKNESSDENDEPVALUE", CFG_CUSTOM, 40)
activity_inoestrous
Definition: Hare_all.h:97
Hare_Young::BeginStep
virtual void BeginStep(void)
BeginStep for Hare_Young.
Definition: Hare_all.cpp:1754
THare_Population_Manager::GetMaxDailyGrowthEnergyF
double GetMaxDailyGrowthEnergyF(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in fat construction.
Definition: Hare_all.h:578
TAnimal::Dying
virtual void Dying()
Definition: PopulationManager.h:266
heavy_cultivator_aggregate
Definition: treatment.h:108
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_all.h:238
water
Definition: treatment.h:80
cfg_juvenile_starvation_threshold
static CfgInt cfg_juvenile_starvation_threshold("HARE_JUVENILE_STARVE_THRESHOLD", CFG_CUSTOM, 16)
g_hare_peg_inertia
double g_hare_peg_inertia
Definition: Hare_all.cpp:50
Hare_Juvenile::ShouldMature
bool ShouldMature()
Test for maturation.
Definition: Hare_all.cpp:2630
THare_Population_Manager::m_HareThresholdDD
int m_HareThresholdDD
Input variable - Threshold density dependence level.
Definition: Hare_all.h:750
Hare_Infant::OnFarmEvent
bool OnFarmEvent(FarmToDo event)
Do we require a response to a farm event.
Definition: Hare_all.cpp:1408
fp_liquidNH3
Definition: treatment.h:51
THare::GetRMR
double GetRMR()
Get todays RMR.
Definition: Hare_THare.cpp:349
THare_Population_Manager::DoFirst
virtual void DoFirst()
The first method called of the new time-step.
Definition: Hare_all.cpp:817
Hare_Female::EndStep
virtual void EndStep(void)
Female EndStep.
Definition: Hare_all.cpp:3291
molluscicide
Definition: treatment.h:75
THare_Population_Manager::m_KJperM
double m_KJperM[7001]
Precalculated cost of locomotion - KJ per m per kg
Definition: Hare_all.h:786
THare_Population_Manager::m_GoodYearBadYear
float m_GoodYearBadYear
Variable for adding stochasticity.
Definition: Hare_all.h:742
burn_straw_stubble
Definition: treatment.h:92
THare_Population_Manager::HuntingDifferentiatedBeetleBankArea
void HuntingDifferentiatedBeetleBankArea(void)
Definition: Hare_all.cpp:4178
THare::Forage
double Forage(int &time)
Foraging.
Definition: HareForagenPeg.cpp:54
MRR_Data::OutputToFile
void OutputToFile()
Definition: Hare_all.cpp:4340
Population_Manager::SimW
int SimW
Definition: PopulationManager.h:511
tole_Stream
Definition: tole_declaration.h:89
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
cfg_infant_starvation_threshold
static CfgInt cfg_infant_starvation_threshold("HARE_INFANT_STARVE_THRESHOLD", CFG_CUSTOM, 4)
cfg_HareHunting
CfgFloat cfg_HareHunting("HARE_HUNTING", CFG_CUSTOM, 0.15)
Hare_Male::EndStep
virtual void EndStep(void)
EndStep code for Hare_Male.
Definition: Hare_all.cpp:2859
cfg_pm_eventfrequency
CfgInt cfg_pm_eventfrequency
struct_Hare::RefNum
int RefNum
Definition: Hare_all.h:143
Hare_Male::GeneralOrganoPhosphate
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method...
Definition: Hare_all.cpp:3099
THare_Population_Manager::m_MortStochast
double m_MortStochast
Stochasticity around mortality parameters
Definition: Hare_all.h:758
MRR_Entry::m_trappings2
int m_trappings2
Definition: Hare_all.h:111
cfg_hare_i_cut
CfgInt cfg_hare_i_cut("HARE_CUTTING_MORT_INFANT", CFG_CUSTOM, 50)
Hare_Male::ON_Dead
virtual void ON_Dead()
Definition: Hare_all.cpp:3044
THare_Population_Manager::Init
void Init()
Sets up data structures and calculations prior to starting simulation.
Definition: Hare_all.cpp:402
cattle_out_low
Definition: treatment.h:100
cfg_HareMaleDensityDepValue
CfgFloat cfg_HareMaleDensityDepValue("HARE_MALEDENDEPVALUE", CFG_CUSTOM, 0.1)
cfg_BeetleBankMinY
CfgInt cfg_BeetleBankMinY
tohs_DestroyObject
Definition: Hare_all.h:80
Hare_Female::m_OestrousCounter
int m_OestrousCounter
State variable - Days in oestrous.
Definition: Hare_all.h:1052
cfg_young_starvation_threshold
static CfgInt cfg_young_starvation_threshold("HARE_YOUNG_STARVE_THRESHOLD", CFG_CUSTOM, 4)
cfg_hare_adult_breed_threshold
static CfgFloat cfg_hare_adult_breed_threshold("HARE_ADULT_BREED_THESHOLD", CFG_CUSTOM, 1600 *0.03)
cfg_hare_sex_ratio
static CfgInt cfg_hare_sex_ratio("HARE_SEX_RATIO", CFG_CUSTOM, 50)
cfg_Hare_Recovery_Time
CfgInt cfg_Hare_Recovery_Time("HARE_RECOVERY_TIME", CFG_CUSTOM, 10)
Population_Manager::m_AOR_Probe
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526
TAnimal::SupplyPoint
APoint SupplyPoint()
Definition: PopulationManager.h:209
fp_pk
Definition: treatment.h:50
Hare_Juvenile::BeginStep
virtual void BeginStep(void)
BeginStep for Hare_Juvenile.
Definition: Hare_all.cpp:2261
cfg_HareMortStochasticity
CfgFloat cfg_HareMortStochasticity("HARE_MORTSTOCHASTICITY", CFG_CUSTOM, 1.0)
g_MaxLeveretGrowthEnergy
const double g_MaxLeveretGrowthEnergy[36]
Definition: Hare_all.cpp:300
fa_npk
Definition: treatment.h:61
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:112
cattle_out
Definition: treatment.h:83
cfg_min_growth_attain
CfgFloat cfg_min_growth_attain("HARE_MINGROWTHATTAIN", CFG_CUSTOM, 0.475)
THare_Population_Manager::TheRipleysOutputProbe
virtual void TheRipleysOutputProbe(FILE *a_prb)
Standard spatial output.
Definition: Hare_all.cpp:1198
THare
The base class for all hare classes.
Definition: Hare_all.h:154
THare::m_KJWalking
double m_KJWalking
KJ/m cost of walking per kg hare.
Definition: Hare_all.h:233
Hare_Young::Hare_Young
Hare_Young(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for Hare_Young.
Definition: Hare_all.cpp:1716
THare::m_fatReserve
double m_fatReserve
State variable - the energy reserve of the hare.
Definition: Hare_all.h:213
fp_npk
Definition: treatment.h:49
fa_npks
Definition: treatment.h:60
cfg_BeetleBankMinX
CfgInt cfg_BeetleBankMinX
Hare_Juvenile::st_NextStage
void st_NextStage()
Maturation to Hare_Male or Hare_Female.
Definition: Hare_all.cpp:2607
cfg_young_ddepmort
CfgInt cfg_young_ddepmort("HARE_YOUNGDDEPMORT", CFG_CUSTOM, 16)
stubble_harrowing
Definition: treatment.h:90
THare::m_lastYearsDensity
int m_lastYearsDensity
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:276
cfg_hare_adult_dispersal_threshold
static CfgFloat cfg_hare_adult_dispersal_threshold("HARE_ADULT_DISP_THESHOLD", CFG_CUSTOM, 1600 *0.02)
THare_Population_Manager::ExtraPopMort
void ExtraPopMort(void)
An extra global mortality
Definition: Hare_all.cpp:4093
THare::SetMum
void SetMum(Hare_Female *)
Set the mother pointer. Reimplemented in Hare_Infant.
Definition: Hare_all.h:399
THare_Population_Manager::GetMaxDailyGrowthEnergy
double GetMaxDailyGrowthEnergy(int a_age)
Definition: Hare_all.h:552
THare::m_experiencedDensity
int m_experiencedDensity
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:271
stubble_plough
Definition: treatment.h:35
THare::m_KJRunning
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: Hare_all.h:228
cfg_maxLeveretBirthWeight
static CfgFloat cfg_maxLeveretBirthWeight("HARE_MAXLEVERETBIRTHWEIGHT", CFG_CUSTOM, 125 *0.88 *0.33)
autumn_plough
Definition: treatment.h:34
tole_Pond
Definition: tole_declaration.h:101
Hare_Female::Step
virtual void Step(void)
Female Step.
Definition: Hare_all.cpp:3236
Hare_Male::BeginStep
virtual void BeginStep(void)
BeginStep for Hare_Male.
Definition: Hare_all.cpp:2715
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: Landscape.h:1637
activity_Foraging
Definition: Hare_all.h:92
fp_manure
Definition: treatment.h:55
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: Landscape.h:1632
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
strigling_sow
Definition: treatment.h:95
cfg_hare_juvenile_predation
static CfgFloat cfg_hare_juvenile_predation("HARE_JUVENILE_PREDATION", CFG_CUSTOM, 0.0016)
cfg_littersize_mean7
static CfgFloat cfg_littersize_mean7("HARE_LITTERSIZE_MEAN_G", CFG_CUSTOM, 2.17)
cfg_ForageRestingRatio
CfgFloat cfg_ForageRestingRatio("HARE_FORAGERESTRATIO", CFG_CUSTOM, 0.67)
THare::m_RefNum
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: Hare_all.h:265
Hare_Infant::ON_BeingFed
void ON_BeingFed(double a_someMilk)
Get energy from milk given.
Definition: Hare_all.cpp:1698
cfg_Hare_StdSpeedWalking
CfgFloat cfg_Hare_StdSpeedWalking("HARE_STD_SPEEDWALKING", CFG_CUSTOM, 0.65 *60)
Landscape::CorrectCoordsPt
APoint CorrectCoordsPt(int x, int y)
Function to prevent wrap around errors with co-ordinates using x/y pair.
Definition: Landscape.h:1544
THare::m_pesticideInfluenced1
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Hare_all.h:311
THare_Population_Manager::DoAlmostLast
virtual void DoAlmostLast()
Called before clean-up of dead objects.
Definition: Hare_all.cpp:907
Hare_Young::st_Resting
TTypeOfHareState st_Resting()
Resting.
Definition: Hare_all.cpp:1926
Hare_Female::PlaceYoung
APoint PlaceYoung()
Find somewhere nice for the babies to hide.
Definition: Hare_all.cpp:3755
Hare_Juvenile::EndStep
virtual void EndStep(void)
BeginStep for Hare_Juvenile.
Definition: Hare_all.cpp:2379
cfg_littersize_SD7
static CfgFloat cfg_littersize_SD7("HARE_LITTERSIZE_SD_G", CFG_CUSTOM, 0.955)
Hare_Male::st_ReproBehaviour
TTypeOfHareState st_ReproBehaviour()
Currently Unused.
Definition: Hare_all.cpp:3034
THare_Population_Manager::HuntingGrid
void HuntingGrid(void)
Definition: Hare_all.cpp:4227
THare::Walking
void Walking(int a_dist, int a_direction)
Walking.
Definition: Hare_THare.cpp:183
Hare_Female::GeneralEndocrineDisruptor
virtual void GeneralEndocrineDisruptor(double a_pesticide_dose)
Handles internal effects of endocrine distrupter pesticide exposure for female.
Definition: Hare_all.cpp:4380
struct_Hare::L
Landscape * L
Definition: Hare_all.h:140
Hare_Female::m_NoYoung
int m_NoYoung
State variable - current litter size.
Definition: Hare_all.h:1045
g_VegHeightForageReduction
double g_VegHeightForageReduction
Used to scale access to crops for modern day farm intensiveness.
Definition: Hare_all.cpp:282
Hare_Infant::SetWeight
void SetWeight(double w)
Set the weight.
Definition: Hare_all.h:851
TAnimal
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
Hare_Female::st_ReproBehaviour
TTypeOfHareState st_ReproBehaviour()
Reproductive behaviour control.
Definition: Hare_all.cpp:3520
cfg_HareHuntingThreshold
CfgInt cfg_HareHuntingThreshold("HARE_HUNTING_THRESHOLD", CFG_CUSTOM, 0)
THare_Population_Manager::m_shot
int m_shot
Hunting Bag.
Definition: Hare_all.h:756
cfg_fixadult_starve
CfgInt cfg_fixadult_starve("HARE_FIXADULT_STARVE", CFG_CUSTOM, 360)
cfg_MRR_FirstYear
static CfgInt cfg_MRR_FirstYear("HARE_MRRFIRSTYEAR", CFG_CUSTOM, 10000)
winter_plough
Definition: treatment.h:42
cfg_littersize_SD3
static CfgFloat cfg_littersize_SD3("HARE_LITTERSIZE_SD_C", CFG_CUSTOM, 0.955)
activity_Dispersal
Definition: Hare_all.h:94
Hare_Female::SetSterile
void SetSterile()
Female is sterile.
Definition: Hare_all.h:1093
Hare_Infant::ON_Dead
virtual void ON_Dead()
This hare has been killed.
Definition: Hare_all.cpp:1688
Hare_Male::Init
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_all.cpp:2686
AnimalPosition
A class defining an animals position.
Definition: PopulationManager.h:168
Hare_Female::AllYoungMatured
void AllYoungMatured()
No more young to look after.
Definition: Hare_all.cpp:3931
THare_Population_Manager::GetMaxDailyGrowthEnergyP
double GetMaxDailyGrowthEnergyP(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in protein construction.
Definition: Hare_all.h:565
THare::MovePeg
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:527
cfg_hare_juvenile_dispersal_threshold
static CfgFloat cfg_hare_juvenile_dispersal_threshold("HARE_JUVENILE_DISP_THESHOLD", CFG_CUSTOM, 99999)
cfg_HareHuntingBeetleBankArea
CfgFloat cfg_HareHuntingBeetleBankArea("HARE_HUNTING_BEETLEBANKAREA", CFG_CUSTOM, 0.95)
MRR_Data::m_Entries
vector< MRR_Entry > m_Entries
Definition: Hare_all.h:127
FloatToDouble
void FloatToDouble(double &d, float f)
THare_Population_Manager::GetRMR
double GetRMR(int a_age, double a_size)
Returns the RMR given a specific age and mass.
Definition: Hare_all.cpp:1034
cfg_littersize_SD11
static CfgFloat cfg_littersize_SD11("HARE_LITTERSIZE_SD_K", CFG_CUSTOM, 0.6415)
Population_Manager::BeforeStepActions
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
Hare_Infant
Class for infant hares (stationary, only milk inputs)
Definition: Hare_all.h:817
Hare_Juvenile::st_Resting
TTypeOfHareState st_Resting()
Juvenile Resting.
Definition: Hare_all.cpp:2507
tole_UrbanPark
Definition: tole_declaration.h:79
cfg_HareWalkingPowerConst
CfgFloat cfg_HareWalkingPowerConst("HARE_WALKINGPOWERCONST", CFG_CUSTOM, -0.316)
Hare_Female::m_sterile
bool m_sterile
State variable - is/not sterile.
Definition: Hare_all.h:1049
THare_Population_Manager::GetGrowthEfficiencyF
double GetGrowthEfficiencyF(int a_age)
Get the growth efficiency for this a_age for creating fat.
Definition: Hare_all.h:614
MRR_Entry::m_HareRefNum
int m_HareRefNum
Definition: Hare_all.h:109
THare_Population_Manager::POMOutputs
void POMOutputs()
This method is called to dump the information needed for POM approaches.
Definition: Hare_all.cpp:1073
THare::ON_Dead
virtual void ON_Dead(void)
Mortality - overridden in descendent classes.
Definition: Hare_all.h:424
MRR_Data::IncTrapping
void IncTrapping()
Definition: Hare_all.h:123
cfg_MRR_LastYear
static CfgInt cfg_MRR_LastYear("HARE_MRRLASTYEAR", CFG_CUSTOM, 0)
THare::m_old_weight
double m_old_weight
State variale - last hare weight.
Definition: Hare_all.h:185
hob_Male
Definition: Hare_all.h:60
THare::GetAge
int GetAge()
Definition: Hare_all.h:377
THare::m_ddindex
int m_ddindex
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:281
fp_sludge
Definition: treatment.h:57
Population_Manager
Base class for all population managers.
Definition: PopulationManager.h:424
cfg_hare_y_cut
CfgInt cfg_hare_y_cut("HARE_CUTTING_MORT_YOUNG", CFG_CUSTOM, 10)
straw_chopping
Definition: treatment.h:87
THare::m_TodaysEnergy
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: Hare_all.h:218
fungicide_treat
Definition: treatment.h:73
deep_ploughing
Definition: treatment.h:43
preseeding_cultivator_sow
Definition: treatment.h:40
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: Landscape.h:1596
Hare_Young::st_NextStage
void st_NextStage()
Maturation to Hare_Juvenile.
Definition: Hare_all.cpp:1970
mow
Definition: treatment.h:93
fa_pk
Definition: treatment.h:62
cfg_DaysToOestrous
static CfgInt cfg_DaysToOestrous("HARE_DAYSTOOESTROUS", CFG_CUSTOM, 20)
cfg_pm_eventsize
CfgInt cfg_pm_eventsize
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
Landscape::SupplyPesticideType
TTypesOfPesticide SupplyPesticideType(void)
Definition: Landscape.h:433
Hare_Female::m_MyYoung
TListOfHares m_MyYoung
Pointer to litter.
Definition: Hare_all.h:1060
cfg_littersize_SD6
static CfgFloat cfg_littersize_SD6("HARE_LITTERSIZE_SD_F", CFG_CUSTOM, 0.6415)
cfg_littersize_mean1
static CfgFloat cfg_littersize_mean1("HARE_LITTERSIZE_MEAN_A", CFG_CUSTOM, 1.535)
cfg_MRR2
static CfgInt cfg_MRR2("HARE_MMRTWO", CFG_CUSTOM, 999)
tohs_Dying
Definition: Hare_all.h:79
spring_harrow
Definition: treatment.h:45
THare::EnergyBalance
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:277
cfg_littersize_SD9
static CfgFloat cfg_littersize_SD9("HARE_LITTERSIZE_SD_I", CFG_CUSTOM, 0.6415)
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: Landscape.h:1616
Hare_Female::m_LeveretMaterial
double m_LeveretMaterial
State variable - Mass of foetal material.
Definition: Hare_all.h:1056
Hare_Infant::~Hare_Infant
virtual ~Hare_Infant()
Hare infant destructor.
Definition: Hare_all.cpp:1295
Hare_Infant::BeginStep
virtual void BeginStep(void)
BeginStep for the Hare_Infant.
Definition: Hare_all.cpp:1308
THare::m_foragingenergy
double m_foragingenergy
Energy obtained from foraging/feeding.
Definition: Hare_all.h:252
cfg_littersize_mean8
static CfgFloat cfg_littersize_mean8("HARE_LITTERSIZE_MEAN_H", CFG_CUSTOM, 1.72)
Hare_Male::st_Resting
TTypeOfHareState st_Resting()
Male Resting.
Definition: Hare_all.cpp:2937
Hare_Female::ON_RemoveYoung
void ON_RemoveYoung(THare *a_young)
A leveret has matured.
Definition: Hare_all.cpp:3901
MRR_Data
Class for running mark-release-recapture experiments.
Definition: Hare_all.h:118
tole_MetalledPath
Definition: tole_declaration.h:84
Hare_Juvenile::ReInit
void ReInit(struct_Hare a_data)
Juvenile object reinitiation.
Definition: Hare_all.cpp:2225
Hare_Female::ReInit
void ReInit(struct_Hare a_data)
Female object reinitiation.
Definition: Hare_all.cpp:3123
tohs_InitialState
Definition: Hare_all.h:71
THare_Population_Manager::m_YoungMortRate
double m_YoungMortRate
Input variable - Young mortality rate.
Definition: Hare_all.h:738
cfg_MaxEnergyIntakeScaler
static CfgFloat cfg_MaxEnergyIntakeScaler("HARE_MAXENERGYINTAKESCALER", CFG_CUSTOM, 3.0)
THare_Population_Manager::m_RMR
double m_RMR[2][366]
Precalculated RMR with age
Definition: Hare_all.h:772
tole_SandDune
Definition: tole_declaration.h:81
cfg_HareInterferenceConstant
CfgFloat cfg_HareInterferenceConstant("HARE_INTERFERENCECONSTANT", CFG_CUSTOM,-0.03)
AnimalPosition::m_y
unsigned m_y
Definition: PopulationManager.h:173
tohs_ReproBehaviour
Definition: Hare_all.h:77
Hare_Female::dumpEnergy
void dumpEnergy()
Used to record energetic status.
Definition: Hare_all.cpp:3472
Hare_Female::AllYoungKilled
void AllYoungKilled()
Last leveret predated.
Definition: Hare_all.cpp:3879
Hare_Female::m_litter_no
int m_litter_no
State variable - current litter number.
Definition: Hare_all.h:1047
hob_Juvenile
Definition: Hare_all.h:59
Hare_Juvenile::st_Dispersal
TTypeOfHareState st_Dispersal()
Juvenile Dispersal.
Definition: Hare_all.cpp:2449
THare_Population_Manager::TheAOROutputProbe
virtual void TheAOROutputProbe()
Output method.
Definition: Hare_all.cpp:1217
THare::st_Dying
void st_Dying()
Tidy up before removing the object on death.
Definition: Hare_THare.cpp:172
THare_Population_Manager::m_JuvMortRate
double m_JuvMortRate
Input variable - Juvenile mortality rate.
Definition: Hare_all.h:730
THare_Population_Manager::GetAdultDensity
int GetAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y. Each square is 256x...
Definition: Hare_all.h:681
cfg_RMRrainFactor
CfgFloat cfg_RMRrainFactor("HARE_RMRRAINFACTOR", CFG_CUSTOM, 0.47)
hilling_up
Definition: treatment.h:79
cfg_HareFemaleReproMortValue
CfgInt cfg_HareFemaleReproMortValue("HARE_FEMALEREPROMORT", CFG_CUSTOM, 0)
Hare_Young
Class for young hares (low mobility, milk and solid food inputs)
Definition: Hare_all.h:872
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
tole_River
Definition: tole_declaration.h:65
cfg_adult_starvation_threshold
static CfgInt cfg_adult_starvation_threshold("HARE_ADULT_STARVE_THRESHOLD", CFG_CUSTOM, 16)
Hare_Male
Class for male hares.
Definition: Hare_all.h:976
activity_oestrouscycle
Definition: Hare_all.h:96
THare::m_expDensity
int m_expDensity[365]
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:286
THare::m_DensitySum
int m_DensitySum
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:291
biocide
Definition: treatment.h:104
Population_Manager::StateNames
const char * StateNames[100]
Definition: PopulationManager.h:531
cfg_littersize_mean5
static CfgFloat cfg_littersize_mean5("HARE_LITTERSIZE_MEAN_E", CFG_CUSTOM, 1.72)
THare_Population_Manager::BodyBurdenPrb
FILE * BodyBurdenPrb
Definition: Hare_all.h:790
fa_calcium
Definition: treatment.h:70
THare::m_pesticide_burden
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Hare_all.h:301
syninsecticide_treat
Definition: treatment.h:99
fa_manure
Definition: treatment.h:66
THare_Population_Manager::MRROutputs
void MRROutputs()
Special probe for data to be used in mark-release-recapture simulations.
Definition: Hare_all.cpp:1232
cfg_ReproStartDay
static CfgInt cfg_ReproStartDay("HARE_REPROSTARTDAY", CFG_CUSTOM, 18)
cfg_MRR5
static CfgInt cfg_MRR5("HARE_MMRFIVE", CFG_CUSTOM, 270)
Hare_Infant::ReInit
void ReInit(struct_Hare a_data)
Infant object reinitiation.
Definition: Hare_all.cpp:1276
fp_npks
Definition: treatment.h:48
THare::m_Age
int m_Age
State variale - hare age.
Definition: Hare_all.h:170
row_cultivation
Definition: treatment.h:76
cfg_FarmIntensiveness
CfgFloat cfg_FarmIntensiveness("HARE_FARMINTENSIVENESS", CFG_CUSTOM, 0.01)
Landscape::SupplyRain
double SupplyRain(void)
Definition: Landscape.h:1365
THare::ForageP
double ForageP(int &time)
Foraging but also incorporating pesticide exposure.
Definition: HareForagenPeg.cpp:181
Population_Manager::m_TheLandscape
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
MRR_Data::MRR_Data
MRR_Data()
Definition: Hare_all.cpp:4290
cfg_littersize_mean9
static CfgFloat cfg_littersize_mean9("HARE_LITTERSIZE_MEAN_I", CFG_CUSTOM, 1.72)
trial_insecticidetreat
Definition: treatment.h:96
activity_lactation
Definition: Hare_all.h:100
Hare_Object
Hare_Object
Definition: Hare_all.h:56
MRR_Data::m_currenttrapping
int m_currenttrapping
Definition: Hare_all.h:126
Population_Manager::OpenTheReallyBigProbe
bool OpenTheReallyBigProbe()
Definition: PopulationManager.cpp:859
cfg_ReallyBigOutput_used
CfgBool cfg_ReallyBigOutput_used
Landscape::SupplyVegHeight
double SupplyVegHeight(int a_polyref)
Definition: Landscape.h:936
Hare_Infant::EndStep
virtual void EndStep(void)
EndStep for the Hare_Infant.
Definition: Hare_all.cpp:1390
THare::m_CurrentHState
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: Hare_all.h:165
Hare_Female::GeneralOrganoPhosphate
virtual void GeneralOrganoPhosphate(double a_pesticide_dose)
Handles internal effects of organophosphate pesticide exposure for female.
Definition: Hare_all.cpp:4393
THare::m_IamSick
bool m_IamSick
flag for sickness - used in conjunction with disease configurations
Definition: Hare_all.h:295
cfg_HareHuntingDate
CfgInt cfg_HareHuntingDate("HARE_HUNTING_DATE", CFG_CUSTOM, 312)
struct_Hare
Class used to pass hare information to CreateObjects.
Definition: Hare_all.h:134
activity_givebirth
Definition: Hare_all.h:99
THare_Population_Manager::GetInterference
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: Hare_all.h:700
Hare_Female::ON_AreYouMyMum
bool ON_AreYouMyMum(THare *a_young)
Debug function.
Definition: Hare_all.cpp:3974
hob_Infant
Definition: Hare_all.h:57
Population_Manager::SimH
int SimH
Definition: PopulationManager.h:511
Hare_Male::Hare_Male
Hare_Male(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
Constructor.
Definition: Hare_all.cpp:2668
fp_ammoniumsulphate
Definition: treatment.h:54
stubble_cultivator_heavy
Definition: treatment.h:36
Population_Manager::m_ListNameLength
unsigned m_ListNameLength
Definition: PopulationManager.h:538
THare_Population_Manager::CalcLitterSize
void CalcLitterSize(double mean, double SD, int litter)
Definition: Hare_all.cpp:709
TALMaSSObject::GetCurrentStateNo
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
spring_plough
Definition: treatment.h:44
fa_greenmanure
Definition: treatment.h:67
Hare_Male::Step
virtual void Step(void)
Step for Hare_Male.
Definition: Hare_all.cpp:2798
THare::m_StarvationDays
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: Hare_all.h:208
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
Hare_Female::DoLactation
void DoLactation()
Lactation.
Definition: Hare_all.cpp:3787
THare_Population_Manager::Hunting
void Hunting(void)
Definition: Hare_all.cpp:4131
TAnimal::CheckManagement
void CheckManagement(void)
Definition: PopulationManager.cpp:1404
TAnimal::Supply_m_Location_y
int Supply_m_Location_y()
Definition: PopulationManager.h:216
Hare_Female::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_all.cpp:4008
THare_Population_Manager::DoLast
virtual void DoLast()
The last method called before the new time-step starts.
Definition: Hare_all.cpp:763
g_FarmIntensiveness
double g_FarmIntensiveness
Definition: Hare_all.cpp:283
fp_calcium
Definition: treatment.h:59
THare_Population_Manager::m_OurMRRData
MRR_Data * m_OurMRRData
Data structure for MarkReleaseRecapture expts
Definition: Hare_all.h:788
cfg_littersize_SD10
static CfgFloat cfg_littersize_SD10("HARE_LITTERSIZE_SD_J", CFG_CUSTOM, 0.6415)
trial_toxiccontrol
Definition: treatment.h:97
spring_roll
Definition: treatment.h:46
THare_Population_Manager::m_MaxDailyGrowthEnergy
double m_MaxDailyGrowthEnergy[5001]
Precalculated max growth energy requirement with size
Definition: Hare_all.h:774
fa_manganesesulphate
Definition: treatment.h:64
tole_HeritageSite
Definition: tole_declaration.h:90
bed_forming
Definition: treatment.h:106
cut_weeds
Definition: treatment.h:94
Hare_Infant::Step
virtual void Step(void)
Step for the Hare_Infant.
Definition: Hare_all.cpp:1355
cfg_littersize_mean12
static CfgFloat cfg_littersize_mean12("HARE_LITTERSIZE_MEAN_L", CFG_CUSTOM, 0.0)
Hare_Infant::st_Developing
TTypeOfHareState st_Developing()
Developmental behaviour for the infant hare.
Definition: Hare_all.cpp:1615
cfg_ReproEndDay
static CfgInt cfg_ReproEndDay("HARE_REPROENDDAY", CFG_CUSTOM, 240)
cfg_littersize_mean2
static CfgFloat cfg_littersize_mean2("HARE_LITTERSIZE_MEAN_B", CFG_CUSTOM, 2.508)
fp_manganesesulphate
Definition: treatment.h:53
THare::GetTotalWeight
double GetTotalWeight()
Provide the wet weight of the hare.
Definition: Hare_all.h:370
Hare_Infant::Hare_Infant
Hare_Infant(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Hare infant constructor.
Definition: Hare_all.cpp:1270
MRR_Entry
Data entry for mark release recapture data MRR_Data.
Definition: Hare_all.h:108
herbicide_treat
Definition: treatment.h:71
THare::Running
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:152
THare::m_MyMum
Hare_Female * m_MyMum
Pointer to the hare's mum.
Definition: Hare_all.h:190
cfg_Hare_StdSpeedRunning
CfgFloat cfg_Hare_StdSpeedRunning("HARE_STD_SPEEDRUNNING", CFG_CUSTOM, 13 *60)
MRR_Data::AddEntry
void AddEntry(int a_RefNum)
Definition: Hare_all.cpp:4298
l_pest_daily_mort
CfgFloat l_pest_daily_mort
cfg_hare_ExtEff
CfgFloat cfg_hare_ExtEff("HARE_EXTEFF", CFG_CUSTOM, 3.25)
cfg_MRR4
static CfgInt cfg_MRR4("HARE_MMRFOUR", CFG_CUSTOM, 999)
Hare_Female::UpdateGestation
void UpdateGestation()
Update gestation counter.
Definition: Hare_all.cpp:3626
Hare_Female::m_reproActivity
TTypeOfActivity m_reproActivity
State variable - current reproductive state.
Definition: Hare_all.h:1058
THare::m_peg_y
int m_peg_y
peg y-coordinate
Definition: Hare_all.h:260
growth_regulator
Definition: treatment.h:72
cut_to_silage
Definition: treatment.h:86
cfg_littersize_mean10
static CfgFloat cfg_littersize_mean10("HARE_LITTERSIZE_MEAN_J", CFG_CUSTOM, 1.72)
product_treat
Definition: treatment.h:101
THare::m_weight
double m_weight
State variale - hare weight g.
Definition: Hare_all.h:180
Hare_Infant::SetMum
void SetMum(Hare_Female *a_af)
Set the mother pointer.
Definition: Hare_all.h:856
Hare_Juvenile::st_Foraging
TTypeOfHareState st_Foraging()
Juvenile foraging.
Definition: Hare_all.cpp:2385
cfg_hare_pesticideresponse_on
CfgBool cfg_hare_pesticideresponse_on("HARE_PESTICIDERESPONSE_ON", CFG_CUSTOM, false)
If set to true then hares will collect and respond to pesticide information. This will slow the simul...
THare_Population_Manager::GetGrowthEfficiencyP
double GetGrowthEfficiencyP(int a_age)
Get the growth efficiency for this a_age for creating protein.
Definition: Hare_all.h:602
THare::m_Type
Hare_Object m_Type
State variale - the type of hare.
Definition: Hare_all.h:175
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
FarmToDo
FarmToDo
Definition: treatment.h:31
tole_Carpark
Definition: tole_declaration.h:85
ttop_AcuteEffects
Definition: Landscape.h:68
cfg_hare_male_predation
static CfgFloat cfg_hare_male_predation("HARE_MALE_PREDATION", CFG_CUSTOM, 0.0023)
tohs_Dispersal
Definition: Hare_all.h:74
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
THare_Population_Manager::SubtractHareDensity
void SubtractHareDensity(int x, int y, Hare_Object a_type)
Density function - subtracts one from the density in the square containing by x,y....
Definition: Hare_all.h:646
Hare_Male::st_Foraging
TTypeOfHareState st_Foraging()
Male Foraging.
Definition: Hare_all.cpp:2872
THare_Population_Manager::GetGrowthEfficiency
double GetGrowthEfficiency(int a_age)
Get the growth efficiency for this a_age.
Definition: Hare_all.h:590
Hare_Female::Init
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_all.cpp:3134
Hare_Young::st_Developing
TTypeOfHareState st_Developing()
Developmental code for the young hare.
Definition: Hare_all.cpp:1938
pigs_out
Definition: treatment.h:84
cfg_AdultMaxFat
static CfgFloat cfg_AdultMaxFat("HARE_ADULT_MAXFAT", CFG_CUSTOM, 0.04/(0.33 *0.88))
g_RMRrainFactor
double g_RMRrainFactor
Definition: Hare_all.cpp:51
Hare_Young::~Hare_Young
virtual ~Hare_Young()
Destructor for Hare_Young.
Definition: Hare_all.cpp:1744
struct_Hare::weight
double weight
Definition: Hare_all.h:144
trial_control
Definition: treatment.h:98
Hare_Juvenile::Hare_Juvenile
Hare_Juvenile(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for the juvenile hare object.
Definition: Hare_all.cpp:2219
Landscape::SupplyLargestPolyNumUsed
int SupplyLargestPolyNumUsed()
Definition: Landscape.h:355
THare_Population_Manager::m_GrowthEfficiency
double m_GrowthEfficiency[5001]
Precalculated growth efficiency with size
Definition: Hare_all.h:776
cfg_FarmIntensivenessH
CfgInt cfg_FarmIntensivenessH("HARE_FARMINTENSIVENESSH", CFG_CUSTOM, 10)
cfg_minLeveretBirthWeight
static CfgFloat cfg_minLeveretBirthWeight("HARE_MINLEVERETBIRTHWEIGHT", CFG_CUSTOM, 95 *0.88 *0.33)
Hare_Female::~Hare_Female
virtual ~Hare_Female()
Female Destructor.
Definition: Hare_all.cpp:3156
cut_to_hay
Definition: treatment.h:85
Population_Manager::m_ListNames
const char * m_ListNames[32]
Definition: PopulationManager.h:537
cfg_littersize_SD8
static CfgFloat cfg_littersize_SD8("HARE_LITTERSIZE_SD_H", CFG_CUSTOM, 0.6415)
spring_sow
Definition: treatment.h:47
Hare_Juvenile::st_Developing
TTypeOfHareState st_Developing()
The development code for Hare_Juvenile.
Definition: Hare_all.cpp:2522
tohs_Running
Definition: Hare_all.h:78
THare::TimeBudget
void TimeBudget(TTypeOfActivity a_activity, int dist)
Adjust time budger for an activity.
Definition: Hare_THare.cpp:314
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
Hare_Young::EndStep
virtual void EndStep(void)
EndStep code for Hare_Young.
Definition: Hare_all.cpp:1851
THare_Population_Manager::GetTotalDensity
int GetTotalDensity(int x, int y)
Density function - returns the density of all hares in the square containing by x,...
Definition: Hare_all.h:676
Hare_Female::st_Resting
TTypeOfHareState st_Resting()
Resting.
Definition: Hare_all.cpp:3507
sleep_all_day
Definition: treatment.h:33
MRR_Entry::m_trappings1
int m_trappings1
Definition: Hare_all.h:110
Hare_Female::Hare_Female
Hare_Female(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
Female Constructor.
Definition: Hare_all.cpp:3117
g_hare_maxFoetalKJ
const double g_hare_maxFoetalKJ[41]
Definition: Hare_all.cpp:350
TTypeOfHareState
TTypeOfHareState
Enumerator for hare behavioural states.
Definition: Hare_all.h:69
tole_AmenityGrass
Definition: tole_declaration.h:76
Hare_Female::AddYoung
void AddYoung(THare *a_new)
Add a leveret to the list of kids.
Definition: Hare_all.cpp:3844
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
cfg_littersize_mean4
static CfgFloat cfg_littersize_mean4("HARE_LITTERSIZE_MEAN_D", CFG_CUSTOM, 1.72)
Hare_Young::ON_Dead
virtual void ON_Dead()
This hare has been killed.
Definition: Hare_all.cpp:2206
Hare_Male::GeneralEndocrineDisruptor
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this m...
Definition: Hare_all.cpp:3090
autumn_or_spring_plough
Definition: treatment.h:91
THare_Population_Manager::m_Interference
double m_Interference[2500]
Array storing density-dependence effect with density
Definition: Hare_all.h:760
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: Landscape.h:1488
THare_Population_Manager::BodyBurdenOut
void BodyBurdenOut(int a_year, int a_day, double a_bb, double a_mgkg)
BodyBurden output.
Definition: Hare_all.h:723
strigling_hill
Definition: treatment.h:105
Hare_Juvenile
Class for juvenile hares (after 5 weeks old, fully mobile)
Definition: Hare_all.h:924
THare_Population_Manager::GetDelayedAdultDensity
int GetDelayedAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y, but for last year a...
Definition: Hare_all.h:689
tole_Coast
Definition: tole_declaration.h:67
THare::m_peg_x
int m_peg_x
peg x-coordinate
Definition: Hare_all.h:256
tole_BuiltUpWithParkland
Definition: tole_declaration.h:80
activity_Resting
Definition: Hare_all.h:90
THare_Population_Manager::m_RefNums
int m_RefNums
The last hare ID used
Definition: Hare_all.h:754
Hare_Female::UpdateOestrous
void UpdateOestrous()
Update oestrous counter.
Definition: Hare_all.cpp:3580
fa_slurry
Definition: treatment.h:63
swathing
Definition: treatment.h:81
cfg_hare_peg_inertia
static CfgFloat cfg_hare_peg_inertia("HARE_PEG_INERTIA", CFG_CUSTOM, 0.20)
Landscape::GetHareFoodQuality
double GetHareFoodQuality(int a_polygon)
Definition: Landscape.cpp:3403
Hare_Young::Step
virtual void Step(void)
Step code for Hare_Young.
Definition: Hare_all.cpp:1801
cfg_littersize_SD4
static CfgFloat cfg_littersize_SD4("HARE_LITTERSIZE_SD_D", CFG_CUSTOM, 0.6415)
cfg_juv_starve
CfgInt cfg_juv_starve("HARE_JUV_STARVE", CFG_CUSTOM, 2500)
Hare_Female::m_GestationCounter
int m_GestationCounter
State variable - Days in gestation.
Definition: Hare_all.h:1054
October
const int October
Definition: Landscape.h:45
Population_Manager::IncLiveArraySize
void IncLiveArraySize(int a_listindex)
Increments the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:437
cfg_BeetleBankMaxY
CfgInt cfg_BeetleBankMaxY