TExcelTAD
Home › Power Systems: Three-Phase, Generation, Grids & Protection › Economic Dispatch: Equal Incremental Cost and λ-Iteration

Economic Dispatch: Equal Incremental Cost and λ\lambda-Iteration

A load flow tells you what happens for a given set of generator outputs. But who decides those outputs? With 250 MW250\ \text{MW} of load and two power stations that burn fuel at different rates, there are infinitely many splits that satisfy the load, and they cost different amounts per hour. Economic dispatch picks the cheapest split for the units that are already running, every few minutes, within each unit's limits. Its answer, the marginal cost λ\lambda, is also the price that most electricity markets publish (Energy Markets and Grid Operation).

Safety. This lesson is pure calculation about power-station scheduling; nothing is built or measured on live plant.

Cost curves and incremental cost

A thermal unit's fuel use grows with output a little faster than linearly, because efficiency falls away from the best operating point. A quadratic fits test data well:

Ci(Pi)=ai+biPi+ciPi2[€/h],dCidPi=bi+2ciPi[€/MWh]C_i(P_i) = a_i + b_i P_i + c_i P_i^2 \quad [\text{€/h}], \qquad \frac{dC_i}{dP_i} = b_i + 2c_i P_i \quad [\text{€/MWh}]

The derivative is the incremental cost: what one more megawatt-hour from this unit costs at its present output. For the two units of network N4 (The Load-Flow Problem), with PP in MW:

Unit aa (€/h) bb (€/MWh) cc (€/MW2h\text{€/MW}^2\text{h}) Limits (MW)
G1 at bus 1 500 42.0 0.016 50 to 250
G2 at bus 2 400 38.0 0.020 50 to 200

(Illustrative numbers. Real values depend on fuel prices and carbon costs and change daily.)

The equal incremental cost rule

Minimise ∑iCi(Pi)\sum_i C_i(P_i) subject to ∑iPi=PD\sum_i P_i = P_D. With a Lagrange multiplier λ\lambda:

L=∑iCi(Pi)+λ(PD−∑iPi)⇒dCidPi=λ for every unit not at a limit\mathcal{L} = \sum_i C_i(P_i) + \lambda\Big(P_D - \sum_i P_i\Big) \quad\Rightarrow\quad \frac{dC_i}{dP_i} = \lambda \ \text{for every unit not at a limit}

If one unit were producing a megawatt-hour more cheaply at the margin than another, shifting a megawatt to it would save money; at the optimum no such shift exists. A unit whose incremental cost at PmaxP_\text{max} is still below λ\lambda runs at PmaxP_\text{max}; one whose incremental cost at PminP_\text{min} is above λ\lambda runs at PminP_\text{min}. The multiplier λ\lambda is the system marginal cost: the cost of serving one more megawatt of load.

Losses and penalty factors

Power from a distant unit loses more on the way. With losses PL(P1,P2,…)P_L(P_1, P_2, \ldots), the balance becomes ∑Pi=PD+PL\sum P_i = P_D + P_L and the optimum condition

dCidPi Li=λ,Li=11−∂PL/∂Pi\frac{dC_i}{dP_i}\,L_i = \lambda, \qquad L_i = \frac{1}{1 - \partial P_L/\partial P_i}

The penalty factor LiL_i is a little above 1 for units whose extra output raises losses. The classic way to express PLP_L is the B-coefficient (Kron) loss formula, in its simplest form a quadratic form in the generator outputs fitted to load-flow results, PL≈∑i∑jPiBijPjP_L \approx \sum_i\sum_j P_i B_{ij} P_j. Here a diagonal version is used, PL=0.00015 P12+0.00010 P22P_L = 0.00015\,P_1^2 + 0.00010\,P_2^2 (MW), chosen to give about the 5 MW5\ \text{MW} that the Newton–Raphson load flow found for N4. Modern dispatch replaces the B formula with sensitivities from the network model (optimal power flow), but the idea is the same.

The λ\lambda-iteration

For a given λ\lambda, each unit's output follows from bi+2ciPi=λ/Lib_i + 2c_iP_i = \lambda/L_i, clipped to its limits. Total output rises monotonically with λ\lambda, so bisection on λ\lambda finds the value at which the outputs add up to the demand (plus losses). With losses, update the penalty factors from the new outputs and repeat until they settle.

Worked example: 250 MW without losses

Given: the two units above, PD=250 MWP_D = 250\ \text{MW}, losses neglected.

Find: P1P_1, P2P_2, λ\lambda and the hourly cost.

Solve:

