Question about TIME STEP and delays

Use this forum to post Vensim related questions.
Post Reply
ema
Junior Member
Posts: 7
Joined: Wed Mar 07, 2018 8:12 am
Vensim version: DSS

Question about TIME STEP and delays

Post by ema »

Dear admins,

I was hoping you could clarify a conceptual doubt I'm having. We are building a small macro model to analyse the transition to a low-carbon economic system, but often stumple open unstable behaviour of the model. Reading other threads of the forum, I started wondering whether this could be caused by the way we model lags. Some of the variables in our model depend on the value of some other variable at the previous period (e.g. consumption is a function of disposable income at t-1; inflation is calculated using the difference between current and previous prices; and so on).

The way we are creating the t-1 variables is using the DELAY FIXED function, with TIMESTEP as the dtime. Judging from your comments to other questions, where you state that the time step should be smaller than the smallest delay in the model, I'm guessing you would recommend us to change this?

Looking forward to your opinion.

All the best, and thanks.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Question about TIME STEP and delays

Post by Administrator »

My guess is that you are formulating the problem incorrectly. You don't typically use DELAY FIXED with time step as the delay to calculate things.

Can you upload the model so we can take a look?
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: Question about TIME STEP and delays

Post by tomfid »

It's generally better to avoid discrete delays like DELAY FIXED and use continuous stocks & flows instead. See:
http://metasd.com/2017/11/discrete-time-stinks/

There are also several examples of continuous energy-economic models here:
http://metasd.com/model-library/
ema
Junior Member
Posts: 7
Joined: Wed Mar 07, 2018 8:12 am
Vensim version: DSS

Re: Question about TIME STEP and delays

Post by ema »

Dear Tom and admin, many thanks for your quick replies and links. I really appreciate the support service you offer to users.

I think we were indeed formulating the problem incorrectly; in the process of improving the model now. I will upload as soon as we have something worthy looking at.

Regarding DELAY and time steps, what I understand from your comments is that every timeI have a variable that depends on the previous value of some other variable I should treat the first variable as a stock, and influence its rate using the current value of the second variable. Is that correct? But then, what would be the appropriate use of DELAY functions?

I was also interested in reading your blog, Tom. I was always under the impression that SD softwares worked in discrete time, because of their 'time steps approach'. But you clearly suggest this is not the case. I'll try to dig deeper.

All the best,
Emanuele
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Question about TIME STEP and delays

Post by tomfid »

In a literal sense, the software does operate in discrete time, because a digital computer can't really do anything continuously. But it's desirable for the model to be independent of any particular discrete time step as much as possible. This is particularly true if you're using RK integration, where time may be sliced into finer steps than TIME STEP.

When you're using Euler integration, the discrete time step is in fact given by TIME STEP, which continuous and discrete representations similar. For example:

x previous = INTEG( (x - x previous)/TIME STEP, 0 )
is the same as
x previous(t+1) = x(t)
if TIME STEP =1.

For convenience, you can use
x previous = SMOOTH( x, TIME STEP )
or
x previous = DELAY FIXED( x, TIME STEP, x )
to represent the same thing.

The DELAY functions are normally used to represent delays that are much longer than TIME STEP, but which have higher-order arrival distributions. See http://metasd.com/2011/04/delay-sandbox/
Post Reply