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

Operator strategy simulation fixes #633

Merged
merged 14 commits into from
Nov 14, 2022
Merged

Operator strategy simulation fixes #633

merged 14 commits into from
Nov 14, 2022

Conversation

geofjamg
Copy link
Member

Signed-off-by: Geoffroy Jamgotchian geoffroy.jamgotchian@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
No

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

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

  • if network element of action are not found in the LfNetwork, an exception in raised even if element is not just in same connected component.
  • a performance bug, state restoration is always done even if no action simulation has been done.

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: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@geofjamg geofjamg requested a review from annetill October 20, 2022 21:55
@geofjamg geofjamg changed the title Operator strategy simulation fixes [WIP] Operator strategy simulation fixes Oct 21, 2022
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg changed the title [WIP] Operator strategy simulation fixes Operator strategy simulation fixes Oct 21, 2022
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@@ -181,10 +202,4 @@ public void apply() {
branch.getPiModel().setTapPosition(newTapPosition);
}
}

private static void checkBranch(LfBranch branch, String branchId) {
Copy link
Member

Choose a reason for hiding this comment

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

So, in that case, no log to the user? And ok no exception.

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 removed the check at lfnetwork level but it would be better to keep it on iidm network

Copy link
Member

Choose a reason for hiding this comment

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

There is nothing at iidm network I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes i will add it in this pr

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 added to check of actions at IIDM network level and at LfNetwork level we can suppose that if not found it is in another component. what are we supposed to do in that case? Maybe we new status added in next core release, we can have the status "no impact" for this operator strategy result?

Also for IIDM check, it is relevant to throw an exception if an action does not exist in the network ? this is what we are doing for contingencies but maybe we should only warm the user that this contingency or action is invalid and discarded?

@geofjamg geofjamg changed the title Operator strategy simulation fixes [WIP]Operator strategy simulation fixes Oct 24, 2022
@annetill annetill added the bug Something isn't working label Oct 26, 2022
@annetill annetill changed the title [WIP]Operator strategy simulation fixes [WIP] Operator strategy simulation fixes Oct 26, 2022
geofjamg and others added 8 commits November 3, 2022 17:12
# Conflicts:
#	src/test/java/com/powsybl/openloadflow/sa/LfActionTest.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg changed the title [WIP] Operator strategy simulation fixes Operator strategy simulation fixes Nov 13, 2022
@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 1 Code Smell

92.5% 92.5% Coverage
0.0% 0.0% Duplication

@geofjamg
Copy link
Member Author

@annetill it is now ready for review

@geofjamg geofjamg requested a review from annetill November 13, 2022 13:56
List<OperatorStrategy> operatorStrategies) {
List<OperatorStrategy> operatorStrategies,
Map<String, Action> actionsById,
Set<Action> neededActions) {
Copy link
Member

Choose a reason for hiding this comment

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

What I understand from previous talk with @sylvlecl and you is that the actions order matters. That is why I used a list instead of a set. With your modifications, are we sure that order is conserved?

Set<String> contingencyIds = propagatedContingencies.stream().map(propagatedContingency -> propagatedContingency.getContingency().getId()).collect(Collectors.toSet());
Map<String, List<OperatorStrategy>> operatorStrategiesByContingencyId = new HashMap<>();
for (OperatorStrategy operatorStrategy : operatorStrategies) {
if (contingencyIds.contains(operatorStrategy.getContingencyId())) {
operatorStrategiesByContingencyId.computeIfAbsent(operatorStrategy.getContingencyId(), key -> new ArrayList<>()).add(operatorStrategy);
// check actions IDs exists
for (String actionId : operatorStrategy.getActionIds()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@annetill this is here that the order is defined and it is a List

@annetill annetill merged commit e18afa5 into main Nov 14, 2022
@annetill annetill deleted the actions_fix branch November 14, 2022 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR: next-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants