TIME STEP FUNCTION

Use this forum to post Vensim related questions.
Post Reply
Inthanongsone
Member
Posts: 34
Joined: Thu Jan 28, 2016 6:01 pm
Vensim version: DSS

TIME STEP FUNCTION

Post by Inthanongsone »

Hi,

I'm working on calculating the value of one parameter that occurrs at difference time-scale.

I want to create the time step (look like the one in the figure) to control the calculation.
I can't generate that kind of graph using the IF THEN ELSE, and STEP functions (referred to Vensim model).

Could anyone kindly suggest me what functions can i use to generate this kind of graphs.

I attached a picture and a vensim model for your information.

I really appreciate any help. :)

Best regards,
Inthan
Attachments
Time Contraint.vmf
(12.69 KiB) Downloaded 298 times
TIMESTEP for control calculation
TIMESTEP for control calculation
TIMESTEP_GRAPH.png (8.7 KiB) Viewed 5289 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: TIME STEP FUNCTION

Post by tomfid »

I think, generically, your strategy could be something like:

Phase a start = 3
Phase a duration = 4
Phase b start = INITIAL(Phase a start+phase a duration + TIME STEP) ~ time step is optional to prevent concurrence of a & b
Phase b duration = 5

Phase a is started = STEP(1,Phase a start)
Phase a is done = STEP(1,Phase a start+Phase a duration)
Phase a is active = Phase a is started - Phase a is done

Phase b is started = STEP(1,Phase b start)
Phase b is done = STEP(1,Phase b start+Phase b duration)
Phase b is active = Phase b is started - Phase b is done

If there are a lot of activities, this is easier done with arrays - see the project model example in the help system.

If you want the phase durations to vary dynamically or randomly, you need to take a slightly different approach. Create a state machine, with a stock representing each phase's activity state.
Inthanongsone
Member
Posts: 34
Joined: Thu Jan 28, 2016 6:01 pm
Vensim version: DSS

Re: TIME STEP FUNCTION

Post by Inthanongsone »

Thank you so very much Tom for your suggestions.

I can't thank you enough.

Regards,
Inthan
sbeiss
Newbie
Posts: 1
Joined: Sun Jul 30, 2017 7:52 pm
Vensim version: PLE+

Re: TIME STEP FUNCTION

Post by sbeiss »

If you want the phase durations to vary dynamically or randomly, you need to take a slightly different approach. Create a state machine, with a stock representing each phase's activity state.
Hi Tom - this is excatly the situation I'm facing right now. Can you elaborate your proposal of a state machine a bit in more detail please?
Thanks in advance
Stefan
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: TIME STEP FUNCTION

Post by Administrator »

You need a stock per state. For example,

car is travelling = integ ( car starts travelling - car stops travelling , 0 )

All variables above will be either 0 or 1. You can then add more stocks (eg, car is parked) and the car travels through the states.

Hope this helps.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: TIME STEP FUNCTION

Post by tomfid »

If the timing is static, you don't need the state machine. You can just chain together the delays you have:

Code: Select all

Reconnaissance phase=
	PULSE(INITIAL TIME, "Total reconnaissance time (y)" )
Units: Dmnl

**************************************************************
Prospecting Phase=
	PULSE(INITIAL TIME+"Total reconnaissance time (y)","Total prospecting time (y)"
)
Units: Dmnl

**************************************************************
If you want the phases to be nonoverlapping, just add TIME STEP to the start time in the second equation.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: TIME STEP FUNCTION

Post by tomfid »

The state machine might look like this:
stateMachine.png
stateMachine.png (8.79 KiB) Viewed 4798 times
The trigger could be a DELAY FIXED of the previous start, but with that kind of fixed timing, the state machine is really overkill.

Code: Select all

Starting Exploration=
	Prospecting*Trigger for Start of Prospecting/TIME STEP
Units: 1/Month

**************************************************************
Note the division by TIME STEP for dimensional consistency; without that, your model won't work if TIME STEP <> 1.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: TIME STEP FUNCTION

Post by tomfid »

Post Reply