-
Notifications
You must be signed in to change notification settings - Fork 43
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
Load default loadflow parameters from json file in classpath #3040
Conversation
Signed-off-by: Hugo KULESZA <hugo.kulesza@rte-france.com>
Signed-off-by: Hugo KULESZA <hugo.kulesza@rte-france.com>
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.
Some minor issues
private final String jsonParametersFile; | ||
|
||
AbstractLoadFlowDefaultParametersLoader(String name, String jsonParametersFile) { | ||
this.name = name; |
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.
Objects.requireNonNull ?
} | ||
|
||
public LoadFlowParameters(List<LoadFlowDefaultParametersLoader> defaultParametersLoaders) { | ||
int numberOfLoadersFound = defaultParametersLoaders.size(); |
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.
Same
} else if (numberOfLoadersFound == 1) { | ||
LoadFlowDefaultParametersLoader loader = defaultParametersLoaders.get(0); | ||
JsonLoadFlowParameters.update(this, loader.loadDefaultParametersFromFile()); | ||
LOGGER.info("Default loadflow configuration has been updated using the reference file from parameters loader '{}'", loader.getSourceName()); |
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.
Maybe just a debug log
this(ServiceLoader.load(LoadFlowDefaultParametersLoader.class) | ||
.stream() | ||
.map(ServiceLoader.Provider::get) | ||
.collect(Collectors.toList())); |
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.
toList()
if (numberOfLoadersFound > 1) { | ||
List<String> names = defaultParametersLoaders.stream() | ||
.map(LoadFlowDefaultParametersLoader::getSourceName) | ||
.collect(Collectors.toList()); |
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.
toList()
|
||
AbstractLoadFlowDefaultParametersLoader(String name, String jsonParametersFile) { | ||
this.name = name; | ||
this.jsonParametersFile = jsonParametersFile; |
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.
same
Signed-off-by: Hugo KULESZA <hugo.kulesza@rte-france.com>
...low/loadflow-api/src/test/java/com/powsybl/loadflow/LoadFlowDefaultParametersLoaderMock.java
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
A new way to define default loadflow parameters is added.
The order of loadflow parameters override is now the following :
Only one parameters JSON file can be used, if multiple are found none are used to override parameters