feat: add powerio conversion server (synced to 0.1.1) with ANDES bridge#1
Closed
samtalki wants to merge 4 commits into
Closed
feat: add powerio conversion server (synced to 0.1.1) with ANDES bridge#1samtalki wants to merge 4 commits into
samtalki wants to merge 4 commits into
Conversation
…memory powerio 0.1.0 ships convert_str, so the server's inline conversion no longer stages temp files; the _EXT/_stage/_unlink_quietly machinery is gone. The file is now a faithful copy of the canonical powerio.mcp.server (same eight tools, the docstring polish from its review, the save_case newline fix both copies already shared), with the standalone header pointing at upstream. The powerio extra pins >=0.1.0 and a regression test asserts inline conversion never touches tempfile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PyPSA bridge: drop out-of-service branches and generators before import_from_pypower_ppc, which ignores the ppc status columns; gencost rows are realigned after generator drops. pandapower's from_ppc honors status so its bridge is unchanged (documented by a new test). powerio server: shadow-import guard on startup; explicit laplacian elif with unreachable-else guard; OSError arm in convert_case; belt-and- braces (ValueError/KeyError/TypeError) arm in _load. tests: 7 new cases covering OOS branch/generator drops, pandapower status contrast, laplacian matrix, bad-JSON ValueError, and OSError normalization. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upstream landed the error-shape hardening from the Power-Agent#34 review (eigenergy/powerio#93, released as 0.1.1): _parse maps an unreadable file (OSError) to the documented ValueError shape, convert_case says "cannot read file" instead of "conversion failed" for that case, and the defensive-arm comments came along. Ports the upstream suite's unreadable-file and wrong-schema tests. No new powerio API, so the >=0.1.0 floor stands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds load_network_from_json and load_network_from_any to ANDES/andes_mcp.py,
following the same pattern as the PyPSA bridge. Both tools accept a powerio
JSON transport string or any powerio-readable file (MATPOWER, PSS/E, PowerWorld
.aux, PowerModels JSON, egret JSON), convert to MATPOWER via powerio's
case.to_format("matpower"), and write the result to out_path for ANDES to
consume via run_power_flow. Bumps the powerio extra pin to >=0.1.1 to match
the 0.1.1 server already on this branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
@qian-harvard — carried your OOS fix and error hardening from Power-Agent#34 into this branch (see |
Owner
Author
|
Opened by mistake — the correct PR is Power-Agent#35. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
powerio/powerio_mcp.py) — 8 tools covering case conversion, the JSON transport, matrix builders (B′, B″, Y-bus, PTDF, LODF, LACPF, Laplacian), and dense views; synced to upstream 0.1.1 including error-shape hardening from fix(mcp): unreadable files keep the ValueError shape; harden error mapping eigenergy/powerio#93powermcp/_servers/powerioload_network_from_json,load_network_from_any) — converts any powerio-readable format to MATPOWER and stages it forrun_power_flow>=0.1.1Test plan
pip install -e ".[andes,egret,opendss]"andpytest tests/— 93 passed, 4 skipped expectedpowermcp run poweriolaunches the server over stdiotest_andes_load_network_from_any,test_andes_load_network_from_json) pass whenandesis installed🤖 Generated with Claude Code