Skip to content

DSO Measurements (E-Redes)

DSO measurements are the validated data that the distribution system operator sends for a community. In Portugal the DSO is E-Redes, and its meters are the CPEs identified by codes starting with PT0002. The data uses the DSO's own format, and it carries more information than a plain consumption/generation reading, such as the surplus and the share of the REC's injection allocated to each consumer.

DSO measurements apply only to CPE meters (and to the virtual aggregator meter, see below). Internal meters are invisible to the DSO, so they always rely on Loads.

Mode How DSO measurements are used
Real operation Always. The Market and Settlement read the DSO measurements for every CPE
Simulation Optional. When enabled for a run, they replace the self-gathered Loads of the CPEs

What the DSO Sends

Per CPE

One record per CPE and 15-minute interval. All energy values are in kWh.

Field DSO code Description
consumption 423 Energy consumed from the public grid
grid_injection 424 Energy injected into the public grid by a prosumer meter
imputed_energy 415 Share of the total REC injection that was allocated to a consumer meter
energy_surplus 413 Surplus allocated to a consumer meter: energy produced in the REC but not consumed internally, which the REC manager sells to an aggregator or retailer
grid_sc 418 Energy self-consumed from the public grid by a consumer meter

Each value also carries a *_stage field, which is the quality flag set by the DSO: 0 real, 1 estimated, 2 invalid.

The platform derives the CPE's net metered energy as consumption − grid_injection. That value is used as the measurement of resources that are attached directly to a CPE.

Per aggregator meter

The DSO also reports data for the community's aggregator meter. This virtual meter has its own DSO code, and it represents the community as a whole instead of any physical device.

Field DSO code Description
total_surplus 421 Total surplus allocated to all consumer meters
sharing_energy 452 All energy injected by the prosumer meters

How DSO Measurements Are Used

In real operation

For a PROD community, the Market and Settlement always read DSO measurements for CPEs:

  • The allocation of each CPE (imputed_energy and energy_surplus) comes from the DSO instead of being calculated. It is the basis of the transactions and of the billing.
  • The net energy of resources attached directly to a CPE is consumption − grid_injection.
  • Resources behind an internal meter still use the Loads of that meter.

The platform checks that every CPE has a record for every session. If any are missing, the run stops with an error that states how many rows were expected (sessions × CPEs) and how many were found.

In simulation

A simulation normally has no DSO data, so the platform emulates it from the CPE Loads. If you have real DSO data for the simulated period, for example when re-running historical data or comparing results, you can turn on Use DSO measurements in the Simulation dashboard. It is the use_dso_measurements flag of the clear_market and run_settlement simulation tasks.

With the option enabled:

  • The CPEs use the DSO allocation instead of the emulated one, and their DSO measurements replace their Loads.
  • Internal meters keep using their Loads. There is no DSO data for them.
  • The choice is made per run, not per CPE. Every CPE needs DSO data for every session in the period, otherwise the run fails with the same missing rows error. There is no automatic fallback to Loads.

With the option disabled, any DSO data that was uploaded is ignored.

Uploading DSO Data

Uploading DSO data works in the same way as Loads:

  • Records are upserted by community, meter and timestamp.
  • Sessions are created for new timestamps and reopened for existing ones, and their results are deleted. Run the Market and Settlement again afterwards.
  • datetime_timestamp is the start of the 15-minute interval.

There are two ways to upload:

  • JSON with POST /core/api/communities/{community_id}/dso, with the CPE records in dso_loads and the aggregator records in dso_aggregator_loads. The meter_id must be a CPE or aggregator meter, never an internal meter.
  • DSO file in the DSO's SGL v2 format (template). Each line is one CPE and one variable code, with the values in kW (converted to kWh) and the interval end as a time. The platform resolves the CPE codes to community meters.

See the DSO API reference for all the parameters, responses and the paginated, KPI and per-meter read endpoints.

Simplified CPE data

Some integrations cannot receive the full DSO format and send plain consumption and generation for a CPE. This "simplified" CPE data needs further discussion with INESC TEC, as it does not include the DSO's allocation and surplus.

Send aggregator rows with the CPE rows

As implemented, the upload task fails when dso_loads has rows and dso_aggregator_loads is empty. Send at least one aggregator row, or check the task status after every upload.

Dynamic Communities

When the allocation method is DYNAMIC, the DSO measurements follow a two-step exchange: the DSO first sends the proportional allocation, then you generate the dynamic coefficients (Bilateral Energy Allocations) and send them to the DSO for validation. See Market & Sessions for the session states of this flow.