TExcelTAD
Home › Power Systems: Three-Phase, Generation, Grids & Protection › DC Load Flow and Contingency Screening

DC Load Flow and Contingency Screening

A control room must answer, every few minutes, a harder question than "is the grid fine now?": would it still be fine if any one line or generator tripped? This is the N−1 security criterion, required by every transmission operator's grid code (in Europe by the System Operation Guideline, Regulation (EU) 2017/1485). A real grid has thousands of possible outages, each needing its own load flow. The trick that makes it fast enough is the DC load flow: a linear approximation of the Newton–Raphson equations that gives active-power flows within a few percent with a single matrix solve, and turns outages into simple sensitivity factors. It is also the network model inside most electricity-market clearing engines (Energy Markets).

Safety. Grid-level analysis: calculation and simulation only. The bench analogue is a resistor network on a current-limited supply.

Three assumptions

Start from Pi=∑k∣ViVk∣(Gikcos⁡θik+Biksin⁡θik)P_i = \sum_k \lvert V_i V_k \rvert (G_{ik}\cos\theta_{ik} + B_{ik}\sin\theta_{ik}) and assume, as holds well on HV transmission:

  1. R≪XR \ll X: drop GG, so each line has susceptance 1/x1/x.
  2. Flat voltages: all ∣V∣=1 pu\lvert V \rvert = 1\ \text{pu}.
  3. Small angle differences: sin⁡θik≈θik\sin\theta_{ik} \approx \theta_{ik}.

Then the flow on a line and the bus balance become linear:

Pik=θi−θkxik,P=B θP_{ik} = \frac{\theta_i - \theta_k}{x_{ik}}, \qquad \mathbf{P} = \mathbf{B}\,\boldsymbol{\theta}

where B\mathbf{B} is built like Ybus\mathbf{Y}_\text{bus} from the line susceptances 1/x1/x alone (no charging, no resistance). Delete the slack row and column (its angle is the zero reference) and solve once. Losses are ignored, so the slack supplies exactly the load minus the other generation, and reactive power and voltage magnitudes are not computed at all.

The equations are exactly those of a resistor network: angle is voltage, reactance is resistance, injected power is current. That analogy is the lab below.

Sensitivities: PTDF and LODF

Because the model is linear, every flow is a weighted sum of injections. The power transfer distribution factor PTDFℓ,i\text{PTDF}_{\ell,i} is the change of flow on line ℓ\ell when 1 pu1\ \text{pu} is injected at bus ii and taken out at the slack. Superposition then gives the effect of any trade or redispatch.

When line oo trips, its pre-outage flow fof_o redistributes. The line outage distribution factor gives the share that lands on each other line ℓ\ell:

fℓpost=fℓ+LODFℓ,o fo,LODFℓ,o=PTDFℓ,(i→k)1−PTDFo,(i→k)f_\ell^\text{post} = f_\ell + \text{LODF}_{\ell,o}\,f_o, \qquad \text{LODF}_{\ell,o} = \frac{\text{PTDF}_{\ell,(i \to k)}}{1 - \text{PTDF}_{o,(i \to k)}}

where PTDFℓ,(i→k)\text{PTDF}_{\ell,(i \to k)} is the flow on ℓ\ell for a transfer of 1 pu1\ \text{pu} from bus ii to bus kk, the ends of line oo. With all LODFs precomputed, screening every single-line outage is one multiply per pair. Outages that look dangerous are then rechecked with a full AC load flow.

Worked example: N4 by hand

Given: N4's reactances (Bus Types and the Y-Bus): 1–2 0.050.05, 1–3 0.080.08, 2–3 0.060.06, 2–4 0.080.08, 3–4 0.10 pu0.10\ \text{pu}; injections P2=+1.0P_2 = +1.0, P3=−1.5P_3 = -1.5, P4=−1.0 puP_4 = -1.0\ \text{pu}.

Find: the angles and the flow on line 1–3.

Solve: the susceptances are 2020, 12.512.5, 16.6716.67, 12.512.5 and 10 pu10\ \text{pu}. With bus 1 as reference:

[49.17−16.67−12.5−16.6739.17−10−12.5−1022.5][θ2θ3θ4]=[1.0−1.5−1.0]⇒θ=(−0.02857, −0.07429, −0.09333) rad\begin{bmatrix} 49.17 & -16.67 & -12.5 \\ -16.67 & 39.17 & -10 \\ -12.5 & -10 & 22.5 \end{bmatrix} \begin{bmatrix} \theta_2 \\ \theta_3 \\ \theta_4 \end{bmatrix} = \begin{bmatrix} 1.0 \\ -1.5 \\ -1.0 \end{bmatrix} \quad\Rightarrow\quad \theta = (-0.02857,\ -0.07429,\ -0.09333)\ \text{rad}

P13=(0−(−0.07429))/0.08=0.9286 pu=92.9 MWP_{13} = (0 - (-0.07429))/0.08 = 0.9286\ \text{pu} = 92.9\ \text{MW}.

Check: the AC load flow gave 95.7 MW95.7\ \text{MW} on line 1–3 and θ3=−3.79∘\theta_3 = -3.79^\circ against −4.26∘-4.26^\circ here. The DC flows are 11 to 4 %4\ \% low mostly because they ignore the 5 MW5\ \text{MW} of losses; angles are off by more, because the real voltages are below 1 pu1\ \text{pu}. For screening overloads, that accuracy is usually enough, with a margin.

In Python: DC flows, PTDFs and an outage

python · try it yourself
import numpy as np

# N4: (from, to, x) and AC flows from the Newton-Raphson lesson (MW, sending end)
lines = [(1, 2, 0.05), (1, 3, 0.08), (2, 3, 0.06), (2, 4, 0.08), (3, 4, 0.10)]
ac_flow = [59.37, 95.67, 76.78, 82.17, 19.45]
P = np.array([0.0, 1.0, -1.5, -1.0])          # injections, pu (slack's value unused)
n, m = 4, len(lines)

A = np.zeros((m, n))                          # branch-bus incidence matrix
for l, (i, k, x) in enumerate(lines):
    A[l, i - 1], A[l, k - 1] = 1, -1
Bd = np.diag([1 / x for _, _, x in lines])    # branch susceptances
Bbus = A.T @ Bd @ A                           # DC "B-bus" (no resistance, no charging)

def dc_flows(Bbus, Bd, A, P):
    th = np.zeros(n)
    th[1:] = np.linalg.solve(Bbus[1:, 1:], P[1:])   # bus 1 = slack, angle 0
    return th, Bd @ A @ th

th, f = dc_flows(Bbus, Bd, A, P)
print("angles (deg):", np.round(np.degrees(th), 3))
for l, (i, k, x) in enumerate(lines):
    print(f"line {i}-{k}: DC {100*f[l]:6.2f} MW   AC {ac_flow[l]:6.2f} MW")
print(f"slack supplies {100*(f[0]+f[1]):.1f} MW in DC (no losses)")

# PTDF: flow change on each line per 1 pu injected at a bus and taken at the slack
X = np.zeros((n, n)); X[1:, 1:] = np.linalg.inv(Bbus[1:, 1:])
PTDF = Bd @ A @ X
print("PTDF (rows = lines, columns = buses 1..4):")
print(np.round(PTDF, 3))

# LODF for the outage of line 1-3, then check by re-solving without it
o = 1
ptdf_o = PTDF @ A[o]                          # flow change per 1 pu transferred across line o's ends
lodf = ptdf_o / (1 - ptdf_o[o])
f_post = f + lodf * f[o]; f_post[o] = 0
keep = [l for l in range(m) if l != o]
_, f_chk = dc_flows(A[keep].T @ Bd[np.ix_(keep, keep)] @ A[keep], Bd[np.ix_(keep, keep)], A[keep], P)
rating = 120.0
print("outage of line 1-3:")
for j, l in enumerate(keep):
    i, k, _ = lines[l]
    flag = "  OVERLOAD" if abs(100 * f_post[l]) > rating else ""
    print(f"  line {i}-{k}: LODF {lodf[l]:+.3f}, post-outage {100*f_post[l]:6.2f} MW (re-solved {100*f_chk[j]:6.2f}){flag}")
