Newton–Raphson
The key idea
The solver cannot compute the answer directly, so it hunts for it: guess the voltages, measure how wrong the guess is, use the local slope to make a much better guess, and repeat. The error shrinks so fast that three to five rounds are usually enough.
The idea
A power flow has to satisfy a power balance at every bus: the power flowing in must equal the power flowing out. Write that requirement down for every bus and you get a large system of equations with no direct solution.
Newton–Raphson deals with it in rounds:
- Guess. Start somewhere — usually a "flat start": every voltage at 1.0 pu, every angle at zero.
- Measure the mismatch. Put the guess into the balance equations. The amount by which each bus fails to balance is its mismatch — the error of the current guess.
- Correct along the slope. Work out how sensitive each mismatch is to each voltage (this sensitivity table is the Jacobian). Slide down that slope to the point where the mismatch would be zero if the network were linear. It is not linear — so the new point is not perfect. But it is far closer.
- Repeat until every mismatch is below tolerance. Then the guess is the answer.
Try it
Take the steps yourself and watch the mismatch history collapse.
iteration 0 · guess 0.600 pu · mismatch -2.415
- |2.415|
The dot is the current guess. The dashed line is the tangent — the curve's local slope. Each step slides down the tangent to where it crosses zero, and guesses again from there.
Why it matters
- It is why results arrive in seconds. Each round roughly squares the error — 0.1 becomes 0.01 becomes 0.0001. This "quadratic convergence" is why network size barely changes the iteration count.
- "Did not converge" now means something. The solver ran out of iterations with mismatch remaining. Usually the model — not the solver — is the problem: an island with no slack, a missing impedance, a load the network cannot physically serve. The bus with the largest remaining mismatch points near the fault.
- The tolerance is the meaning of "solved". Convergence means every bus balances to within the tolerance you set — not that the answer is exact to infinite digits.
The math, if you want it
Collect the unknowns (voltage angles and magnitudes) in a vector x, and the power mismatches in a vector f(x). Each round solves J·Δx = −f(x), where J = ∂f/∂x is the Jacobian, then updates x ← x + Δx. Near the solution the error obeys ‖ek+1‖ ≈ c·‖ek‖² — quadratic convergence. J is large but almost entirely zeros (each bus only connects to a few others), so Phasor factorizes it with a sparse LU decomposition each round.
See it in Phasor
Phasor's power flow is a full Newton–Raphson solver with the Jacobian rebuilt every iteration. You set the mismatch tolerance and the iteration limit in the solver settings — and when a case does not converge, the message names the bus with the largest remaining mismatch.