Surge Architecture
April 19, 2026 ยท View on GitHub
This document is a high-level map of the current workspace. If this summary and
the manifests disagree, use the root Cargo.toml and the crate manifests.
Workspace Shape
A useful mental model is:
- Foundation:
surge-network,surge-solution,surge-sparse,surge-io,surge-topology - Steady-state and transfer solvers:
surge-dc,surge-ac,surge-transfer,surge-hvdc - Optimization:
surge-opf - Security:
surge-contingency - Markets:
surge-dispatch,surge-market - Interfaces:
surge-bindings,surge-py
Core Dependency Rules
surge-networkis the shared domain-model layer.surge-solutionis the shared result and replay layer.surge-sparseis a utility crate and is not the universal solver base; several solver crates also use their own direct numerical dependencies.surge-iohandles parse and write boundaries and depends onsurge-networkandsurge-topology.- Solver crates generally depend downward into shared model or lower-level solver crates; interface crates sit at the leaves.
surge-dispatchcomposessurge-dc,surge-ac,surge-hvdc, andsurge-opfinto the unified SCED/SCUC kernel.surge-marketdepends onsurge-dispatchand hosts the canonical market-formulation layer (reserve catalogues, multi-stage workflows, AC SCED setup, GO C3 adapter).
Interface Crates
surge-bindings
surge-bindings produces the surge-solve binary and a small supporting rlib. Its current direct workspace dependencies are:
surge-networksurge-solutionsurge-dcsurge-acsurge-iosurge-contingencysurge-opfsurge-hvdcsurge-transfer
The CLI contract is defined in src/surge-bindings/src/main.rs and should be treated as authoritative over secondary prose.
surge-py
surge-py builds the native _surge extension consumed by the surge Python package wrapper. Its current direct workspace dependencies are:
surge-networksurge-solutionsurge-dcsurge-acsurge-iosurge-contingencysurge-opfsurge-hvdcsurge-topologysurge-transfersurge-dispatchsurge-market
The Python contract is defined by the binding source in src/surge-py/src/
and the package-level stubs in src/surge-py/python/surge/, especially
__init__.pyi, io/__init__.pyi, and io/psse/*.pyi.
Typical Data Flow
- Parse or construct a
surge_network::Network. - Run one or more analysis crates against that model.
- Surface results through
surge-solutioncontracts, solver-specific outputs, Python, or CLI interfaces. - Optionally export the network or derived artifacts through
surge-ioor interface-specific helpers.
Structural Caveats
- The workspace is not a strict single-stack pipeline; many analysis crates share the same model layer and compose with each other selectively.
- Public docs should use the published Python names and study entry points such as
solve_ac_pf,solve_dc_pf,surge.dc.prepare_study,surge.transfer.prepare_transfer_study,surge.transfer.compute_nerc_atc, andsurge.contingency.n1_branch_study.
How To Re-Verify This Document
Use these commands when auditing future drift:
git grep -n '^members = \\[$' Cargo.toml
cargo metadata --no-deps
cargo tree -p surge-bindings
cargo tree -p surge-py
Those outputs should be preferred over hand-maintained counts or diagrams.