Reference: language and settings

Formulas

Updated 3 November 2026 · 2 min read

What a formula can contain, and what each part of a model is allowed to use.

The parts of a formula#

PartExamples
Numbers7, 0.35, 1.5e-6
Names of stocks, constants and variablesInfected, ContactRate
Timet
Operators+ - * /, and brackets ( )
FunctionsExp, Log, Pow, Sqrt, Min, Max, Abs, Step
Your lookup tablesEffect(Crowding)

A name in a formula is the label made into one word: Room temperature becomes RoomTemperature. The name is shown under the title in each block’s settings. Formulas are limited to 400 characters; past that, part of it wants to be a variable.

There is no ^ for powers: write Pow(x, 2). There is no if: see below.

Functions#

FunctionGivesExample
Exp(x)e to the power xExp(-t / Tau)
Log(x)Natural logarithmLog(Price / BasePrice)
Pow(x, y)x to the power yPow(Size, 0.75)
Sqrt(x)Square rootSqrt(Area)
Min(a, b)The smallerMin(Demand, Capacity)
Max(a, b)The largerMax(0, Profit)
Abs(x)The size, without signAbs(Error)
Step(x)1 when x is above 0, else 0Step(t - 10)

Switching and limiting without if#

  • From a time on: Step(t - 10) * Vaccination is 0 before time 10 and the full rate after.
  • For a window: (Step(t - 10) - Step(t - 20)) * Campaign is on from 10 to 20.
  • Never below zero: Max(0, Inflow - Outflow).
  • Never more than what is there: Min(Orders, Inventory / ShippingTime).
  • A real rule with branches: a C# block.

What each part may use#

InMay use
A stock’s starting valueNumbers and constants
A flowt, stocks, constants, variables, tables, blocks
A variablet, stocks, constants, other variables that don’t depend on it, tables, blocks
A nonlinear function or integralAll of a variable’s names, plus x, the unknown or the variable of integration
A spatial stock’s starting profilex, the position, and constants
A spatial stock’s diffusiont and constants
A spatial stock’s sourcex, u (the cell’s own value), and the rest of the model