Skip to main content

solve_with_loops

Function solve_with_loops 

Source
pub fn solve_with_loops(
    ctx: &mut SolveContext<'_>,
    tol: f64,
    max_iter: usize,
    backend: JacobianBackend,
    loops: &mut [&mut dyn OuterLoop],
    budget: usize,
) -> (Vec<IslandReport>, OuterLoopReport)
Expand description

Solve, then run an ordered list of outer loops to a fixed point.

§The schedule

Transcribed from powsybl-open-loadflow’s AcloadFlowEngine, because it is not the obvious one:

  • An initial solve runs first. If it does not settle, no loop is consulted at all — there is nothing useful a control can decide from a state that is not a power flow.
  • The loops are nested, innermost first. Each is run to its own stability (an inner check/re-solve loop) before the next is consulted.
  • Any loop reporting Unstable re-solves and becomes the “last unstable” loop. The driver then continues down the list, and wraps back to the start.
  • Termination is reaching the last-unstable loop again having changed nothing on the way: the whole list has been walked and every criterion holds simultaneously, which is what a fixed point of the combined controls means.

budget caps total re-solves across every loop, as one shared figure rather than a per-loop count. An empty loops makes this exactly one ordinary solve.