---
title: The power-flow problem
heading: Slack, PV and PQ buses, the nonlinear power-flow equations in polar form, counting unknowns, line flows and losses from the solution, and a two-bus case solved exactly
eyebrow: S10 · Lesson 17 · The power-flow problem
xp: 50
---

::: hook
Given what every generator produces and every load consumes, what are the voltages at all the buses, and how much flows on each line? That's the power-flow (or load-flow) problem, solved thousands of times a day by every grid operator: for planning, for checking what happens if a line trips, for pricing. It looks like circuit analysis, but the sources and loads are specified as powers rather than voltages or currents, which makes the equations nonlinear. This lesson sets up the problem; the next three solve it.
:::

::: play
- Two buses: a slack bus held at 1∠0° and a load bus drawing P + jQ through a line of reactance X.
- The plot shows the load bus voltage and the vars the slack generator must supply against P, for a load whose Q/P ratio you set.
- The slack must supply the load's vars plus the line's own $I^2X$, which grows as the square of the current: by the nose, the line is eating more vars than the load.
:::

```sim plot
view: graph
x: P = 0..2 pu
y: v = 0..3 pu
slider: X = 0.1..0.5 = 0.2
slider: t = 0..1 = 0.5
plot: sqrt(((1 - 2*P*t*X) + sqrt((1 - 2*P*t*X)^2 - 4*X^2*(P^2 + (P*t)^2)))/2) | samples: 800 | label: load bus voltage
plot: P*t + X*(P^2 + (P*t)^2)/(((1 - 2*P*t*X) + sqrt((1 - 2*P*t*X)^2 - 4*X^2*(P^2 + (P*t)^2)))/2) | samples: 800 | color: ch3 | label: slack generator's vars
```

::: predict
## A power-flow case has 100 buses: one slack, 20 generator (PV) buses and 79 load (PQ) buses. How many unknowns must be solved for?

- [ ] 200
- [ ] 198
- [x] 178
- [ ] 79

::: reveal
Each non-slack bus has an unknown angle (99), and each PQ bus also has an unknown voltage magnitude (79): 178. The PV buses' magnitudes are held by their generators, and the slack bus's magnitude and angle are both fixed.
:::
:::

::: nameit
## Bus types

| Bus | Specified | Unknown |
|---|---|---|
| Slack (swing), one per island | $|V|$, δ = 0 | P, Q |
| PV (generator) | P, $|V|$ | δ, Q |
| PQ (load) | P, Q | $|V|$, δ |

The slack bus absorbs whatever the losses turn out to be. A PV bus whose generator hits a var limit becomes a PQ bus at that limit.

## The equations

With $Y_{ik} = |Y_{ik}|\angle\theta_{ik}$ and $V_i = |V_i|\angle\delta_i$, the power injected at bus i is $S_i = V_i\sum_kY_{ik}^*V_k^*$:

$$P_i = \sum_k|V_iV_kY_{ik}|\cos(\theta_{ik} + \delta_k - \delta_i), \qquad Q_i = -\sum_k|V_iV_kY_{ik}|\sin(\theta_{ik} + \delta_k - \delta_i)$$

One P equation for every non-slack bus and one Q equation for every PQ bus: $2(n - 1) - n_{PV}$ equations in as many unknowns. They're nonlinear in δ and |V|, so they're solved by iteration from a **flat start** (all magnitudes 1, angles 0).

## After the solution

With all voltages known, the flow from i to j on a branch with series admittance y = g + jb (ignoring charging) is

$$P_{ij} = |V_i|^2g - |V_iV_j|(g\cos\delta_{ij} + b\sin\delta_{ij})$$

and the line's loss is $P_{ij} + P_{ji}$, which equals $R|I|^2$.

## Two buses, exactly

For a lossless line X with the load bus at P + jQ, the voltage magnitude comes from the nose-curve quadratic (lesson 7) and the angle from $\sin\delta_2 = -PX/|V_2|$.
:::

::: example
## Solve the two-bus case with X = 0.2 pu and a load of 1 + j0.5 pu.

::: solution
1. **Voltage magnitude.**
   $$\begin{aligned} |V_2|^2 &= \tfrac{1}{2}\big[(1 - 0.2) \\ &\quad + \sqrt{0.8^2 - 4(0.04)(1.25)}\,\big] \\ &= 0.7317 \end{aligned}$$
   so $|V_2|$ = 0.855 pu.
2. **Angle.**
   $$\sin\delta_2 = -0.2/0.855$$
   so δ₂ = −13.5°.
3. **Slack power.** The slack supplies 1 pu of real power (no losses) and
   $$\begin{aligned} Q_1 &= 0.5 + \frac{0.2 \times 1.25}{0.7317} \\ &= 0.842\ \text{pu} \end{aligned}$$
   of vars: the load's 0.5 plus 0.342 consumed by the line.
4. **Check.** Plugging $V_2 = 0.855\angle{-13.5°}$ back in delivers exactly 1 + j0.5.

**Answer:** $V_2 = 0.855\angle{-13.5°}$ pu, and the slack supplies 1 + j0.842 pu.
:::
:::

::: example
## A 345 kV line with g = 0.5 and b = −5 pu (100 MVA base) joins buses at 1.02∠0° and 0.98∠−8°. How much real power leaves the first bus?

::: solution
1. **Set up the flow.**
   $$\begin{aligned} P_{12} &= 1.02^2(0.5) - 1.02 \times 0.98 \\ &\quad \times (0.5\cos 8° - 5\sin 8°) \end{aligned}$$
2. **Evaluate the terms.**
   $$\begin{aligned} P_{12} &= 0.520 - 0.9996 \\ &\quad \times (0.4951 - 0.6959) \\ &= 0.520 + 0.201 \\ &= 0.721\ \text{pu} \end{aligned}$$

**Answer:** 0.721 pu, or 72 MW.
:::
:::

::: example
## A slack bus at 1 pu feeds 2 + j0.5 pu through a lossless X = 0.1 pu. Find every voltage the load bus could have.

::: solution
1. **Eliminate the angle.** The two-bus equations give
   $$\begin{aligned} &V^4 + (2QX - 1)V^2 \\ &\quad + X^2(P^2 + Q^2) = 0 \end{aligned}$$
2. **Put in the numbers.**
   $$V^4 - 0.9V^2 + 0.0425 = 0$$
3. **Solve the quadratic in $V^2$.**
   $$V^2 = (0.9 \pm 0.8)/2$$
   so V = 0.922 pu or V = 0.224 pu.
4. **Which is which.** Both satisfy the power-flow equations. The high-voltage solution is the operating point; the low one, with huge current, is the unstable branch of the nose curve.
5. **What a solver finds.** A power flow started from a flat start finds the high one.

**Answer:** V = 0.922 pu (the operating point) or V = 0.224 pu (the unstable branch).
:::
:::

::: check
given: n = 30 | 118 | 2000; f = 0.1 | 0.2; let m = round(n*f)
answer: 2*(n - 1) - m
tolerance: 0

## A power-flow case has {n} buses: one slack, {m} PV buses and the rest PQ. How many unknowns does it have?

::: right
Right. $2(n - 1) - n_{PV}$ = {answer}.
:::

::: misses
- [2*n] The slack's two values are fixed, and each PV bus's magnitude is known.
- [2*(n - 1)] The PV buses' voltage magnitudes are specified.
- [any] Not yet. One angle per non-slack bus, one magnitude per PQ bus.
:::
:::

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

## A slack bus at 1 pu feeds {P} + j{Q} pu through a lossless X = {X} pu. What's the load bus voltage magnitude?

::: right
Right. The upper root of the quadratic: {answer} pu.
:::

::: misses
- [any] Not yet. $V^4 + (2QX - 1)V^2 + X^2(P^2 + Q^2) = 0$.
:::
:::

::: check
given: X = 0.1 | 0.25; P = 0.5 | 1.2; Q = 0.2 | 0.6
answer: -asin(P*X/sqrt(((1 - 2*Q*X) + sqrt((1 - 2*Q*X)^2 - 4*X^2*(P^2 + Q^2)))/2))*180/pi
unit: °
tolerance: 0.5%

## For the same two-bus case, what's the load bus's angle?

::: right
Right. $\sin\delta_2 = -PX/|V_2|$: {answer}°.
:::

::: misses
- [-asin(P*X)*180/pi] Use the load bus's actual voltage, not 1 pu.
- [any] Not yet. $P = |V_1||V_2|\sin(\delta_1 - \delta_2)/X$.
:::
:::

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

## For the same case, how many vars must the slack generator supply?

::: right
Right. The load's Q plus the line's $X|I|^2 = X(P^2 + Q^2)/|V_2|^2$: {answer} pu.
:::

