Hi,
With regard to the method to avoid negative stock, a common practice is to set a cap for the outflow as suggested by previous posts, i.e.
outflow = MIN (desired outflow, stock/minimum time to drain stock)
This is a very useful method. But how about a stock having multiple outflows? How should the second argument ("stock/minimum time to drain stock") be tweaked so as to cap individual outflow and therefore their aggregated effect would not over-drain the stock? In other words, how should individual outflows be capped appropriately?
Many thanks.
Cap for multiple outflows to avoid negative stock
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
Re: Cap for multiple outflows to avoid negative stock
Assuming you have a level 'widgets" and two outflows, the correct way to do this would be
outflow 1 = min (widgets / time step , desired outflow 1 rate )
outflow 2 = min (widgets / time step - outflow 1, desired outflow 2 rate )
The "min" is removing "what you want to remove" or all that's in the level. So the parameter in "outflow 2" needs to be what is left in the level, this is "widgets/time step - outflow 1".
I hope this makes sense.
outflow 1 = min (widgets / time step , desired outflow 1 rate )
outflow 2 = min (widgets / time step - outflow 1, desired outflow 2 rate )
The "min" is removing "what you want to remove" or all that's in the level. So the parameter in "outflow 2" needs to be what is left in the level, this is "widgets/time step - outflow 1".
I hope this makes sense.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Cap for multiple outflows to avoid negative stock
The solution depends on the logic of the situation. Tony's approach works when there's a natural prioritization.
Another possibility is something like this:
Desired Outflow = Desired A out + Desired B out
Max Outflow = Stock/Min Time to Drain
Min Time to Drain >= TIME STEP
Total Outflow = MIN( Desired Outflow, Max Outflow)
Relative Outflow = ZIDZ( Total Outflow, Desired Outflow )
A out = Desired A out * relative outflow
B out = Desired B out * relative outflow
Another possibility is something like this:
Desired Outflow = Desired A out + Desired B out
Max Outflow = Stock/Min Time to Drain
Min Time to Drain >= TIME STEP
Total Outflow = MIN( Desired Outflow, Max Outflow)
Relative Outflow = ZIDZ( Total Outflow, Desired Outflow )
A out = Desired A out * relative outflow
B out = Desired B out * relative outflow
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/