Skip to content

Impact and herding (euroflex_bess_lab.realtime.impact)

Belgium's implicit-balancing market is shallow. When many batteries react to the same imbalance signal they overshoot: the system imbalance (SI) flips sign and the settlement price turns against them (herd behaviour; see Bruninx, Karimi Madahi, Verstraeten, Decuyper, Develder, Helsen, Herd Behavior in Decentralized Balancing Models: A Case Study in Belgium, arXiv 2602.17352). A large optimiser has to price its own impact. This package is the impact layer of the PRISM framework (Plan.md section 2): pi_k(q) = M(X_k(q)), the settlement price of quarter-hour k when the fleet deviates by q MW, under both Belgian mechanisms.

Results, validation errors and headline numbers: reports/impact.md (regenerated by scripts/research/impact_study.py).

Modules

Module What it does
curves Monotone piecewise-linear volume -> price curves, fixed-effect fits (first differences within the delivery hour by default), one curve per local-hour block with pooled fallback
alpha Elia's alpha: 1{|SI_k| > 150 MW} * 200 / (1 + exp((450 - x) / 65)) * c, x = (|SI_k| + |SI_k-1|) / 2, price factor c = clip((400 - MIP) / 200, 0, 1) short / clip((MDP + 200) / 200, 0, 1) long (100 % of ODS134); fitted alternatives; counterfactual modes
state Quarter-hour states (ODS134 + ODS127, ODS212) and running QH-to-date states (ODS133, ODS211)
response The counterfactual price functions current_price / assemble_current_price (neutral band, FLOOR / CAP, exact alpha), new_formula_price / new_formula_parts, and the displacement rules
channels Split of the own-price impact into merit-order, alpha (own and next quarter-hour), weight and branch (overshoot) channels
operators CurrentFormulaImpact, NewFormula2026Impact (ImpactModel implementations), fitting (fit_current_response, fit_new_formula_response), activation pass-through
validation Hold-out back-tests: curve calibration on realised activation changes; full-operator "natural SI shift" test
policies ImpactAwareThresholdStrategy (internalises the fleet's own impact), price_taking_threshold, VolumeFromSI
fleet Capacity-value curve (per-MW value versus fleet size), re-settlement of recorded traces
equilibrium Multi-fleet minute loop: closed-loop herding, naive / Nash / central best responses; Cournot solvers
synthetic Synthetic market with known slopes (tests, examples)

Usage

from euroflex_bess_lab.realtime import BatteryParams, MarketData, simulate
from euroflex_bess_lab.realtime.impact import CurrentFormulaImpact, fit_current_response
from euroflex_bess_lab.realtime.impact.policies import (
    ImpactAwareThresholdStrategy,
    VolumeFromSI,
    price_taking_threshold,
)
from euroflex_bess_lab.realtime.impact import current_state_from_market

market = MarketData.from_public("2026-01-01", "2026-08-01", include_new_formula=True)
fit, alpha_fit = fit_current_response(market)  # curves, alpha, pass-through
impact = CurrentFormulaImpact.from_market(market, fit)  # an ImpactModel
battery = BatteryParams(power_mw=1.0, energy_mwh=2.0)

herd = simulate(market, price_taking_threshold("current"), battery, impact=impact, fleet_mw=400.0)
state = current_state_from_market(market)
vmap = VolumeFromSI.fit(state.si_mw, state.up_mw, state.down_mw)
aware = simulate(
    market, ImpactAwareThresholdStrategy("current", fit, 400.0, volume_map=vmap), battery, impact=impact, fleet_mw=400.0
)

impact.price_at(q) gives the counterfactual price of every quarter-hour for a deviation q (scalar, (n,) or an (n, k) grid); impact.adjust(qh_index, base_price, fleet_delta_mw) is the ImpactModel hook used by simulate (base + pi(q) - pi(0), so a zero deviation returns the published prices unchanged and missing components mean no impact). impact.aligned(sub_market) re-indexes an operator to a slice. The 2026 formula works the same way with NewFormula2026Impact / fit_new_formula_response and mechanism="new2026".

The operators

Displacement. SI' = SI + q. Elia's aFRR + mFRR activation offsets a share kappa of the deviation (the pass-through, estimated per period from consecutive quarter-hours as -d(U - D) / dSI; the remainder is absorbed by imbalance netting / IGCC and the ACE). A long deviation removes gross upward activation first and only then adds downward activation: U' = max(U - kappa q, 0), D' = D + max(kappa q - U, 0) (short deviations symmetrically). Volumes are the ODS127 / ODS212 quarter-hour activations (aFRR + mFRR; IGCC and reserve sharing excluded: on ODS212 SI ~= -(net aFRR + net mFRR) with an IGCC coefficient of ~0).

Current formula (Elia's rule, verified on ODS134 May 2024 - Jul 2026; structure from the paper agent). MIP = max(aFRR, mFRR SA, mFRR DA up prices, FLOOR), MDP = min(down prices, CAP); if |SI| < 25 MW the price is (FLOOR + CAP) / 2 (Elia publishes that midpoint as MIP or MDP; the state builders restore the structural value); otherwise MIP + alpha if SI < 0 else MDP - alpha with the exact alpha above. Counterfactual: MIP' = max(MIP + f_up(U') - f_up(U), FLOOR), MDP' = min(MDP + f_down(D') - f_down(D), CAP), alpha by the rule at SI_k + q_k, SI_k-1 + q_k-1 and MIP' / MDP' (the fleet's own previous deviation enters x'), the neutral band at |SI'| < 25 MW. The legacy ratio alpha mode is kept for comparison only.

2026 formula. Default (displacement="pro_rata"): within the original branch the published aFRR / mFRR weights are kept (reductions pro-rata across aFRR and mFRR, increases aFRR) and the branch's main component moves by the weighted product-price changes (main' = main + w_a dP_aFRR + w_m dP_mFRR); after a sign flip the new-direction regulation is aFRR (weights 1 / 0) priced along the aFRR curve from the observed new-direction volume. Option displacement="afrr_first": only aFRR absorbs the deviation (scheduled mFRR stays for the quarter-hour) and the weights follow the net volumes, w' = w + w_net(q) - w_net(0) - the weight channel, which raises the short-branch price when a long deviation displaces aFRR while dearer mFRR stays (and therefore is not monotone). Final mapping: NewWeightedMechanism2026.price_given_si (incentive rule included, incentive kept at its published value). Verified on ODS212: the published weights are net-volume shares, w_aFRR = |aFRR_up - aFRR_down| / (|net aFRR| + |net mFRR|) (95.5 % exact on quarter-hours with mFRR; the rest is the ramp of directly activated mFRR).

Properties (tested). Non-increasing in q within a branch (short / neutral / long; default displacement); exact at q = 0; the branch switches when the deviation exceeds |SI| with the opposite sign (overshoot); isinstance(op, ImpactModel).

Channels. channels.current_channels(op, q) / channels.new_channels(op, q, displacement=...) split pi(q) - pi(0) per quarter-hour into merit (merit order), alpha_own / alpha_carry (alpha of the same and, via x, of the next quarter-hour; current rule), weight (2026 rule, afrr_first) and branch (neutral band / sign flip); channel_value turns them into EUR per MW per year for a fleet's quarter-hour energies.

Curves. fit_response_curve(volume, price, increasing=..., groups=hour_ids): ramp basis on quantile knots, bounded least squares on first differences of consecutive quarter-hours of the same delivery hour (or within-group demeaning), prices clipped at the 0.1 / 99.9 % quantiles, residuals winsorised at 1 / 99 % and refitted, unidentified segments flat, linear tail beyond the last knot. mFRR curves use day fixed effects and stronger winsorising (sparse, with -15,000 EUR/MWh outliers); with fewer than 300 activated quarter-hours the mFRR price is held fixed. Optional: quarter-hour merit-order curves from ODS156/157 (BidCurveDelta, bid_curves= in CurrentFormulaImpact.from_market), used as a stress scenario only (they overstate the realised response).

Validation

validation.validate_curve_changes predicts within-hour price changes from realised activation changes (curve calibration and out-of-sample R^2 against a no-change baseline). validation.validate_operator_si_shift feeds the operator the realised SI change between consecutive quarter-hours as if it were a fleet deviation and predicts the next published price (baselines: persistence and the same operator with flat curves), split by sign-flip and same-sign pairs. Both are run on hold-out periods in scripts/research/impact_study.py and reported in reports/impact.md.

Policies, fleet curve and equilibrium

  • price_taking_threshold(mechanism): ThresholdStrategy on the running price of the mechanism (price_cum_eur_mwh or nf_imbalance_price_eur_mwh), bands = 0.25 / 0.75 quantiles of the last 14 days of published prices.
  • ImpactAwareThresholdStrategy: same signal, same bands, chooses the fleet deviation q in [-Q, Q] maximising q (P(q) - band) with P(q) = signal + pi(X_run, q) - pi(X_run, 0); reduces exactly to the threshold rule when the believed impact is zero (impact_scale=0); passes check_no_lookahead.
  • fleet.capacity_value_curve: per-MW value, cycles/day and overshoot share for fleet sizes 1 ... 1,600 MW; price takers are simulated once and re-settled per size (settle_quarter_hours), impact-aware policies per size. Overshoot share = share of the fleet's active quarter-hours in which its deviation is opposite to SI and larger than |SI|. Signals are open loop (the fleet does not see its own deviation inside the quarter-hour).
  • equilibrium.simulate_fleet_game: N fleets per scenario, every minute; herding (heterogeneous price takers, closed-loop running signal that contains the fleets' own deviations), herding_homogeneous, naive (each fleet internalises only its own impact), nash (symmetric equilibrium by damped best responses on the price-response function of the running state), central (joint profit). Reports per-MW value, overshoot / harm shares, the change in residual imbalance energy sum |SI + q| and an activation-cost proxy 0.25 (U' MIP' - D' MDP'). symmetric_equilibrium / nash_equilibrium reproduce the analytic Cournot solution q_i = (a - b s - c) / (b (N + 1)) on a linear market (tested).

Outputs (regenerated by scripts/research/impact_study.py)

File (reports/ledgers/) Content
impact_capacity_value_curve.parquet (+ .json) mechanism, policy, fleet_mw, eur_per_mw_year, cycles_per_day, overshoot_share + window (2026H1 = Jan-Jul 2026 natural experiment, both mechanisms; 2025 = current formula), harm / deployed shares, average prices, tail risk; strat:<name> rows when other agents' price-taking ledgers (realtime_*.parquet) are re-settled (--update-strat)
impact_qh_ledgers_<window>.parquet (+ .json) Quarter-hour ledgers of the curve runs for Q = 1 / 100 / 400 / 1,600 MW (per unit battery)
impact_capacity_value_sensitivity.parquet Price taker under alternative impact environments; impact-aware policy with misspecified / prior-period beliefs
impact_channels.parquet Revenue effect of each impact channel (merit, alpha own / next QH, weight, branch)
impact_equilibrium.parquet (+ .json) Multi-fleet results per mechanism, policy and total implicit capacity
impact_validation.json, impact_response_fits.json Hold-out validation, rule checks, fitted curves / alpha / pass-through per period

Approximations and limitations

  • Reduced-form operators fitted on public data, not Elia's activation optimisation (PICASSO / MARI); quarter-hour averages stand in for the 4-second aFRR dynamics; marginal prices are moved incrementally around their published values; the 2026 incentive component is kept at its published value.
  • ODS126 minute activation volumes are not on the scale of the ODS127 quarter-hour volumes, so running activations for the current formula are mapped from the running SI (VolumeFromSI, median gross activation per SI bin).
  • Simulation environments are fitted in-sample on each evaluation window; the impact-aware policy is given the same response function (known impact function, unknown future). impact_scale tests misspecified beliefs.
  • Fleets are incremental to history (existing implicit reactions are in the data); bands use exogenous published prices; the equilibrium is a per-minute stage game with the band as the opportunity cost of energy, and SOC limits only clip the chosen power.
  • The 2026-formula data is Elia's simulation of the new design on historical days (ODS211/212, deleted by Elia on 17 Nov 2026); market participants will adapt to the new design.