Preventing negative stocks with IF THEN ELSE

Use this forum to post Vensim related questions.
Post Reply
julppu
Newbie
Posts: 1
Joined: Wed Feb 11, 2009 2:26 pm

Preventing negative stocks with IF THEN ELSE

Post by julppu »

Hey all!

I'm a newbie to system dynamics and I'm learning how to use VenSim PLE. One question that has been bothering me is about negative stocks. Can I use this kind of an equation to prevent the stock from going negative:

IF THEN ELSE(outflow rate > stock, stock, outflow rate)

I believe that the flows are always related to time, but the stocks aren't. So can I compare the values of rates to the values of stocks? If this is not possible, how could it be done?

Thanks a lot for your help!

- julppu
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

I usually use
outflow rate = min (desired outflow rate, stock / time step).

This will take out the desired amount if there is enough in the stock, if not, it will take everything out (stock/time step).

Hope this helps.

Tony.
Post Reply