Skip to content

Rename Switch.closed to Switch.default_closed (schema 0.3.0) - #12

Merged
Markus-de-Koster merged 1 commit into
mainfrom
switch-default-closed
Oct 16, 2026
Merged

Markus-de-Koster merged 1 commit into
mainfrom
switch-default-closed

Conversation

@Markus-de-Koster

Copy link
Copy Markdown
Member

Switch states fix the topology, so they belong in the grid description, but the stored value is only the switch's default state (for example the normal operating state a DSO documents). The state of a calculation is a calculation input: branch_states overrides it per solve or assembly without editing the grid. The field name and its description now say so.

Compatibility: a mode="before" validator on Switch reads the pre-rename key closed as default_closed (with a DeprecationWarning) and rejects both keys with different values; the grid always serialises default_closed. A schema 0.2.0 reader rejects the new key (extra="forbid"). SCHEMA_VERSION goes from 0.2.0 to 0.3.0; a persisted 0.2.0 dataset reads with the minor-drift warning.

Every reader of the field moves to the new name: topology, fusion, Y-bus assembly, the branch-state copy in the solver, the numpy and OpenDSS oracles, and the pandapower and power-grid-model converters and exporters. Tests cover loading a grid JSON with the old key, re-serialising it with the new one, and the contradiction error.

Switch states fix the topology, so they belong in the grid description, but the
stored value is only the switch's default state (for example the normal
operating state a DSO documents). The state of a calculation is a calculation
input: branch_states overrides it per solve or assembly without editing the
grid. The field name and its description now say so.

Compatibility: a mode="before" validator on Switch reads the pre-rename key
`closed` as `default_closed` (with a DeprecationWarning) and rejects both keys
with different values; the grid always serialises `default_closed`. A schema
0.2.0 reader rejects the new key (extra="forbid"). SCHEMA_VERSION goes from
0.2.0 to 0.3.0; a persisted 0.2.0 dataset reads with the minor-drift warning.

Every reader of the field moves to the new name: topology, fusion, Y-bus
assembly, the branch-state copy in the solver, the numpy and OpenDSS oracles,
and the pandapower and power-grid-model converters and exporters. Tests cover
loading a grid JSON with the old key, re-serialising it with the new one, and
the contradiction error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Markus-de-Koster
Markus-de-Koster merged commit a0fb743 into main Oct 16, 2026
8 checks passed
@Markus-de-Koster
Markus-de-Koster deleted the switch-default-closed branch October 16, 2026 19:07
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