Conversation
Adds a new provider that orchestrates a two-pass security analysis. It first runs a static analysis on all contingencies. Based on configurable criteria (e.g., `NOT_CONVERGED`, `SPS_TRIGGERED`), it can then run a dynamic analysis on a subset of contingencies that require further investigation. Signed-off-by: Riad Benradi <riad.benradi_externe@rte-france.com>
Signed-off-by: Riad Benradi <riad.benradi_externe@rte-france.com>
Signed-off-by: Riad Benradi <riad.benradi_externe@rte-france.com>
|
| * | ||
| * @author Riad Benradi {@literal <riad.benradi at rte-france.com>} | ||
| */ | ||
| public class MixedSecurityAnalysis { |
There was a problem hiding this comment.
HybridSecurityAnalysis would be better
| MixedModeParametersExtension ext = new MixedModeParametersExtension(); | ||
|
|
||
| // Default values — used if the key is absent from the config file | ||
| ext.setStaticSimulator("load-flow"); |
There was a problem hiding this comment.
Maybe not a good idea to have a default value, as in powsybl core we don't know anything about OLF and DynaFlow
|
|
||
| // Override with values from config file if the section exists | ||
| // Reads from a YAML block named "mixed-mode-analysis" | ||
| config.getOptionalModuleConfig(MixedModeParametersExtension.NAME).ifPresent(module -> { |
There was a problem hiding this comment.
What are you doing here, you set to the extension what you read in the extension???
| // Default values — used if the key is absent from the config file | ||
| ext.setStaticSimulator("load-flow"); | ||
| ext.setDynamicSimulator("dynaflow"); | ||
| ext.setSwitchCriteria(List.of("NOT_CONVERGED")); |
There was a problem hiding this comment.
Use a Constant from the criteria class
|
|
||
| /** @return the provider version */ | ||
| @Override | ||
| public String getVersion() { |
There was a problem hiding this comment.
We would expect here either:
- the core version ?
- the version of found simulators ?
| * @author Riad Benradi {@literal <riad.benradi at rte-france.com>} | ||
| */ | ||
|
|
||
| public class AnalysisSwitchCriteria { |
There was a problem hiding this comment.
My advice here: before trying to create an abstraction on static / dynamic simulation contingency selection, try to code it simple and make it working with a simple processing: from static analysis, get contingencies from which an automaton has been triggered or a divergence and the re-run the dynamic one. It could be coded in a very simple way.
| /** | ||
| * The name of the static simulator to use for the first pass. | ||
| */ | ||
| private String staticSimulator; |
There was a problem hiding this comment.
The right term for a SecurityAnalysis is provider so here you need the name of the static security analysis provider and the name of the dynamic security analysis provider.
| /** | ||
| * The name of the dynamic simulator to use for the second pass (for complex cases). | ||
| */ | ||
| private String dynamicSimulator; |
There was a problem hiding this comment.
Maybe also another question from myself: could dynamic term here be a little bit confusing as we also have a DynamicSecurityAnalysis API (impl for dynawaltz)? But here we a looking for the classical implementation of SecurityAnalysis but implemented by DynaFlow which is is also a dynamic simulator... this is very confusing.
| <groupId>com.powsybl</groupId> | ||
| <artifactId>powsybl-security-analysis-api</artifactId> | ||
| </dependency> | ||
| <dependency> |
There was a problem hiding this comment.
You are creating a cycling dependency! We cannot have a dependency on OLF in powsybl core
| FAILED, | ||
| NO_IMPACT | ||
| NO_IMPACT, | ||
| SPS_TRIGGERED |
There was a problem hiding this comment.
There is probably something to do like this, but for me it should be done in another PR before with everything regarding upgrading the security analysis result API to store automation systems triggering.


Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
feature
What is the new behavior (if this is a feature change)?
This PR introduces a new Mixed-Mode Security Analysis feature. It adds a new SecurityAnalysisProvider that orchestrates a two-pass workflow:
1.Static Analysis : It first runs a fast, static analysis (e.g., using OpenLoadFlow) on all specified contingencies.
2.Criteria Evaluation : It then evaluates the results of the static pass against a configurable set of criteria (e.g.,NOT_CONVERGED, SPS_TRIGGERED, LIMIT_VIOLATIONS).
3.Dynamic Analysis Pass : For any contingencies that meet the switch criteria, it automatically triggers a more detailed dynamic analysis (e.g., using DynaFlow).
4.Result Merging : Finally, it merges the results from both passes, prioritizing the results from the dynamic analysis for any contingencies that were re-analyzed.
This allows for a more efficient and targeted security analysis, where computationally expensive dynamic simulations are only used when necessary.
Does this PR introduce a breaking change or deprecate an API?