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

Voltage and angle by bus in node/breaker topology #1170

Merged
merged 13 commits into from
Feb 28, 2020
Merged

Conversation

annetill
Copy link
Member

@annetill annetill commented Feb 21, 2020

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • 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)

I need to update the documentation.

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest

Yes, fix issue #735

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Voltage and angle are no longer attached to bus bar sections in IIDM serialization. We introduce bus at node/breaker level with voltage, angle and the list of nodes that belong to this bus.

What is the current behavior? (You can also link to an open issue here)

Voltage and angle are attached to a bus bar section.

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

There are attached to bus in the node/breaker topology.

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

Mathieu BAGUE and others added 7 commits February 17, 2020 11:18
Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
Signed-off-by: Anne Tilloy <atilloy@gmail.com>
…opology during the XIIDM import.

Signed-off-by: Anne Tilloy <atilloy@gmail.com>
Signed-off-by: Anne Tilloy <atilloy@gmail.com>
…leUntilMaximumVersion

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
…Version

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: Anne Tilloy <atilloy@gmail.com>
@annetill
Copy link
Member Author

Hi ! For the moment, when no voltage and no angle are defined for a given bus, we read/write the list of nodes only. I am not sure that it is what you expected. What do you think ?

@@ -20,8 +20,9 @@
<iidm:switch id="BK2" name="Breaker" kind="BREAKER" retained="true" open="false" node1="3" node2="4"/>
<iidm:switch id="DISC_BBS1_BK3" name="Disconnector" kind="DISCONNECTOR" retained="false" open="false" node1="0" node2="5"/>
<iidm:switch id="BK3" name="Breaker" kind="BREAKER" retained="true" open="false" node1="5" node2="6"/>
<iidm:bus nodes="0,1,2,3,4,5,6"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no V and/or theta, should we serialize buses?

Copy link
Member Author

Choose a reason for hiding this comment

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

Line deleted.

@@ -5,7 +5,7 @@
<iidm:busBreakerTopology>
<iidm:bus id="B1"/>
</iidm:busBreakerTopology>
<iidm:vscConverterStation id="C1" name="Converter1" lossFactor="0.011" voltageRegulatorOn="true" voltageSetpoint="405.0" bus="B1" connectableBus="B1" p="100.0" q="50.0">
<iidm:vscConverterStation id="C1" name="Converter1" voltageRegulatorOn="true" lossFactor="0.011" voltageSetpoint="405.0" bus="B1" connectableBus="B1" p="100.0" q="50.0">
Copy link
Contributor

Choose a reason for hiding this comment

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

It's strange that the order of the two attributes is changing

Copy link
Member Author

Choose a reason for hiding this comment

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

Revert.

</iidm:nodeBreakerTopology>
<iidm:vscConverterStation id="C2" name="Converter2" lossFactor="0.011" voltageRegulatorOn="false" reactivePowerSetpoint="123.0" node="2">
<iidm:vscConverterStation id="C2" name="Converter2" voltageRegulatorOn="false" lossFactor="0.011" reactivePowerSetpoint="123.0" node="2">
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark here

Copy link
Member Author

Choose a reason for hiding this comment

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

Revert.

@@ -45,6 +46,8 @@
<iidm:switch id="BV" name="BW" kind="BREAKER" retained="true" open="false" node1="17" node2="18"/>
<iidm:switch id="BX" name="BY" kind="BREAKER" retained="true" open="false" node1="19" node2="20"/>
<iidm:switch id="BZ" name="CA" kind="BREAKER" retained="true" open="false" node1="21" node2="22"/>
<iidm:bus v="236.44736" angle="15.250391" nodes="0,1,6,7,8,9,10,15,16,17,18,19,20,21,22"/>
<iidm:bus nodes="3,4,5"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark here

Copy link
Member Author

Choose a reason for hiding this comment

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

Line deleted.

