Skip to content

Read cases through PowerIO (replaces #60) - #76

Open
sshin23 wants to merge 8 commits into
mainfrom
powerio-cases
Open

sshin23 wants to merge 8 commits into
mainfrom
powerio-cases

Conversation

@sshin23

@sshin23 sshin23 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Continues #68 (by @samtalki) from a branch in this repository, so the Claude review workflow can run; the commits from #68 are kept with their author.

MATPOWER files are still read with ExaPowerIO; every other format is read through PowerIO.jl, so any single-phase network PowerIO reads becomes an OPF case: PSS/E RAW/RAWX, PowerModels JSON, pandapower, PowerWorld, CGMES, XIIDM, and more, as well as networks already parsed with PowerIO. Issue #52 is fixed here.

How a case is read

  • Lookup: a path, or a bare PGLib-OPF name (pglib_opf_*.m, also api/… and sad/…). Names resolve in the same lazy PGLib-OPF v23.07 artifact ExaPowerIO used, now declared in this package's Artifacts.toml. It has the same tree hash, so existing depots reuse the download. A missing path that isn't a PGLib name is an ArgumentError and no longer triggers the download.

  • Pre-parsed networks: anywhere a file name was accepted, a network already parsed with PowerIO works too: PowerIO.parse(BalancedNetwork, path; format), or its module PowerIO.parse(PioModule{BalancedNetwork}, path), possibly edited with PowerIO.apply_updates!.

  • Parsing: parse_ac_power_data calls PowerIO.to_powerdata(net, T), then keeps what is in service, in file order:

    • isolated buses and out-of-service generators, branches and storage are dropped;
    • the rest are renumbered densely;
    • rateA = 0 (or a non-finite rating) becomes the limit implied by the voltage and angle bounds, as ExaPowerIO 0.3.2 does.

    Both paths give ExaPowerIO's row structs, so no model body changed. A MATPOWER file goes through ExaPowerIO's own filtered parse with no copy of its rows, as on main; a file that parse cannot represent (an element at an isolated bus, a piecewise-linear cost, storage) is read unfiltered and compacted in place. Empty tables stay concrete for GPU convert_array.

  • Parity: the ExaPowerIO and PowerIO paths give the same tables, every field to 1e-12, on all 66 top-level PGLib-OPF v23.07 cases and the 5 fixtures in data/.

Ahead-of-time compilation

compile_all runs the case reader inside a juliac --trim=safe library. PowerIO 0.11.6 fails trim verification (90 errors: a value type picked at run time, untyped handle locks, a keyword element type). eigenergy/PowerIO.jl#184 adds:

  • a typed parse(BalancedNetwork, path), which returns the network as parse(T, str) does in Base;
  • a positional to_powerdata(net, T);
  • a trimmed-app CI check.

With it, the :acp library verifies and links, and its obj/cons match the in-Julia model exactly on case14 (by path) and on case30 and api/case14 (by PGLib name). This PR adds an aot CI slice so a regression shows up. A compiled library can't download the PGLib artifact; that was already true with ExaPowerIO, and test_aot now resolves the name in Julia first.

PowerIO 0.11.7 and later are registered, so the branch pin is gone; compat is PowerIO = "0.11.7, 0.12". With PowerIO 0.12.1, the aot slice passes on Julia 1.13.2 (31/31); on Julia 1.12.7 trim verification fails (also with PowerIO 0.11.12), mostly on Pkg REPLExt code reached through LazyArtifacts.

Behavior changes (0.5.0)

  • More inputs accepted: any balanced PowerIO format, and pre-parsed networks.
  • Storage: out-of-service storage is dropped. storage_bus is the model position of the bus; it was the raw MATPOWER bus number, which indexed the wrong bus whenever numbering wasn't 1..n. Storage p_loss/q_loss are per unit, as in ExaPowerIO 0.3.4.
  • Inconsistent shunt admittance scaling in multiperiod OPF methods #52: a load curve scales pd/qd only; bus shunts (gs, bs) keep their value. The Pd/Qd matrix path already did this. Nothing in the test fixtures has a shunt, so the hard-coded objectives are unchanged.
  • New errors:
    • an in-service generator, branch or storage unit at an isolated bus raises ArgumentError; before, it silently got bus index 0;
    • a piecewise-linear generator cost (MATPOWER model 1) raises ArgumentError; before, its breakpoints were read as polynomial coefficients.
  • Multi-period shapes: a curve shorter than N, Pd/Qd with the wrong number of rows, mismatched Pd/Qd, or too few periods raise DimensionMismatch instead of a BoundsError or an @assert.
  • Reference bus: when a case's reference bus has no in-service generator, the new reference is the bus of the generator with the largest Pmax. ExaPowerIO compared column 10, which is PMIN; ExaPowerIO 0.3.5 (Pick the replacement reference bus by PMAX, not PMIN ExaPowerIO.jl#31), required here, fixes it. This changes the reference bus of case1951_rte and case6468/6470/6495/6515_rte.
  • va0 is in radians. It was degrees, so a warm start start = (va = d -> d.va0,) was off by 180/π. The default starts don't use it. Bus rows keep va in degrees, as the file gives it.
  • MATPOWER writer: it refuses a solution whose row counts don't match the case file (DimensionMismatch), and a non-MATPOWER case file (ArgumentError). Before, it could write values into the wrong rows.
  • Native library: PowerIO's library is a lazy artifact fetched on the first parse. The precompile workload fetches it, or skips itself offline instead of failing.

Tests

  • New test/parser_tests.jl (the nothing slice):
    • concrete inference of opf_args (path and pre-parsed), mpopf_args_default and positional mpopf_args; isbits rows, empty tables included;
    • an edited case14: an isolated bus, out-of-service generator and branch, bus numbers offset by 1000 with the rows reversed, and storage in and out of service at a non-contiguous bus, with every index checked and a solve;
    • each refusal;
    • rateA = 0 against PowerModels' calc_thermal_limits!;
    • pre-parsed and updated networks;
    • round trips: PowerModels JSON (same tables and objective) and PSS/E RAW (same network, solves);
    • case lookup;
    • Inconsistent shunt admittance scaling in multiperiod OPF methods #52, and the multi-period shape errors.
  • Reference solves: PGLib case5, case14, case30 and case57, by name, against PowerModels/Ipopt (rtol = 1e-6). DC OPF case3/5/14 against PowerModels' DCPPowerModel, through the previously unused test_dcopf_case.
  • Writer: row-count and non-MATPOWER refusals.
  • aot CI slice: test_aot (the EMP_TEST_AOT opt-in still works), plus a case loaded by path in the rectangular form.

Verification (local, Julia 1.13.1, macOS)

  • EMP_TEST_SELECTION=nothing: 808 passed. cpu: 450 passed. aot: 19 passed, with all six models compiled under --trim=safe.
  • The cuda slice needs the self-hosted runners.
  • The goc3 slice is untouched here. The GOC3 path moves to PowerIO in a separate PR.

Rebased onto main (0.4.8)

  • Conflicts resolved in Project.toml, src/opf.jl, src/ExaModelsPower.jl, test/runtests.jl; the parser tests run next to the violations, case-start and zero-compile tests.

  • case_start (from Start from the case's operating point: start = :case, case_start, compiled start writer #72) converted va0 from degrees; with va0 now in radians it is used as is.

  • Local results with PowerIO 0.12.1: nothing 868/868 (Julia 1.12.7); cpu 458 passed, 1 broken (below); aot 31/31 (Julia 1.13.2). cuda, goc3 and docs were not run locally.

  • POCL zero-compile check marked broken on KernelAbstractions ≥ 0.10.7. That release runs the CPU backend through ThreadTeams 1.4, whose new_job_closure holds an edge that fails verification when its package image loads, so every stored POCL kernel launch (KernelAbstractions' own, and cons!/opf_violations here) is rejected and compiles again at run time. With KernelAbstractions 0.10.5 the same workload loads without compiling. This check also fails on main since that release.

Parse speed

ExaPowerIO 0.3.4 parses MATPOWER faster than PowerIO 0.12.1 on all 66 PGLib-OPF cases and an 82k-bus case (median 5.7x, 1.7x to 10.6x; Julia 1.13.4, median of 5 after a warm-up), which is why .m files stay on ExaPowerIO. End to end, parse_ac_power_data against main (Julia 1.13.4, 3 alternating processes of 15 repetitions each, median): case14 0.82x, case1354_pegase 0.98x, case9241_pegase 0.99x, case13659_pegase 1.00x, case30000_goc 1.01x, case78484_epigrids 1.01x, an 82k-bus case 1.00x.

🤖 Generated with Claude Code

samtalki and others added 5 commits November 16, 2026 16:54
Every case is parsed by PowerIO instead of ExaPowerIO, so any single-phase
network PowerIO reads (MATPOWER, PSS/E, PowerModels JSON, pandapower,
CGMES, ...) becomes an OPF case, and a network already parsed with PowerIO
can be passed wherever a file name was. ExaPowerIO is no longer a
dependency; the PGLib-OPF artifact it provided is declared here, with the
same tree hash.

`parse_ac_power_data` reads `PowerIO.to_powerdata(net, T)` and keeps what
is in service, in file order, as named isbits row types with ExaPowerIO's
field names, so no model body changes. It matches ExaPowerIO 0.3.4 field
for field on every PGLib-OPF case, except that `va` is in radians, storage
is remapped to model bus positions, and a lost reference bus moves to the
largest-Pmax generator (ExaPowerIO compared PMIN).

A load curve no longer scales bus shunts (#52). The MATPOWER writer
refuses a solution whose row counts do not match the case file.

The compiled library parses with `parse(BalancedNetwork, path)` and the
positional `to_powerdata(net, T)`, which pass `juliac --trim=safe` from
eigenergy/PowerIO.jl#184; PowerIO is pinned to that branch until 0.11.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parser_tests.jl covers inference of the arguments a compiled library
builds, in-service selection and renumbering on an edited case14, each
refusal, the implied thermal limit against PowerModels, pre-parsed and
updated networks, PowerModels JSON and PSS/E round trips, case lookup,
and the multi-period load contract. PGLib cases by name are solved against
PowerModels, and DC OPF against DCPPowerModel through the unused
`test_dcopf_case`.

An `aot` slice runs `test_aot`, now compiling into a temporary directory,
with a case loaded by path, so a regression in the trimmed case reader
fails CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PowerIO.jl #184 now returns the value from parse(BalancedNetwork, path), as
parse(T, str) does in Base, and the module from parse(PioModule{V}, path). The
case reader drops its `.value`; the tests that emit or apply updates ask for
the module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s VA in radians

The parse now gives va0 in radians, so case_start must not convert it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KernelAbstractions 0.10.7 runs the CPU backend through ThreadTeams 1.4, whose
new_job_closure holds an edge that fails verification when its package image
loads. Every stored POCL kernel launch is rejected and compiles again at run
time, including cons! and opf_violations. With KernelAbstractions 0.10.5 the
same workload loads without compiling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sshin23 sshin23 added the claude:pr Request an unattended Claude review of this PR label Nov 17, 2026
Comment thread src/parser.jl Outdated
k == 0 && throw(ArgumentError("storage at unknown bus " * string(s.storage_bus)))
push!(storage, _row(StorageRow{T}, merge(s, (;
i = length(storage) + 1, storage_bus = _at(k, "storage unit"),
p_loss = s.p_loss / raw.baseMVA, q_loss = s.q_loss / raw.baseMVA))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): p_loss/q_loss are now put on per unit here, but Pexts/Qexts stay in MW/MVAr: PowerIO's to_powerdata emits st.active_power_mw undivided (exa.jl lines 249-250 in 0.11.7), and this row copies it as is. The model subtracts s.Pexts from per-unit powers in c_storage_balance (pst + pstd - pstc - s.Pexts - s.Zr*I2), so a case with a nonzero ps/qs column is off by baseMVA there. ExaPowerIO 0.3.4 had the same inconsistency (its parser only divided columns 4-7, 10-12, 15-16), so this is not a regression and every fixture has ps = qs = 0, but since this is the one place the storage row is rescaled, Pexts = s.Pexts / raw.baseMVA, Qexts = s.Qexts / raw.baseMVA would make the whole row per unit, as PowerModels' make_per_unit! does for ps/qs.

Comment thread src/parser.jl
pos[k] = length(bus) + 1
push!(bus, _row(BusRow{T}, merge(b, (; i = pos[k]))))
end
_at(k, what) = pos[k] == 0 ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): an in-service generator, branch or storage unit at a type-4 bus is refused here, where MATPOWER's ext2int and PowerModels' propagate_topology_status! deactivate it (with a warning) and go on. The refusal is documented and tested, so this is a design choice, but PSS/E RAW is now an advertised input, and RAW files routinely leave the branches and machines of an IDE=4 bus with STAT=1 (PSS/E treats them as out of service by virtue of the bus type). Unless PowerIO's RAW reader already clears those statuses, such a file will fail to load with this error rather than build the connected part of the network. Dropping the element with @warn, or at least saying so in the opf_model docstring, would make the RAW path match what users of those files expect.

Comment thread Project.toml Outdated
name = "ExaModelsPower"
uuid = "2fff4b78-0b6c-428d-bac8-85ccea8c4bdf"
version = "0.4.8"
version = "0.5.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): the 0.4.8 → 0.5.0 bump lands in 8641e95 together with the parser rewrite, and the compat widening to PowerIO = "0.11.7, 0.12" in 65881d2 together with the case_start radians change. The repo convention is that version and compat changes go in their own commits. The minor bump itself is right for the behavior changes listed in the description (radians va0, storage_bus as a position, dropped ExaPowerIO dependency). If the PR is squash-merged this is moot.

@claude claude Bot 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.

VERDICT: APPROVE (head d10276f)

What I checked

  • Parser against PowerIO 0.11.7's to_powerdata (read from the PowerIO source): va arrives in radians, generator and branch bus references are positions in bus, storage_bus is a source id, p_loss/q_loss are MW, costs are already scaled to per unit (c2*base^2, c1*base, c0), rate_a = 0 and Inf pass through, and isolated buses keep type 4. _in_service handles each of these correctly: dense renumbering in file order, f_idx/t_idx and the arc table rebuilt from the kept branches, storage resolved id → raw position → model position, p_loss/q_loss divided by baseMVA. The reference-bus rule (largest Pmax when the file's reference has no in-service generator) is PowerIO's and matches the description. The typed parse(BalancedNetwork, path), positional to_powerdata(net, T; zero_impedance) and library_available() all exist in 0.11.7, so the compat lower bound is right.
  • Thermal limit for rateA = 0: same formula as PowerModels' calc_thermal_limits! (the extra cap of the angle at π only matters for |angmax| > π and is documented in the comment); the arc rate_a is taken from the adjusted branch row.
  • Model bodies: unchanged. Rows are concrete isbits NamedTuple types with ExaPowerIO's field names and order, so the generators still compile into the same blocks and convert_array moves them to the GPU once; all per-element logic stays in the parser. storage_bus is now a model position, which is what c_active_power_balance and c_ohms index with; the old raw bus number was wrong for non-1..n numbering.
  • Load curve (#52): pd/qd scaled, gs/bs kept. case3 (the only multi-period fixture solved against a hard-coded objective) has no shunts, so those references are legitimately unchanged.
  • case_start: va0 in radians, used as is. write_matpower_solution: the row-count and non-MATPOWER refusals are correct (the table regex matches only bus|gen|branch, so tables == 3 is the right check).
  • Artifacts.toml: same PGLib tree hash and sha256 as ExaPowerIO's, so existing depots reuse the download. No Manifest.toml. Exported API docstrings updated for the case argument. No leftover ExaPowerIO references.
  • Tests: test/parser_tests.jl is wired into runtests.jl in the nothing slice and covers inference, renumbered/isolated/out-of-service rows with every index checked, each refusal, rateA = 0 against PowerModels, pre-parsed and updated networks, JSON/RAW round trips, PGLib case5/14/30/57 against PowerModels/Ipopt at rtol = 1e-6, DC OPF case3/5/14 against DCPPowerModel, the writer refusals and the multi-period shape errors. The aot slice is new; test_aot now also compiles a case by path in Rect. The only weakened check is the POCL zero-compile test, marked broken for KernelAbstractions ≥ 0.10.7 with the reason stated in the comment and the description; it also fails on main.
  • PR description vs diff: matches. CI (gh pr checks 76): all seven checks still pending at review time; the description states the aot slice only passes on Julia 1.13, which the owner should keep in mind if the 1 channel resolves to 1.12.

Blocking findings: none.

Non-blocking nits (inline):

  1. src/parser.jl:155: Pexts/Qexts stay in MW while the rest of the storage row is per unit; the model subtracts Pexts from per-unit powers. Pre-existing (ExaPowerIO did the same), fixtures have 0.
  2. src/parser.jl:117: refusing an in-service element at an isolated bus is stricter than MATPOWER/PowerModels, and PSS/E RAW files commonly have that pattern.
  3. Project.toml:3: version bump and compat change share commits with code changes.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.19355% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.91%. Comparing base (dbe35c4) to head (107634a).

Files with missing lines Patch % Lines
src/parser.jl 92.45% 8 Missing ⚠️
src/mpopf.jl 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
+ Coverage   90.27%   92.91%   +2.64%     
==========================================
  Files          12       12              
  Lines        1326     1440     +114     
==========================================
+ Hits         1197     1338     +141     
+ Misses        129      102      -27     
Flag Coverage Δ
aot 35.70% <36.18%> (?)
cpu 50.14% <79.87%> (?)
cuda 48.35% <79.87%> (+2.44%) ⬆️
goc3 40.77% <0.00%> (-3.52%) ⬇️
nothing 50.07% <94.15%> (+4.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sshin23
sshin23 marked this pull request as draft November 17, 2026 01:39
sshin23 and others added 2 commits November 16, 2026 22:36
ExaPowerIO parses MATPOWER 1.7x to 11x faster than PowerIO 0.12.1 (66
PGLib-OPF cases and an 82k-bus case), so .m files go through ExaPowerIO's
filtered parse with no copy of its rows, as on main. A case that parse cannot
represent (an element at an isolated bus, a piecewise-linear cost, storage)
is read unfiltered and compacted in place. PowerIO reads every other format
and pre-parsed networks into the same ExaPowerIO row types. Bus rows keep VA
in degrees; va0 is in radians. Storage Pexts/Qexts are per unit on both paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y PMAX

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sshin23
sshin23 marked this pull request as ready for review November 17, 2026 04:55
@sshin23 sshin23 added claude:pr Request an unattended Claude review of this PR and removed claude:pr Request an unattended Claude review of this PR labels Nov 17, 2026
Comment thread src/parser.jl
# the download or reports a path the caller did not write.
function _case_path(case::AbstractString)
path = String(case)
ispath(path) && return path

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): ispath accepts a directory, so ac_opf_model("some/dir") is handed to PowerIO.parse and fails there with a parse error rather than the ArgumentError this function exists to give. isfile(path) && return path keeps the message for the one case that cannot be a case file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Kept ispath: PowerIO reads some formats from a directory (PowerIO.parse takes "a path to a file or directory", e.g. a CGMES folder), so a directory can be a case. A directory that is not one still fails in PowerIO.parse with its own error. The other nits are addressed in 107634a.

Comment thread src/parser.jl
raw = try
ExaPowerIO.parse_matpower(T, path)
catch err
err isa BoundsError || rethrow()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): the fallback for a generator at an isolated bus whose id is the file's lowest or highest relies on ExaPowerIO throwing a BoundsError from bus_map[...] / has_gen[gen.bus]. That holds today only because ExaPowerIO's function-level @inbounds does not reach the method body; an @inbounds added inside parse_matpower_inner later would turn this path into an out-of-bounds read or write that never reaches the catch. Worth a comment here stating the assumption, or an upstream check in ExaPowerIO that raises a typed error for an unknown bus id so the catch can be narrowed to it. No test covers this branch (the isolated bus in parser_tests.jl is an interior id), so a case with the lowest or highest bus id isolated would be the one to add.

Comment thread src/matpower_output.jl Outdated
end
println(io, "\t", join(out, '\t'), ";", isempty(comment) ? "" : "\t" * comment)
end
tables == 3 || throw(ArgumentError(case_file * " is not a MATPOWER case: the solution " *

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): this check runs after the loop has already copied every line of the input into io, so with the path form (write_matpower_solution(out, case_file, ...)) a non-MATPOWER case leaves a file at out holding a copy of the JSON/RAW input before the ArgumentError. Counting the mpc.bus|gen|branch = [ headers in lines before the first println would refuse without writing anything.

the compiler needs, not its values, so the resulting library instantiates any
case at run time from a path. The multi-period models additionally bake `N` and the
case at run time from a path, in any format PowerIO reads. The library reads
cases through PowerIO's native library, which it finds the way PowerIO does (the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): since 609b1d5 a .m file is read by ExaPowerIO and only other formats go through PowerIO's native library, so this sentence now overstates when the powerio_capi artifact is needed. Suggest: "A MATPOWER .m file is read with ExaPowerIO; any other format is read through PowerIO's native library, which the compiled library finds the way PowerIO does (...)".

Comment thread Project.toml Outdated
name = "ExaModelsPower"
uuid = "2fff4b78-0b6c-428d-bac8-85ccea8c4bdf"
version = "0.4.8"
version = "0.5.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (non-blocking): 0.5.0 is the right bump for the behavior changes listed in the description (the va0 unit, storage indexing, the new refusals). The repository's practice so far has been to land the version bump as its own commit on main after the feature PR (Bump version to 0.4.7, 0.4.6, ...), and here it sits in the first feature commit. Either keep it and note the departure, or drop it from the PR and bump after merging.

@claude claude Bot 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.

VERDICT: APPROVE (head 2296dd4)

Full review of the PR at head 2296dd4 (7 commits, 19 files).

What was checked

  • Parser correctness (src/parser.jl): the fast path keeps ExaPowerIO's filtered MATPOWER parse untouched, so the row structs, per-unit scaling, cost normalisation by baseMVA^(n-i), tap/shift/angle limits in radians and the rateA = 0 thermal limit are the same as on main. The fallback (_exapowerio_rows + _in_service!) and the PowerIO path (_powerio_rows) were traced against ExaPowerIO 0.3.5 and PowerIO 0.12.1 sources: isolated buses dropped and the rest renumbered densely in file order; generator/branch bus references remapped through pos; f_idx = l, t_idx = l + m with m the in-service branch count and arcs rebuilt to match; storage looked up by source bus id and mapped to model position; Pexts/Qexts/p_loss/q_loss brought to per unit on both paths (ExaPowerIO 0.3.5 already divides p_loss/q_loss, PowerIO reports all four in MW); PowerIO's va (radians) converted back to degrees in the bus row and va0 = deg2rad(va) in the tables, so CASE_START dropping its pi/180 is consistent. Bus-type reconciliation and reference-bus replacement match between the two readers for a single reference bus. PWL costs refused on both paths; the fast path falls back when it sees storage, a bus index 0 or a PWL row.
  • Multi-period loads: update_load_data now scales pd/qd only, fixing #52; shunts keep their value, which the new test asserts on case14's bus 9. Shape errors replace BoundsError/@assert.
  • Model bodies: unchanged; constraints remain generators over the same row structs, so the block structure and GPU behaviour are as before. CUDA slice green.
  • Writer: row-count and non-MATPOWER refusals are correct and tested.
  • Tests: test/parser_tests.jl is wired in through runtests.jl under the nothing slice; it covers inference, the edited case14 (reversed/offset bus numbers, isolated bus, out-of-service rows, storage in and out of service), each refusal, rateA = 0 against PowerModels, pre-parsed/updated networks, PowerModels JSON and PSS/E round trips, and PGLib case5/14/30/57 against PowerModels/Ipopt. DC OPF now checked against DCPPowerModel on case3/5/14. The POCL zero-compile test is marked broken with the KernelAbstractions 0.10.7 reason stated, and reports an unexpected pass if it starts working. No test weakened or deleted otherwise. New aot CI slice runs test_aot.
  • Conventions: no Manifest.toml; every renamed public entry point keeps its docstring; compat ExaPowerIO = "0.3.5" is its own commit; PowerIO = "0.11.7, 0.12", LazyArtifacts = "1"; version 0.5.0 is the right semver bump for the listed behaviour changes.
  • CI: all checks pass (nothing, cpu, cuda, goc3, aot, build, docs, codecov). The description's verification claims match.

Blocking findings: none.

Non-blocking nits (inline): _case_path uses ispath and so accepts a directory; the MATPOWER fast path's fallback depends on a BoundsError from ExaPowerIO for an isolated bus at the lowest/highest id and that branch is untested; the writer copies the whole input before refusing a non-MATPOWER case; the compile_all docstring still says all cases go through PowerIO's native library; the version bump sits in the feature commit rather than its own.

…id isolated buses, drop the version bump

- write_matpower_solution checks that the case is MATPOWER before opening out,
  so a refused case leaves no file.
- A test isolates the lowest and highest bus ids of case14, the case where the
  fast MATPOWER read fails on its bus lookup and the case is read again.
- The compile_all docstring says .m files are read with ExaPowerIO.
- The version stays 0.4.8; it is bumped after merging, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude:pr Request an unattended Claude review of this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants