Foundation
The bus admittance matrix, denoted Ybus or simply Y, is a complex-valued square matrix that captures the entire electrical structure of a power network in a single algebraic object. Each row of Y relates the current injection at one bus to the voltages at all buses, transforming the geometric network of branches and transformers into a linear system I = YV that is the starting point for every power-flow calculation.
Think of Ybus as a phonebook for the network: row i, column k tells you how much current flows into bus i when bus k is energized to one per-unit voltage and all other buses are grounded. The diagonal entry Yii is the bus’s self-admittance — what happens when bus i itself is energized — and is determined by all branches and shunts incident to it. The off-diagonal Yik is the mutual admittance between buses i and k, nonzero only if a branch directly connects them.
Because most buses connect to only a handful of others (transmission networks have average node degree 2–4, distribution feeders even lower), Y is extremely sparse. A 10,000-bus transmission system has perhaps 30,000 nonzero entries in a matrix of 10⁸ cells — a fill-in ratio under 0.05%. This sparsity is the reason large-scale power-flow and OPF are tractable: linear-algebra routines designed for sparse complex matrices exploit it to deliver O(n) or O(n log n) solves on networks where naive dense methods would be hopeless.
Each branch (i,j) — a transmission line, cable, or transformer — has a series admittance ys = 1 / (r + jx) capturing conduction along the branch, and shunt admittances ysh/2 at each end capturing line charging and core losses. For a branch with tap ratio T (a complex number on the from-side accounting for off-nominal turns ratio and phase shift), the 2×2 branch admittance matrix relating the from/to currents to the from/to voltages is:
For a simple line without taps (T = 1), the matrix simplifies to symmetric entries with −ys on the off-diagonals and ys + shunts on the diagonals. The tap ratio asymmetrizes Ybranch in a controlled way that preserves the underlying complex-power balance.
Ybus is built by summing branch contributions over all branches incident to each bus, plus any bus-level shunts (capacitor banks, reactors, fixed-load conductances). For each bus i and each pair (i,k):
For typical networks without parallel branches between the same pair of buses, the off-diagonal sum reduces to a single term: Yik = −ys of the connecting branch (with tap-ratio modifications). Parallel branches add their admittances directly. The result is a symmetric matrix when no phase-shifting transformers are present, and remains structurally symmetric (Yik ≠ 0 ⟺ Yki ≠ 0) even when entries differ due to taps.
Y inherits the sparsity pattern of the network’s incidence graph. For meshed transmission systems, Y is sparse with average node degree 2–4. For radial distribution feeders, Y is even sparser — its graph is a tree, giving exactly n−1 off-diagonal nonzeros for an n-bus system. Sparse Cholesky and LU factorizations on Y are the computational backbone of most power-flow algorithms.
Without phase shifters, Y is complex symmetric (Y = YT, not Y = Y* — the entries are complex but the matrix is not Hermitian). Its real part G is positive semidefinite for passive networks; its imaginary part B can have either sign and is typically dominated by line susceptances. These properties determine which linear-algebra methods apply and how they behave numerically.
The full Ybus is singular: the row sums equal the bus shunts, and if no shunts exist, the rows sum to zero — reflecting the fact that adding a constant voltage to all buses produces no current flow. Practical power-flow methods break this singularity by fixing one bus (the slack bus) as a reference, removing its row and column from the system.
The bus admittance matrix is the bridge between physical network description and optimization formulation. Active and reactive power injections at each bus are expressed as quadratic forms in voltage involving Y:
This single equation is the source of every centralized OPF formulation in Lirion. Polar substitution Vi = |Vi| ejθi yields the AC formulation; rectangular substitution gives ACR; lifting to W-space (|Vi||Vk|cos θik, etc.) gives SOCWR; explicit current variables I = YV give IVR; assumption-based linearization gives DC and BFA. Ybus is the constant — the input parameter that encodes the network — while the choice of how to represent V is what distinguishes one formulation from another.
Constructing Y from a MATPOWER case file involves parsing branch data (resistance, reactance, susceptance, tap ratio, phase shift, status) and summing complex contributions. Lirion does this once during problem setup, caches the sparse matrix, and reuses it across model formulations — the same Y feeds AC, DC, SOCWR, and every other model. The cost of building Y is negligible compared to the cost of solving the optimization, but its sparsity pattern propagates into every Jacobian, making early careful construction essential.