-
Notifications
You must be signed in to change notification settings - Fork 8
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
Increase security analysis with temporary limits and violations filter #195
Conversation
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>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
ce756b5
to
e552d3a
Compare
src/main/java/com/powsybl/openloadflow/network/impl/LfBranchImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/network/impl/LfBranchImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@@ -21,6 +25,9 @@ | |||
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractLfBranch.class); | |||
|
|||
private static final Comparator<CurrentLimits.TemporaryLimit> TEMPORARY_LIMITS_COMPARATOR = | |||
Comparator.comparingDouble(CurrentLimits.TemporaryLimit::getValue).reversed(); |
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.
I'm wondering, isn't it the same to sort based on descending values as to sort based on ascending acceptableDuration
? Then we wouldn't need to sort, as they are already sorted in TemporaryLimitImpl
based on ascending acceptableDuration
src/main/java/com/powsybl/openloadflow/network/AbstractLfBranch.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysis.java
Outdated
Show resolved
Hide resolved
Now, we have to imagine a post-processing that, for a branch and for s side:
|
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
SortedSet<LfTemporaryLimit> temporaryLimits = new TreeSet<>(TEMPORARY_LIMITS_COMPARATOR); | ||
if (currentLimits != null) { | ||
for (CurrentLimits.TemporaryLimit temporaryLimit : currentLimits.getTemporaryLimits()) { | ||
double valuePerUnit = temporaryLimit.getValue() != Double.MAX_VALUE ? temporaryLimit.getValue() * bus.getNominalV() / PerUnit.SB : Double.MAX_VALUE; |
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.
Double.NaN
?
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.
Indeed I think that we don't need to make the distinction between temporary and permanent limit. The permanent limit is just a temporary limit with infinite duration time. And with that, the comparator works for all limits and it will ease the post processing on limit violations.
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
The temporary limits are already sorted Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
if (currentLimits != null) { | ||
double toPerUnit = bus.getNominalV() / PerUnit.SB; | ||
for (LoadingLimits.TemporaryLimit temporaryLimit : currentLimits.getTemporaryLimits()) { | ||
double valuePerUnit = temporaryLimit.getValue() != Double.MAX_VALUE ? temporaryLimit.getValue() * toPerUnit : Double.MAX_VALUE; |
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 the default value for limit value is Double.MAX_VALUE
and not NaN
?
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.
Because Double.NaN is not supported as value in the implementation TemporaryLimitAdder
of powsybl-iidm-impl. Do you think we should still support a NaN value?
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
if (postContingencyComputationOk) { | ||
detectViolations( | ||
network.getBranches().stream().filter(b -> !lfContingency.getBranches().contains(b)), | ||
network.getBuses().stream().filter(b -> !lfContingency.getBuses().contains(b)), | ||
postContingencyLimitViolations); | ||
} | ||
|
||
preContingencyLimitViolations.forEach((subjectSideId, preContingencyViolation) -> { | ||
LimitViolation postContingencyViolation = postContingencyLimitViolations.get(subjectSideId); | ||
if (postContingencyViolation != null && postContingencyViolation.getAcceptableDuration() >= preContingencyViolation.getAcceptableDuration()) { |
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.
@geofjamg I think that the comparator should rely on getValue and not on getAcceptableDuration. What do you think ?
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
…than 1.1. Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
This reverts commit d369d07. Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
2450a99
to
9838e2a
Compare
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 restYes, issue: #129
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
LimitViolationFilter
is not used for the moment.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)