42+0.032 P1=38+0.040 P2,P1+P2=25042+0.032 P1=38+0.040 (250−P1) ⇒ 0.072 P1=6P1=83.33 MW,P2=166.67 MW,λ=42+0.032⋅83.33=44.67 €/MWh\begin{aligned} 42 + 0.032\,P_1 &= 38 + 0.040\,P_2, \qquad P_1 + P_2 = 250 \\ 42 + 0.032\,P_1 &= 38 + 0.040\,(250 - P_1) \ \Rightarrow\ 0.072\,P_1 = 6 \\ P_1 &= 83.33\ \text{MW}, \quad P_2 = 166.67\ \text{MW}, \quad \lambda = 42 + 0.032 \cdot 83.33 = 44.67\ \text{€/MWh} \end{aligned}

The cost is C1+C2=(500+3500+111.1)+(400+6333.3+555.6)=11 400 €/hC_1 + C_2 = (500 + 3500 + 111.1) + (400 + 6333.3 + 555.6) = 11\,400\ \text{€/h}.

Check: both units are inside their limits, and both incremental costs equal 44.67 €/MWh44.67\ \text{€/MWh}. The cheaper unit (lower bb) carries more, but not everything: its incremental cost rises faster (c2>c1c_2 > c_1).

In Python: λ\lambda-iteration with limits and penalty factors

python · try it yourself
import numpy as np

# Two units of network N4: cost C(P) = a + b P + c P^2 in EUR/h, P in MW
units = {"G1 (bus 1)": dict(a=500.0, b=42.0, c=0.016, Pmin=50.0, Pmax=250.0),
         "G2 (bus 2)": dict(a=400.0, b=38.0, c=0.020, Pmin=50.0, Pmax=200.0)}
U = list(units.values())
B = np.array([0.00015, 0.00010])          # loss coefficients (1/MW): P_loss = sum B_i P_i^2

def output(lam, pen):
    """Each unit runs where its incremental cost times its penalty factor equals lambda."""
    return np.array([np.clip((lam / L - u["b"]) / (2 * u["c"]), u["Pmin"], u["Pmax"])
                     for u, L in zip(U, pen)])

def dispatch(demand, losses=False, tol=1e-6):
    pen = np.ones(2)
    for _ in range(50):                    # outer loop: update penalty factors
        lo, hi = 0.0, 100.0                # lambda-iteration by bisection (EUR/MWh)
        while hi - lo > tol:
            lam = (lo + hi) / 2
            P = output(lam, pen)
            Ploss = float(B @ P**2) if losses else 0.0
            lo, hi = (lam, hi) if P.sum() < demand + Ploss else (lo, lam)
        if not losses:
            break
        new = 1 / (1 - 2 * B * P)          # penalty factor L_i = 1/(1 - dPloss/dP_i)
        if np.abs(new - pen).max() < 1e-9:
            break
        pen = new
    cost = sum(u["a"] + u["b"] * p + u["c"] * p * p for u, p in zip(U, P))
    return lam, P, Ploss, pen, cost

for D, loss in [(250, False), (250, True), (420, False)]:
    lam, P, Pl, pen, cost = dispatch(D, loss)
    print(f"D = {D} MW, losses {'on ' if loss else 'off'}: lambda = {lam:.3f} EUR/MWh, "
          f"P1 = {P[0]:.2f}, P2 = {P[1]:.2f} MW, loss = {Pl:.2f} MW, cost = {cost:.0f} EUR/h"
          + (f", penalty factors {pen[0]:.4f} {pen[1]:.4f}" if loss else ""))

# compare with the operating point used in the load-flow lessons: P2 = 100 MW, slack covers the rest
P = np.array([150.0, 100.0])
for _ in range(20):                        # slack output including losses
    P[0] = 250 + B @ P**2 - P[1]
cost_lf = sum(u["a"] + u["b"] * p + u["c"] * p * p for u, p in zip(U, P))
print(f"load-flow schedule P1 = {P[0]:.2f}, P2 = {P[1]:.2f} MW costs {cost_lf:.0f} EUR/h")

import matplotlib.pyplot as plt
lam, P, _, _, _ = dispatch(250)
for (name, u), p in zip(units.items(), P):
    x = np.linspace(u["Pmin"], u["Pmax"], 50)
    plt.plot(x, u["b"] + 2 * u["c"] * x, label=f"{name}: dC/dP")
    plt.plot(p, lam, "ko")
plt.axhline(lam, ls="--", color="gray", label=f"lambda = {lam:.2f} EUR/MWh")
plt.xlabel("unit output P (MW)"); plt.ylabel("incremental cost (EUR/MWh)")
plt.title("Equal incremental cost, 250 MW, no losses"); plt.legend(); plt.grid(alpha=0.3)
plt.show()
D = 250 MW, losses off: lambda = 44.667 EUR/MWh, P1 = 83.33, P2 = 166.67 MW, loss = 0.00 MW, cost = 11400 EUR/h
D = 250 MW, losses on : lambda = 46.097 EUR/MWh, P1 = 89.40, P2 = 164.51 MW, loss = 3.91 MW, cost = 11575 EUR/h, penalty factors 1.0276 1.0340
D = 420 MW, losses off: lambda = 49.040 EUR/MWh, P1 = 220.00, P2 = 200.00 MW, loss = 0.00 MW, cost = 19314 EUR/h
load-flow schedule P1 = 154.58, P2 = 100.00 MW costs 11775 EUR/h

