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

Fast switch position modification #705

Merged
merged 34 commits into from
Apr 3, 2023
Merged

Fast switch position modification #705

merged 34 commits into from
Apr 3, 2023

Conversation

geofjamg
Copy link
Member

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, ...)
Feature

What is the new behavior (if this is a feature change)?
When network caching is enabled, we can now open or close a switch in fast mode (so reusing most of previous internal data structure) if it has been previously been tagged as retained.

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)

annetill and others added 6 commits December 12, 2022 16:17
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@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 Fast switch modif Fast switch position modification Jan 16, 2023
@geofjamg geofjamg changed the base branch from main to integration-core-5.1.0-SNAPSHOT January 16, 2023 21:44
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
import java.util.stream.Collectors;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public class AcLoadFlowFromCache {

private static final int MAX_PLAUSIBLE_SWITCHES_TO_RETAIN = 10;
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be configurable? Calculated with a heuristic from network size?

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 any idea of the algorithm to defined this max plausible: a % of the network branch ? but maybe that will be too low for small networks ? or min(percent * branch.size(), 10) or something like this?

Base automatically changed from integration-core-5.1.0-SNAPSHOT to main January 17, 2023 19:36
geofjamg and others added 4 commits January 17, 2023 20:55
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
# Conflicts:
#	src/main/java/com/powsybl/openloadflow/NetworkCache.java
#	src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowWithCachingTest.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@sonarcloud
Copy link

sonarcloud bot commented Jan 27, 2023

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 2 Code Smells

91.2% 91.2% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg changed the title Fast switch position modification [WIP] Fast switch position modification Jan 27, 2023
@geofjamg
Copy link
Member Author

Wait, I have to solve the configurable param issue

@geofjamg
Copy link
Member Author

Wait, I have to solve the configurable param issue

@annetill If you don't mind I prefer to postpone this feature to next release

geofjamg and others added 2 commits March 27, 2023 21:19
…lection (#762)

Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg changed the title [WIP] Fast switch position modification Fast switch position modification Mar 27, 2023
@geofjamg geofjamg requested a review from annetill March 27, 2023 19:20
geofjamg and others added 2 commits March 27, 2023 21:26
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@@ -159,6 +160,23 @@ private boolean onShuntUpdate(ShuntCompensator shunt, String attribute) {
});
}

private boolean onSwitchOpen(String switchId, boolean open) {
Copy link
Member

Choose a reason for hiding this comment

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

The method name should be more generic as you support open or close.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to onSwitchUpdate

# Conflicts:
#	src/main/java/com/powsybl/openloadflow/OpenLoadFlowParameters.java
#	src/test/java/com/powsybl/openloadflow/OpenLoadFlowParametersTest.java
#	src/test/resources/debug-parameters.json
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@@ -900,6 +918,8 @@ public OpenLoadFlowParameters update(Map<String, String> properties) {
.ifPresent(prop -> this.setMostMeshedSlackBusSelectorMaxNominalVoltagePercentile(Double.parseDouble(prop)));
Optional.ofNullable(properties.get(SLACK_BUS_COUNTRY_FILTER_PARAM_NAME))
.ifPresent(prop -> this.setSlackBusCountryFilter(parseStringListProp(prop).stream().map(Country::valueOf).collect(Collectors.toSet())));
Optional.ofNullable(properties.get(ACTIONABLE_SWITCHES_IDS_PARAM_NAME))
.ifPresent(prop -> this.setActionableSwitchesIds(new HashSet<>(parseStringListProp(prop))));
Copy link
Member

Choose a reason for hiding this comment

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

Map -> 42 too, better no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Copy link
Member

@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.

Maybe you need a more technical review than mine? Functionally the PR is great, and we need to have a first feed back of our users to be sure that it is the good design with swicthes ids as parameters.

geofjamg and others added 9 commits March 31, 2023 12:15
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>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 3, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

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

89.7% 89.7% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg merged commit e9e839f into main Apr 3, 2023
@geofjamg geofjamg deleted the fast_switch_modif branch April 3, 2023 17:03
geofjamg added a commit that referenced this pull request Apr 17, 2023
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants