1Demonstration 1 of 4
A tub with no drain can only grow
What does the structural check say about a stock that has an inflow and no outflow?
A stock that appears as a flow destination and never as an origin can only grow. The check finds it before any step runs, and the stepped levels show the growth it would hide.
The tub holds 50 litres. The tap supplies litres per minute from a source outside the boundary; the drain, when present, removes 4 litres per minute to a sink.
Predict first. With the tap at 10 and no drain, does check() return an empty list?
Choose an example
Constructed example: the chapter's bathtub, with tap rates and a drain rate of 4 chosen for this reader.
Calculated values
- Structural check
- no problems
- Net flow (l/min)
- 6
- Level after 8 minutes (l)
- 98
Net flow = 10 - 4 = 6 litres per minute, so after 8 minutes the level is 50 + 8 x 6 = 98 litres. The level rises.
Use the idea
Run the structural check each time a stock or flow is added, and confirm any stock that can only grow or only shrink is meant to.
Where the conclusion applies
Eight one-minute steps with constant rates. A cumulative counter legitimately only grows, so the message is a prompt to confirm intent, not a verdict.
Check your understanding: With the tap at 14 and the drain present, what is the level after 8 minutes?
Chapter 12 source: section "The failure worth engineering for". Demonstration C12-D01.
2Demonstration 2 of 4
Conservation as an executable claim
What does the residual say when a flow ends at a name that was never declared?
The step moves litres out of the tub either way. Only a declared sink is counted as a crossing, so an undeclared destination leaves the outflow unexplained and the residual equals minus the drain.
The residual is the change in the total inside the boundary minus what crossed the boundary at declared sources and sinks. The tap supplies 10 litres in the minute; the drain removes the chosen amount.
Predict first. If the drain empties into an undeclared name at 7 litres per minute, what is the residual?
Choose an example
Constructed example: the chapter's bathtub step, with the drain rate and its destination varied for this reader.
Calculated values
- Drain empties into
- declared sink
- Change in the total (l)
- 6
- Net crossing at declared boundary (l)
- 6
- Conservation residual (l)
- 0
- Structural check
- no problems
The total inside changes by (50 + 10 - 4) - 50 = 6. The tap crosses in 10 and the declared sink takes out 4, so the expected change is 10 - 4 = 6. Residual = 6 - 6 = 0. The accounting closes: the residual is zero.
Use the idea
Test the residual in every model with a transfer, since a flow forgotten at one end still runs and still looks plausible.
Where the conclusion applies
One minute, one tub, constant rates. The residual detects a missing endpoint; it cannot say whether a declared source or sink is a realistic simplification.
Check your understanding: With the drain at 10 into an undeclared name, what is the change in the total and what is the residual?
Chapter 12 source: section "Conservation as an executable claim". Demonstration C12-D02.
3Demonstration 3 of 4
A clamp hides a mechanism; a limited flow names it
When shipments exceed inventory, what is the difference between flooring the stock and limiting the flow?
A clamped stock discards the deficit, so the total no longer matches what crossed the boundary. A limited flow ships only what exists and the unmet demand is kept as backlog, so the residual stays zero.
Inventory starts at 40 units and production adds 10 per week. Requested shipments are the chosen number. A clamp holds the stock at zero; a limited flow ships no more than is on hand.
Predict first. With 70 requested and the stock clamped at zero, how many units does the residual say were created?
Choose an example
Constructed example: the chapter's warehouse argument with inventory, production and request sizes defined for this reader.
Calculated values
- Requested shipments (units)
- 70
- Shipped (units)
- 70
- Inventory after the week
- 0
- Unmet orders (units)
- 0
- Conservation residual (units)
- 20
Stock before clamping = 40 + 10 - 70 = (-20); the clamp holds it at 0. Change in the total = 0 - 40 = (-40); expected from the boundary = 10 - 70 = (-60). Residual = (-40) - (-60) = 20. The clamp raised the stock from (-20) to 0, which created 20 units.
Use the idea
Express a bound on the flow, and decide what happens to the demand that was not met, instead of clamping the stock.
Where the conclusion applies
One week, shipments read from the starting inventory, and unmet orders simply waiting. In a real warehouse unmet orders may be cancelled, which is a further flow to declare.
Check your understanding: With 60 requested and the flow limited, how many units wait as backlog?
Chapter 12 source: section "Bounds, and what they assert". Demonstration C12-D03.
4Demonstration 4 of 4
Units as a type system: a rate times a time
What goes wrong when forty units per week is added straight to an inventory of two hundred?
Kept, dt turns the rate into an amount and the inventory grows with the step length. Dropped, the update always adds 40, so only a one week step gives the right answer, by coincidence.
Inventory is in units. Production is 40 units per week. dt is the length of the step in weeks, so dt x 40 is a number of units.
Predict first. At a two week step with dt dropped, how many units does the inventory show?
Choose an example
Constructed example: the chapter's 40 units per week and 200 units, with the step length varied for this reader.
Calculated values
- Step length (weeks)
- 1.00
- Correct inventory (units)
- 240
- Inventory with dt dropped (units)
- 240
- Shown
- 240
- A flow unit of just 'units'
- refused (no time base)
Inventory = 200 + 1.00 x 40 = 200 + 40 = 240 units. The weeks cancel, so the sum is in units.
Use the idea
Make the unit a required field on every flow so that a rate without a time base is refused where it is written.
Where the conclusion applies
A constant production rate and a single step from 200 units. The constructor check catches a missing time base, but not a flow whose unit is wrong in some other way.
Check your understanding: With dt kept at half a week, how many units does the inventory hold after one step?
Chapter 12 source: section "Units as a type system". Demonstration C12-D04.