With losses the system λ\lambda rises to 46.10 €/MWh46.10\ \text{€/MWh} and the units together produce 253.9 MW253.9\ \text{MW} to cover 3.9 MW3.9\ \text{MW} of losses. The penalty factors (1.0281.028 for G1, 1.0341.034 for G2 with this loss formula) shift output toward the unit with the smaller loss sensitivity. At 420 MW420\ \text{MW}, G2 reaches its 200 MW200\ \text{MW} limit and G1 alone sets λ=49.04 €/MWh\lambda = 49.04\ \text{€/MWh}. Finally, the schedule assumed in the load-flow lessons (P2=100 MWP_2 = 100\ \text{MW}, the slack covering the rest) costs about 200 €/h200\ \text{€/h} more than the optimum: real money over a year (1.751.75 million euros) for a two-unit system.

Guided lab: fit a cost curve from test data

Hand calculation. A plant heat-rate test gives fuel cost at four outputs, for example 60 MW60\ \text{MW}: 30783078, 120 MW120\ \text{MW}: 57705770, 180 MW180\ \text{MW}: 85788578 and 240 MW240\ \text{MW}: 11 502 €/h11\,502\ \text{€/h} (made-up data consistent with G1). Fit aa, bb, cc by least squares (Least-Squares Fitting), using three points by hand first.

Simulation. Use np.polyfit(P, C, 2) and put the fitted unit into the dispatch program; compare λ\lambda with the textbook coefficients.

What you would measure. On a real unit, the plant's performance engineers measure fuel flow (or coal mass and calorific value) against electrical output at steady loads. Fuel metering is typically good to 11 to 2 %2\ \% and calorific value to a similar amount, so cc, a small curvature term, is the least certain coefficient (often ±20 %\pm 20\ \% or worse): dispatch decisions near equal incremental costs are correspondingly uncertain. There is no bench version of this lab, and none is needed: it is a data-analysis exercise.

Hazards. None: no electrical work.

Pitfalls

  • Equal costs instead of equal incremental costs. Average cost per MWh is irrelevant to the split; the margin decides.
  • Forgetting limits. A unit at its limit no longer satisfies dC/dP=λdC/dP = \lambda; ignoring the limit gives impossible outputs.
  • Penalty factors applied the wrong way. Multiply the incremental cost by LiL_i; units with a high LiL_i are made to look more expensive.
  • Treating dispatch as network-free. Line limits (from the DC load flow) can force a more expensive split; that is security-constrained dispatch.

Practice

  1. With the units above and no losses, find P1P_1, P2P_2 and λ\lambda for PD=150 MWP_D = 150\ \text{MW}.
  2. What is the cost of serving the 251st megawatt at PD=250 MWP_D = 250\ \text{MW} (no losses)?
  3. For PD=420 MWP_D = 420\ \text{MW}, why is λ\lambda not the incremental cost of G2?
Answer
  1. 0.072 P1=38+0.04⋅150−42=20.072\,P_1 = 38 + 0.04 \cdot 150 - 42 = 2, so P1=27.8 MWP_1 = 27.8\ \text{MW}, below G1's minimum: G1 runs at 50 MW50\ \text{MW}, G2 at 100 MW100\ \text{MW}, λ=38+0.04⋅100=42.0 €/MWh\lambda = 38 + 0.04 \cdot 100 = 42.0\ \text{€/MWh} (set by G2).
  2. About λ=44.67 €\lambda = 44.67\ \text{€}.
  3. G2 is at Pmax=200 MWP_\text{max} = 200\ \text{MW} with an incremental cost of 46.0 €/MWh46.0\ \text{€/MWh}; it cannot respond to more load, so the marginal unit is G1 at 49.0449.04.

Test yourself

At the economic dispatch optimum (no losses, no limits active), every running unit has the same…

  1. output
  2. average cost per MWh
  3. incremental cost
  4. efficiency

A unit has C=400+38P+0.02P2C = 400 + 38P + 0.02P^2 €/h. Its incremental cost at 150 MW is…

  1. 38 €/MWh
  2. 44 €/MWh
  3. 41 €/MWh
  4. 50 €/MWh

A penalty factor greater than 1 means that extra output from that unit…

  1. reduces system losses
  2. increases system losses, so it is made to look more expensive
  3. is free
  4. violates its limit

In the λ\lambda-iteration, why does bisection on λ\lambda work?

  1. the cost is linear
  2. total output is a monotonically increasing function of λ\lambda
  3. there is only one unit
  4. losses are zero