Skip to content

Fix powerio-prob review findings before the first publish - #253

Merged
samtalki merged 1 commit into
mainfrom
fix/prob-review-findings
Jul 12, 2026
Merged

Fix powerio-prob review findings before the first publish#253
samtalki merged 1 commit into
mainfrom
fix/prob-review-findings

Conversation

@samtalki

Copy link
Copy Markdown
Member

What changed

Fixes from the pre-publish review of powerio-prob (sonnet 5 review workflow, findings verified by hand against the code and src/goc3.jl):

  • Reserve membership sets (active_reserve_set_pr/cs, reactive_reserve_set_pr/cs) now take their zone index from the reserve section's document order, the same order that assigns n_p/n_q in the reserve rows. The sorted uid lists crossed indices between the two tables whenever document order was not alphabetical, and diverged from src/goc3.jl past nine zones (prz_10 sorts before prz_2). Regression test with two zones out of lexicographic order.
  • GOC3 branch records with r = x = 0 are rejected with the offending uid instead of writing NaN into the static and survivor rows (series_terms, shared by both paths). Stricter than src/goc3.jl, which computes the same formula unguarded.
  • A simple_dispatchable_device without device_type defaults to producer in the SCOPF projection, the balanced reader's rule; the projection previously errored while every other GOC3 consumer accepted the document.
  • build_ac_opf_instance folds a self-loop branch's whole pi model stamp into the bus shunt vectors, matching build_ybus (validated entrywise in the Y_bus cross-check with a tapped, shifted self-loop). build_dc_opf_instance keeps dropping self-loops and now says why (no angle difference, shift injection cancels).
  • Both instance builders call check_base_mva before scaling; a zero base previously produced Inf/NaN under per unit and silently zeroed costs.
  • write_dcopf_bundle sanitizes the case name before joining it into the output path, so bundles stay under the caller's output directory.
  • The bundle manifest's powerio_version reports the powerio core version through the new powerio::VERSION const.
  • #[non_exhaustive] on the SCOPF row structs and DcOpfOutputs. The options structs stay literal constructible on purpose.
  • Goc3Section::index (linear rescan per row) is gone; the survivor and transformer loops use their enumerate position. reserve_set shares one devices_by_bus/bus_order precomputation across its four calls.

Deferred with an issue: #252 (wire renumbering keyed off bare field names).

Checks

  • New tests: two-zone reserve index agreement, zero impedance rejection, device_type default, self-loop fold plus the extended Y_bus entrywise cross-check, zero base MVA rejection in both builders, bundle path confinement.
  • cargo test --workspace --all-features (46 suites), scripts/ci-clippy.sh, cargo fmt --all --check, RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps green locally.

🤖 Generated with Claude Code

Reserve membership sets share the reserve rows' document order zone
indices; zero impedance GOC3 branches error by uid instead of writing
NaN; a missing device_type defaults to producer like the balanced
reader; AC instances fold self-loop admittance into the bus shunts,
matching build_ybus; both builders reject a bad base MVA; the DC OPF
bundle path is confined to the output directory and its manifest
reports powerio::VERSION; SCOPF rows and DcOpfOutputs are
non_exhaustive; the O(n^2) uid rescans are gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Conversion Matrix

Legend

Cells show X/Y: observed warnings / expected warnings. Counts include source parse, target write, and target readback.

  • 🟢 0/0: no warnings and checked invariants held.
  • 🟡 X=Y: observed warnings match the reviewed expected count, and that count is nonzero.
  • 🔴 X!=Y or invariant failure: behavior changed. If warnings decreased because fidelity improved, update the expected counts in the same PR.
  • Expected counts are the *_WARNING_BASELINE arrays in powerio-cli/tests/conversion_matrix_report.rs; accept an intentional change by editing the matching source/target entry in the same PR.

Transmission

6 cases.

Source ↓ / target → MATPOWER .m PowerModels JSON PSS/E .raw PowerWorld .aux egret JSON pandapower JSON Surge JSON PSLF .epc
MATPOWER .m 🟢 0/0 🟢 0/0 🟡 8/8 🟡 8/8 🟢 0/0 🟡 5/5 🟢 0/0 🟡 11/11
PowerModels JSON 🟡 6/6 🟢 0/0 🟡 14/14 🟡 14/14 🟡 1/1 🟡 11/11 🟡 24/24 🟡 16/16
PSS/E .raw 🟡 13/13 🟡 1/1 🟢 0/0 🟡 1/1 🟡 1/1 🟡 3/3 🟡 1/1 🟡 10/10
PowerWorld .aux 🟡 12/12 🟢 0/0 🟢 0/0 🟢 0/0 🟢 0/0 🟡 2/2 🟢 0/0 🟡 5/5
egret JSON 🟢 0/0 🟢 0/0 🟡 8/8 🟡 8/8 🟢 0/0 🟡 5/5 🟢 0/0 🟡 11/11
pandapower JSON 🟡 6/6 🟢 0/0 🟡 11/11 🟡 11/11 🟡 5/5 🟢 0/0 🟢 0/0 🟡 11/11
Surge JSON 🟡 2/2 🟡 2/2 🟡 10/10 🟡 10/10 🟡 2/2 🟡 7/7 🟡 2/2 🟡 17/17
PSLF .epc 🟡 17/17 🟡 5/5 🟡 5/5 🟡 5/5 🟡 5/5 🟡 7/7 🟡 5/5 🟡 8/8

Distribution

7 cases.

Source ↓ / target → OpenDSS .dss BMOPF JSON PMD JSON
OpenDSS .dss 🟢 0/0 🟡 187/187 🟡 120/120
BMOPF JSON 🟡 1/1 🟢 0/0 🟢 0/0
PMD JSON 🟡 22/22 🟡 71/71 🟢 0/0

Full warning details: download conversion-matrix-warning-details for this workflow run.

@samtalki
samtalki merged commit 2a9186a into main Jul 12, 2026
26 checks passed
@samtalki
samtalki deleted the fix/prob-review-findings branch July 12, 2026 20:55
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