colinsheppard / time

A NetLogo extension that brings date/time utilities and discrete event scheduling to NetLogo
12 stars 13 forks source link

Using time:go-until with LogoTime #35

Closed dk-forestry closed 9 years ago

dk-forestry commented 9 years ago

Hi Colin,

Thanks for resolving the last issue that quickly!

Could you also have a look into this question: http://stackoverflow.com/questions/25060039/using-timego-until-in-netlogo-time-extension ?

Here's a copy of the question:

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?

colinsheppard commented 9 years ago

Hey again, wow [forehead slap], this is apparently a case of getting ahead of myself during documentation. I clearly intended to add the capability of using a LogoTime and not just a number, but I never implemented it.

Fortunately, it was quick and painless to add, which I just did and I will again release a new version of the extension shortly.

Thank you for using the extension, for your patience, and for bringing these issues to my attention... I appreciate it! Feel free to submit more issues if you have them... as you've probably determined already, I don't monitor stackoverflow, so github is your best bet.

Cheers, Colin

kgtroitzsch commented 8 years ago

I am trying to use the time extension together with NetLogo's Behavior Space. My model stops as requested when it is run separately, but in Behaviour Space they never stop (and do not update the view, the monitors and the plots). Any experience with the time extension under Behavior Space?

colinsheppard commented 8 years ago

@kgtroitzsch sorry I didn't respond to this, I had a busy Spring. I've never attempted to use the time extension with Behavior Space, so I can't really say why the problem is occurring. I'll add it to my issues list for future investigation.

kgtroitzsch commented 8 years ago

Dear Colin,

no problem, I found a hack to circumvent the problem J

Best

Klaus


Dr. Klaus G. Troitzsch, Universitätsprofessor (a.D. / retired)

Institut für Wirtschafts- und Verwaltungsinformatik

Universität Koblenz-Landau

e-mail: mailto:kgt@uni-koblenz.de kgt@uni-koblenz.de

www: http://userpages.uni-koblenz.de/~kgt http://userpages.uni-koblenz.de/~kgt,

Von: Colin Sheppard [mailto:notifications@github.com] Gesendet: Sonntag, 12. Juni 2016 18:58 An: colinsheppard/time Cc: kgtroitzsch; Mention Betreff: Re: [colinsheppard/time] Using time:go-until with LogoTime (#35)

@kgtroitzsch https://github.com/kgtroitzsch sorry I didn't respond to this, I had a busy Spring. I've never attempted to use the time extension with Behavior Space, so I can't really say why the problem is occurring. I'll add it to my issues list for future investigation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/colinsheppard/time/issues/35#issuecomment-225447893 , or mute the thread https://github.com/notifications/unsubscribe/AHsyG1UhKXkmGahinvmKx_NkNPSP5HvYks5qLDqtgaJpZM4CTrYs . https://github.com/notifications/beacon/AHsyGyK3si9dR2hmLtJtbQdEAZVFKbVCks5qLDqtgaJpZM4CTrYs.gif