Skip to main content

solve_dc_network

Function solve_dc_network 

Source
pub fn solve_dc_network(
    buses: &mut [DcBus],
    lines: &[DcLine],
    tol: f64,
    max_iter: usize,
) -> DcSolveStatus
Expand description

Solves a small resistive DC network for the unknown bus voltages, given each bus’s role (fixed voltage, fixed power, fixed current, or passive).

Newton-Raphson over the non-UdcSlack/Ground buses (FixedIdc/ Passive rows are already linear — ΣG·V - injection = 0 — but are solved in the same loop as FixedP’s genuinely nonlinear V·ΣG·V - p_spec = 0 rather than special-cased, exactly as AC’s P- and Q-mismatch rows differ in structure but share one Jacobian). Components with no UdcSlack/Ground reference at all are excluded from the unknowns entirely and reported via DcSolveStatus::isolated_buses, rather than producing a singular (indeterminate) system.