angles (deg): [ 0.    -1.637 -4.256 -5.348]
line 1-2: DC  57.14 MW   AC  59.37 MW
line 1-3: DC  92.86 MW   AC  95.67 MW
line 2-3: DC  76.19 MW   AC  76.78 MW
line 2-4: DC  80.95 MW   AC  82.17 MW
line 3-4: DC  19.05 MW   AC  19.45 MW
slack supplies 150.0 MW in DC (no losses)
PTDF (rows = lines, columns = buses 1..4):
[[ 0.    -0.714 -0.457 -0.6  ]
 [ 0.    -0.286 -0.543 -0.4  ]
 [ 0.     0.214 -0.343 -0.033]
 [ 0.     0.071 -0.114 -0.567]
 [ 0.    -0.071  0.114 -0.433]]
outage of line 1-3:
  line 1-2: LODF +1.000, post-outage 150.00 MW (re-solved 150.00)  OVERLOAD
  line 2-3: LODF +0.750, post-outage 145.83 MW (re-solved 145.83)  OVERLOAD
  line 2-4: LODF +0.250, post-outage 104.17 MW (re-solved 104.17)
  line 3-4: LODF -0.250, post-outage  -4.17 MW (re-solved  -4.17)

Assume every N4 line is rated 120 MW120\ \text{MW}. In the intact network the most loaded line, 1–3, is at 77 %77\ \%. If line 1–3 trips, all of its 92.9 MW92.9\ \text{MW} moves to line 1–2 (LODF =1= 1: the slack's power must now leave through 1–2), which reaches 150 MW150\ \text{MW}, and three quarters of it onto 2–3 (146 MW146\ \text{MW}): two post-contingency overloads, so the intact state is not N−1 secure. The operator must act before the outage happens: redispatch generation (more output at bus 2, less at the slack) or reconfigure. The LODF prediction matches a full re-solution without the line exactly, as it must for a linear model. Flow on 3–4 even reverses.

Interactive: N4 as a resistor network

The netlist lab is the DC load flow itself. Bus 1 (the slack, angle 00) is the ground node; resistors equal to the reactances stand for the lines; current sources inject 1 A1\ \text{A} at n2 and draw 1.5 A1.5\ \text{A} and 1 A1\ \text{A} at n3 and n4. Node voltages read directly as angles in radians: n3 shows −74.29 mV-74.29\ \text{mV}, i.e. θ3=−0.07429 rad\theta_3 = -0.07429\ \text{rad}, and the currents are the flows in pu: I(R13)=−928.6 mAI(\text{R13}) = -928.6\ \text{mA} (negative because it flows from ground, bus 1, into n3, against the element's node order), I(R23)=761.9 mAI(\text{R23}) = 761.9\ \text{mA}. Slide the reactance of line 1–3 up to 100 Ω100\ \Omega to simulate its outage: I(R12)I(\text{R12}) becomes −1.498 A-1.498\ \text{A} and I(R23)I(\text{R23}) 1.457 A1.457\ \text{A}, the overloads found above (not exactly 1.5001.500 and 1.4581.458 because 100 Ω100\ \Omega is not quite an open circuit).

node voltages (to ground 0)n2-28.57 mVn3-74.29 mVn4-93.33 mVnetlistI2 0 n2 1I3 n3 0 1.5I4 n4 0 1R12 n2 0 0.05R13 n3 0 0.08R23 n2 n3 0.06R24 n2 n4 0.08R34 n3 n4 0.10element currents (node 1 to node 2 through it)I20>n21.00 AI3n3>01.50 AI4n4>01.00 AR12n2>0-571 mAR13n3>0-929 mAR23n2>n3762 mAR24n2>n4810 mAR34n3>n4190 mA

Guided lab: an N−1 study on the bench

Hand calculation. Scale the analogue so that 0.01 pu0.01\ \text{pu} of reactance is 100 Ω100\ \Omega (the lines become 500500, 800800, 600600, 800800 and 1000 Ω1000\ \Omega) and 1 pu1\ \text{pu} of power is 1 mA1\ \text{mA}. A "voltage" of 1 V1\ \text{V} is then an angle of 0.1 rad0.1\ \text{rad}. Predict the node voltages and branch currents intact and with line 1–3 removed, using the factors above.

Simulation. Run the program with the scaled values (flows scale with the injections, angles with the resistances), or set the netlist lab's resistors to the scaled values.

What you would measure. Keep node 1 as the reference, drive node 2 from a second current-limited supply set to constant-current mode (1.0 mA1.0\ \text{mA}) and model the loads at nodes 3 and 4 as constant-current electronic-load channels (1.51.5 and 1.0 mA1.0\ \text{mA}). Expect node voltages of about −0.29-0.29, −0.74-0.74 and −0.93 V-0.93\ \text{V} relative to node 1 (so put node 1 at a positive potential, e.g. 5 V5\ \text{V}, and read differences), and branch currents within about ±2 %\pm 2\ \% (resistor and current-setting tolerance). Pull out the 1–3 resistor and the 1–2 current rises from 0.570.57 to 1.5 mA1.5\ \text{mA}.

Hazards and safe setup. Low voltage and milliamperes from current-limited instruments; no hazard beyond wiring errors. Set every source's voltage compliance to ≤12 V\le 12\ \text{V}.

Pitfalls

  • Using the DC flow on distribution networks. With R/XR/X near or above 1, assumption 1 fails badly.
  • Expecting voltages or reactive power. The DC model has neither; a contingency that causes low voltages is invisible to it.
  • Forgetting losses. Flows are typically a few percent low; add a margin or a loss estimate.
  • Islanding outages. If a line outage splits the network, 1−PTDFo=01 - \text{PTDF}_o = 0 and the LODF is undefined: the outage must be handled as an island.

Practice

  1. Using the PTDF table, how much does the flow on line 1–3 change if bus 2's generator raises its output by 20 MW20\ \text{MW} (and the slack lowers by the same)?
  2. Using the same table, by how much must bus 2 raise its output to bring line 1–2's post-outage flow (line 1–3 tripped) down to 120 MW120\ \text{MW}? Hint: after the outage, all slack power goes through line 1–2.
  3. Why is LODF12,13=1_{12,13} = 1 in N4?
Answer
  1. PTDF13,2=−0.286\text{PTDF}_{13,2} = -0.286: the flow on 1–3 falls by 0.286⋅20=5.7 MW0.286 \cdot 20 = 5.7\ \text{MW}, to 87.1 MW87.1\ \text{MW}.
  2. After the outage the slack's output equals the flow on 1–2: 150 MW150\ \text{MW} falls to 120 MW120\ \text{MW} if bus 2 generates 30 MW30\ \text{MW} more (130 MW total), and the slack 30 MW30\ \text{MW} less.
  3. Bus 1 has only two lines. When one trips, everything the slack produces must leave through the other.

Test yourself

Which assumption is NOT part of the DC load flow?

  1. line resistance neglected
  2. all voltage magnitudes 1 pu
  3. small angle differences
  4. loads modelled as constant impedances

In the DC load flow, the flow on a line from bus ii to bus kk is…

  1. (θi−θk)/xik(\theta_i - \theta_k)/x_{ik}
  2. (θi−θk) xik(\theta_i - \theta_k)\,x_{ik}
  3. (Vi−Vk)/rik(V_i - V_k)/r_{ik}
  4. sin⁡(θi−θk)\sin(\theta_i - \theta_k)

An LODF of 0.75 for line A with respect to the outage of line B means…

  1. line A trips with probability 0.75
  2. 75 % of line B's pre-outage flow appears on line A after B trips
  3. line A is loaded to 75 %
  4. line A carries 75 % of the total load

The N4 network with every line rated 120 MW is not N−1 secure because…

  1. line 1–3 is overloaded now
  2. losing line 1–3 overloads lines 1–2 and 2–3
  3. the slack bus is overloaded
  4. the voltages are below 0.95 pu