-
Notifications
You must be signed in to change notification settings - Fork 2
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
[IIDM v1.6.0] Make substations optional (#365) #414
Conversation
4e20298
to
aecb4fe
Compare
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
c67f461
to
6648d8b
Compare
} | ||
|
||
Network& ThreeWindingsTransformerAdder::getNetwork() { | ||
return m_substation.getNetwork(); | ||
return const_cast<Network&>(static_cast<const ThreeWindingsTransformerAdder*>(this)->getNetwork()); |
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.
Notice: sonar is not happy with thoses hacks... But I think it is better than duplicating const methods content...
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.
From my point of view, if we keep both getSubstation
and getNullableSubstation
, maybe the getSubstation
should maybe throw an exception to avoid having an alias countrary at what we have in java.
src/iidm/VoltageLevel.cpp
Outdated
void VoltageLevel::setNetworkRef(Network& network) { | ||
if (static_cast<bool>(m_networkRef)) { | ||
m_networkRef = network; | ||
} |
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.
To be discuss: I think the networkRef should be settable to null (empty reference) when the voltage is detached from the network
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.
The bug exists in java => I posted powsybl/powsybl-core#1960 and #421 to fix it later
…ow an exception if the substation is not set Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Mathieu BAGUE <[email protected]>
private: | ||
stdcxx::Reference<Network> m_networkRef; |
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.
Why don't we use NetworkRef
instead like we did in Substation?
src/iidm/VoltageLevel.cpp
Outdated
@@ -262,6 +271,12 @@ VoltageLevel& VoltageLevel::setLowVoltageLimit(double lowVoltageLimit) { | |||
return *this; | |||
} | |||
|
|||
void VoltageLevel::setNetworkRef(Network& network) { | |||
if (static_cast<bool>(m_networkRef)) { |
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.
Why this test? m_networkRef is always set except if the VoltageLevel is detached. Then, you will never enter this method. Do I miss something?
Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Mathieu BAGUE <[email protected]>
Kudos, SonarCloud Quality Gate passed! |
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the restCloses #365
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)