Skip to content
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

Network modification. Replace threeWindingsTransformers by 3 twoWindingsTransformers and vice versa #3167

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

marqueslanauja
Copy link
Contributor

@marqueslanauja marqueslanauja commented Oct 2, 2024

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)

Does this PR already have an issue describing the problem?

What kind of change does this PR introduce?

Feature

This PR contains two network modification methods.
The first one, replaces all the ThreeWindingsTransformers of the network by 3 equivalent TwoWindingsTransformers. In this process:

  • A new voltage level is created for the star node with ratedU0 as nominal voltage.
  • 3 new TwoWindingsTransformers are created. One for each leg of the removed ThreeWindingsTransformer.
  • The following attributes are mapped, copied or adjusted:
    • Electrical characteristics, ratioTapChangers, and phaseTapChangers. (No adjustments are required)
    • Operational Loading Limits.
    • Controllers using any of the ThreeWindingsTransformer terminals as regulatingTerminals.
    • Active and reactive power of the ThreeWindingsTransformer terminals.
    • Aliases for known CGMES identifiers (terminal, transformer end, ratio and phase tap changer).
    • Properties, 3-wt star bus voltage and angle, operational limit names.
    • Extensions (only IIDM extensions are considered), TransformerFortescueData, PhaseAngleClock, and TransformerToBeEstimated
  • Properties, aliases and extensions not mapped are recorded in the functional log (report nodes).
  • New and removed equipment is also recorded in the functional log.

The second one, replaces all the 3 TwoWindingsTransformers of the network by an equivalent ThreeWindingsTransformer. In this process:

  • BusbarSections and the 3 TwoWindingsTransformers are the only connectables allowed In the voltageLevel associated with the star bus.
  • A new ThreeWindingsTransformer is created for replacing the 3 TwoWindingsTransformers.
  • The following attributes are mapped, copied or adjusted:
    • RatedU0 is set to the nominal voltage of the star voltage level.
    • Electrical characteristics, ratioTapChangers, and phaseTapChangers. Adjustments are required if TwoWindingsTransformers are not well oriented (End2 must be on the star side).
    • Operational Loading Limits.
    • Controllers using any of the ThreeWindingsTransformer terminals as regulatingTerminals.
    • Active and reactive power of the ThreeWindingsTransformer terminals.
    • Aliases for known CGMES identifiers (terminal, transformer end, ratio and phase tap changer).
    • Properties: star bus voltage and angle are added as properties, and operational limit names are copied.
    • Extensions (only IIDM extensions are considered), TransformerFortescueData, PhaseAngleClock, and TransformerToBeEstimated
  • Properties, aliases and extensions not mapped are recorded in the functional log (report nodes).
  • New and removed equipment is also recorded in the functional log.

In both processes, internal connections are created to manage the replacement.

What is the current behavior?

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

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)

Custom IIDM implementation maintainers should implement the following method in their RemoteReactivePowerControl implementations:

  • RemoteReactivePowerControl setRegulatingTerminal(Terminal regulatingTerminals);

Other information:

