LP
Solver: OSQP
The Linearized Branch-Flow Approximation (BFA), better known as LinDistFlow, is the workhorse model for radial distribution-network optimization. Introduced by Baran and Wu in 1989, it linearizes the branch-flow equations by dropping the quadratic loss term — keeping voltages and reactive power as decision variables (unlike DC) while remaining a convex linear program (unlike AC).
Use BFA for distribution-grid planning, voltage regulation studies, DER hosting capacity assessment, and any radial-network problem where you need reactive power and voltage magnitudes but cannot afford full AC. BFA’s accuracy degrades on meshed networks and under heavy loading where losses become non-negligible — for those cases, SOCBF (its convex relaxation) is the natural upgrade.
The branch-flow model parameterizes each branch (i,j) by its sending-end real and reactive power flows Pij, Qij and the squared current magnitude ℓij = |Iij|². Bus voltages are tracked via vi = |Vi|². For a radial network with i upstream of j, the exact AC branch-flow equations read:
BFA assumes losses are small (rij ℓij ≪ Pij and xij ℓij ≪ Qij) and drops the quadratic terms. The voltage-drop equation collapses to its linear form:
The current-balance equation ℓij vi = Pij² + Qij² is dropped entirely. Power balance at each bus becomes a linear sum of branch flows minus loads. The result is a linear program in (Pij, Qij, vi, Pg, Qg) — convex, fast, and exact on lossless radial networks.
The complete LinDistFlow formulation reads:
Voltage bounds are expressed on vi = |Vi|² (squared magnitudes) — a quirk of the branch-flow parameterization. Active and reactive power balance are tracked independently, unlike DC where only active power appears.
BFA is an LP with constraint matrix proportional to the network’s incidence matrix plus a voltage-drop coupling per branch. It scales effortlessly to feeders with thousands of buses, with solve times in milliseconds. OSQP is Lirion’s default solver; HiGHS and Gurobi are equally efficient on this problem class.
The accuracy gap to full AC depends on network loading and r/x ratios. On urban distribution feeders with high X/R, BFA voltage predictions are within 1% of AC. On rural feeders with cables (high R/X) and heavy loading, the gap grows to 5–10% — in such cases, SOCBF (the convex relaxation that retains the dropped quadratic term) is preferable.
Solving BFA on a MATPOWER case file requires a single call to solve:
using Lirion
# Solve LinDistFlow on a radial distribution feeder
out = solve("case33bw.m"; model = bfa(), algorithm = centralized())
# Voltages, flows, and dispatch
v_sq = out.solution["bus"]["w"] # squared voltage magnitudes
Pij = out.solution["branch"]["pf"] # active branch flows
Qij = out.solution["branch"]["qf"] # reactive branch flows
println("Objective: $", round(out.objective, digits=2))
println("Min voltage: ", round(sqrt(minimum(v_sq)), digits=4), " p.u.")