Category: System Dynamics
Represents state element for material flows.
syStock(InflowRate, OutflowRate, DiscreteInflow, DiscreteOutflow, InitialValue, TimeNow, [LowestLevel], [HighestLevel])
The syStock function syntax has the following arguments:
- InflowRate: required. Rate of material inflow (quantity per time unit) as a number or a name of corresponding syLoop.
- OutflowRate: required. Rate of material outflow (quantity per time unit) as a number or a name of corresponding syLoop.
- DiscreteInflow: required. Discrete addition of material onto the stock in particular timestep as a number or a name of corresponding syLoop().
- DiscreteOutflow: required. Discrete withdrawal of material from the stock in particular timestep as a number or a name of corresponding syLoop().
- InitialValue: required. Initial quantity of material on stock at the very beginning of simulation time.
- TimeNow: required. Reference to a cell with syClock().
- LowestLevel: optional. The lowest possible quantity on the stock (not limited if ommited).
- HighestLevel: optional. The highest possible quantity on the stock (not limited if ommited).
Return value is current quantity on the stock.
syStock provides a state variable in the model and is convenient for material flows. Similar element is syState(), which is best suited to information flows.
Material arrives to the stock at some rate per assumed unit of time (InflowRate) and leaves the stock according to the outflow rate (OutflowRate). If rates are not equal, and especially if they dynamically change during the simulation time, the stock provides the information about the material still "on stock". InitialValue is the amount that is already on stock at the start of the simulation time.
At each timestep, a specific amount of material can be added to the stock or taken from it by setting DiscreteInflow and DiscreteOutflow arguments.
In real systems the stock is typically limited by its highest and lowest possible volume. This is imitated by LowestLevel and HighestLevel arguments.
Besides giving the current quantity, syStock has additional outputs which can be accessed by syStockOutput element. For instance, if the material inflows are higher than outflows for some period of time, and you set the HighestLevel, then the overflow output can tell you the amount of material that got "spilled" in the last time interval. Besides, the outflow quantity and outflow rate can be used to connect syStock elements in series, the material flowing from one syStock to the next via syStockOutput.
If the LowestLevel is set and if the outflow is higher than inflow for some simulated time, the outflow becomes equal to inflows - that means that the material cannot be magically created in syStock. syStock also preserves the material which can always be observed as a quantity on stock or as an overflow.
Feedback loops can be arranged by syLoop() elements. To implement a feedback loop, firstly refer to the model's "outcome" variables like syStock and other elements in your model, by Excel formulas. These formulas should represent the system's behavior and interrelations between variables. The resulting value which should directly influence the syStock (flow rate or discrete change) can then be provided to syStock by the syLoop() element.
NOTE: If syStock refers to a syLoop() that does not depend from the model, its return value is error #VALUE during simulation.
Technically, in system dynamics we are using the term "material" although this is not necessarily some fluid, cars, etc. syStock can also represent the number of tellers, number of servers, number of people waiting, money ... in a certain moment of simulated time.
=syStock(0,0,B3,B4,0,A1)- A simple stock with discrete changes defined by formulas in cells B3 and B4, which is empty at the beginning of simulation time. There is no feedback loop.
=syStock("Birth rate","Mortality",0,0,1000000,A1,0)- In combination with
syLoop("Mortality",B8)this syStock implements a simple population model with positive and negative feedback loop where birth rate and mortality formulas are given in cells B7 and B8 that refer back to the same syStock. syStock does not have any discrete changes, the initial value is 1 million inhabitants, and the lowest possible population size is 0.