marqueslanauja and others added 15 commits October 2, 2024 15:55
…ngsTranformers and vice versa.

Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
Signed-off-by: marquesja1 <[email protected]>
@marqueslanauja marqueslanauja marked this pull request as ready for review October 21, 2024 05:54
@olperr1 olperr1 added the Breaking Change API is broken label Nov 14, 2024
} else if (t2wLeg3.getOperationalLimitsGroups1().stream().anyMatch(operationalLimitsGroup -> propertyName.contains(operationalLimitsGroup.getId()))) {
t2wLeg3.setProperty(propertyName, property);
} else {
copied = false;
Copy link
Member

Choose a reason for hiding this comment

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

I think all other properties should be copied on the 3 2wt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Properties have a strong dependency on the propertyName. The propertyName is essential to use properly the property data. I'm not sure if copying properties with a general procedure, without adjusting their propertyNames will be the best option as the result will not be in general usable for exporting the model to the original format, the main use of the properties now, I think.

Copy link
Member

Choose a reason for hiding this comment

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

Properties are used to pass additional data on an identifiable. They may be used in a full IIDM context (without exporting the network in another format) and it can make sense to transfer them.

marqueslanauja and others added 9 commits November 19, 2024 10:25
…tion/Replace3TwoWindingsTransformersByThreeWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/Replace3TwoWindingsTransformersByThreeWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/Replace3TwoWindingsTransformersByThreeWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/ReplaceThreeWindingsTransformersBy3TwoWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/ReplaceThreeWindingsTransformersBy3TwoWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/ReplaceThreeWindingsTransformersBy3TwoWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/ReplaceThreeWindingsTransformersBy3TwoWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
…tion/ReplaceThreeWindingsTransformersBy3TwoWindingsTransformers.java

Co-authored-by: Olivier Perrin <[email protected]>
Signed-off-by: marqueslanauja <[email protected]>
Copy link

sonarcloud bot commented Nov 22, 2024

Comment on lines +140 to +141
ThreeWindingsTransformerAdder t3wAdder = substation.newThreeWindingsTransformer()
.setId(getId(twoR))
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be safer to unsure that the new ID is unique. It could prevent exceptions during the network modification application:

Suggested change
ThreeWindingsTransformerAdder t3wAdder = substation.newThreeWindingsTransformer()
.setId(getId(twoR))
ThreeWindingsTransformerAdder t3wAdder = substation.newThreeWindingsTransformer()
.setEnsureIdUnicity(true)
.setId(getId(twoR))

* <li>A new voltage level is created for the star node with nominal voltage of ratedU0.</li>
* <li>Three new TwoWindingsTransformers are created, one for each leg of the removed ThreeWindingsTransformer.</li>
* <li>The following attributes are copied from each leg to the new associated twoWindingsTransformer:</li>
* <ul>
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +343 to +351
if (aliasType.equals("CGMES.TransformerEnd" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.TransformerEnd1");
} else if (aliasType.equals("CGMES.Terminal" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.Terminal1");
} else if (aliasType.equals("CGMES.RatioTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.RatioTapChanger1");
} else if (aliasType.equals("CGMES.PhaseTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.PhaseTapChanger1");
} else {
Copy link
Member

Choose a reason for hiding this comment

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

As for IDS, we should ensure the aliases are unique:

Suggested change
if (aliasType.equals("CGMES.TransformerEnd" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.TransformerEnd1");
} else if (aliasType.equals("CGMES.Terminal" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.Terminal1");
} else if (aliasType.equals("CGMES.RatioTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.RatioTapChanger1");
} else if (aliasType.equals("CGMES.PhaseTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.PhaseTapChanger1");
} else {
if (aliasType.equals("CGMES.TransformerEnd" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.TransformerEnd1", true);
} else if (aliasType.equals("CGMES.Terminal" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.Terminal1", true);
} else if (aliasType.equals("CGMES.RatioTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.RatioTapChanger1", true);
} else if (aliasType.equals("CGMES.PhaseTapChanger" + legEnd)) {
t2wLeg.addAlias(alias, "CGMES.PhaseTapChanger1", true);
} else {

Comment on lines +451 to +459
if (aliasType.equals("CGMES.TransformerEnd" + end)) {
t3w.addAlias(alias, "CGMES.TransformerEnd" + leg);
} else if (aliasType.equals("CGMES.Terminal" + end)) {
t3w.addAlias(alias, "CGMES.Terminal" + leg);
} else if (aliasType.equals("CGMES.RatioTapChanger1")) {
t3w.addAlias(alias, "CGMES.RatioTapChanger" + leg);
} else if (aliasType.equals("CGMES.PhaseTapChanger1")) {
t3w.addAlias(alias, "CGMES.PhaseTapChanger" + leg);
} else {
Copy link
Member

Choose a reason for hiding this comment

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

To avoid potential collisions which may cause a crash of the network modification application:

Suggested change
if (aliasType.equals("CGMES.TransformerEnd" + end)) {
t3w.addAlias(alias, "CGMES.TransformerEnd" + leg);
} else if (aliasType.equals("CGMES.Terminal" + end)) {
t3w.addAlias(alias, "CGMES.Terminal" + leg);
} else if (aliasType.equals("CGMES.RatioTapChanger1")) {
t3w.addAlias(alias, "CGMES.RatioTapChanger" + leg);
} else if (aliasType.equals("CGMES.PhaseTapChanger1")) {
t3w.addAlias(alias, "CGMES.PhaseTapChanger" + leg);
} else {
if (aliasType.equals("CGMES.TransformerEnd" + end)) {
t3w.addAlias(alias, "CGMES.TransformerEnd" + leg, true);
} else if (aliasType.equals("CGMES.Terminal" + end)) {
t3w.addAlias(alias, "CGMES.Terminal" + leg, true);
} else if (aliasType.equals("CGMES.RatioTapChanger1")) {
t3w.addAlias(alias, "CGMES.RatioTapChanger" + leg, true);
} else if (aliasType.equals("CGMES.PhaseTapChanger1")) {
t3w.addAlias(alias, "CGMES.PhaseTapChanger" + leg, true);
} else {

Comment on lines +165 to +166
.newTwoWindingsTransformer()
.setId(t3w.getId() + "-Leg" + leg.getSide().getNum())
Copy link
Member

Choose a reason for hiding this comment

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

To avoid potential application crash due to an ID collision:

Suggested change
.newTwoWindingsTransformer()
.setId(t3w.getId() + "-Leg" + leg.getSide().getNum())
.newTwoWindingsTransformer()
.setEnsureIdUnicity(true)
.setId(t3w.getId() + "-Leg" + leg.getSide().getNum())

* <li>Each twoWindingsTransformer is well oriented if the star bus is located at the end 2.</li>
* <li>A new ThreeWindingsTransformer is created for replacing the three TwoWindingsTransformers.</li>
* <li>The following attributes are copied from each twoWindingsTransformer to the new associated leg:</li>
* <ul>
Copy link
Member

Choose a reason for hiding this comment

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

The nested <ul> tags should be inside their corresponding <li> tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for review
Development

Successfully merging this pull request may close these issues.

5 participants