在NetLogo 5.1.0和Windows 8.1上使用NetLogo时间扩展,我希望模拟在特定日期或特定时间段后停止。
time:go-until
应根据https://github.com/colinsheppard/time/#discrete-event-scheduler上的文档为此工作,但我无法弄清楚如何正确使用它。这是我到目前为止所做的:
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
像这样,sim运行40个刻度,然后按预期结束。但是,当我用time:go-until 40
或time:go-until time:create "2011-03-01"
替换time:go-until time:plus start-time 33.0 "days"
时,我会在模拟开始时收到此错误:
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'
以下是文档中应该正常工作的示例:
time:go-until time:plus t-datetime 1.0 "hour"
;; Execute events within the next hour; t-datetime is the current time.
我错过了什么?