v0.1.5
Python-side release: agent / MCP integration helpers, a PyPSA netCDF
bridge, and accessor consistency fixes. No Rust crate API changes.
Added
- Agent-friendly MCP helpers on
surge-py..to_dict()now exists
on every solver result (AcPfResult,DcPfResult,DcOpfResult,
ScopfResult,AcOpfHvdcResult,ContingencyAnalysis,
AcAtcResult,PtdfResult,LodfResult,LodfMatrixResult,
OtdfResult, and the nested contingency / screening types) so MCP
hosts and tool-calling agents can serialize results with one call.
Matrix results acceptformat={"summary","sparse","full"}and a
top_k_per_branchknob. - Network convenience accessors.
Network.summary(),
Network.loads_dataframe(),Network.shunts_dataframe()round out
the existing generator / bus / branch DataFrame surface. - Built-in case helpers.
surge.list_builtin_cases()and
surge.load_builtin_case(name)enumerate the packaged IEEE / market
cases by string name.surge.builtin_case_rated_flags()reports
which built-ins ship with branch thermal ratings (relevant for
transfer-capability studies). - Explicit format override on load.
surge.load(path, format=...)
and thesurge.load_networkalias let MCP hosts pass an explicit
format when the extension is ambiguous or missing. - PyPSA netCDF bridge. New
surge.io.pypsa_nc.load(path)reads
PyPSA netCDF directly into a SurgeNetwork, preserving per-bus
v_mag_pu_setthat the MATPOWER round-trip path cannot always
carry through. Requires the optionalpypsapackage. - Format interop guide. New
docs/format-interop.md
documents per-format round-trip caveats and when to prefer the
PyPSA bridge over a MATPOWER hop.
Changed
- Accessor consistency on
AcPfResult.branch_apparent_power
andbranch_loading_pctare now properties, matching the rest of
the result surface. Breaking for callers using()— drop the
parentheses:result.branch_loading_pct(not
result.branch_loading_pct()). - Branch type auto-detection on
Network.add_branch. An
off-nominal tap (|tap − 1| > 1e-6) or non-zero phase shift now
tags the branch as aTransformer, matching the MATPOWER reader
convention. Previously Python-built networks landed asLine
regardless. - Strict-JSON-safe matrix serialization. PTDF / LODF / OTDF
to_dictnow filters non-finite entries (NaN / ±∞ from radial /
islanding outages) fromnnz,max_abs, and top-k lists, surfaces
nan_count/inf_countseparately, and emits PythonNonefor
non-finite cells informat="full"so the payload round-trips
through strict JSON encoders.
Build
- Docker image builds HiGHS 1.14.0 from source rather than relying
on the Debianlibhighs-devpackage, which lagged behind the
workspace's vendored HiGHS.