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

Zero impedance line open at one side NPE #606

Merged
merged 6 commits into from
Sep 16, 2022
Merged

Zero impedance line open at one side NPE #606

merged 6 commits into from
Sep 16, 2022

Conversation

annetill
Copy link
Member

Signed-off-by: Anne Tilloy anne.tilloy@rte-france.com

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)

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

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:

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

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@marqueslanauja
Copy link
Contributor

marqueslanauja commented Sep 15, 2022

A zero impedance line open at one side is equivalent to a zero impedance line open at the two sides. In my opinion should be managed as a disconnected line and should not be included in the internal network used for the loadflow calculation.

This comment does not apply in this case because the opened line is a line with impedance.

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Network network = NodeBreakerNetworkFactory.create3Bars();
network.getLine("L2").setR(0.0).setX(0.0);
network.getLine("L1").getTerminal1().disconnect();
LoadFlow.run(network);
Copy link
Member

Choose a reason for hiding this comment

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

@annetill Maybe we can add a check on values?

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
branch.updateFlows(pqBus.p, pqBus.q, pqOtherBus.p, pqOtherBus.q);
} else {
branch.updateFlows(pqOtherBus.p, pqOtherBus.q, pqBus.p, pqBus.q);
}
}

private PQ getBranchFlow(LfBranch branch, LfBus bus) {
return branch.getBus1().equals(bus) ? new PQ(branch.getP1().eval(), branch.getQ1().eval())
: new PQ(branch.getP2().eval(), branch.getQ2().eval());
if (branch.getBus1() != null && branch.getBus1().equals(bus)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is enough... if it is not bus1, so it is bus2 as the branch is adjacent. My only question is about disabled branch. It is not managed and we never compute zero impedance flows in a security analysis, right?

Copy link
Contributor

@marqueslanauja marqueslanauja Sep 15, 2022

Choose a reason for hiding this comment

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

Better the previous fix. When a line is antenna the opened bus is null and the returned flow at this side is NaN. With the previous fix the returned flow will be 0.0, the right flow. However, to calculate zeroImpedanceFlows both fixes are ok as the method will never be used to calculate the flow at the antenna side, the flow is always needed at the connected side.

Copy link
Member Author

Choose a reason for hiding this comment

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

With previous fix, the last else is never reached by unit tests. I have tried during one hour and I think that it could not be reached as it is an adjacent branch. So I think that the right fix is this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

91.7% 91.7% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg merged commit 9f41777 into main Sep 16, 2022
@geofjamg geofjamg deleted the zero-impedance-npe branch September 16, 2022 09:01
flo-dup pushed a commit that referenced this pull request Sep 19, 2022
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
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.

4 participants