Page 1 of 1

Preventing negative stocks with IF THEN ELSE

Posted: Wed Feb 11, 2009 2:33 pm
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

Posted: Wed Feb 11, 2009 3:14 pm
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.