Time of day in Ventity

A place for Ventity software questions & answers
Post Reply
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Time of day in Ventity

Post by cobleg »

Is there explicit recognition of the time of day in Ventity? For example, is there a Get Time Value function?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Time of day in Ventity

Post by tomfid »

You can get the date somponents with SimulationDay() etc.

We don't have the equivalent for time of day, but you can use Modulo. When calendar time is active, Time starts at 0 and increments by time step. So, with a time step of an hour (or some fraction thereof),

Time of Day = Modulo(time, hours per day) ~ hours
Hours per day = 24 ~ hours/day
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Re: Time of day in Ventity

Post by cobleg »

Thanks. I also need to work with higher frequency time intervals, e.g. every half-hour. Is there a way of integrating that with calendar time too? For example, instead of showing hourly subdivision for each day (see below) is it possible to show 48 subdivisions in DateTime to show the half-hour intervals?
DateTime hours in Ventity.png
DateTime hours in Ventity.png (45.56 KiB) Viewed 7303 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Time of day in Ventity

Post by tomfid »

I'm pretty sure just setting time step to 0.5 hour will do that.
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Re: Time of day in Ventity

Post by cobleg »

Ok, thanks. Seems obvious now that you pointed that out. I managed to get what I needed - namely a repeating index to use in a lookup table. :D
To achieve that for a 48 interval day with each interval being 30 minutes, I dialled in these settings:
1. Run Control: Time Step = 0.02083333 (i.e. 1/48), Unit of Time = 0.5*Hour
2. Defined an auxiliary "Intervals per day", Units = 0.5*Hour, Equation = 48* Time Step
3. Defined an auxiliary "Time of Day", Units = 0.5*Hour, Equation = Modulo(Time, Intervals per day)

Note that using Time Step in 2. was required to get the repeating index.

I have attached my simple example model in case this helps someone else. :mrgreen:
Attachments
Half hour intervals -second day in Ventity.png
Half hour intervals -second day in Ventity.png (14.18 KiB) Viewed 7282 times
Half hour intervals - first day in Ventity.png
Half hour intervals - first day in Ventity.png (15.06 KiB) Viewed 7282 times
High Frequency.zip
(6.88 KiB) Downloaded 416 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Time of day in Ventity

Post by tomfid »

I think there may be some unintended consequences to this.

0.5*hour isn't understood as a time unit. The calendar algorithm seems to be defaulting to days as a result. (since time = 2 at the end of the 10/21-10/22 interval).

Units checking is likely to have trouble later, because a unit with the * operator in it will be interpreted as (0.5)*(hour) - not sure a "0.5" will be understood.

If you want one time unit to be half an hour you could name it something like HalfHour, but I'm not sure the calendar time algorithm will recognize that.

I would instead set Time Step = 0.5 with time unit "Hour".
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Time of day in Ventity

Post by tomfid »

High Frequency 2.zip
(6.96 KiB) Downloaded 496 times
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Re: Time of day in Ventity

Post by cobleg »

Thanks for the additional advice. Much appreciated!
Post Reply