diff --git a/pom.xml b/pom.xml index 198fb0c0..df8ad38e 100644 --- a/pom.xml +++ b/pom.xml @@ -43,10 +43,9 @@ powsybl/java-dynawo:2.1.0 - 30 + 31 org.gridsuite.securityanalysis.server 1.0.5 - 1.11.0 @@ -133,7 +132,6 @@ com.powsybl powsybl-ws-commons - ${powsybl-ws-commons.version} org.springframework.cloud diff --git a/src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java b/src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java index 50039032..1ea51186 100644 --- a/src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java +++ b/src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java @@ -15,7 +15,6 @@ import com.powsybl.loadflow.LoadFlowResult; import com.powsybl.network.store.client.NetworkStoreService; import com.powsybl.security.*; -import com.powsybl.security.detectors.DefaultLimitViolationDetector; import com.powsybl.ws.commons.LogUtils; import com.powsybl.ws.commons.computation.service.*; import org.gridsuite.securityanalysis.server.dto.ContingencyInfos; @@ -28,7 +27,6 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.UUID; @@ -69,7 +67,8 @@ public SecurityAnalysisResult run(SecurityAnalysisRunContext runContext) { Network network = getNetwork(runContext.getNetworkUuid(), runContext.getVariantId()); runContext.setNetwork(network); - return run(runContext, null); + AtomicReference rootReporter = new AtomicReference<>(); + return run(runContext, null, rootReporter); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; @@ -94,20 +93,17 @@ protected CompletableFuture getCompletableFuture(Securit .filter(Objects::nonNull) .toList(); + SecurityAnalysisRunParameters runParameters = new SecurityAnalysisRunParameters() + .setSecurityAnalysisParameters(runContext.getParameters()) + .setComputationManager(executionService.getComputationManager()) + .setFilter(LimitViolationFilter.load()) + .setReportNode(runContext.getReportNode()); + return securityAnalysisRunner.runAsync( runContext.getNetwork(), variantId, n -> contingencies, - runContext.getParameters(), - executionService.getComputationManager(), - LimitViolationFilter.load(), - new DefaultLimitViolationDetector(), - Collections.emptyList(), - Collections.emptyList(), - Collections.emptyList(), - Collections.emptyList(), - Collections.emptyList(), - runContext.getReportNode()) + runParameters) .thenApply(SecurityAnalysisReport::getResult); } diff --git a/src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisProviderMock.java b/src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisProviderMock.java index a664a88a..7cb374f7 100644 --- a/src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisProviderMock.java +++ b/src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisProviderMock.java @@ -6,19 +6,12 @@ */ package org.gridsuite.securityanalysis.server; -import com.powsybl.commons.report.ReportNode; -import com.powsybl.computation.ComputationManager; import com.powsybl.contingency.*; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import com.powsybl.loadflow.LoadFlowResult; import com.powsybl.security.*; -import com.powsybl.action.Action; -import com.powsybl.security.interceptors.SecurityAnalysisInterceptor; -import com.powsybl.security.limitreduction.LimitReduction; -import com.powsybl.security.monitor.StateMonitor; import com.powsybl.security.results.PostContingencyResult; -import com.powsybl.security.strategy.OperatorStrategy; import org.gridsuite.securityanalysis.server.dto.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -199,17 +192,8 @@ static List getResultPreContingencyWithNe public CompletableFuture run(Network network, String workingVariantId, - LimitViolationDetector detector, - LimitViolationFilter filter, - ComputationManager computationManager, - SecurityAnalysisParameters parameters, ContingenciesProvider contingenciesProvider, - List interceptors, - List operatorStrategies, - List actions, - List monitors, - List limitReductions, - ReportNode reportNode) { + SecurityAnalysisRunParameters parameters) { LOGGER.info("Run security analysis mock"); switch (workingVariantId) { case VARIANT_3_ID -> {