From 3ae74fcdd4317f1d89770435910c9e6efac02468 Mon Sep 17 00:00:00 2001 From: Thang PHAM Date: Fri, 25 Jul 2025 09:22:18 +0200 Subject: [PATCH] DSA using computation lib Signed-off-by: Thang PHAM --- pom.xml | 12 ++++++++++++ .../server/config/RestTemplateConfig.java | 2 +- .../DynamicSecurityAnalysisController.java | 6 +++--- .../service/DynamicSecurityAnalysisObserver.java | 2 +- .../DynamicSecurityAnalysisResultService.java | 2 +- .../service/DynamicSecurityAnalysisService.java | 6 +++--- .../DynamicSecurityAnalysisWorkerService.java | 4 ++-- .../server/service/ParametersService.java | 2 +- .../DynamicSecurityAnalysisResultContext.java | 8 ++++---- .../contexts/DynamicSecurityAnalysisRunContext.java | 4 ++-- ...bstractDynamicSecurityAnalysisControllerTest.java | 2 +- .../DynamicSecurityAnalysisControllerIEEE14Test.java | 6 +++--- .../DynamicSecurityAnalysisControllerTest.java | 6 +++--- 13 files changed, 37 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 7de8ff2..197f5da 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,11 @@ 42.0.0 + + 1.0.0 + + 1.28.0 + powsybl/java-dynawo:3.0.0 org.gridsuite.dynamicsecurityanalysis.server gridsuite @@ -130,6 +135,7 @@ com.powsybl powsybl-ws-commons + ${powsybl-ws-commons.version} com.powsybl @@ -140,6 +146,12 @@ powsybl-dynawo-security-analysis + + org.gridsuite + gridsuite-computation + ${gridsuite-computation.version} + + org.springframework.boot diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/config/RestTemplateConfig.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/config/RestTemplateConfig.java index 72370cf..e62e6d4 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/config/RestTemplateConfig.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/config/RestTemplateConfig.java @@ -12,7 +12,7 @@ import com.powsybl.commons.report.ReportNodeJsonModule; import com.powsybl.dynamicsimulation.json.DynamicSimulationParametersJsonModule; import com.powsybl.security.dynamic.json.DynamicSecurityAnalysisJsonModule; -import com.powsybl.ws.commons.computation.ComputationConfig; +import org.gridsuite.computation.ComputationConfig; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisController.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisController.java index 67988a6..0a5725c 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisController.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisController.java @@ -6,13 +6,13 @@ */ package org.gridsuite.dynamicsecurityanalysis.server.controller; -import com.powsybl.ws.commons.computation.dto.ReportInfos; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.collections4.CollectionUtils; +import org.gridsuite.computation.dto.ReportInfos; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; import org.gridsuite.dynamicsecurityanalysis.server.service.DynamicSecurityAnalysisResultService; import org.gridsuite.dynamicsecurityanalysis.server.service.DynamicSecurityAnalysisService; @@ -25,8 +25,8 @@ import java.util.List; import java.util.UUID; -import static com.powsybl.ws.commons.computation.service.AbstractResultContext.*; -import static com.powsybl.ws.commons.computation.service.NotificationService.*; +import static org.gridsuite.computation.service.AbstractResultContext.*; +import static org.gridsuite.computation.service.NotificationService.*; import static org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisApi.API_VERSION; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.TEXT_PLAIN_VALUE; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisObserver.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisObserver.java index e483374..632101e 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisObserver.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisObserver.java @@ -8,10 +8,10 @@ import com.powsybl.loadflow.LoadFlowResult; import com.powsybl.security.SecurityAnalysisReport; -import com.powsybl.ws.commons.computation.service.AbstractComputationObserver; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.observation.ObservationRegistry; import lombok.NonNull; +import org.gridsuite.computation.service.AbstractComputationObserver; import org.gridsuite.dynamicsecurityanalysis.server.dto.parameters.DynamicSecurityAnalysisParametersInfos; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisResultService.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisResultService.java index e10a41e..7e26776 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisResultService.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisResultService.java @@ -7,8 +7,8 @@ package org.gridsuite.dynamicsecurityanalysis.server.service; -import com.powsybl.ws.commons.computation.service.AbstractComputationResultService; import jakarta.transaction.Transactional; +import org.gridsuite.computation.service.AbstractComputationResultService; import org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; import org.gridsuite.dynamicsecurityanalysis.server.entities.DynamicSecurityAnalysisResultEntity; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisService.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisService.java index b2256a6..e9439ca 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisService.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisService.java @@ -9,9 +9,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.powsybl.network.store.client.NetworkStoreService; import com.powsybl.security.dynamic.DynamicSecurityAnalysisProvider; -import com.powsybl.ws.commons.computation.service.AbstractComputationService; -import com.powsybl.ws.commons.computation.service.NotificationService; -import com.powsybl.ws.commons.computation.service.UuidGeneratorService; +import org.gridsuite.computation.service.AbstractComputationService; +import org.gridsuite.computation.service.NotificationService; +import org.gridsuite.computation.service.UuidGeneratorService; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; import org.gridsuite.dynamicsecurityanalysis.server.service.contexts.DynamicSecurityAnalysisResultContext; import org.gridsuite.dynamicsecurityanalysis.server.service.contexts.DynamicSecurityAnalysisRunContext; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisWorkerService.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisWorkerService.java index 3c56eaf..63929a2 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisWorkerService.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/DynamicSecurityAnalysisWorkerService.java @@ -28,8 +28,8 @@ import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import com.powsybl.security.dynamic.DynamicSecurityAnalysisRunParameters; import com.powsybl.security.results.PostContingencyResult; -import com.powsybl.ws.commons.computation.service.*; import org.apache.commons.collections4.CollectionUtils; +import org.gridsuite.computation.service.*; import org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; import org.gridsuite.dynamicsecurityanalysis.server.dto.contingency.ContingencyInfos; @@ -60,7 +60,7 @@ import static org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException.Type.CONTINGENCIES_NOT_FOUND; import static org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException.Type.DUMP_FILE_ERROR; import static org.gridsuite.dynamicsecurityanalysis.server.service.DynamicSecurityAnalysisService.COMPUTATION_TYPE; -import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.*; +import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.getReportNode; /** * @author Thang PHAM diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/ParametersService.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/ParametersService.java index 50ad261..f8f03c8 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/ParametersService.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/ParametersService.java @@ -15,8 +15,8 @@ import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfig; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; -import com.powsybl.ws.commons.computation.dto.ReportInfos; import jakarta.transaction.Transactional; +import org.gridsuite.computation.dto.ReportInfos; import org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException; import org.gridsuite.dynamicsecurityanalysis.server.dto.parameters.DynamicSecurityAnalysisParametersInfos; import org.gridsuite.dynamicsecurityanalysis.server.entities.parameters.DynamicSecurityAnalysisParametersEntity; diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisResultContext.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisResultContext.java index 726af78..36d81f9 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisResultContext.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisResultContext.java @@ -8,8 +8,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.powsybl.ws.commons.computation.dto.ReportInfos; -import com.powsybl.ws.commons.computation.service.AbstractResultContext; +import org.gridsuite.computation.dto.ReportInfos; +import org.gridsuite.computation.service.AbstractResultContext; import org.gridsuite.dynamicsecurityanalysis.server.dto.parameters.DynamicSecurityAnalysisParametersInfos; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; @@ -19,8 +19,8 @@ import java.util.Objects; import java.util.UUID; -import static com.powsybl.ws.commons.computation.service.NotificationService.*; -import static com.powsybl.ws.commons.computation.utils.MessageUtils.getNonNullHeader; +import static org.gridsuite.computation.service.NotificationService.*; +import static org.gridsuite.computation.utils.MessageUtils.getNonNullHeader; /** * @author Thang PHAM diff --git a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisRunContext.java b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisRunContext.java index e440c3b..b3bf594 100644 --- a/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisRunContext.java +++ b/src/main/java/org/gridsuite/dynamicsecurityanalysis/server/service/contexts/DynamicSecurityAnalysisRunContext.java @@ -8,11 +8,11 @@ import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfig; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; -import com.powsybl.ws.commons.computation.dto.ReportInfos; -import com.powsybl.ws.commons.computation.service.AbstractComputationRunContext; import lombok.Builder; import lombok.Getter; import lombok.Setter; +import org.gridsuite.computation.dto.ReportInfos; +import org.gridsuite.computation.service.AbstractComputationRunContext; import org.gridsuite.dynamicsecurityanalysis.server.dto.contingency.ContingencyInfos; import org.gridsuite.dynamicsecurityanalysis.server.dto.parameters.DynamicSecurityAnalysisParametersInfos; diff --git a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/AbstractDynamicSecurityAnalysisControllerTest.java b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/AbstractDynamicSecurityAnalysisControllerTest.java index c5766cc..9eb6bd3 100644 --- a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/AbstractDynamicSecurityAnalysisControllerTest.java +++ b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/AbstractDynamicSecurityAnalysisControllerTest.java @@ -8,8 +8,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.powsybl.network.store.client.NetworkStoreService; -import com.powsybl.ws.commons.computation.service.ReportService; import lombok.SneakyThrows; +import org.gridsuite.computation.service.ReportService; import org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisApplication; import org.gridsuite.dynamicsecurityanalysis.server.controller.utils.TestUtils; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; diff --git a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerIEEE14Test.java b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerIEEE14Test.java index e73a025..1cbe324 100644 --- a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerIEEE14Test.java +++ b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerIEEE14Test.java @@ -32,10 +32,10 @@ import java.util.Optional; import java.util.UUID; -import static com.powsybl.ws.commons.computation.service.AbstractResultContext.VARIANT_ID_HEADER; -import static com.powsybl.ws.commons.computation.service.NotificationService.HEADER_RESULT_UUID; -import static com.powsybl.ws.commons.computation.service.NotificationService.HEADER_USER_ID; import static org.assertj.core.api.Assertions.assertThat; +import static org.gridsuite.computation.service.AbstractResultContext.VARIANT_ID_HEADER; +import static org.gridsuite.computation.service.NotificationService.HEADER_RESULT_UUID; +import static org.gridsuite.computation.service.NotificationService.HEADER_USER_ID; import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.RESOURCE_PATH_DELIMITER; import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.zip; import static org.mockito.ArgumentMatchers.anyList; diff --git a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerTest.java b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerTest.java index 7af13e9..7ed849a 100644 --- a/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerTest.java +++ b/src/test/java/org/gridsuite/dynamicsecurityanalysis/server/controller/DynamicSecurityAnalysisControllerTest.java @@ -19,7 +19,7 @@ import com.powsybl.security.dynamic.DynamicSecurityAnalysis; import com.powsybl.security.results.PostContingencyResult; import com.powsybl.security.results.PreContingencyResult; -import com.powsybl.ws.commons.computation.service.NotificationService; +import org.gridsuite.computation.service.NotificationService; import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus; import org.gridsuite.dynamicsecurityanalysis.server.dto.contingency.ContingencyInfos; import org.gridsuite.dynamicsecurityanalysis.server.dto.parameters.DynamicSecurityAnalysisParametersInfos; @@ -45,9 +45,9 @@ import java.util.function.Supplier; import static com.powsybl.network.store.model.NetworkStoreApi.VERSION; -import static com.powsybl.ws.commons.computation.service.AbstractResultContext.VARIANT_ID_HEADER; -import static com.powsybl.ws.commons.computation.service.NotificationService.*; import static org.assertj.core.api.Assertions.assertThat; +import static org.gridsuite.computation.service.AbstractResultContext.VARIANT_ID_HEADER; +import static org.gridsuite.computation.service.NotificationService.*; import static org.gridsuite.dynamicsecurityanalysis.server.service.DynamicSecurityAnalysisService.COMPUTATION_TYPE; import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.RESOURCE_PATH_DELIMITER; import static org.gridsuite.dynamicsecurityanalysis.server.utils.Utils.zip;