@@ -7,6 +7,7 @@
<iidm:switch id="br1" kind="BREAKER" retained="false" open="false" node1="1" node2="2"/>
<iidm:internalConnection node1="0" node2="1"/>
<iidm:internalConnection node1="3" node2="4"/>
<iidm:bus nodes="0,1,2"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark here

Copy link
Member Author

Choose a reason for hiding this comment

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

Line deleted.

@@ -20,6 +21,7 @@
<iidm:switch id="br2" kind="BREAKER" retained="false" open="false" node1="1" node2="2"/>
<iidm:internalConnection node1="0" node2="1"/>
<iidm:internalConnection node1="3" node2="4"/>
<iidm:bus nodes="0,1,2"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark

Copy link
Member Author

Choose a reason for hiding this comment

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

Line deleted.

Comment on lines 96 to 106
for (Bus bus : vl.getBusView().getBuses()) {
try {
context.getWriter().writeEmptyElement(context.getVersion().getNamespaceURI(), "bus");
XmlUtil.writeDouble("v", bus.getV(), context.getWriter());
XmlUtil.writeDouble("angle", bus.getAngle(), context.getWriter());
Set<Integer> nodes = nodesByBus.get(bus.getId());
context.getWriter().writeAttribute("nodes", StringUtils.join(nodes.toArray(), ','));
} catch (XMLStreamException e) {
throw new UncheckedXmlStreamException(e);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can replace this by a forEach and an intermediary method writeCalculatedBus(Bus, Set<Integer>, NetworkXmlWriterContext) (with a stream, it will also be easier to filter bus with a voltage or angle non NaN).

Copy link
Contributor

Choose a reason for hiding this comment

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

This method could be declared as a static method in BusXml.

Copy link
Member Author

@annetill annetill Feb 27, 2020

Choose a reason for hiding this comment

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

Done, but in VoltageLevelXml.java.

Signed-off-by: Anne Tilloy <atilloy@gmail.com>
annetill and others added 3 commits February 27, 2020 14:34
…L attribute.

Signed-off-by: Anne Tilloy <atilloy@gmail.com>
Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
@mathbagu
Copy link
Contributor

@MioRtia @annetill I add both do-not-merge and to-be-refactored because I want to refactor a bit the code to solve the last sonar issue about complexity. I will extract the export of CalculatedBus in a function. Please, do not merge :)

Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
@mathbagu mathbagu removed the request for review from sylvlecl February 28, 2020 09:12
@sonarcloud
Copy link

sonarcloud bot commented Feb 28, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

85.6% 85.6% Coverage
0.0% 0.0% Duplication

@miovd miovd merged commit 2a32588 into master Feb 28, 2020
@miovd miovd deleted the voltages-by-bus branch February 28, 2020 09:38
mathbagu pushed a commit that referenced this pull request Feb 28, 2020
* Add a function to get the nodes of each buses, from the BusView

Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>

* Export of bus in node/breaker topology with voltage, angle and nodes.
* Voltage and angle by bus instead of busbar sections in node/breaker topology during the XIIDM import.

Signed-off-by: Anne Tilloy <atilloy@gmail.com>

* add IidmXmlUtil.assertMaximumVersion and IidmXmlUtil.readOptionalDoubleUntilMaximumVersion
* add IidmXmlUtil.runFromMinimumVersion and IidmXmlUtil.runUntilMaximumVersion

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>

* Backward compatibility management and unitary tests update.
* Not assert anything where there is a deletion or an addition of an XML attribute.

Signed-off-by: Anne Tilloy <atilloy@gmail.com>

* Add unit tests
* Solve last code smell (complexity)

Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>

Co-authored-by: Mathieu BAGUE <mathieu.bague@gmail.com>
Co-authored-by: MioRtia <miora.ralambotiana@rte-france.com>
(cherry picked from commit 2a32588)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Voltage/angle values lost on XIIDM export --> import for buses with no bus bar sections
3 participants