Skip to content

fix(psse): start PSS/E at its default bus size, not 50 buses (release 0.5.1) - #154

Merged
qian-harvard merged 2 commits into
mainfrom
release/v0.5.1
Nov 12, 2026
Merged

qian-harvard merged 2 commits into
mainfrom
release/v0.5.1

Conversation

@qian-harvard

Copy link
Copy Markdown
Contributor

Problem

The PSS/E server called psspy.psseinit(50), under a comment calling 50 a "PSS/E 35+ bus mode; do NOT change". The argument is actually the requested bus capacity; 50 is the bus limit of the free PSS/E Xplore edition. On a full PSS/E 36.2 the engine therefore starts at PSS/E's 1,000-bus minimum.

psspy.case() grows the engine by itself, so opening a .sav hides the problem. A RAW read does not: on PSS/E 36.2.1, psspy.read(0, "bench.raw") loads 1,000 of 1,648 buses and still returns ierr=0, logging only "Area slack bus … not found" errors along the way.

It can't be corrected after startup either. A second psseinit(50000) is ignored, and bus_size_level(50000) reports 50,000 while the RAW read still stops at 1,000. So an agent "resizing" through run_psspy_command believes it succeeded and keeps working on a truncated case.

Engine start Then Buses loaded from 1,648-bus bench.raw
psseinit(50) (0.5.0) — 1,000, ierr=0
psseinit(50) bus_size_level(50000) 1,000
psseinit(50) psseinit(50000) 1,000
psseinit(0) (this PR) — 1,648

Fix

  • psseinit(0) asks PSS/E for its default size level, the bus size set in the PSS/E GUI (50,000 unless changed), so the server matches the GUI.
  • New optional psse.bus_size config key (powermcp config set psse.bus_size 150000) and POWERMCP_PSSE_BUS_SIZE override for cases larger than that. A value that isn't a whole number is refused with an actionable error before the engine starts.
  • README config table documents psse.bus_size.
  • Version bumped to 0.5.1 (pyproject.toml, powermcp/__init__.py, registry test).

Verification

  • New tests in tests/test_psse_server.py cover the default (psseinit(0)), config, env-over-config, and invalid values. tests/test_vendor_import.py used to assert psseinit(50); it now asserts 0.
  • On PSS/E 36.2.1 through the patched server module: bench.raw loads all 1,648 buses, bench2.sav (7,917 buses) opens and solves, and psse.bus_size=150000 gives a 150,000-bus engine. A server launched over stdio exactly as MCP clients launch it reports a 50,000 size level.
  • Local suite: 479 passed. The 4 failures (test_doctor ×2, test_powerio_server::test_registry_entry, test_runner::test_preflight_missing_pip_dep_raises) fail identically on main on this machine and are environment-specific. The ANDES tests were excluded locally because they hang on this machine. Neither is related to this change.

🤖 Generated with Claude Code

qian-harvard and others added 2 commits November 12, 2026 17:21
The server called psseinit(50), believing 50 was a "PSS/E 35+ bus mode".
It is the requested bus capacity (50 is PSS/E Xplore's limit), so the
engine started at PSS/E's 1,000-bus minimum. psspy.case() grows the size
on its own, but a RAW read into that engine silently drops every bus past
1,000 while returning ierr=0 (bench.raw: 1,000 of 1,648 buses). The size
cannot be fixed afterwards: a second psseinit() is ignored and
bus_size_level() does not grow working memory.

psseinit(0) now asks PSS/E for its default size level, the bus size set in
the PSS/E GUI (50,000 unless changed). A larger size can be set with the
new optional psse.bus_size config key or POWERMCP_PSSE_BUS_SIZE; a value
that is not a whole number is refused before the engine starts.

Verified on PSS/E 36.2.1: bench.raw loads all 1,648 buses, bench2.sav
(7,917 buses) opens and solves, and psse.bus_size=150000 gives 150,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qian-harvard
qian-harvard merged commit 3510a88 into main Nov 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant