Skip to content

feat(dist): read CIM16 LV feeders with text enumerations and a Diagram Layout - #768

Merged
samtalki merged 4 commits into
eigenergy:mainfrom
MohamedNumair:dist/cim16-reader
Nov 10, 2026
Merged

samtalki merged 4 commits into
eigenergy:mainfrom
MohamedNumair:dist/cim16-reader

Conversation

@MohamedNumair

@MohamedNumair MohamedNumair commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A CIM16 LV feeder stated with sequence impedances and no per phase class routed to the CGMES reader and failed ("CGMES profile set is missing required EQ profile data"). Read with an explicit cim-dist token, it gave three phase switches for its single phase fuses and defaulted to 60 Hz. This PR makes the cim-dist reader read such feeders into MulticonductorNetwork, so they convert to every distribution format through the shared writers. No writer changes.

  • Routing. A header-less CIM document with the IEC 61968 customer classes (ServiceLocation, UsagePoint) and no CGMES md:FullModel header routes to cim-dist.
  • Text enumerations. An enumeration written as text (<cim:Terminal.phases>A</cim:Terminal.phases>) reads like the EnumClass.value reference form.
  • Ampacity. A segment takes i_max from the WireInfo.ratedCurrent (or a subclass) its PowerSystemResource.AssetDatasheet names.
  • Diagram Layout. A segment's DiagramObjectPoints, in sequenceNumber order, are its route. A bus takes the end of the first segment at its node, else the point of the equipment there or of the composite switch that holds a switch (marked derived). A diagram that names an EPSG: code sets the network's CRS. PowerIO does not reproject.
  • Frequency. A CIM16 document set without a BaseFrequency reads at 50 Hz, the ENTSO-E default the CGMES reader also assumes. CIM100 keeps 60 Hz. Either default is a READ.CIM_DIST.VALUE_DEFAULTED finding.
  • Context. Circuit, CompositeSwitch, PSRType, and Switch.CompositeSwitch are reported as context. ServiceLocation and UsagePoint are still unmapped classes.

Tests

powerio-dist/tests/cim.rs adds a synthetic CIM16 feeder: source, cable, three single phase fuses in a composite switch, a phase B fuse, two consumers, customer classes, and a GIS diagram, all with invented names, values, and coordinates. No fixture files are added. The tests pin:

  • the mapping: fuse phases, line code, ampacity, load shapes, 50 Hz, and findings;
  • the layout: route order, bus locations, and CRS;
  • the conversion to OpenDSS, PMD, BMOPF, and CIM: each output reparses with its source, loads, and 50 Hz, and the CIM rewrite is byte stable.

All three tests fail on main and pass here.

  • cargo test: 3405 passed, 0 failed.
  • cargo clippy -p powerio-dist --all-targets --all-features -- -D warnings: clean.
  • Locally with clippy 1.97, scripts/ci-clippy.sh stops at float_cmp in files this PR does not touch (powerio-tx/src/format/psse.rs, powerio/tests/ac_ots.rs, powerio/tests/partial_transformer_ir.rs). main passes CI on current stable.

A follow-up PR maps the Schneider Electric ADMS extension of CIM16 on top of this one.

…m Layout

A CIM16 LV feeder stated with sequence impedances and no per phase class
routed to the CGMES reader and failed, and read with an explicit
`cim-dist` token it gave three phase switches for its single phase fuses.

- Route a header-less CIM document with the IEC 61968 customer classes
  (`ServiceLocation`, `UsagePoint`) to `cim-dist`.
- Read an enumeration stated as text (`<cim:Terminal.phases>A</...>`)
  like a reference.
- Take a segment's ampacity from the `WireInfo.ratedCurrent` its
  `AssetDatasheet` names.
- Read the Diagram Layout: a segment's `DiagramObjectPoint`s are its
  route, and a bus takes the end of the first segment at its node, else
  the point of the equipment there or of the composite switch that holds
  a switch. A diagram that names an `EPSG:` code sets the network's
  coordinate reference system.
- Default a CIM16 document set without a `BaseFrequency` to 50 Hz, as the
  CGMES reader does.
- Report `Circuit`, `CompositeSwitch`, and `PSRType` as context.

The new tests pin a synthetic CIM16 feeder: its mapping, its layout, and
its conversion to OpenDSS, PMD, BMOPF, and a byte stable CIM rewrite.
@MohamedNumair

MohamedNumair commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

The two failing checks on this PR come from main, not from this change. validate fails the same way on #766 and #767. #744 fixes both, and both checks pass on that PR.

