Step function key with respect to time

Use this forum to post Vensim related questions.
Post Reply
ankush.a
Junior Member
Posts: 4
Joined: Wed Dec 15, 2021 12:07 pm
Vensim version: PLE

Step function key with respect to time

Post by ankush.a »

Is there any way we can do a step function with respect to a time basis? Suppose the initial value we take as say 10 and the time for the model being run as say maybe 30 days

Now, what if we try to have 3 different step functions with say:
1:Step to 20 between 0-10
2:Step to 10 between 10-20
3:Step to 15 between 20-30

Is there any way the step function can be say put into one command for all 3?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Step function key with respect to time

Post by Administrator »

You can use some IF THEN ELSE statements. Or a lookup table.

What are you actually trying to do?

value to use = if then else ( time >=0 :and: <10, 20 , 0 )
+ if then else ( time >=10 :and: <20, 10 , 0
if then else ( time >=20 :and: <= final time, 15 , 0
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: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Step function key with respect to time

Post by tomfid »

Two more options:

1. Use multiple STEP functions:

value = initial value + STEP( new val 1-initial value, 10 ) + STEP( ..

2. Use a lookup. This will be much easier to interpret if there are several steps.
ankush.a
Junior Member
Posts: 4
Joined: Wed Dec 15, 2021 12:07 pm
Vensim version: PLE

Re: Step function key with respect to time

Post by ankush.a »

Ok so my doubt is said I have with me 100 tickets and that I want to use a step function with respect to time to calculate for say around a time period of 20 months. These 20 months is being divided into 3 different types with under type a different value i.e

In the first zone, tickets I have are say 40 for between 0-10 months.
In the second zone, tickets I have say 20 for between 10-15 months
In the third zone, tickets I have say 40 for between 15-20 months

I am running the model for 20 months but just that it is being divided this way. So now if I want to use multiple step functions under the stock tool, would it be possible or not.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Step function key with respect to time

Post by tomfid »

This will be an auxiliary variable, not a stock.

The simplest option might be to use IF THEN ELSE, like:

IF THEN ELSE( Time<time1, tickets1, IF THEN ELSE( Time<time2, tickets2, tickets3 ) ) ~ tickets/month
time1 = 10 ~ month
tickets1 = 40 ~ tickets/month
time2 = 15 ~ month
tickets1 = 20 ~ tickets/month
tickets3 = 40 ~ tickets/month
ankush.a
Junior Member
Posts: 4
Joined: Wed Dec 15, 2021 12:07 pm
Vensim version: PLE

Re: Step function key with respect to time

Post by ankush.a »

I think I will rephrase my question since I think I wrote it wrongly. Say for example I am running a supermarket and the initial inventory of products I have within say a month would be around 250. Now say that I am trying to calculate the rest of my products that I am going to receive using a step-wise function with respect to time. Let’s say now 100 products for a duration of 0-10 months, 250 products between 10-15 months, and 150 products between 15-25 months. I will be running the model for 25 months i.e the duration at which my step function I ideally want to end at. So in this how would it be best to go about with it?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Step function key with respect to time

Post by tomfid »

Is there a reason the IF THEN ELSE approach above won't work?

If so, I'd probably use a lookup. Using the STEP function isn't really less complex than the IF statements.
Post Reply