Reference: components

Variable

Updated 3 November 2026 · 1 min read

A variable is a value worked out from others by a formula, at every step. It holds nothing over time: it is recomputed from the stocks as they are now.

Place one#

Click Variable in the components list, then the canvas. It is drawn as an oval with its current value.

Settings#

SettingWhat it is
NameIts name; in formulas, one word.
UnitWhat it is measured in. The unit checker works it out from the formula and compares.
FormulaHow it is worked out, from t, stocks, constants and other variables.
OutputMarks it as a result other models can read when this one goes in as a module.

Use it for#

  • Naming part of a long formula. Crowding = Fish / Capacity makes BirthRate * Fish * Effect(Crowding) readable, and gives crowding its own chart.
  • A result you want to see. Profit, concentration, recovery factor: things you want charted that aren’t stocks or flows.
  • A value used in several places, so you change it once.

Rules#

  • Variables can use other variables, as long as no chain of them comes back to where it started. A loop must pass through a stock, which is what holds a value from one step to the next.
  • The builder works out the order: you can place variables anywhere, and each is computed after the ones it uses.

In the C##

Each variable is a line in Evaluate, before the flows:

double Crowding = Fish / Capacity;                                          // ratio

A variable can instead be worked out by C# you write, a C# block, or by a SepalSolver function: a nonlinear function or an integral.