这个问题与这 1略有关联。
使用NetLogo在NetLogo 5.1.0和Windows8.1上的时间扩展,我希望我的模拟
根据时间文件,这应该是可能的:
“所以,如果你使用这个时间:加上原始数据,将一个月加到日期"2012-02-02",你将得到”2012-03-02“;如果你再加一个月,你就得到了"2012-04-02”,尽管二月和三月有不同的天数。“
但是,在下面的最小工作示例中,控制台中的print命令的输出是2011 January 2、2011 February 2、2011 March 5和2011 April 5。
那么,我如何在每个月的某一天安排一项任务?
额外的问题:我如何把任务安排在每个月的第一个(而不是第二个)?
下面是一个工作示例:
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"
;time:schedule-repeating-event-with-period "observer" task do-daily 1 1.0 "days"
time:schedule-repeating-event-with-period "observer" task do-monthly 1 1 "months"
go-until
end
to do-daily
; here are the daily tasks
end
to do-monthly
; here are the monthly tasks
print time:show current-time "yyyy MMMM d"
end
to go-until
time:go-until 100
end发布于 2014-08-03 20:43:30
这是一个bug,现在已经修复了。请参见:
https://stackoverflow.com/questions/25082203
复制相似问题