---
title: Gauss–Seidel power flow
heading: Solving the power-flow equations one bus at a time, the update for PQ buses, handling PV buses and var limits, acceleration factors and when they help, and why the method's simplicity costs iterations on large systems
eyebrow: S10 · Lesson 18 · Gauss–Seidel power flow
xp: 50
---

::: hook
The first digital power-flow programs, in the late 1950s, used the Gauss–Seidel method: sweep through the buses, and at each one solve its own equation for its voltage using the latest values of its neighbors. Each step needs only one row of the sparse admittance matrix, which suited the tiny memories of the time. The method is still the easiest to write and to understand, and seeing where it struggles explains why Newton's method took over.
:::

::: play
- The Gauss–Seidel iterates for the two-bus case of lesson 17 (slack at 1 pu, X = 0.2, load 1 + j0.5), in the complex plane: from the flat start at 1 + j0, the load bus voltage jumps to 0.9 − j0.2 and then zigzags in toward the solution 0.832 − j0.200.
- Each step cuts the error by a factor of about 0.28, so twelve iterations reach 10⁻⁶.
- The imaginary part settles almost immediately; it's the magnitude that takes time.
:::

```sim plot
view: complex
range: 1.1
axes: Re V₂, Im V₂
dot: 1 | label: start
dot: 0.9 - 0.2*j | label: 1
dot: 0.8471 - 0.1882*j | label: 2
dot: 0.8375 - 0.2*j | label: 3
dot: 0.8331 - 0.1989*j | label: 4
dot: 0.8317 - 0.2*j | label: solution
curve: 0.8554*exp(j*u) | over: u = -0.5..0.2 | dashed
```

::: predict
## For the two-bus case, the first iterate from a flat start is $V_2 = (1 - XQ) - jXP$. With X = 0.2 and a load of 1 + j0.5, what is it?

- [x] 0.9 − j0.2
- [ ] 1 − j0.2
- [ ] 0.8 − j0.1
- [ ] 0.855∠−13.5°, already the answer

::: reveal
$V_2^{(1)} = \frac{1}{Y_{22}}\left[\frac{P_2 - jQ_2}{V_2^{(0)*}} - Y_{21}V_1\right]$ with $Y_{22} = -j5$, $Y_{21} = j5$ and the load as a negative injection: $(−1 + j0.5 − j5)/(−j5)$ = 0.9 − j0.2. Its magnitude, 0.922, is still 7.8% off the answer.
:::
:::

::: nameit
## The update

Solve bus i's power equation for $V_i$:

$$V_i^{(k+1)} = \frac{1}{Y_{ii}}\left[\frac{P_i - jQ_i}{V_i^{(k)*}} - \sum_{j < i}Y_{ij}V_j^{(k+1)} - \sum_{j > i}Y_{ij}V_j^{(k)}\right]$$

using each new value as soon as it's computed (that's what distinguishes Gauss–Seidel from Gauss, or Jacobi). Stop when no voltage changes by more than a tolerance, typically 10⁻⁵ to 10⁻⁶ pu.

## PV buses

Q isn't known. Compute it from the current voltages, $Q_i = -\text{Im}\left(V_i^*\sum_jY_{ij}V_j\right)$, use it in the update, then rescale $V_i$ to the specified magnitude, keeping the new angle. If Q exceeds the generator's limit, fix it at the limit and treat the bus as PQ.

## Acceleration

Replace the new value by $V_\text{old} + \alpha(V_\text{new} - V_\text{old})$. Factors of 1.4 to 1.6 often cut iterations on large systems by half, but they're problem dependent: on the two-bus case α = 1.2 takes 22 iterations instead of 12, and α = 1.6 doesn't converge at all.

## The cost

Each sweep is cheap, but information spreads only one bus per step, so the number of iterations grows with the network's size, and convergence slows badly on heavily loaded or ill-conditioned systems. That's the motivation for Newton–Raphson (lesson 19), whose iteration count barely depends on size.
:::

::: example
## A generator bus 2 injects 0.5 pu and holds |V₂| = 1.0, connected to a slack at 1∠0° through X = 0.2. What angle and Q does Gauss–Seidel converge to?

