Skip to content

dist: BMOPF schema 0.1.0 alignment - #264

Open
samtalki wants to merge 3 commits into
mainfrom
worktree-bmopf-schema-010
Open

dist: BMOPF schema 0.1.0 alignment#264
samtalki wants to merge 3 commits into
mainfrom
worktree-bmopf-schema-010

Conversation

@samtalki

Copy link
Copy Markdown
Member

Tracks the BMOPF schema 0.1.0 merged in distribution-system-opt/bmopf-report#16. The writer targets the published schema $id; the reader keeps accepting every pre-0.1.0 spelling.

Schema-driven changes:

  • meta carries case_study_generator (was generator) and the system frequency.
  • Load model enum strings are uppercase.
  • Bus symmetrical component bounds become the per-sequence scalars vpos_min/vpos_max/vneg_max/vzero_max/vn_max; legacy vsym_* arrays map on read (zero/positive/negative order) with warnings for the bounds 0.1.0 cannot carry. The DistBus rename bumps the multiconductor payload to pio-payload-multiconductor/2 (2.0.0); /1 stays served.
  • Three phase transformers emit one lumped r_series/x_series pair on the wye base, each winding's percent resistance referred to its own rating before the sum (identical to the previous form for equal ratings). The split _from/_to fields lost their slots.
  • Transformer taps, neutral impedance, and no load admittance relocate to extras.transformer.<subtype>.<name>; the IBR, control profile, DC, and time series tables relocate under extras the same way. The reader folds all of them back, so the dss round trips keep their fidelity.
  • Typed capacitor element (DistCapacitor). The DSS converter still lowers OpenDSS capacitors to shunt matrices; dss/PMD writers drop typed capacitors with a warning (conversion tracked in the follow-up issue).
  • Lines accept the schema's inline impedance alternative (read into a synthesized linecode) and carry i_max/s_max.
  • One-triangle symmetric matrix spellings mirror on read (BMOPFTools writes the upper triangle only).
  • A grounded terminal counts as referenced in the unused-terminal prune, so standalone grounding survives a write.

The vendored schema and example networks are byte identical to bmopf-report@f2e3684, and cargo run -p powerio-dist --example regen_bmopf_examples regenerates the checked-in example outputs (they had gone stale at v0.2.4). Conversion matrix baselines updated: dss→BMOPF warnings drop 187→132 (relocated fields ride along instead of dropping), and the BMOPF source rows reflect the new fixtures.

🤖 Generated with Claude Code

Track bmopf-report PR #16 (schema 0.1.0): meta case_study_generator +
frequency, uppercase load model enum, per-sequence bus voltage bounds
replacing the vsym arrays (multiconductor payload bumps to /2, 2.0.0),
lumped three phase transformer series impedance referred per winding
rating, transformer taps/neutral/no-load and the IBR, control profile,
DC, and time series tables relocated under the extras escape hatch, a
typed capacitor element, inline line impedance via a synthesized
linecode, line i_max/s_max, and one-triangle symmetric matrix mirroring
on read. The reader keeps accepting every pre-0.1.0 spelling.

The vendored schema and example networks track bmopf-report@f2e3684; a
regen_bmopf_examples example rebuilds the checked-in outputs. Grounded
terminals now count as referenced in the unused-terminal prune, so
standalone grounding survives a write.

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

github-actions Bot commented Jul 22, 2026

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

7 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
DeepMind OPFData JSON 🟡 3/3 🟡 2/2 🟡 5/5 🟡 5/5 🟡 3/3 🟡 4/4 🟡 2/2 🟡 4/4

Distribution

7 cases.

Source ↓ / target → OpenDSS .dss BMOPF JSON PMD JSON
OpenDSS .dss 🟢 0/0 🟡 132/132 🟡 80/80
BMOPF JSON 🟡 18/18 🟢 0/0 🟡 27/27
PMD JSON 🟡 15/15 🟡 59/59 🟢 0/0

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns PowerIO’s distribution (multiconductor) BMOPF read/write paths with bmopf-report BMOPF schema 0.1.0, while preserving backward compatibility for older (“pre-0.1.0”) spellings and improving round-trip fidelity through extras.

Changes:

  • Update BMOPF JSON IO to schema 0.1.0 conventions (meta/frequency, uppercase load models, per-sequence voltage bounds, transformer overflow relocation, one-triangle matrix mirroring, inline line impedance support, etc.).
  • Introduce typed DistCapacitor, plus per-line i_max/s_max, and bump multiconductor payload schema to pio-payload-multiconductor/2 (2.0.0).
  • Re-vendor/regenerate BMOPF example fixtures and update conversion-matrix baselines + tests to match the new canonicalization/compat behavior.

Reviewed changes

