constraining level to positive numbers

Use this forum to post Vensim related questions.
Post Reply
lkshumaine
Newbie
Posts: 1
Joined: Tue May 12, 2015 8:11 pm
Vensim version: PLE

constraining level to positive numbers

Post by lkshumaine »

Hello, I apologize for asking a question that has already been answered in previous posts, but I was unable to access those answers through this forum (I saw an error message when I tried to do so). Anyway, I have a lot of experience with Stella, but less so with Vensim, and I am trying to figure out how to constrain a stock/level so that it cannot become negative. Is there an easy way to do this, or do I have to engineer and IF THEN statement? Thank you.
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: constraining level to positive numbers

Post by tomfid »

There's a lengthy discussion of this here http://www.ventanasystems.co.uk/forum/v ... =26&t=1128

The basic point is that you need to express why the stock can't go negative, i.e. how the "physics" of the situation limits its outflows when the stock nears 0.

The most common situation is the standard linear model, in which outflow = stock/duration, which automatically takes care of the problem, as long as TIME STEP <= duration.

Sometimes stock/TIME STEP is a reasonable shortcut - that's essentially what you get when you check the Stella nonnegativity box. For example, you might write outflow = MIN( desired outflow, stock/TIME STEP).

If the dynamics of stockouts are important, you'll probably want to create something more sophisticated.
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: constraining level to positive numbers

Post by tomfid »

For a few special situations the SINTEG function may be useful - see the Help system.
Post Reply