This PR does not touch the PMD fixtures, the BMOPF writer or powerio-capi. Once #744 merges I will merge main into this branch to rerun the checks.

@frederikgeth frederikgeth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes on reviewed head ace01e9444e78552aaa8c154890f881e47be61e3 for two P2 silent-data-loss findings, attached inline:

  1. Diagram objects for connectivity nodes or terminals are consumed without applying their coordinates or reporting the loss.
  2. An invalid stated WireInfo.ratedCurrent is consumed and discarded without a rating diagnostic.

Validation: 299 distribution unit tests, 47 CIM integration tests and 11 tank-safety tests passed (12 existing unit ignores). Two supplemental regression tests fail on this head and pass with the parent reader. Both also pass with a local diagnostic-only proof fix; the complete focused suites then pass 359 tests. The proof changes were not committed or pushed, and tracked source was restored.

The existing hosted Validation failures are the inherited PMD/BMOPF schema and network-TimeSeries issues, and the Julia binding check uses the stale companion pin. Refresh/recheck after #744's repairs land. #769 depends on this PR; #770 is independent.

No other actionable finding in the reviewed scope. No merge was performed.

Comment thread powerio-dist/src/cim/read.rs Resolved
Comment thread powerio-dist/src/cim/read.rs Resolved

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.

🟡 Changes recommended

Active issues leave ConnectivityNode bus coordinates unset while suppressing loss reports and misclassify geographic CRSs such as EPSG:4258 as projected, causing coordinates to be discarded during conversion.

2 open issues
What changed in this PR

Extends the distribution CIM reader to handle CIM16 low-voltage feeders through the shared multiconductor model and existing writers.

Changes:

  • Routes header-less CIM documents with customer classes to cim-dist and reads text enumerations and wire ampacity.
  • Maps Diagram Layout coordinates to routes and bus locations, and defaults CIM16 inputs without a stated frequency to 50 Hz.
  • Adds synthetic feeder tests for mapping, layout, and distribution-format conversions, with updated documentation.
File Description
powerio/​src/​lib.rs Updates the routing comment to mention customer classes.
powerio-dist/​tests/​cim.rs Adds CIM16 mapping, layout, and conversion tests.
powerio-dist/​src/​cim/​read.rs Implements text enums, ampacity, layout, frequency defaults, and context handling.
powerio-dist/​src/​cim/​mod.rs Adds customer-class routing markers and a routing test.
docs/​src/​format-fidelity.md Documents expanded distribution CIM routing.
docs/​src/​distribution.md Documents supported CIM16 mappings and defaults.
CHANGELOG.md Records the new reader capabilities.

Review effort: Balanced

Comment thread powerio-dist/src/cim/read.rs Resolved
Comment thread powerio-dist/src/cim/read.rs Resolved
A diagram's EPSG code other than 4326 no longer reads as projected on that
alone. Widely used geographic codes such as EPSG:4258 read as longitude and
latitude, so the PMD writer keeps their coordinates. Any other code is
projected when a coordinate lies outside the range of degrees; otherwise the
space stays undeclared with a finding naming the code.

A ConnectivityNode or Terminal drawing now gives its bus a location, ahead of
those derived from equipment. Diagram objects and points are consumed only
once their coordinates reach the network, so any other drawing is reported
unmapped instead of disappearing.
A negative, zero, non-finite, or unparsable WireInfo.ratedCurrent read as an
absent rating with no finding. It now draws a VALUE_UNSUPPORTED finding, once
per catalog entry, while an absent rating stays silent.
@samtalki samtalki mentioned this pull request Nov 7, 2026
samtalki pushed a commit that referenced this pull request Nov 9, 2026
…m Layout

# Conflicts:
#	CHANGELOG.md
#	powerio-dist/tests/cim.rs

samtalki commented Nov 9, 2026

Copy link
Copy Markdown
Member

This PR is folded into #821 through 0b3068fab038. The original commits and author attribution are retained; @MohamedNumair is credited in the RC description and changelog. It now targets main and will auto-close as merged when that included head reaches main through the release integration (some fixes land with #823 first). Please preserve a merge commit rather than squash/rebase. The RC ledger records scope and merge order; any later push here needs another ancestry check.

@samtalki samtalki mentioned this pull request Nov 9, 2026
@samtalki
samtalki merged commit 1987443 into eigenergy:main Nov 10, 2026
52 checks passed
samtalki added a commit that referenced this pull request Nov 11, 2026
…m Layout

# Conflicts:
#	CHANGELOG.md
#	powerio-dist/tests/cim.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.

4 participants