What is auxiliary variable?

A quantity in a simulation that is calculated from other quantities at each moment and does not accumulate over time.

Auxiliary variable diagram example

Public diagram from the Machinations Community. Open it on its own page

An auxiliary variable is a value that the model recalculates from the current state of the system at every step. It has no memory of its own, unlike a stock, which accumulates. It matters because clear auxiliaries make rates readable, and they turn raw stocks into meaningful measures like price, utilization, or time to completion.

How it works

Think of a model as having three kinds of element. Stocks hold quantities and change only through flows (see stock and flow). Constants are fixed inputs. Auxiliaries sit between them: they take stocks and constants as input, apply a formula, and feed the result into a rate or into another auxiliary. When the stocks change, every auxiliary updates in the same step.

A useful test is to ask whether the value would still be known if the clock stopped. A cash balance would not be reconstructable without its history, so it is a stock. A ratio of cash to monthly spending can be computed on the spot, so it is an auxiliary. Splitting a long formula into several named auxiliaries makes a model easier to validate and to explain, and it makes the links in a causal loop diagram easier to trace to the equations.

Example

Say a shop has 400 items in stock and sells 50 items per week. Weeks of cover is 400 divided by 50, which is 8 weeks. It is not a stock: if sales rise to 100 per week, weeks of cover becomes 4 immediately. A price rule such as lowering price by 1 dollar for every week of cover above 6 is another auxiliary, built on the first. This is an illustration with round numbers.

How to model it in Machinations

Use a Register with a formula for each auxiliary. The Register reads Pools and other Registers through state connections and recalculates each step. Then use it as the rate on a resource connection or as the condition on a Gate. Add a chart of the Register next to the Pool it depends on, and use a Lever to change a constant.

See auxiliary variable in a system you can Play

Build the rules in a Machinations diagram, change a value and Play it to watch how the system responds.