Package com.powsybl.security
Interface SecurityAnalysis
-
- All Known Implementing Classes:
AbstractSecurityAnalysis
,DistributedSecurityAnalysis
,ExternalSecurityAnalysis
,SecurityAnalysisImpl
public interface SecurityAnalysis
ASecurityAnalysis
is a power system computation which computes, for aNetwork
, theLimitViolations
on N-situation and the ones caused by a specified list ofContingencies
.Computation results are provided asynchronously as a
SecurityAnalysisResult
.Implementations of that interface may typically rely on an external tool.
Interceptors
might be used to execute client user-specific code on events such as the availability of N-situation results, for example to further customize the results content throughExtensions
.- Author:
- Geoffroy Jamgotchian
, Teofil Calin BANC
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addInterceptor(SecurityAnalysisInterceptor interceptor)
boolean
removeInterceptor(SecurityAnalysisInterceptor interceptor)
CompletableFuture<SecurityAnalysisResult>
run(String workingVariantId, SecurityAnalysisParameters parameters, ContingenciesProvider contingenciesProvider)
default CompletableFuture<SecurityAnalysisResultWithLog>
runWithLog(String workingVariantId, SecurityAnalysisParameters parameters, ContingenciesProvider contingenciesProvider)
To be consistent withrun(String, SecurityAnalysisParameters, ContingenciesProvider)
, this method would also complete exceptionally if there are exceptions thrown.
-
-
-
Method Detail
-
addInterceptor
void addInterceptor(SecurityAnalysisInterceptor interceptor)
-
removeInterceptor
boolean removeInterceptor(SecurityAnalysisInterceptor interceptor)
-
run
CompletableFuture<SecurityAnalysisResult> run(String workingVariantId, SecurityAnalysisParameters parameters, ContingenciesProvider contingenciesProvider)
-
runWithLog
default CompletableFuture<SecurityAnalysisResultWithLog> runWithLog(String workingVariantId, SecurityAnalysisParameters parameters, ContingenciesProvider contingenciesProvider)
To be consistent withrun(String, SecurityAnalysisParameters, ContingenciesProvider)
, this method would also complete exceptionally if there are exceptions thrown. But the original exception would be wrapped inComputationException
, and those .out/.err log file's contents are be collected in theComputationException
too.try { SecurityAnalysisResultWithLog resultWithLog = securityAnalysis.runWithLog(currentState, parameters, contingenciesProvider).join(); result = resultWithLog.getResult(); } catch (CompletionException e) { if (e.getCause() instanceof ComputationException) { ComputationException computationException = (ComputationException) e.getCause(); System.out.println("Consume exception..."); computationException.getOutLogs().forEach((name, content) -> { System.out.println("-----" + name + "----"); System.out.println(content); }); computationException.getErrLogs().forEach((name, content) -> { System.out.println("-----" + name + "----"); System.out.println(content); }); } throw e; }
- Parameters:
workingVariantId
-parameters
-contingenciesProvider
-- Returns:
-
-