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

Bug fix: support of factors with SKIP status after contingencies #476

Merged
merged 12 commits into from
Mar 21, 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>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
for (LfSensitivityFactor<DcVariableType, DcEquationType> lfFactor : lfFactors) {
if (lfFactor.getStatus() == LfSensitivityFactor.Status.ZERO) {
valueWriter.write(lfFactor.getIndex(), contingency != null ? contingency.getIndex() : -1, 0, Double.NaN);
} else if (contingency != null && lfFactor.getStatus() == LfSensitivityFactor.Status.SKIP) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't know yet what is the right fix but not this one because, all skipped factors are handle at the start of DC sensitivity analysis. So here a value is emitted in the writer a second time.

geofjamg and others added 5 commits March 20, 2022 20:43
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg requested a review from Hadrien-Godard March 20, 2022 20:04
@geofjamg
Copy link
Member

@annetill I refactored the code to discard ZERO and SKIP factors at the very beginning of the analysis and clean useless checks everywhere. Is has changed some of the unit test, where we were writing post contingency output on case of invalid factors in some cases. Is it ok for you?

geofjamg and others added 4 commits March 20, 2022 21:15
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@@ -1865,7 +1865,33 @@ void testGeneratorContingencyNotInMainComponentAndMonitoredBranchNotInMainCompon
assertEquals(1, result.getPreContingencyValues().size());
assertEquals(0.0, result.getSensitivityValue("GEN_1", "T2wT"), LoadFlowAssert.DELTA_POWER);
assertEquals(Double.NaN, result.getFunctionReferenceValue("T2wT"), LoadFlowAssert.DELTA_POWER);
assertEquals(0.0, result.getSensitivityValue("GEN_3", "GEN_1", "T2wT"), LoadFlowAssert.DELTA_POWER);
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 am okay with the change in this unit test.

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@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

96.2% 96.2% Coverage
0.0% 0.0% Duplication

Copy link
Member Author

@annetill annetill left a comment

Choose a reason for hiding this comment

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

Approved!

@geofjamg geofjamg merged commit 3c49e59 into main Mar 21, 2022
@geofjamg geofjamg deleted the fix-skip-factors branch March 21, 2022 18:58
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.

3 participants