Translating Stock and Flow Diagrams to Valsight Models
Stock and Flow diagrams can be mapped to Valsight models with simple basic building blocks.
Consider the following, basic example of a stock and flow diagram, adapted from Sterman – Business Dynamics, page 209.
The equivalent Valsight model would look like
Assuming a monthly Inflow of 10 pieces and an Outflow of 9 pieces the formulas may look like this:
Node | Formula | Notes |
---|---|---|
Inflow | EXPAND(10,"Month") | You may connect data via the DATA call, make the node simulatable, and use multiple dimensions (products, countries...) |
Outflow | EXPAND(9,"Month") | same as Inflow |
Net Change in Stock | 'Inflow' - 'Outflow' | The delta between Inflow and Outflow. (this node is actually optional, you may as well use the formula directly in the Stock. |
Stock | RUNNINGSUM('Net Change in Stock') | Accumulate the Net Change in Stock. This node must be set to aggregation type "Closing Sum" to show the right end of period value when displayed at e.g. Year level. |
Explanation / Details
To understand how this works, let's see which numbers are in each node & month for the first 3 month of 2019.
Month / Node | 2019-01 | 2019-02 | 2019-03 |
---|---|---|---|
Inflow | 10 | 10 | 10 |
Outflow | 9 | 9 | 9 |
Net Change in Stock | 1 | 1 | 1 |
Stock | 1 | 2 | 3 |
If we now change Inflow and Outflow in a simulation (shown in red), the table may look like this:
Month / Node | 2019-01 | 2019-02 | 2019-03 |
---|---|---|---|
Inflow | 10 | 10+4 = 14 | 10 |
Outflow | 9-1 =8 | 9 | 9 |
Net Change in Stock | 2 | 5 | 1 |
Stock | 2 | 7 | 8 |
Final Model in Valsight
Setting the aggregation type: