kirchhoff_node_angle.hpp file
B–θ (node-angle) Kirchhoff Voltage Law row assembly.
One of two strategies for emitting DC-OPF KVL constraints — selected via KirchhoffMode::node_angle. The global default is KirchhoffMode::cycle_basis (since 2026-05-14); node_angle is required for per-stage topology changes and phase-shift transformers. The classical B–θ form: one bus angle (theta) variable per active bus + one KVL equality per active line per block:
−θ_a + θ_b + x_τ · f_p − x_τ · f_n = −φ
where x_τ = τ · X / V² is the off-nominal-tap-corrected susceptance and φ is the line's phase-shift angle (radians). In piecewise_direct line-loss mode the f_p / f_n aggregator columns are absent and each segment is stamped directly with ±x_τ — the per-block segment lists are passed via seg_p_cols / seg_n_cols and the function picks the right path automatically.
The sibling KirchhoffMode::cycle_basis strategy (the global default since 2026-05-14) eliminates theta entirely and emits per-cycle equalities — see kirchhoff_cycle_basis.hpp.
Namespaces
- namespace gtopt
- namespace gtopt::kirchhoff
- namespace gtopt::kirchhoff::node_angle