Defination of an equation

Use this forum to post Vensim related questions.
Post Reply
sankee82
Member
Posts: 28
Joined: Mon Oct 01, 2018 5:56 pm
Vensim version: DSS

Defination of an equation

Post by sankee82 »

Is there any way to define a variable as the difference of the value of another variable/level in the present cycle and the previous cycle?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Defination of an equation

Post by tomfid »

Yes - you just need to use a stock to store the previous value. If you're using Euler integration, you can use
previous input = SMOOTH( input, TIME STEP )
Otherwise it may be better to use DELAY FIXED.

In a continuous time model "previous cycle" may not have a useful meaning, because model behavior should be invariant to the TIME STEP. Therefore it may be better to use an explicit parameter, e.g.,
previous input = SMOOTH( input, perception horizon )

If you're using this to compute a slope, the TREND function does this.
Post Reply