Equation Variable Level

Use this forum to post Vensim related questions.
Post Reply
adegio
Junior Member
Posts: 2
Joined: Thu Jan 20, 2022 8:33 pm
Vensim version: PLE

Equation Variable Level

Post by adegio »

Hello. For a level variable whose expression is Lt = L(t-1) + Inp - Oup
How is L(t-1) entered into the Vensim equation?
I hope I was clear. Thank.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Equation Variable Level

Post by tomfid »

In spite of the title, https://metasd.com/2017/11/discrete-time-stinks/ provides some advice.

Generally you just need a stock equation,

L = INTEG( input - output, L initial )
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Equation Variable Level

Post by tomfid »

L(t) = L(t-1) ... implies discrete indexing, i.e. discrete steps with TIME STEP = 1. Generally it's best to avoid constraining the time interval - you want to think of it as "arbitrarily short". A better recurrence for Euler integration is:

L(t) = L(t-dt) + (input-output)*dt

where dt is shorthand for the TIME STEP of the integration. If dt=1, this reduces to the previous, except that it's dimensionally consistent. This also shows why stocks have units of stuff and flows have units of stuff/time.
adegio
Junior Member
Posts: 2
Joined: Thu Jan 20, 2022 8:33 pm
Vensim version: PLE

Re: Equation Variable Level

Post by adegio »

Thank.
Post Reply