cday41 / paz-search

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

Awake and asleep time across dates #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Animals remain active, or asleep, for incorrect amounts of time. For 
example, in the run I did ("30 yr run"), with mean active = 12 and sd = 5, 
then mean resting = 12 and sd = 5, several animals were continually asleep 
for 2 to 7 days of a 10 day run. Others were active for >2 days at a time. 

I looked at animal 5 in the animal.log. Time to asleep (or awake) resets 
after the home range trigger, which results in animals being awake or 
asleep for the remainder of the simulation run (depending on if they were 
asleep or awake when the trigger occured). 

See below. Note in the last portion that time is presented as AM/PM and 
military. The military time is correct, but the AM/PM is set to 12 AM.

# Animal 5 (who stays awake from 11/14 onward)
# Wakes up and calculates the time she goes to sleep
10:27:54:607:  must be asleep
10:27:54:607:  Waketime is 11/14/2009 15:09:49.1210000
10:27:54:607:  curr time is 11/14/2009 16:00:00
10:27:54:607:  time to wake up, I am going home = False
10:27:54:607:  my new mover is a type of SEARCH.RandomWCMover
10:27:54:607:  inside calc sleep getting the number of hours before I go 
to sleep
10:27:54:607:  get the mean and sd for this rest time
10:27:54:607:  inside getDurationMeanAndSD for  0
10:27:54:607:  the mean is 12 sd = 5
10:27:54:607:  new duration id is 1
10:27:54:607:  I will be active for 8.33458173815361
10:27:54:607:  so I will go to sleep at 11/14/2009 11:29 PM

# Below is the 4 pm step (some lines deleted). 
# Animal 5 is not looking for a home yet. 
# Note the 'sleep time' is till 1129pm. 
10:27:54:528:  inside Animal Do Time Step for 5 the time is 11/14/2009 
4:00 PM
10:27:54:528:  percent time step is 0
10:27:54:528:  is dead = False
10:27:54:528:  do text output is True
10:27:54:607:  Close call value is 0.921908545737112
10:27:54:607:  SafeRiskyTrigger is 0.01
10:27:54:607:  RiskySafeTrigger is 0.001
10:27:54:607:  inside change active state
10:27:54:607:  must be asleep
10:27:54:607:  Waketime is 11/14/2009 15:09:49.1210000
10:27:54:607:  curr time is 11/14/2009 16:00:00
10:27:54:607:  time to wake up, I am going home = False
10:27:54:607:  my new mover is a type of SEARCH.RandomWCMover
10:27:54:607:  inside calc sleep getting the number of hours before I go 
to sleep
10:27:54:607:  get the mean and sd for this rest time
10:27:54:607:  inside getDurationMeanAndSD for  0
10:27:54:607:  the mean is 12 sd = 5
10:27:54:607:  new duration id is 1
10:27:54:607:  I will be active for 8.33458173815361
10:27:54:607:  so I will go to sleep at 11/14/2009 11:29 PM

# Below is the 5 pm step (some lines deleted). 
# Animal 5 is looking for a home. Note the change in 'sleep time'. 
# The new sleep time is before the current time of 5pm.
# Although the military time is till the same (23:29 in military is 11:29 
PM), the AM/PM time format is now set to 12 AM.

10:28:06:607:  inside Animal Do Time Step for 5 the time is 11/14/2009 
5:00 PM
10:28:06:607:  percent time step is 0
10:28:06:607:  is dead = False
10:28:06:607:  do text output is True
10:28:09:747:  SafeRiskyTrigger is 0.01
10:28:09:747:  RiskySafeTrigger is 0.001
10:28:09:747:  ok now see if it is time to look for a home yet
10:28:09:747:  yes it is time to look for a home calling find home
10:28:09:747:  inside find home calling to get the name of my memory map
10:28:09:747:  now setting the home range center
10:28:14:607:  that returned False
10:28:14:607:  adding an eligible home site
10:28:14:607:  X = 465839.251467591 Y= 646534.411285707
10:28:14:607:  Food = 0.03 Risk = 0
10:28:14:607:  now there are 30 sites to choose from
10:28:14:607:  inside change active state
10:28:14:607:  must be awake
10:28:14:607:  Sleep time is 11/14/2009 12:00:00 AM 23:29:53.6150000
10:28:14:607:  curr time is 11/14/2009 17:00:00

# I think the 12 AM is used (rather than 11:29 PM, or 23:29 military)
# Animal 5 never goes back to sleep...
10:31:26:420:  must be awake
10:31:26:420:  Sleep time is 11/14/2009 12:00:00 AM 23:29:53.6150000
10:31:26:420:  curr time is 11/15/2009 00:00:00
# Etc.
10:32:00:733:  must be awake
10:32:00:733:  Sleep time is 11/14/2009 12:00:00 AM 23:29:53.6150000
10:32:00:733:  curr time is 11/15/2009 01:00:00
# Etc.
10:32:29:468:  must be awake
10:32:29:468:  Sleep time is 11/14/2009 12:00:00 AM 23:29:53.6150000
10:32:29:468:  curr time is 11/15/2009 02:00:00

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

Attachments:

GoogleCodeExporter commented 9 years ago
Looking closer, some animals do not exhibit this problem. I think the issue may 
be 
based on the fact that the calculation uses 12 AM of a different date. 

If you look above, the date does not change from 11/14 to 11/15 for sleep time. 
So 
11:29 PM of 11/14 gets rounded to 12 AM of 11/15, BUT the sleep time date does 
not 
increment (it remains 11/14). Thus, the sleep time is correct, but the date is 
1 day 
behind and is never reached.

I'll look some more, but it appears that this has nothing to do with the home 
range 
trigger (just happened to be the animal I looked at) and is an issue with 
incrementing 'date' when calculating time to sleep (or time to awake, I would 
guess).

Original comment by nmcc...@purdue.edu on 16 Nov 2009 at 2:03

GoogleCodeExporter commented 9 years ago

Original comment by nmcc...@purdue.edu on 16 Nov 2009 at 2:06

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Disregard the post just before this. I was looking at the wrong results. I have 
deleted it as well.

We now have a new problem with calculating the active and sleeping cycles (this 
one 
is with revision 248). When we compare the current time to the sleep time we 
choose 
to sleep everytime (see examples below). This results in awake periods that are 
never more than a single timestep:

09:50:42:514:  inside change active state
09:50:42:514:  must be awake
09:50:42:514:  Sleep time is 11/13/2009 12:00:00 AM 01:40:31.2300000
09:50:42:514:  curr time is 11/12/2009 06:00:00
09:50:42:514:  time to go to sleep

...
09:50:46:810:  inside change active state
09:50:46:810:  must be awake
09:50:46:810:  Sleep time is 11/12/2009 12:00:00 AM 20:44:49.3580000
09:50:46:810:  curr time is 11/12/2009 06:00:00
09:50:46:810:  time to go to sleep

...
09:53:21:859:  inside change active state
09:53:21:859:  must be awake
09:53:21:859:  Sleep time is 11/16/2009 12:00:00 AM 14:03:16.9490000
09:53:21:859:  curr time is 11/15/2009 06:00:00
09:53:21:859:  time to go to sleep

We have a similar problem with wake times (although a bit different). In this 
case 
if the dates differ (i.e. we are supposed to wake up sometime after today) we 
correctly stay sleeping but if the dates are the same we always choose to wake 
(see 
examples below):

Good:
09:51:04:418:  inside change active state
09:51:04:418:  must be asleep
09:51:04:418:  Waketime is 11/13/2009 07:14:54.9470000
09:51:04:418:  curr time is 11/12/2009 14:00:00
(The animal keeps sleeping)

Bad:
09:51:11:448:  inside change active state
09:51:11:448:  must be asleep
09:51:11:448:  Waketime is 11/13/2009 11:29:32.8180000
09:51:11:448:  curr time is 11/13/2009 02:00:00
09:51:11:448:  time to wake up, I am going home = False

I have attached the xml I used (I just changed timestep lengths to shorten run 
time). It uses all of the same maps as the above xml.

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

Attachments:

GoogleCodeExporter commented 9 years ago
Need to verify this is fixed with revision 249

Original comment by bpa...@purdue.edu on 4 Dec 2009 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by ran...@mwwb.net on 5 Dec 2013 at 12:51