::: solution
1. **Angle.** At convergence the equations hold exactly:
   $$\sin\delta_2/0.2 = 0.5$$
   gives δ₂ = 5.74°.
2. **Reactive power.** The generator injects
   $$\begin{aligned} Q_2 &= (1 - \cos 5.74°)/0.2 \\ &= 0.025\ \text{pu} \end{aligned}$$
   just enough for the line's own $I^2X$.
3. **During the iterations.** Each pass computes Q from the latest angle, updates $V_2$, and rescales it to 1.0.

**Answer:** δ₂ = 5.74° and $Q_2$ = 0.025 pu.
:::
:::

::: example
## If each iteration shrinks the error by a factor of 0.28 from an initial 0.07 pu, how many iterations reach 10⁻⁶?

::: solution
1. **Set the condition.**
   $$0.07 \times 0.28^k < 10^{-6}$$
2. **Solve for k.**
   $$\begin{aligned} k &> \frac{\ln(10^{-6}/0.07)}{\ln 0.28} \\ &= 8.76 \end{aligned}$$
3. **Count them.** That's 9 more after the first, or about 10 to 12 in total, consistent with the 12 the two-bus case takes.
4. **A large system.** A large system's factor might be 0.95, needing hundreds of iterations.

**Answer:** 9 more iterations after the first, about 10 to 12 in all.
:::
:::

::: example
## A generator bus is set to hold 1.02 pu, but holding it would take 0.6 pu of vars and the machine's limit is 0.4. The bus's short-circuit level is 5 pu. What does the power flow do, and where does the voltage end up?

::: solution
1. **Switch the bus type.** The bus switches from PV to PQ with Q fixed at 0.4 pu, and its voltage is no longer held.
2. **Estimate the drop.** It falls by roughly the missing vars over the short-circuit level:
   $$\begin{aligned} \Delta V &\approx 0.2/5 \\ &= 0.04\ \text{pu} \end{aligned}$$
   to about 0.98 pu.
3. **Later iterations.** Real power-flow programs check the limit after each iteration and switch the bus back to PV if the voltage later rises enough that the generator could hold it within its limit.

**Answer:** the bus becomes a PQ bus with Q held at 0.4 pu, and its voltage falls to about 0.98 pu.
:::
:::

::: check
given: X = 0.1 | 0.2 | 0.3; P = 0.5 | 1; Q = 0.2 | 0.5
answer: sqrt((1 - X*Q)^2 + (X*P)^2)
tolerance: 0.5%

## A slack at 1∠0° feeds a load of {P} + j{Q} pu through X = {X}. What's the magnitude of the first Gauss–Seidel iterate for the load bus, from a flat start?

::: right
Right. $V^{(1)} = (1 - XQ) - jXP$, magnitude {answer}.
:::

::: misses
- [any] Not yet. Apply the update once with $V^{(0)} = 1$.
:::
:::

::: check
given: P = 0.3 | 0.8 | 1.5; X = 0.1 | 0.25; V = 1.02 | 1.05
answer: asin(P*X/V)*180/pi
unit: °
tolerance: 0.5%

## A PV bus at {V} pu injects {P} pu into a slack at 1∠0° through X = {X}. What angle does Gauss–Seidel converge to?

::: right
Right. $\sin^{-1}(PX/|V_1||V_2|)$ = {answer}°.
:::

::: misses
- [asin(P*X)*180/pi] Include the PV bus's voltage magnitude.
- [any] Not yet. $P = |V_1||V_2|\sin\delta/X$.
:::
:::

::: check
given: P = 0.3 | 0.8 | 1.5; X = 0.1 | 0.25; V = 1.02 | 1.05
answer: (V^2 - V*cos(asin(P*X/V)))/X
tolerance: 0.5%

## For the same PV bus, how many vars does its generator inject at the solution?

::: right
Right. $(|V_2|^2 - |V_1||V_2|\cos\delta)/X$ = {answer} pu.
:::

::: misses
- [(1 - cos(asin(P*X/V)))/X] Use the PV bus's magnitude, {V}.
- [any] Not yet. Reactive flow from bus 2 into the line.
:::
:::

::: check
given: e = 0.05 | 0.2; r = 0.3 | 0.6 | 0.9; t = 1e-4 | 1e-6
answer: ceil(ln(t/e)/ln(r) - 0.0001)
tolerance: 0

