public interface SecurityAnalysis
SecurityAnalysis
is a power system computation which computes, for a Network
,
the LimitViolations
on N-situation
and the ones caused by a specified list of Contingencies
.
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
through Extensions
.
Modifier and Type | Method and 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 with
run(String, SecurityAnalysisParameters, ContingenciesProvider) , this method would also complete exceptionally
if there are exceptions thrown. |
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)
run(String, SecurityAnalysisParameters, ContingenciesProvider)
, this method would also complete exceptionally
if there are exceptions thrown. But the original exception would be wrapped in ComputationException
, and those .out/.err log file's contents
are be collected in the ComputationException
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;
}
workingVariantId
- parameters
- contingenciesProvider
- Copyright © 2020. All rights reserved.