Skip to content

Internal Transactions Between Members

A Transaction is a record of energy exchanged between two community members in a session. It is the building block of settlement.

Transaction Model

Field Description
session_id The session in which the trade occurred
buyer_id Community member who consumed the energy
seller_id Community member who produced the energy
energy_kwh Amount of energy traded
price Agreed price (€/kWh) based on community market_rate
datetime_timestamp Time slot of the trade

How Transactions Are Created

Transactions are created automatically during market clearing:

flowchart TD
    L[Load Data: consumption & production per member per slot]
    MC[Market Clearing Algorithm]
    A[Allocation Coefficients]
    T[Transaction Records]

    L --> MC
    A --> MC
    MC --> T
  1. For each 15-min slot, the clearing algorithm identifies members with surplus (production > consumption)
  2. Surplus is allocated to consuming members using the community's method_alloc_coeff
  3. One Transaction record per buyer-seller pair per time slot is created

Allocation Methods

Method Description
FIXED Pre-defined static coefficients per member
DYNAMIC Coefficients computed proportionally to real-time consumption

Transaction Adjustments

Small discrepancies between computed and metered energy (within transaction_adjustment_tolerance) are handled via adjustments:

POST /core/api/communities/{community_id}/sessions/transactions/adjustments

Adjustments are additive corrections to existing transactions and are included in the final settlement computation.

DSO Energy Codes

The following DSO measurement codes map to settlement concepts (from Portuguese E-REDES format):

Code Description
413 Surplus allocated to each consumer (IC/IA)
415 Energy attributed to each consumer
418 Self-consumption via RESP per consumer
421 Total surplus attributed to each producer (IPr/IA)
424 Net injection by each producer / extraction by each storage
452 Total community energy available for sharing