## Each iteration multiplies the error by {r}, starting from {e}. How many iterations until it's below {t}?

::: right
Right. The smallest k with $e r^k < t$: {answer}.
:::

::: misses
- [any] Not yet. Solve $er^k = t$ and round up.
:::
:::

::: check
given: a = 0.95 | 0.98; b = 0.9 | 0.93; s = 1.2 | 1.5
answer: a + s*(b - a)
tolerance: 0.1%

## An iteration moves a voltage from {a} to {b}. With an acceleration factor of {s}, what value is kept?

::: right
Right. $V_\text{old} + \alpha(V_\text{new} - V_\text{old})$ = {answer}.
:::

::: misses
- [b] That's without acceleration.
- [any] Not yet. Overshoot the step by α.
:::
:::

::: check
given: m = 0.3 | 0.5; q = 0.2 | 0.4 | 0.65
answer: (q + m - abs(q - m))/2
tolerance: 0.5%

## A PV bus's generator can supply at most {m} pu of vars. An iteration computes that it would need {q} pu. What Q does the next update use?

::: right
Right. {answer} pu: if the need exceeds the limit, Q is clamped and the bus is treated as PQ, letting its voltage fall below the setpoint.
:::

::: misses
- [any] Not yet. Compare the computed Q with the limit.
:::
:::

::: check
kind: parts
given: V = 1 | 1.02 | 1.05; n = 0.5 | 0.8; m = 0.2 | 0.4; S = 4 | 10

## A PV bus set to {V} pu would need {n} pu of vars, but its generator is limited to {m} pu. The bus's short-circuit level is {S} pu.

::: part
answer: n - m
tolerance: 0.5%

### How many vars short is it?

::: misses
- [any] Needed minus the limit.
:::
:::

::: part
answer: V - (n - m)/S
tolerance: 0.5%

### Roughly where does its voltage settle?

::: misses
- [any] $\Delta V \approx \Delta Q/S_{sc}$.
:::
:::
:::

::: check
kind: derivation
vars: P = 0.05..1, X = 0.05..0.5, V = 0.95..1.05

## A PV bus at V pu injects P into a 1 pu slack through lossless X.

::: step
answer: asin(P*X/V)

### What is its angle, in radians?
:::

::: step
answer: (V^2 - V*cos(asin(P*X/V)))/X

### How many vars does its generator inject?
:::

::: right
Right. The PV bus fixes V; its angle follows P and its vars follow whatever the network needs to hold V.
:::
:::

::: explain
## Why does Gauss–Seidel need more iterations as the network grows, while Newton–Raphson doesn't?

::: model
Gauss–Seidel updates each bus from its neighbors' latest voltages, so a change at one bus reaches a bus k branches away only after about k sweeps, and the corrections spread through a large network like heat diffusing through a long bar: slowly, with the slowest error patterns decaying only a little per sweep. Newton–Raphson linearizes all the equations together and solves for every correction at once with a sparse factorization, so a disturbance anywhere is felt everywhere in a single step. Its convergence is quadratic near the solution, and typically three to five iterations suffice whether the system has ten buses or ten thousand.
:::
:::

::: practice

::: check
given: X = 0.15 | 0.35; P = 0.4 | 1.2; Q = 0.1 | 0.6
answer: sqrt((1 - X*Q)^2 + (X*P)^2)
tolerance: 0.5%

## First GS iterate magnitude: X = {X}, load {P} + j{Q}?

::: misses
- [any] $|(1 - XQ) - jXP|$.
:::
:::

::: check
given: e = 0.1 | 0.5; r = 0.5 | 0.95; t = 1e-5 | 1e-8
answer: ceil(ln(t/e)/ln(r) - 0.0001)
tolerance: 0

## Iterations to go from {e} to {t} at rate {r}?

::: misses
- [any] $\lceil\ln(t/e)/\ln r\rceil$.
:::
:::

::: check
given: P = 0.2 | 1; X = 0.05 | 0.3
answer: asin(P*X)*180/pi
unit: °
tolerance: 0.5%

## PV-bus angle for {P} pu through X = {X}, both at 1 pu?

::: misses
- [any] $\sin^{-1}(PX)$.
:::
:::
:::
