10 releases
Uses new Rust 2024
| 0.1.9 | May 4, 2026 |
|---|---|
| 0.1.8 | May 1, 2026 |
| 0.1.7 | Apr 26, 2026 |
| 0.1.1 | Mar 31, 2026 |
#967 in Algorithms
Used in 7 crates
(6 directly)
2MB
37K
SLoC
surge-ac
surge-ac is the AC power-flow crate in the Surge workspace. It provides the
nonlinear steady-state solvers and the AC-side helper layers used directly by
users and by higher-level crates such as surge-contingency, surge-hvdc, and
surge-opf.
Root Surface
The crate root re-exports the main public entry points:
solve_ac_pfandAcPfOptionsfor full Newton-Raphson AC power flowsolve_fdpf,FdpfOptions,FdpfVariant, andFdpfFactorsfor fast-decoupled power flowPreparedAcPfandPreparedStartfor repeated Newton-Raphson solves on a prepared modelmerge_zero_impedance,expand_pf_solution, andMergedNetworkfor zero-impedance contraction and result expansion- lower-level Newton-Raphson kernel types such as
PreparedNrModel,NrKernelOptions,NrState,NrWorkspace, andrun_nr_innerfor advanced integration work
Public modules remain available for advanced callers:
controlfor AC-side outer-loop and control supportmatrixfor AC matrix assembly helperstopologyfor AC-specific topology helpersac_dcfor AC/DC-adjacent support code used by the wider workspace
Choosing A Solver
Use solve_ac_pf when you need the full nonlinear AC solve:
- quadratic convergence on well-conditioned transmission cases
- reactive power limits, slack policies, island handling, and AC-side outer loops
- the canonical path for accuracy-sensitive studies
Use solve_fdpf when you need a cheaper approximate AC solve:
- screening and repeated approximate studies on transmission networks
- XB and BX variants through
FdpfVariant - lower per-iteration cost than Newton-Raphson, but less robust and less exact
Example
use surge_ac::{solve_ac_pf, AcPfOptions};
use surge_io::load;
let net = load("examples/cases/ieee118/case118.surge.json.zst")?;
let sol = solve_ac_pf(&net, &AcPfOptions::default())?;
println!("iterations={} mismatch={:.2e}", sol.iterations, sol.max_mismatch);
# Ok::<(), Box<dyn std::error::Error>>(())
Notes
- The current public contract is centered on Newton-Raphson, fast-decoupled power flow, prepared solves, and zero-impedance handling.
- Continuation power flow is not part of the current public crate surface.
- When you need a workspace-level interface instead of direct Rust use, reach
for
surge-solveor the Python package insurge-py.
Dependencies
~17MB
~293K SLoC