Energy Markets and Grid Operation
Economic dispatch assumed one company that owns every power station and knows every cost curve. Most large grids no longer work that way. Generators, suppliers, storage owners and large consumers are separate companies; they sell and buy energy in markets, and an independent system operator keeps the physics in order: balance every second, every line inside its rating, the grid secure against the next outage. This lesson is a short map of how the two fit together: who the operators are, how a day-ahead auction sets a price by merit order, how intraday trading, balancing and ancillary services close the gap to real time, what happens when the network is congested, why some countries pay for capacity, and what the control room does all day.
Safety. Markets and control rooms are studied here by calculation only. The one physical analogue is a resistor triangle on a current-limited supply.
Dates. Market rules change every year. Every rule quoted below is dated; the state described is that of November 2026 unless stated, and you should check the current rules of the market you work in.
Who runs what
- A transmission system operator (TSO) runs the high-voltage grid of a control area: it balances the area, procures reserves, computes how much cross-border capacity can be traded and keeps the grid N−1 secure. In the EU, TSOs are legally unbundled from generation and supply (Third Energy Package of 2009, now Directive (EU) 2019/944, amended by the 2024 market-design reform, Directive (EU) 2024/1711 and Regulation (EU) 2024/1747) and cooperate in ENTSO-E, which writes the network codes and the System Operation Guideline (Regulation (EU) 2017/1485, SOGL) used in Frequency Control.
- A distribution system operator (DSO) runs the medium- and low-voltage networks (Distribution Systems) and, increasingly, manages the DER connected to them.
- An independent system operator (ISO) or regional transmission organisation (RTO), the North American model, operates the grid and the wholesale market of a region without owning the lines (PJM, MISO, CAISO, ERCOT and others).
- Power exchanges (in the EU, nominated electricity market operators, NEMOs) run the auctions; balance responsible parties are the companies financially responsible for any difference between what they scheduled and what their customers and plants actually did.
Market timeframes
Energy is traded in stages, each closer to real time and each correcting the previous one with better forecasts:
- Forward and futures contracts (years to days ahead) hedge price risk; they are financial or bilateral and do not see the network.
- The day-ahead market is the main physical auction. In the EU, Single Day-Ahead Coupling (SDAC) clears all coupled bidding zones together with one algorithm (EUPHEMIA) at gate closure 12:00 CET on the day before delivery, publishing prices for every zone shortly before 13:00. Since 1 October 2025 (first delivery day; trading day 30 September) SDAC uses a 15-minute market time unit: 96 prices per zone per day instead of 24.
- The intraday market lets parties correct their positions as wind, solar and demand forecasts improve. EU Single Intraday Coupling (SIDC) has offered continuous cross-border trading since June 2018 (go-live 12 June 2018, as XBID) and, since 13 June 2024, three pan-European intraday auctions (at 15:00 and 22:00 CET on D−1 and 10:00 on D, the last one for the hours from 12:00 to 24:00 of D). Cross-border continuous trading closed one hour before delivery until ACER Decision 11/2025 cut the gate closure to 30 minutes, introduced border by border from 14 January 2026 (some borders may keep a derogation until 2029); inside some zones local trading continues until a few minutes before. Products are 15-minute (and hourly) blocks.
- After gate closure only the TSO acts, with balancing energy (next section). After delivery, each balance responsible party pays or is paid the imbalance price for its deviation in each imbalance settlement period, harmonised at 15 minutes by the Electricity Balancing Guideline (Regulation (EU) 2017/2195).
Merit order and marginal pricing
Each seller offers a quantity at a price, each buyer bids a quantity at the most it will pay. The auction sorts offers upwards (the merit order, cheapest first: wind and solar near zero, then nuclear, then gas) and bids downwards, and finds where supply meets demand. Every accepted seller is paid, and every accepted buyer pays, that one clearing price: pay-as-clear, or uniform marginal pricing. Bidding true marginal cost is then the sensible strategy for a small producer, because the price it receives is set by someone else; that is why the clearing price equals the system of economic dispatch when offers are true incremental costs. The cheap units earn the difference between price and their cost as infra-marginal rent, which pays back their capital.
Mathematically the auction is a linear programme that maximises welfare (value of accepted bids minus cost of accepted offers) subject to supply equal to demand; the price is the dual variable (Lagrange multiplier) of the balance constraint, exactly as was in economic dispatch.
Worked example: one hour of a day-ahead auction
Given: offers: wind at , nuclear at , CCGT A at , CCGT B at , OCGT at . Bids: inflexible load at the price cap, industry at , heat pumps at , battery charging at . (Illustrative numbers.)
Find: the clearing price and the accepted volumes.
Solve: cumulative supply is , , , at , , , . Demand willing to pay at least is ; the heat pumps () and the battery () are out. Wind and nuclear give , so CCGT A supplies the last of its and is the marginal unit:
Check: at any price just below , CCGT A would offer nothing and supply () would fall short of demand (, or below ); just above , supply () exceeds demand (). The price is where the two step curves cross.
In Python: clearing an auction as a linear programme
import numpy as np
from scipy.optimize import linprog
import matplotlib.pyplot as plt
# One delivery period: offers and bids as (name, MW, EUR/MWh); illustrative numbers
offers = [("wind", 300, 0.0), ("nuclear", 400, 12.0), ("CCGT A", 250, 68.0),
("CCGT B", 200, 82.0), ("OCGT", 150, 145.0)]
bids = [("inflexible load", 800, 4000.0), ("industry", 120, 90.0),
("heat pumps", 100, 60.0), ("battery charging", 80, 40.0)]
def clear(offers, bids):
"""Maximise sum(bid * d) - sum(offer * g) subject to sum(g) = sum(d); the price is the dual."""
c = [o[2] for o in offers] + [-b[2] for b in bids]
A_eq = [[1] * len(offers) + [-1] * len(bids)]
bounds = [(0, o[1]) for o in offers] + [(0, b[1]) for b in bids]
r = linprog(c, A_eq=A_eq, b_eq=[0], bounds=bounds, method="highs")
return float(r.eqlin.marginals[0]), r.x[:len(offers)], r.x[len(offers):]
for label, wind in (("windy", 300), ("calm", 100), ("very windy", 650)):
off = [(n, wind if n == "wind" else q, p) for n, q, p in offers]
price, g, d = clear(off, bids)
cost = sum(p * x for (_, _, p), x in zip(off, g))
print(f"{label} hour (wind {wind} MW): price {price:.2f} EUR/MWh, volume {g.sum():.0f} MW, "
f"cost of accepted offers {cost:.0f} EUR/h")
for (n, q, p), x in zip(off, g):
if x > 1e-6:
print(f" {n:8s} {x:6.1f} of {q:3d} MW at offer {p:6.2f}: paid {price*x:6.0f}, margin {(price-p)*x:6.0f} EUR/h")
print(" accepted bids:", ", ".join(f"{n} {x:.0f}/{q}" for (n, q, p), x in zip(bids, d)))
# the windy hour as step curves
fig, ax = plt.subplots(figsize=(6, 3.5))
q = np.cumsum([0] + [o[1] for o in offers]); p = [o[2] for o in offers]
ax.step(q, p + [p[-1]], where="post", label="supply (merit order)")
qd = np.cumsum([0] + [b[1] for b in bids]); pd = [min(b[2], 200) for b in bids]
ax.step(qd, pd + [pd[-1]], where="post", label="demand bids (cap drawn at 200)")
ax.axhline(68, ls="--", c="grey"); ax.text(20, 72, "clearing price 68 EUR/MWh")
ax.set_xlabel("MW"); ax.set_ylabel("EUR/MWh"); ax.set_ylim(-5, 210); ax.legend(fontsize=8); ax.grid(alpha=0.3)
fig.tight_layout(); plt.show()windy hour (wind 300 MW): price 68.00 EUR/MWh, volume 920 MW, cost of accepted offers 19760 EUR/h
wind 300.0 of 300 MW at offer 0.00: paid 20400, margin 20400 EUR/h
nuclear 400.0 of 400 MW at offer 12.00: paid 27200, margin 22400 EUR/h
CCGT A 220.0 of 250 MW at offer 68.00: paid 14960, margin 0 EUR/h
accepted bids: inflexible load 800/800, industry 120/120, heat pumps 0/100, battery charging 0/80
calm hour (wind 100 MW): price 82.00 EUR/MWh, volume 920 MW, cost of accepted offers 35740 EUR/h
wind 100.0 of 100 MW at offer 0.00: paid 8200, margin 8200 EUR/h
nuclear 400.0 of 400 MW at offer 12.00: paid 32800, margin 28000 EUR/h
CCGT A 250.0 of 250 MW at offer 68.00: paid 20500, margin 3500 EUR/h
CCGT B 170.0 of 200 MW at offer 82.00: paid 13940, margin 0 EUR/h
accepted bids: inflexible load 800/800, industry 120/120, heat pumps 0/100, battery charging 0/80
very windy hour (wind 650 MW): price 40.00 EUR/MWh, volume 1050 MW, cost of accepted offers 4800 EUR/h
wind 650.0 of 650 MW at offer 0.00: paid 26000, margin 26000 EUR/h
nuclear 400.0 of 400 MW at offer 12.00: paid 16000, margin 11200 EUR/h
accepted bids: inflexible load 800/800, industry 120/120, heat pumps 100/100, battery charging 30/80
Three lessons from three hours. With less wind the merit order shifts left and a dearer gas unit sets the price ( instead of ), raising the margin of every cheaper unit. With a lot of wind, no generator is marginal at all: the heat pumps are now in and the battery's bid sets the price at , with only of its accepted. Demand response and storage set prices too (The Smart Grid): flexible bids raise the price in surplus hours and, as sellers, cap it in scarce ones. With still more wind and too little flexible demand, prices can go negative (SDAC's harmonised limits are and , with rules that move a limit automatically after prices come close to it; ACER, 2026), when plants that are paid per MWh produced, or that cannot cheaply stop, keep running.
Real auctions add block orders (all-or-nothing over several periods), minimum-income and ramping conditions for thermal plant (Unit Commitment), and the network between zones, which is the next topic.
Congestion, zones and nodes
The auction above treats the grid as a copper plate. When a line limit binds, the cheapest schedule is not feasible, and the price of energy becomes different at different places.
- Nodal pricing (locational marginal pricing, LMP), used by all US ISOs/RTOs: the market clears a DC (or AC) network model with every line limit included. The price at bus is the dual of that bus's balance: the cost of serving one more MW there.
- Zonal pricing, used in Europe: each bidding zone (often a country) has one price, and only the capacity between zones is modelled. In the Core region of central Europe, capacity is allocated flow-based since 8 June 2022, with PTDFs of the critical lines (DC Load Flow) inside the market algorithm; the Electricity Regulation (EU) 2019/943 requires TSOs to offer at least of critical-line capacity to cross-zonal trade (with transition plans to the end of 2025). Congestion inside a zone is not priced; the TSO fixes it after the market by redispatch: paying plants on one side of the bottleneck to lower output and on the other side to raise it.
The DC load flow and the N−1 rule from the control room meet the market in the example below: a triangle network whose cheap generator sits at a bus with only two lines.
In Python: N−1 check and security-constrained prices
import numpy as np
from scipy.optimize import linprog
# Three-bus triangle, x = 0.1 pu on 100 MVA for every line, every line rated 400 MW
lines = [(1, 2), (1, 3), (2, 3)]
x, rating = 0.1, 400.0
gen = {"G1": (1, 500, 15.0), "G2": (2, 400, 60.0), "G3": (3, 300, 90.0)} # bus, MW, EUR/MWh
load = np.array([0.0, 150.0, 450.0]) # MW at buses 1..3
A = np.zeros((3, 3))
for l, (i, k) in enumerate(lines):
A[l, i - 1], A[l, k - 1] = 1, -1
Bd = np.eye(3) / x
Bbus = A.T @ Bd @ A
X = np.zeros((3, 3)); X[1:, 1:] = np.linalg.inv(Bbus[1:, 1:])
PTDF = Bd @ A @ X # MW on each line per MW injected at a bus (bus 1 = slack)
LODF = np.zeros((3, 3))
for o in range(3):
p = PTDF @ A[o]
LODF[:, o] = p / (1 - p[o]); LODF[o, o] = -1
Gmap = np.zeros((3, 3)) # generator -> bus
for j, (b, _, _) in enumerate(gen.values()):
Gmap[b - 1, j] = 1
def n1_report(g, label):
f = PTDF @ (Gmap @ g - load)
print(f"{label}: G1, G2, G3 = {g[0]:.0f}, {g[1]:.0f}, {g[2]:.0f} MW; "
f"flows 1-2 {f[0]:.1f}, 1-3 {f[1]:.1f}, 2-3 {f[2]:.1f} MW")
worst = 0.0
for o, (i, k) in enumerate(lines):
post = f + LODF[:, o] * f[o]
for l, (a, b) in enumerate(lines):
if l == o:
continue
worst = max(worst, abs(post[l]))
if abs(post[l]) > rating + 1e-6:
print(f" outage of {i}-{k}: line {a}-{b} at {abs(post[l]):.1f} MW > {rating:.0f} MW")
print(f" worst post-contingency flow {worst:.1f} MW ({100*worst/rating:.0f} % of rating)")
def dispatch(secure):
"""Minimum cost; intact line limits, and with secure=True every post-outage flow as well."""
rows = [PTDF]
if secure:
for o in range(3):
rows.append(np.delete(PTDF + np.outer(LODF[:, o], PTDF[o]), o, axis=0))
S = np.vstack(rows)
A_ub = np.vstack([S @ Gmap, -S @ Gmap])
b_ub = np.concatenate([rating + S @ load, rating - S @ load])
r = linprog([u[2] for u in gen.values()], A_ub=A_ub, b_ub=b_ub, A_eq=[np.ones(3)],
b_eq=[load.sum()], bounds=[(0, u[1]) for u in gen.values()], method="highs")
mu = r.ineqlin.marginals
lmp = r.eqlin.marginals[0] + (mu[:len(S)] - mu[len(S):]) @ S # price at each bus
return r.x, r.fun, lmp
g0, c0, lmp0 = dispatch(secure=False)
n1_report(g0, "copper-plate schedule")
print(f" cost {c0:.0f} EUR/h, prices at buses 1, 2, 3: {lmp0[0]:.2f}, {lmp0[1]:.2f}, {lmp0[2]:.2f} EUR/MWh")
g1, c1, lmp1 = dispatch(secure=True)
n1_report(g1, "N-1 secure schedule")
print(f" cost {c1:.0f} EUR/h (+{c1 - c0:.0f}), prices at buses 1, 2, 3: "
f"{lmp1[0]:.2f}, {lmp1[1]:.2f}, {lmp1[2]:.2f} EUR/MWh")
print(f"zonal alternative: one price {lmp0[1]:.0f} EUR/MWh, then redispatch G1 {g1[0]-g0[0]:+.0f}, "
f"G2 {g1[1]-g0[1]:+.0f}, G3 {g1[2]-g0[2]:+.0f} MW costing the TSO {c1 - c0:.0f} EUR/h")copper-plate schedule: G1, G2, G3 = 500, 100, 0 MW; flows 1-2 183.3, 1-3 316.7, 2-3 133.3 MW
outage of 1-2: line 1-3 at 500.0 MW > 400 MW
outage of 1-3: line 1-2 at 500.0 MW > 400 MW
outage of 1-3: line 2-3 at 450.0 MW > 400 MW
outage of 2-3: line 1-3 at 450.0 MW > 400 MW
worst post-contingency flow 500.0 MW (125 % of rating)
cost 13500 EUR/h, prices at buses 1, 2, 3: 60.00, 60.00, 60.00 EUR/MWh
N-1 secure schedule: G1, G2, G3 = 400, 150, 50 MW; flows 1-2 133.3, 1-3 266.7, 2-3 133.3 MW
worst post-contingency flow 400.0 MW (100 % of rating)
cost 19500 EUR/h (+6000), prices at buses 1, 2, 3: 15.00, 60.00, 90.00 EUR/MWh
zonal alternative: one price 60 EUR/MWh, then redispatch G1 -100, G2 +50, G3 +50 MW costing the TSO 6000 EUR/h
The copper-plate schedule loads no line beyond while everything is in service, but it is not N−1 secure: bus 1 and bus 3 each have only two lines, so losing one of them sends that bus's whole export or import ( or ) through the other. The secure schedule caps G1's export at one line's rating () and makes G3 cover bus 3's load beyond of import. With the constraints in the market, prices separate: at bus 1 (one more MW there would come from G1, which is held back), at bus 2 and at bus 3 (one more MW there must come from G3). In a zonal market everyone sees one price of and the TSO pays the same as redispatch afterwards. The physics and the cost are the same; who sees the price signal differs.
Interactive: the triangle as a resistor network
As in DC Load Flow, bus 1 is ground, each resistor is a line of , and stands for . The current sources draw the copper-plate schedule's net loads: at bus 2 () and at bus 3. Intact, the lab shows (the flowing from bus 1 into bus 3; the sign follows the element's node order), and . Raise R13 to to take line 1–3 out: becomes and , the and overloads of the N−1 check (not exactly, because is not quite an open circuit).
Balancing and ancillary services
Whatever the markets schedule, the TSO must balance the real system second by second, and it buys ancillary services for that. The balancing reserves are the control stages of Frequency Control:
| Reserve (EU name) | Control stage | Activation (Continental Europe) | How it is bought (2025) |
|---|---|---|---|
| FCR, frequency containment | primary, droop | full within , local, frequency-driven | joint daily auction of several TSOs (FCR Cooperation), 4-hour products |
| aFRR, automatic frequency restoration | secondary, AGC | full within (standard product), TSO signal | capacity auctions plus energy via the European platform PICASSO |
| mFRR, manual frequency restoration | tertiary | full within (standard product) | energy via the platform MARI |
| RR, replacement reserve | tertiary | from | platform TERRE (some TSOs only) |
The TSO usually pays twice: for capacity (being available, per MW and hour) and for energy actually activated, at a marginal price on the platforms. Other ancillary services are voltage control (reactive power from generators, STATCOMs and shunt devices, Voltage Control), black-start capability, and in low-inertia grids new products for fast frequency response and inertia (grid-forming converters, synchronous condensers), which several TSOs started to procure in the early 2020s.
Capacity mechanisms
An energy-only market pays plants only when they run. A peaking plant needed for a few hours a year must recover its fixed costs from scarcity prices in those hours, which are politically unpopular and financially risky. Capacity mechanisms pay for firm capacity instead, typically through auctions years ahead: the GB Capacity Market (T-4 auctions since December 2014, T-1 auctions since 2017), PJM's Reliability Pricing Model (since 2007; base residual auctions normally three years ahead, on a compressed schedule since 2022), and mechanisms in France, Italy, Belgium and others. In the EU they are allowed only where an adequacy assessment shows a need, and Regulation (EU) 2019/943 bars plants emitting more than of fossil CO per kWh from new contracts, and since 1 July 2025 also existing plants that emit more than and more than per installed kW per year on average (Article 22(4)). Texas (ERCOT) stays energy-only and relies on scarcity pricing through an operating-reserve demand curve (ORDC, since June 2014). Capacity is credited by its contribution to adequacy, so storage of short duration and variable renewables get a de-rated value.
The control room
A TSO's control room runs an energy management system (EMS) on top of SCADA (supervisory control and data acquisition):
- SCADA collects breaker states, flows and voltages from remote terminal units in every substation every few seconds and sends commands back. Phasor measurement units add time-synchronised phasors at typically to frames per second in a grid (measurement standard IEC/IEEE 60255-118-1:2018, which replaced IEEE C37.118.1-2011; data transfer IEEE C37.118.2-2011).
- State estimation turns the redundant, noisy and occasionally wrong measurements into the most likely set of bus voltages and angles, by weighted least squares over the load-flow equations (Newton–Raphson); it also flags bad data and wrong breaker states.
- Contingency analysis repeats the N−1 check above on the estimated state, every few minutes, for every credible outage, with DC sensitivities to screen and full AC load flows on the dangerous cases (DC Load Flow). Under SOGL each TSO must keep its grid N−1 secure and agree remedial actions with its neighbours, coordinated by regional coordination centres.
- AGC sends setpoints to aFRR providers every few seconds; optimal power flow and redispatch tools find the cheapest remedial actions.
DSOs run the distribution equivalent: an ADMS (advanced distribution management system) with fault location, network reconfiguration and, with DER, a DERMS that sends limits and setpoints to inverters (The Smart Grid).
How DER and demand response take part
A single heat pump or home battery is too small to bid. Aggregators pool thousands of them into a virtual power plant that bids in day-ahead and intraday markets and offers reserves (many TSOs have pre-qualified pools of batteries and flexible loads for FCR and aFRR since the late 2010s). In the US, FERC Order 2222 (September 2020) requires the ISOs/RTOs to let DER aggregations take part in wholesale markets, with a minimum size of no more than . In Germany, the Redispatch 2.0 rules (from 1 October 2021) brought plants from , and smaller ones that the grid operator can control remotely, into redispatch. Two network problems come with it: a VPP that responds to one zonal price can overload a distribution feeder, which is why DSOs develop local flexibility markets and operating envelopes; and the market must trust measurement and baselines (what would the load have been without the call?).
Guided lab: read a real day-ahead curve
Hand calculation. Take the three-hour example and compute, for the calm hour, what the price would be if the industry bid ( at ) dropped out; then what a battery discharging at an offer of would do to it.
Simulation. Add these orders to the lists in the first Python cell and check your answers; then reproduce a negative price by adding more wind and an inflexible "must-run" offer.
What you would measure. Markets publish their results: the ENTSO-E Transparency Platform shows day-ahead prices per zone and quarter-hour, and exchanges publish the aggregated supply and demand curves of each auction. Download one sunny weekday: expect a midday trough (often near zero or negative in spring), an evening peak several times higher, and price differences between neighbouring zones whenever cross-zonal capacity binds. The published data are exact to the cent; the uncertainty lies in your reading of why, since individual offers are confidential. Hazards: none; no electrical work. For the resistor triangle, the hazards and safe setup of the DC Load Flow bench lab apply (current-limited supplies, compliance ).
Pitfalls
- Average cost is not the price. Pay-as-clear pays every unit the marginal price; the infra-marginal rent is not a windfall error but what pays for capital.
- Copper-plate thinking. A market result can be infeasible for the grid; redispatch or nodal prices bring the network back in.
- Treating rules as constants. Gate closures, product lengths, price limits and platform membership change yearly; date every rule you quote.
- Confusing the operators. A TSO in Europe owns and runs its grid; an ISO in North America runs the grid and market but does not own the lines; neither owns the generators.
Practice
- In the windy hour, CCGT A fails just before the auction. What is the new price and which bids are accepted?
- In the triangle network, why is the price at bus 2 still in the secure schedule?
- Why can a European TSO not simply order a cheap power station in another bidding zone to run?
Answer
- Supply is now , , and at , , and . Between and demand is but supply only ; above the industry bid drops out and demand () is below supply. So the industry bid sets the price at : CCGT B runs fully (), industry gets of its , the OCGT stays off.
- One more MW at bus 2 comes from G2 itself, which is between its limits, and does not change the flow that binds (G1's export, bus 3's import).
- Generation is dispatched by the market and by each TSO in its own area; cross-zonal flows are limited to the capacity offered to the market, and any redispatch across borders must be agreed between the TSOs (cross-border redispatch, coordinated regionally).
Test yourself
In a pay-as-clear auction, a wind farm that offered at 0 €/MWh is paid…
- 0 €/MWh
- its own average cost
- the clearing price
- the highest accepted offer plus a premium
Since 1 October 2025, the EU single day-ahead coupling (SDAC) clears prices for…
- each hour (24 per day)
- each 15 minutes (96 per day)
- each 5 minutes
- each day as one block
Which reserve in Continental Europe must be fully activated within 30 s, driven by local frequency?
- FCR
- aFRR
- mFRR
- RR
In the three-bus example the nodal prices are 15, 60 and 90 €/MWh. Why is bus 3 the dearest?
- its lines have the highest reactance
- after losing line 2–3 it is fed by one line only, so load beyond 400 MW of import must come from the local 90 €/MWh unit
- it has the most generation
- losses are highest there
State estimation in an EMS is mainly…
- a forecast of tomorrow's load
- a weighted least-squares fit of the network state to redundant measurements
- the market clearing algorithm
- a protection relay function