Repository navigation
fix(dist): replace names OpenDSS cannot carry instead of writing them verbatim - #770
Conversation
… verbatim Names from other formats can be free text (a CIM `IdentifiedObject.name` such as `Cable type A`). OpenDSS output refused a network whose bus id held a character the dss tokenizer splits on, and wrote any other such name verbatim with a warning, into a deck that did not parse back: a line code `Cable type A` became `linecode=Cable type A`. The writer now works on a copy of the network in which each such name is replaced before writing. Each character `name_breaks_dss` rejects becomes `_`, with a numeric suffix when the result is already taken in the same dss class (lines and switches share `Line`, shunts and capacitors share `Capacitor`), in element, line code, bus, and circuit names and in every typed reference: bus fields, `linecode`, and an IBR's control profile. Each replacement is an `EMIT.DSS.VALUE_SUBSTITUTED` finding. A network whose names are all safe is written from the original, without a copy. The pre-emission validation checks the network as written. A new test writes a CIM feeder with free text bus, line, line code, load, and source names to OpenDSS, reads the deck back with every element connected, and checks that a second write replaces nothing. The writer's unit test for unrepresentable names now pins the replacements.
frederikgeth
left a comment
There was a problem hiding this comment.
Requesting changes on reviewed head a9785bf44d17a18db0b68ff41ceebeae239d3540 for one P2 collision in the new name allocation, attached inline. Fixed-dispatch IBRs emit into the same OpenDSS Generator class as ordinary generators, so they need shared name reservations.
Validation: 300 distribution unit tests passed (12 existing ignores), and all 45 CIM integration tests passed. A supplemental round-trip regression with a generator named a_b and a fixed-dispatch IBR named a b fails on this head: both emit as Generator.a_b, and reading the deck back returns one generator instead of two. The regression passes with shared generator/IBR name reservations. That local proof change was not committed or pushed.
Current hosted CI also has inherited BMOPF validation failures (PMD profile fields and unsupported network time series emission) and a stale Julia companion coverage failure for AC OTS entry points. Refresh and rerun the affected checks after the dependency repairs land. No other actionable code finding in this review's scope. No merge was performed.
The OpenDSS helper line nodes (#765), absent line ampacity (#762), names OpenDSS cannot carry (#770), BMOPF provenance (#763), the libsqlite3-sys advisory fix with the Rust 1.89 MSRV, and the dependency bumps ship in 0.11.10 before this candidate. The candidate section refers to that release instead of restating them, and the 0.11.10 section is the one main carries. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017y9wBpFumRrmQLvdxnVwZG
…m verbatim # Conflicts: # CHANGELOG.md
A fixed dispatch IBR writes as a dss Generator, so a renamed IBR could take a generator's name and one of them would be lost (review of #770).
The OpenDSS helper line nodes (#765), absent line ampacity (#762), names OpenDSS cannot carry (#770), BMOPF provenance (#763), the libsqlite3-sys advisory fix with the Rust 1.89 MSRV, and the dependency bumps ship in 0.11.10 before this candidate. The candidate section refers to that release instead of restating them, and the 0.11.10 section is the one main carries. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017y9wBpFumRrmQLvdxnVwZG
|
This PR is folded into #821 through |
…m verbatim # Conflicts: # CHANGELOG.md
A fixed dispatch IBR writes as a dss Generator, so a renamed IBR could take a generator's name and one of them would be lost (review of #770).
The OpenDSS helper line nodes (#765), absent line ampacity (#762), names OpenDSS cannot carry (#770), BMOPF provenance (#763), the libsqlite3-sys advisory fix with the Rust 1.89 MSRV, and the dependency bumps ship in 0.11.10 before this candidate. The candidate section refers to that release instead of restating them, and the 0.11.10 section is the one main carries. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017y9wBpFumRrmQLvdxnVwZG
Summary
Names from other formats can be free text, such as a CIM
IdentifiedObject.namelikeCable type A. The OpenDSS writer handled such names in two ways, and both broke the output:validate_emissionrefuse the whole conversion: "bus Node 1 is ambiguous or not representable in DSS".EMIT.DSS.VALUE_SUBSTITUTED"will not reparse identically" warning. For examplelinecode=Cable type AandNew Load.House 1 = flat!, which OpenDSS (and PowerIO's own dss reader) cannot parse back.The new
powerio-dist/src/dss/write/safe_names.rsruns before writing and works on a copy of the network:name_breaks_dssrejects becomes_(//becomes__): whitespace,,,=,!, quotes, brackets, and.in a bus id.Line, shunts and capacitors shareCapacitor, and matching ignores case.line.linecode, andibr.control_profile.EMIT.DSS.VALUE_SUBSTITUTED: "line codecable type a, 4x70: name holds characters dss cannot carry in a token; written asCable_type_A__4x70".validate_emissionchecks the network as written, so a bus id likeNode 1is no longer refused.Native objects and extras are not rewritten. They carry dss text from a dss source, whose names are safe already. The model keeps its original names; only the deck changes.
Tests
free_text_names_write_a_dss_deck_that_reads_back(powerio-dist/tests/cim.rs) writes a synthetic CIM feeder with free text bus, line, line code, load, and source names to OpenDSS. It checks each replacement finding, reads the deck back with every element connected, and confirms a second write replaces nothing. It fails onmainat the bus id refusal.unrepresentable_names_are_reportedbecomesunrepresentable_names_are_replaced_and_reportedand pins the replacements in the deck text.safe_names.rscover the substitution alphabet and suffixes on collision.cargo test: 3404 passed, 0 failed. The conversion matrix baseline is unchanged: its fixtures have safe names.cargo clippy -p powerio-dist --all-targets --all-features -- -D warnings: clean.This is independent of #768 and #769. All three add tests at the end of
powerio-dist/tests/cim.rs, so whichever merges later needs a one-line conflict resolution there.