powsybl-core icon indicating copy to clipboard operation
powsybl-core copied to clipboard

Remove violation detector from SecurityAnalysis API

Open flo-dup opened this issue 11 months ago • 1 comments

Please check if the PR fulfills these requirements

  • [x] The commit message follows our guidelines

Does this PR already have an issue describing the problem? No

What kind of change does this PR introduce? Refactor

What is the current behavior? LimitViolationDetector in SecurityAnalysis API, not in line wit

What is the new behavior (if this is a feature change)?

  • LimitViolationDetector removed from SecurityAnalysis, SecurityAnalysisProvider and SecurityAnalysisInput
  • interface LimitViolationDetector moved to dedicated package com.powsybl.security.detectors
  • LimitViolationDetector parameter in DefaultSecurityAnalysis now optional (nullable)

Does this PR introduce a breaking change or deprecate an API?

  • [x] Yes
  • [ ] No

If yes, please check if the following requirements are fulfilled

  • [x] The Breaking Change or Deprecated label has been added
  • [x] The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps) Starting from this release the LimitViolationDetector is removed from security analysis API. The default implementations remains available, and the DefaultSecurityAnalysis default implementation still handles a LimitViolationDetector parameter through its constructor, although it is now becoming nullable. The DefaultSecurityAnalysisProvider now builds a DefaultSecurityAnalysis with a null LimitViolationDetector.

If you want to still use the LimitViolationDetector you need to pass one to your security analysis (or to the DefaultSecurityAnalysis). Hence, you cannot use directly the DefaultSecurityAnalysisProvider anymore. It is thus not possible to call SecurityAnalysis.find() to create the SecurityAnalysis.Runner anymore. Instead, you should declare your own SecurityAnalysisProvider (which may or not extends DefaultSecurityAnalysisProvider) which will create a DefaultSecurityAnalysis using the constructor taking a LimitViolationDetector. The downfall is that the provider won't be retrieved dynamically from the default-impl-name property of the configuration file.

flo-dup avatar Mar 19 '24 16:03 flo-dup