Two execution modes
Pipelines support two execution modes against the same definition: deterministic evaluation (calculation, illustrated by the examples below) or compilation into an optimisation model when one or more inputs are decision variables. See Optimisation for the optimisation form.Example pipelines
Let’s walk through a series of increasingly powerful examples to help get a feel for how the pipelines express different cost structures. Note each example is available as a diagram and as the equivalent JSON representation. The diagrams are available in LLM-readable mermaid diagrams in llms-full.txt.Example: Fixed monthly fee
This is likely the very simplest example we can give: Each month, the metering point is billed some fixed fee. The fee is the same independent of what the metering point does, so there are no Registered Datasets needed. The pipeline consists of a single Constant Function which outputs a fixed cost per month.- Diagram
- JSON
Example: Energy tax
Let’s take it a step further and do a calculation that does depend on what the Metering Point does. The energy tax in Sweden is calculated based on energy consumed from the grid. There is a Registered Dataset for the energy consumption that is tracked on a quarter-hourly basis by the electricity meter. This one we pass as input to the Multiply function together with the energy tax price to get the tax cost per quarter-hour.- Diagram
- JSON
Example: Peak tariff
Some rate plans charge you for “peak” usage - but what exactly is a “peak”? Unfortunately that depends on which System Operators you ask. This example shows a simplified peak calculation:- In each month, find the three highest hourly peaks
- Take the average of those three
- Multiply that average with some fee
- Aggregate the quarter-hour consumption data to hourly kWh by summing it
- Divide the hourly energy consumption data by 1 hour to convert to kW (yes, yes, but otherwise we would have needed to add a separate ‘conversion’ operator you know)
- Select the 3 highest values per month (see Absent Values)
- Aggregate to monthly peaks by taking the mean of those 3 peaks
- Multiply the monthly peak value by the fee to get the final cost
- Diagram
- JSON
Following the values through
To see what each function does, follow a few real values through a peak fee: Mälarenergi’s Effektavgift for a 20 A house in January 2026. It charges for the highest hour on weekdays between 07:00 and 19:00, holidays excluded, at 47.4 SEK per kW. Take one weekday evening in January, 18:00 to 20:00, and suppose it is the house’s only usage that month:
Eight values in, 113.76 SEK out. The bigger hour, 19:00, never counted. Pass
include_intermediate_time_series=true to Calculate to get every one of these steps back for your own data.