-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PowerTransformerEnd.endNumber to sort transformer windings #3234
Use PowerTransformerEnd.endNumber to sort transformer windings #3234
Conversation
2db89d4
to
2f92b88
Compare
4e1fd3d
to
f680d6a
Compare
…to sort transformer windings Signed-off-by: Romain Courtier <[email protected]>
Signed-off-by: Romain Courtier <[email protected]>
f680d6a
to
f6b0c3e
Compare
.forEach(tends -> { | ||
PropertyBags tends1 = new PropertyBags( | ||
tends.getValue().stream() | ||
.sorted(Comparator | ||
.comparing(WindingType::fromTransformerEnd) | ||
.thenComparing(end -> end.asInt(endNumber, -1))) | ||
.collect(Collectors.toList())); | ||
.sorted(Comparator.comparing(WindingType::endNumber)) | ||
.toList()); | ||
tends.setValue(tends1); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified into
gends.values().forEach(tends -> tends.sort(Comparator.comparing(WindingType::endNumber)));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
However, please note that this will be reworked in #3238 and the sorting will be removed from here. Instead, it will be done within the SPARQL query.
Signed-off-by: Romain Courtier <[email protected]>
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No.
What kind of change does this PR introduce?
Refactoring.
What is the current behavior?
During CGMES conversion of a CIM16 file (CGMES 2.4.15),
WindingType
class is using Terminal.sequenceNumber to classify and sort the windings as PRIMARY/SECONDARY/TERTIARY. However, sequenceNumber isn't fetched by the SPARQL query and therefore is never used in theWindingType
class. As a consequence, WindingType.windingType always returns PRIMARY for CIM16 Propertybags.This is not an issue because another sort is done in the CGMES import using PowerTransformerEnd.endNumber, giving the correct classifications of windings for CIM16 files, but this additional sorting shouldn't be required and should be done directly in
WindingType
.What is the new behavior (if this is a feature change)?
Since the SPARQL queries fetch the PowerTransformerEnd.endNumber and use it to classify and sort the windings as PRIMARY/SECONDARY/TERTIARY, the use of Terminal.sequenceNumber is droped in favor of PowerTransformerEnd.endNumber.
As a consequence, the additional sorting in CGMES import isn't required anymore.
This also gives the iidm
WindingType
class a clearer purpose which is to support the difference in the modeling of the winding numberings between CIM14 and CIM16.Does this PR introduce a breaking change or deprecate an API?
Other information:
This is bad practice to rely on PowerTransformerEnd.Terminal.sequenceNumber. The correct way to classify windings in CIM16 is with the use of PowerTransformerEnd.endNumber.