Page 1 of 1

Defination of an equation

Posted: Fri May 03, 2019 1:56 pm
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?

Re: Defination of an equation

Posted: Fri May 03, 2019 2:35 pm
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.