STEM will perform arithmetic on both scalar (single value) and time-series fields. When a time series is determined by an arithmetic formula, the usual parameterisation inside is replaced by a read-only table of values for each year of the model run – see 4.7 Viewing and editing time series.
In addition to the standard mathematical operators and functions above, there are also some special functions which only apply to time series.
prev(X, y) prevYear(X, y) |
Previous-period time series, taking values of time series X, lagged by one period, and scalar value y in year zero Previous-year time series
|
prevThis(y) |
Previous-period result for an expression Transformation, used for self-references in (cumulating) expressions |
year0(X)
yearN(X, n) |
Scalar value of time series X in year zero or year n, for compatibility with formulae for scalars |
periodBegin()
periodEnd()
|
Returns a time series: for each period, the beginning/end of that period measured in elapsed years from the start of Y1 |
periodLen() |
Returns a time series: for each period, the length of that period measured in years |
shift (input, offset)
|
input is a reference to any time-series input in the Editor
offset is a number, measured in years, which controls how much the output is shifted in time compared to the input
|
Special functions for time series
A formula for a time series can include references to scalars, which are implicitly converted to constant time series, and a formula for a scalar may use the
year0() or yearN() functions to extract a specific value from a time series.
Note: STEM will automatically use the year0() value of a time series included in a formula for a scalar.