Skip to main content

solve_constrained

Function solve_constrained 

Source
pub fn solve_constrained(
    buses: &mut [Bus],
    ybus: &YBusSparse,
    switches: &[ConstrainedSwitch],
    tol: f64,
    max_iter: usize,
) -> ConstrainedSolution
Expand description

Runs Newton-Raphson with each closed switch enforced as an exact equality.

ybus must not contain the switches — that is the entire point. Build it from the network’s own lines and transformers, and pass the switches here.

Islands are decided across closed switches, since a switch conducts even though it contributes no admittance. Without that, the two ends of every closed switch would look like separate components and mark_unreferenced_islands would de-energize whichever side does not hold the reference — turning a perfectly ordinary network into a dead one.