::: misses
- [Q] The line's reactance absorbs vars too.
- [Q + X*(P^2 + Q^2)] Divide by $|V_2|^2$: the current is S/V.
- [any] Not yet. Q from the slack = load Q + line $I^2X$.
:::
:::

::: check
given: V = 1 | 1.03; W = 0.96 | 1; d = 5 | 12; g = 0.4 | 1.5; b = 4 | 10
answer: V^2*g - V*W*(g*cos(d*pi/180) - b*sin(d*pi/180))
tolerance: 0.5%

## A branch with series admittance {g} − j\given{b} pu joins buses at {V}∠0° and {W}∠−{d}°. How much real power leaves the first bus?

::: right
Right. $|V_i|^2g - |V_iV_j|(g\cos\delta + b\sin\delta)$ with b = −{b}: {answer} pu.
:::

::: misses
- [any] Not yet. Use the branch-flow formula.
:::
:::

::: check
given: R = 0.01 | 0.04; P = 0.6 | 1.5; Q = 0.1 | 0.5; V = 0.95 | 1.02
answer: R*(P^2 + Q^2)/V^2
tolerance: 0.5%

## A branch with R = {R} pu delivers {P} + j{Q} pu at {V} pu. What's its real power loss?

::: right
Right. $R|I|^2 = R(P^2 + Q^2)/|V|^2$ = {answer} pu.
:::

::: misses
- [any] Not yet. $|I| = |S|/|V|$.
:::
:::

::: check
kind: parts
given: P = 1 | 2 | 3; Q = 0.2 | 0.5; X = 0.05 | 0.1

## A slack bus at 1 pu feeds {P} + j{Q} pu through a lossless X = {X} pu.

::: part
answer: sqrt((1 - 2*Q*X + sqrt((2*Q*X - 1)^2 - 4*X^2*(P^2 + Q^2)))/2)
tolerance: 0.5%

### What is the operating (high) voltage at the load?

::: misses
- [any] Solve $V^4 + (2QX - 1)V^2 + X^2(P^2 + Q^2) = 0$, larger root.
:::
:::

::: part
answer: sqrt((1 - 2*Q*X - sqrt((2*Q*X - 1)^2 - 4*X^2*(P^2 + Q^2)))/2)
tolerance: 0.5%

### And the other, low-voltage solution?

::: misses
- [any] The smaller root.
:::
:::
:::

::: check
kind: derivation
vars: P = 0.1..1, Q = -0.5..0.5, X = 0.01..0.2

## A 1 pu slack feeds P + jQ through lossless X; write $b = 2QX - 1$ and $c = X^2(P^2 + Q^2)$.

::: step
answer: (2*Q*X - 1)^2 - 4*X^2*(P^2 + Q^2)

### What is the discriminant of the quadratic in $V^2$?
:::

::: step
answer: sqrt((1 - 2*Q*X + sqrt((2*Q*X - 1)^2 - 4*X^2*(P^2 + Q^2)))/2)

### What is the high-voltage solution?
:::

::: right
Right. When the discriminant reaches zero the two solutions merge: the nose of the P–V curve.
:::
:::

::: explain
## Why is the power-flow problem nonlinear when the network itself is linear?

::: model
The network obeys I = YV, which is linear, but the data at most buses are powers, not currents. Power is the product of voltage and the conjugate of current, $S = VI^*$, so specifying P and Q at a load bus fixes a product of two unknowns, and writing it in terms of bus voltages gives sums of products of voltage magnitudes with sines and cosines of angle differences. If loads were given as fixed impedances, the problem would be a linear circuit solved in one step; because they're given as powers, and generators as power plus voltage magnitude, it must be solved iteratively.
:::
:::

::: practice

::: check
given: n = 14 | 57 | 300; f = 0.15 | 0.25; let m = round(n*f)
answer: 2*(n - 1) - m
tolerance: 0

## Unknowns: {n} buses, {m} PV?

::: misses
- [any] $2(n - 1) - n_{PV}$.
:::
:::

::: check
given: R = 0.005 | 0.03; P = 0.4 | 2; Q = 0.05 | 0.8; V = 0.97 | 1.05
answer: R*(P^2 + Q^2)/V^2
tolerance: 0.5%

## Loss: R = {R}, {P} + j{Q} at {V} pu?

::: misses
- [any] $R(P^2 + Q^2)/V^2$.
:::
:::

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

## Load voltage for {P} + j{Q} through X = {X}?

::: misses
- [any] The quadratic's upper root.
:::
:::
:::
