这个问题与this一个问题略有关系。
在NetLogo 5.1.0和Windows 8.1上使用NetLogo时间扩展,我希望我的模拟能够
根据time documentation,这应该是可能的:
“因此,如果您使用时间:加上原语将日期添加到日期”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