Copilot reviewed 24 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/data/dist/bmopf/example_ieee13.json Updates vendored BMOPF IEEE13 fixture to schema 0.1.0 structure/fields.
powerio-pkg/src/package.rs Bumps multiconductor payload schema URL to /2 and version to 2.0.0.
powerio-pkg/src/lowering.rs Updates lowering “dropped voltage bound family” detection to new per-sequence fields.
powerio-pkg/examples/generate_schemas.rs Generates schema for pio-payload-multiconductor/2.
powerio-dist/tests/rich.rs Updates tests to expect uppercase BMOPF load model strings.
powerio-dist/tests/matrix.rs Adjusts round-trip expectations (terminal renumbering, grounding usage, idempotence convergence).
powerio-dist/tests/bmopf.rs Updates fixture validation expectations and adds one-triangle symmetric matrix mirroring coverage.
powerio-dist/src/pmd/write.rs Warns and drops typed capacitor during PMD ENGINEERING writes.
powerio-dist/src/pmd/read.rs Initializes new DistLine limit fields (i_max/s_max) on read.
powerio-dist/src/model.rs Adds per-sequence bus bounds, per-line limits, and typed DistCapacitor to the distribution model.
powerio-dist/src/lib.rs Re-exports DistCapacitor.
powerio-dist/src/dss/write.rs Warns and drops typed capacitor during DSS writes; propagates new line limit fields in tests.
powerio-dist/src/dss/read.rs Initializes new DistLine limit fields (i_max/s_max) on read.
powerio-dist/src/bmopf/write.rs Implements BMOPF schema 0.1.0 writer behavior (meta/frequency, extras relocation, new bounds, line limits, capacitor table, transformer overflow split).
powerio-dist/src/bmopf/read.rs Implements schema-compat reader behavior (meta frequency, extras folding, new bounds + legacy mapping, one-triangle matrix mirroring, inline line impedances, typed capacitors).
powerio-dist/examples/regen_bmopf_examples.rs Adds helper example to regenerate checked-in BMOPF example outputs.
powerio-dist/examples/bmopf/ieee34.json Regenerated BMOPF IEEE34 example output matching schema 0.1.0 + canonicalization.
powerio-dist/examples/bmopf/ieee123.json Regenerated BMOPF IEEE123 example output matching schema 0.1.0 + canonicalization.
powerio-dist/examples/bmopf/4bus_dy.json Regenerated BMOPF 4bus output matching schema 0.1.0 + canonicalization.
powerio-dist/docs/conversion-matrix.md Updates conversion warning counts/baselines to reflect the new behavior and fixtures.
powerio-cli/tests/conversion_matrix_report.rs Updates CLI conversion warning baseline matrix for schema 0.1.0 behavior.
docs/src/pio-json-schema.md Documents the pio-payload-multiconductor/2 schema and legacy /1 availability.
docs/schema/pio-package/0.1/schema.json Updates generated package schema to include new fields/types (bounds, line limits, capacitors).
CHANGELOG.md Adds an Unreleased entry describing BMOPF schema 0.1.0 alignment and related model/schema changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread powerio-dist/src/bmopf/read.rs
samtalki added a commit to eigenergy/PowerIO.jl that referenced this pull request Jul 22, 2026
Taps live under the extras escape hatch and three phase transformers
carry one lumped series pair (eigenergy/powerio#264).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-up on the BMOPF 0.1.0 alignment: the new DistLine
i_max/s_max fields wrote BMOPF but vanished silently through the dss and
PMD writers, against the fidelity policy.

- The PMD ENGINEERING line has its own cm_ub/sm_ub slots, so the line
  ratings now map both directions: the reader takes line-level
  cm_ub/sm_ub into the typed fields (an inline-impedance line's ratings
  stay on the synthesized linecode, whose sm_ub now re-inlines alongside
  cm_ub), and the writer emits them back.
- The dss writer warns when it drops line i_max/s_max; the
  normamps/emergamps mapping decision stays with #266.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YPB7LVTeMcdBYnzA9QdpPe
Copilot AI review requested due to automatic review settings July 23, 2026 16:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 28 changed files in this pull request and generated 1 comment.

Comment thread powerio-dist/src/bmopf/write.rs Outdated
A PMD source spells an unbounded phase as JSON null, which restores as
Inf in the model; the writer's num zero fallback then turned "no limit"
into a zero limit. Line and switch i_max/s_max now go through a bounds
guard that drops the field with a warning when any entry is nonfinite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YPB7LVTeMcdBYnzA9QdpPe
Copilot AI review requested due to automatic review settings July 23, 2026 16:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 28 changed files in this pull request and generated 1 comment.

Comment thread powerio-dist/src/pmd/read.rs
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.

3 participants