Reputation: 329
Using the NetLogo time extension on NetLogo 5.1.0 and Windows 8.1, I would like a simulation to stop either at a specific date, or after a specific period of time.
time:go-until
should work for this according to the documentation on https://github.com/colinsheppard/time/#discrete-event-scheduler, but I can't figure out how to use it correctly. Here's what I have so far:
extensions [time]
globals[
start-time
current-time
]
to setup
clear-all
reset-ticks
set start-time time:create "2011-01-01"
set current-time time:anchor-to-ticks start-time 1.0 "days"
time:anchor-schedule start-time 1.0 "days"
create-turtles 2
time:schedule-repeating-event-with-period turtles task [fd 1] 1 1.0 "days"
end
to go-until
time:go-until 40
;time:go-until time:create "2011-03-01"
;time:go-until time:plus start-time 33.0 "days"
end
Like this, the sim runs for 40 ticks and then ends as expected. However, when I replace time:go-until 40
with either time:go-until time:create "2011-03-01"
or time:go-until time:plus start-time 33.0 "days"
, I get this error at the start of the simulation:
Extension exception: time: was expecting a number as argument 1, found this instead: {{time:logotime 2011-03-01}}
error while observer running TIME:GO-UNTIL
called by procedure GO-UNTIL
called by Button 'go'
Here's an example from the documentation which should work correctly:
time:go-until time:plus t-datetime 1.0 "hour"
;; Execute events within the next hour; t-datetime is the current time.
What am I missing?
Upvotes: 2
Views: 796