System Design Atlas

Generation forecasts and energy balances

06 / 10Worked example

The overall architecture

How are forecast-run responsibility and external processing divided between modules and processes?

The local consistency rule determines the structure of the forecast API. Forecast computation handles deferred work in a separate process. Interval assignment, input versions, forecast approval and energy balance comparison are modules within the API. The measurement source sends versioned values to a time-series store. Forecast computation reads a frozen input version and writes a run manifest and forecast. The forecast API manages approvals and current comparison references in the relational metadata store. A separate comparison path combines an approved forecast with a selected measurement revision. The energy balance team reads the comparison; corrections to actual measurements trigger new comparisons while preserving historical forecasts.

Starting point Corrections extend the comparison history.

Assumptions for the example case

A fictional example design for a generation facility using fixed 15-minute intervals and separate forecast and measurement versions. Each interval spans 900 seconds, inclusive at the start and exclusive at the end; a measurement at exactly 900 seconds belongs to the next interval. All figures and test targets are illustrative assumptions.

Runtime components and datastores

Runtime topology

Measurement data sourceProvides authenticated measurement revisions
Energy balance teamReads versioned comparisons

Forecasting and comparison system

Measurement ingestionchecks source, interval and revision
Time-series datastoreMeasurements and provenance per interval
Forecast computationComputes from a frozen input version
Forecast APIManages approvals and comparison references
Metadata datastoreRun manifest, versions and comparisons
Comparison pathConnects a forecast with a measurement revision
Measurement data source → Measurement ingestionAuthenticated measurement revision
Measurement ingestion → Time-series datastoreValidated interval values
Time-series datastore → Forecast computationFrozen input version
Forecast computation → Metadata datastoreRun manifest and forecast
Forecast API → Metadata datastoreApproval and current reference
Time-series datastore → Comparison pathselected measurement revision
Metadata datastore → Comparison pathApproved forecast
Comparison path → Energy balance teamVersioned comparison

Each comparison binds forecast version, measurement revision and the same interval.

The measurement source sends versioned values to a time-series store. Forecast computation reads a frozen input version and writes a run manifest and forecast. The forecast API manages approvals and current comparison references in the relational metadata store. A separate comparison path combines an approved forecast with a selected measurement revision. The energy balance team reads the comparison; corrections to actual measurements trigger new comparisons while preserving historical forecasts.

Domain responsibilities within the API

Internal responsibilities

Run manifestSave input hash, model version and forecast
Model approvalForecasters confirm the run
Measurement revisionSeparate current and historical actual revisions
Comparison revisionConnect the forecast with the selected measurement revision

Modules remain within the API process.

The forecast API contains interval assignment, input versions, forecast approval and energy balance comparison. Show calls between these responsibilities; the modules have no separate server icons.

Map responsibilities to runtime components

Domain taskRuntimeResponsibility
Interval assignmentForecast APIAssigns time series to the same time period and unit system.
Input versionForecast APIRecords input provenance and revision for a run.
Forecast approvalForecast APIFreezes the approved forecast version.
Energy balance comparisonForecast APICompares specific forecast and measurement revisions.
Forecast computationSeparate background processProcesses stored work and external feedback.
Measurement data sourceExternal boundaryProvides or confirms the evidence agreed for this case.

Interval assignment

Runtime
Forecast API
Responsibility
Assigns time series to the same time period and unit system.

Input version

Runtime
Forecast API
Responsibility
Records input provenance and revision for a run.

Forecast approval

Runtime
Forecast API
Responsibility
Freezes the approved forecast version.

Energy balance comparison

Runtime
Forecast API
Responsibility
Compares specific forecast and measurement revisions.

Forecast computation

Runtime
Separate background process
Responsibility
Processes stored work and external feedback.

Measurement data source

Runtime
External boundary
Responsibility
Provides or confirms the evidence agreed for this case.

Computation jobs use frozen manifests

Computation jobs use frozen manifests

Computation jobs use frozen manifests.

Each comparison identifies the forecast version, measurement revision and matching time interval; later actual measurements do not change historical forecasts.

Time-series revisions, run manifests and comparison versions must express the same valid state. The exercise specifies the input and expected result.

Alternative considered
A separate service for every module would spread the guarantee that comparisons identify fixed forecast and measurement versions for one interval across additional network boundaries.
Trade-off
Common schema changes require coordinated releases.
Reassess
A substantially different load or independent ownership for forecast computation justifies revisiting process boundaries.

Try it yourself

Classify interval assignment, forecast computation and the measurement source as a module, process or external system. Add the authoritative datastore.

A hint for your attempt

A domain responsibility becomes a process only when it has its own execution unit.

Compare with a possible solution
Boundaries
Interval assignment is a module in the forecast API; forecast computation is a separate process; the measurement source is external.
Storage
Time-series revisions, run manifests and comparison versions hold authoritative evidence. Each comparison identifies the forecast version, measurement revision and matching interval; later actual measurements preserve historical forecasts. The shared transaction protects this relationship; external responses remain separate evidence.

Apply to your project

Which planned service boundary would distribute a currently local guarantee across the network?

Next: Old jobs must not displace current measurement revisions.