Settlement¶
Settlement calculates the financial results for each member after a session is cleared. It runs automatically after market clearing and produces detailed breakdowns.
Inputs & Outputs¶
The RECreation settlement engine takes several inputs and produces three categories of results:
Mandatory inputs:
- Community structure (members, meters, allocation coefficients)
- Local prices for LEM transactions
- DSO measurements and allocations
Optional inputs:
- Predefined prices / pricing mechanism override
- Suppliers' contracts and opportunity costs
- Self-consumption tariffs and periods
Results:
- Energy payments among members — peer-to-peer LEM trades
- Self-consumption grid access tariffs — network charges for collective self-consumption
- Members savings — net savings vs. purchasing all energy from the grid
Session → Settlement Flow¶
flowchart LR
S[Session OPEN] --> MC[Market Clearing]
MC --> SM[SettlementMember records]
MC --> SR[SettlementResource records]
MC --> SC[SettlementCPEs records]
MC --> SREC[SettlementREC record]
SM --> BG[Billing Guides]
Revenue Components¶
Settlement computes the following revenue fields for each member per session:
rev_lem_trd — LEM Trading Revenue¶
Revenue from peer-to-peer energy trading in the local energy market.
- Sellers (prosumers with surplus): receive
energy_sold_kwh × lem_price - Buyers (consumers): save
energy_bought_kwh × (grid_price - lem_price)
rev_lem_trd_seller = Σ(energy_sold_kwh[t] × lem_price[t])
rev_lem_trd_buyer = Σ(energy_bought_kwh[t] × (tariff[t] - lem_price[t]))
rev_slc_soc — Social Self-Consumption Credit¶
Portuguese regulatory credit (Crédito de Autoconsumo Coletivo) applied to collectively self-consumed energy. Governed by ERSE tariff rules.
rev_sur — Surplus Injection Revenue¶
Revenue from energy injected into the grid (surplus that was not consumed within the community).
rev_sup — Supply Savings¶
Cost savings from consuming community-produced energy instead of buying from the grid.
rev_total¶
rev_total_pow¶
Power component of the total revenue, including network use-of-system charges:
Settlement Levels¶
Settlement is computed at four levels of granularity:
| Table | Granularity | Key |
|---|---|---|
settlement_members |
Per member per session | (session_id, user_id) |
settlement_members_resources |
Per member per resource per session | (session_id, user_id, resource_id) |
settlement_resource |
Per resource per session | (session_id, resource_id) |
settlement_rec |
Whole community per session | (session_id) |