Many model parameters accept “dynamic expressions” which are mathematical expressions that may include data references, constants, model results, inbuilt variables.

Basic Usage

The simplest dynamic expressions are constants, data references, model result references.

Constant expressions

evap = 5.0
rain = 2.5

Data References

evap = data.climate.by_name.evaporation
rain = data.rainfall.by_name.value

Click here to find out more about data references.

Model Result References

evap = data.climate.by_name.evaporation
rain = data.rainfall.by_name.value

Click here to find out more about model result references.

Arithmetic

Dynamic expressions accept standard mathematical operators: +, -, *, /, ^

evap = 1.2 * data.climate.by_name.evaporation
rain = 0.2 * data.rainfall.by_name.site_a + 0.8 * data.rainfall.by_name.site_b

observed = data.price_of_bananas.by_name.discounted ^ 2 + 10

Conditional Logic

Use if(condition, true_value, false_value) for conditional expressions.

# Summer evaporation is higher
evap = if(data.month > 10, data.summer.by_index.1, data.winter.by_index.1)

# Apply seasonal adjustment
rain = data.rainfall.by_index.1 * if(data.season.by_index.1 == 1, 1.2, 0.8)

# Clamp negative values to zero
inflow = if(data.raw_flows.by_index.0 < 0, 0, data.raw_flows.by_index.0)

Comparison operators: >, <, >=, <=, ==, !=

Common Functions

You can also use common mathematical functions.