cday41 / paz-search

Automatically exported from code.google.com/p/paz-search
0 stars 0 forks source link

Time awake or asleep is incorrect in day 1, appears to be 'reset' at 1st step #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Animals remain active, or asleep, for incorrect amounts of time due to an 
apparent 'reset' of time in day 1. 

I looked at animal 5 in the animal.log in the run I did ("30 yr run"); 
with mean active = 12 and sd = 5, then mean resting = 12 and sd = 5. 

Note that the 1st calculation for "I will go to sleep" indicates animal 5 
will sleep at 11/11/2009 6:50 PM. At the end of step 1, this changes 
to "Sleep time is 11/11/2009 12:00:00 AM 14:13:00.7910000", which is 
before the simulation started. I think something gets 'reset' here. Not 
sure.

# Setting initial time awake
09:38:29:619:  inside setInitialValues for animal 5
09:38:29:619:  the time is 11/11/2009
09:38:31:056:  inside set inital sleeptime curr time is 11/11/2009  6:00 AM
09:38:31:056:  inside calc sleep getting the number of hours before I go 
to sleep
09:38:31:056:  get the mean and sd for this rest time
09:38:31:056:  inside getDurationMeanAndSD for  0
09:38:31:056:  the mean is 12 sd = 5
09:38:31:056:  new duration id is 1
09:38:31:056:  I will be active for 12.8404421320922
09:38:31:056:  so I will go to sleep at 11/11/2009 6:50 PM

# 1st step
09:39:03:025:  inside Animal Do Time Step for 5 the time is 11/11/2009 
6:00 AM
09:39:03:025:  percent time step is 0
09:39:03:025:  is dead = False
09:39:06:807:  ok now see if it is time to look for a home yet
09:39:06:807:  adding an eligible home site
09:39:06:807:  X = 466368.288340401 Y= 646296.671959538
09:39:06:807:  Food = 0.03 Risk = 0
09:39:06:807:  now there are 1 sites to choose from
09:39:06:807:  inside change active state
09:39:06:807:  must be awake
09:39:06:807:  Sleep time is 11/11/2009 12:00:00 AM 14:13:00.7910000
09:39:06:807:  curr time is 11/11/2009 06:00:00 

# Now sleep time is 12 AM, not 6:50pm as above.
# Note that 12am comes before 6am. So, sleep time for animal 5 comes 
before she is first awake (at start of simulation).
# Also note that the animal wakes at 3pm on day 1, so perhaps it used the 
military time 14:13 as the time to go to sleep? Still incorrect based on 
the initital calculation of 6:50pm, I think.

Original issue reported on code.google.com by nmcc...@purdue.edu on 16 Nov 2009 at 1:33

Attachments:

GoogleCodeExporter commented 9 years ago
This seems to have been just a confusion of the way time is written out 
(i.e. "11/11/2009 12:00:00 AM" is how the date is expressed) and the ordering 
of 
logging (i.e. "inside setInitialValues for animal 5" comes after activity 
calculation not before it so we were looking at the wrong animals).

Original comment by bpa...@purdue.edu on 3 Dec 2009 at 3:55