I would like to divide the time into a lot of 15-minute intervals and use i to be its index. Originally, I just run the model for an 8 hour shift. So I use the code below to find i. It works, so i=1 ,2, 3, ..., 32. (8 hours have 32 15-minute intervals)
Now I need to run the model for a lot of days. I need the i to be indexed by i=1,2,...,32,33,......... Which function I should use to replace the function "TimeofDay"?
|Steffen Bangsow |
freelance simulation specialist
Steffen's solution considers that you only need interval-numbers during the working times; so e.g. you only have one 8hr-shift every day, then every day:
In case you need an interval number for every 15min-interval of each day, disregarding the shift-model, you could simply use
iIntervalNumber := time_to_num(EventController.SimTime) // 900;
The SimTime-attribute starts at 0, no matter what you set as starting datetime of the eventcontroller (so you don't have to subtract the 8hr like you did).
if timeofday(eventcontroller.abssimtime)>=21600 /*(600hrs)*/ and timeofday(eventcontroller.abssimtime)<=50400/*(140
if value=0 then