Skip to content

Port the qpf-model exporter from PowerIO - #8

Open
samtalki wants to merge 1 commit into
camera-readyfrom
agent/qpf-model-exporter
Open

samtalki wants to merge 1 commit into
camera-readyfrom
agent/qpf-model-exporter

Conversation

@samtalki

Copy link
Copy Markdown
Member

Summary

Ports the qpf-model exporter from the PowerIO workspace into this repository as scripts/qpf_model.py. The wrapper scripts no longer need POWERIO_ROOT or a Rust toolchain; an installed PowerIO wheel is enough to go from a MATPOWER case to a checked certificate.

Details

  • scripts/qpf_model.py reads only the pinned PowerIO surface (parse_file, len(network.buses), branch rows through in_service, from_id, to_id, and x, and to_networkx for the bus id universe) and writes each in service branch weight 1/x as an exact odd significand dyadic pair. Python floats are binary64, so (1/x).as_integer_ratio() reproduces the same bits the Rust exporter produced.
  • scripts/qpf-cert and scripts/qpf-check now call the python exporter. Nonpositive reactance, self loops, and unknown endpoints are refused with exit 2 before the checker runs.
  • The export tests live in experiments/tests/test_powerio_compat.py because the exporter consumes exactly the surface that file pins. They run in the compatibility job against the released wheel and in the prerelease workflow against the PowerIO v0.9 stack, and skip in the locked experiment environment.
  • The README wrapper section now documents the in repo exporter instead of an unreleased PowerIO development binary.

Verification

  • pytest experiments/tests/test_powerio_compat.py against powerio 0.8.3 in a fresh environment: 7 passed.
  • End to end on a 3 bus case: scripts/qpf-cert then scripts/qpf-check prints exact rationals and returns exit 0 with verdict NO.
  • The locked experiments suite is unchanged; the compat module skips there.

🤖 Generated with Claude Code

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