Page 1 of 1

Common Stock with subscripted structures

Posted: Fri Nov 20, 2009 4:41 pm
by Pepe
Is it possible to have subscripted structures draw from a common un-subscripted stock, and update the value of that stock during the current time step, so that subsequent subscripted structures in the same time step can use the update stock value?

For example:
A car parts store has a stock of 3 alternators (the common stock). Five customers come in at the same time needing the same alternator for their car (the car is the subscripted structure). Three will go home happy, but 2 will need to wait until the stock has been replenished.

The problem arises when I try to remove a part from the common stock using the subscripted structure. The subscript appears on the right hand of the equation, but not the left.

Thanks!

Posted: Fri Nov 20, 2009 5:18 pm
by LAUJJL
posting the model will help
JJ

Posted: Fri Nov 20, 2009 5:28 pm
by Pepe
Here is the model.

Thanks!

Posted: Sat Nov 21, 2009 11:04 am
by bob@vensim.com
the equation for part stock outflow should be

part stock outflow = SUM(parts replaced[part!])

you need to fix the equation for parts replaced - perhaps using ALLOCATE AVAILABLE - to prevent too many replacements given the common stock.

Also it would be good to add units to everything and do units checking.

Posted: Mon Nov 23, 2009 2:31 pm
by Pepe
This worked, thank you! I replaced the equation for part stock outflow with the sum of parts replaced, as suggested.

I also updated the parts replaced equation using Allocate Available and a couple of other variables (needed to get a discrete output, since I can't withdraw 80% of a part). Seems to be working very well.

I learned a lot about the allocation functions in Vensim doing this, and it was very helpful. Thanks again.