Skip to content

Skip writing default attribute values in IIDM serialization#3826

Draft
clementleclercRTE wants to merge 28 commits intomainfrom
cl-default_attribute_values_SerDe
Draft

Skip writing default attribute values in IIDM serialization#3826
clementleclercRTE wants to merge 28 commits intomainfrom
cl-default_attribute_values_SerDe

Conversation

@clementleclercRTE
Copy link
Copy Markdown
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?

What kind of change does this PR introduce?

Performance feature: reduction of serialized file size by omitting attributes equal to their default value.

What is the current behavior?

Every attribute is always written during serialization, even when its value equals the defined default. This produces unnecessarily verbose output, especially for tap changer steps (4 attributes
r, x, g, b almost always zero), switches (retained/open typically false), and transformer/line shunt parameters (g, b typically zero). On large networks this has a measurable impact on file size
and I/O performance, particularly for the binary serialization format.

What is the new behavior (if this is a feature change)?

Attributes whose value equals their default are omitted from the serialized output. The read side is unaffected: all readers already use readDoubleAttribute(name,defaultValue) / readBooleanAttribute(name, defaultValue), which transparently return the default when an attribute is absent.
Versions ≤ 1.16 are unchanged — all attributes continue to be written unconditionally, preserving full backward compatibility.
For the binary format, this PR requires PR #3804, which makes the binary reader order-independent and tolerant of absent attributes.

Full list of attributes now omitted when equal to their default :

Attribute Type Changed to
retained Switch optional default false
open Switch optional default false
r, x, g, b RatioTapChangerStep optional default 0
r, x, g, b PhaseTapChangerStep optional default 0
lowTapPosition RatioTapChanger, PhaseTapChanger optional default 0
loadTapChangingCapabilities RatioTapChanger only optional default false
minP Generator optional default 0
voltageRegulatorOn Generator optional default false
g1, g2, b1, b2 Line optional default 0
g, b TwoWindingsTransformer optional default 0

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

Other information:

The internal method writeTapChangerStep in AbstractTransformerSerDe had its signature changed from (TapChangerStep, TreeDataWriter) to (TapChangerStep, NetworkSerializerContext) in order to access
the IIDM version inside that method for the version guard. This is a package-private refactoring with no impact on the public API.

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…n XML, JSON, and binary serialization

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…ort for skipping extensions

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…ted unit tests

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
… methods via version-based logic

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
@clementleclercRTE clementleclercRTE marked this pull request as draft March 17, 2026 13:03
@clementleclercRTE clementleclercRTE changed the base branch from cl-binary-named-attributes to main March 17, 2026 14:15
@rolnico rolnico self-requested a review March 19, 2026 15:33
…erDe deserialization

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…e' into cl-default_attribute_values_SerDe

# Conflicts:
#	iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AbstractTransformerSerDe.java
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…e' into cl-default_attribute_values_SerDe

# Conflicts:
#	iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/GeneratorSerDe.java
#	iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/LineSerDe.java
#	iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/TwoWindingsTransformerSerDe.java
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