diff --git a/src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java b/src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java index 687281c486..e44d920f27 100644 --- a/src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java +++ b/src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java @@ -38,7 +38,6 @@ protected ResponseEntity handleStudyException(StudyException exception) SECURITY_ANALYSIS_NOT_FOUND, SENSITIVITY_ANALYSIS_NOT_FOUND, SHORT_CIRCUIT_ANALYSIS_NOT_FOUND, - NON_EVACUATED_ENERGY_NOT_FOUND, DYNAMIC_SIMULATION_NOT_FOUND, DYNAMIC_MAPPING_NOT_FOUND, EQUIPMENT_NOT_FOUND, @@ -59,7 +58,6 @@ protected ResponseEntity handleStudyException(StudyException exception) LOADFLOW_RUNNING, SECURITY_ANALYSIS_RUNNING, SENSITIVITY_ANALYSIS_RUNNING, - NON_EVACUATED_ENERGY_RUNNING, DYNAMIC_SIMULATION_RUNNING, SHORT_CIRCUIT_ANALYSIS_RUNNING, VOLTAGE_INIT_RUNNING, @@ -93,7 +91,6 @@ protected ResponseEntity handleStudyException(StudyException exception) GET_MODIFICATIONS_FAILED, GET_NETWORK_ELEMENT_FAILED, SENSITIVITY_ANALYSIS_ERROR, - NON_EVACUATED_ENERGY_ERROR, SHORT_CIRCUIT_ANALYSIS_ERROR, NODE_BUILD_ERROR, URI_SYNTAX, CREATE_VOLTAGE_INIT_PARAMETERS_FAILED, diff --git a/src/main/java/org/gridsuite/study/server/StudyException.java b/src/main/java/org/gridsuite/study/server/StudyException.java index 062a9ba787..add7249723 100644 --- a/src/main/java/org/gridsuite/study/server/StudyException.java +++ b/src/main/java/org/gridsuite/study/server/StudyException.java @@ -27,9 +27,6 @@ public enum Type { SENSITIVITY_ANALYSIS_RUNNING, SENSITIVITY_ANALYSIS_NOT_FOUND, SENSITIVITY_ANALYSIS_ERROR, - NON_EVACUATED_ENERGY_RUNNING, - NON_EVACUATED_ENERGY_NOT_FOUND, - NON_EVACUATED_ENERGY_ERROR, SHORT_CIRCUIT_ANALYSIS_NOT_FOUND, SHORT_CIRCUIT_ANALYSIS_ERROR, LOADFLOW_NOT_FOUND, diff --git a/src/main/java/org/gridsuite/study/server/controller/StudyController.java b/src/main/java/org/gridsuite/study/server/controller/StudyController.java index c45cf2aa39..08a037a43b 100644 --- a/src/main/java/org/gridsuite/study/server/controller/StudyController.java +++ b/src/main/java/org/gridsuite/study/server/controller/StudyController.java @@ -31,7 +31,6 @@ import org.gridsuite.study.server.dto.elasticsearch.EquipmentInfos; import org.gridsuite.study.server.dto.modification.ModificationType; import org.gridsuite.study.server.dto.modification.ModificationsSearchResultByNode; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyParametersInfos; import org.gridsuite.study.server.dto.sensianalysis.SensitivityAnalysisCsvFileInfos; import org.gridsuite.study.server.dto.sensianalysis.SensitivityFactorsIdsByGroup; import org.gridsuite.study.server.dto.sequence.NodeSequenceType; @@ -2211,97 +2210,6 @@ public ResponseEntity invalidateShortCircuitStatus(@Parameter(description return ResponseEntity.ok().build(); } - @PostMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/non-evacuated-energy/run") - @Operation(summary = "run sensitivity analysis non evacuated energy on study") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy has started")}) - public ResponseEntity runNonEvacuatedEnergy(@Parameter(description = "studyUuid") @PathVariable("studyUuid") UUID studyUuid, - @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, - @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid, - @RequestHeader(HEADER_USER_ID) String userId) { - studyService.assertIsNodeNotReadOnly(nodeUuid); - return ResponseEntity.ok().body(studyService.runNonEvacuatedEnergy(studyUuid, nodeUuid, rootNetworkUuid, userId)); - } - - @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/non-evacuated-energy/result") - @Operation(summary = "Get a sensitivity analysis non evacuated energy result on study") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy result"), - @ApiResponse(responseCode = "204", description = "No sensitivity analysis non evacuated energy has been done yet"), - @ApiResponse(responseCode = "404", description = "The sensitivity analysis non evacuated energy has not been found")}) - public ResponseEntity getNonEvacuatedEnergyResult(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid, - @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, - @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) { - String result = rootNetworkNodeInfoService.getNonEvacuatedEnergyResult(nodeUuid, rootNetworkUuid); - return result != null ? ResponseEntity.ok().body(result) : - ResponseEntity.noContent().build(); - } - - @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/non-evacuated-energy/status") - @Operation(summary = "Get the sensitivity analysis non evacuated energy status on study") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy status"), - @ApiResponse(responseCode = "204", description = "No sensitivity analysis non evacuated energy has been done yet"), - @ApiResponse(responseCode = "404", description = "The sensitivity analysis status non evacuated energy has not been found")}) - public ResponseEntity getNonEvacuatedEnergyStatus(@Parameter(description = "Study UUID") @PathVariable("studyUuid") UUID studyUuid, - @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, - @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) { - String result = rootNetworkNodeInfoService.getNonEvacuatedEnergyStatus(nodeUuid, rootNetworkUuid); - return result != null ? ResponseEntity.ok().body(result) : - ResponseEntity.noContent().build(); - } - - @PutMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/non-evacuated-energy/stop") - @Operation(summary = "stop sensitivity analysis non evacuated energy on study") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy has been stopped")}) - public ResponseEntity stopNonEvacuatedEnergy(@Parameter(description = "Study uuid") @PathVariable("studyUuid") UUID studyUuid, - @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, - @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid, - @RequestHeader(HEADER_USER_ID) String userId) { - rootNetworkNodeInfoService.stopNonEvacuatedEnergy(studyUuid, nodeUuid, rootNetworkUuid, userId); - return ResponseEntity.ok().build(); - } - - @GetMapping(value = "/studies/{studyUuid}/non-evacuated-energy/parameters") - @Operation(summary = "Get sensitivity analysis non evacuated energy parameters on study") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy parameters")}) - public ResponseEntity getNonEvacuatedEnergyParametersInfos( - @PathVariable("studyUuid") UUID studyUuid) { - return ResponseEntity.ok().body(studyService.getNonEvacuatedEnergyParametersInfos(studyUuid)); - } - - @PostMapping(value = "/studies/{studyUuid}/non-evacuated-energy/parameters") - @Operation(summary = "set sensitivity analysis non evacuated energy parameters on study, reset to default ones if empty body") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis parameters non evacuated energy are set")}) - public ResponseEntity setNonEvacuatedEnergyParametersInfos( - @PathVariable("studyUuid") UUID studyUuid, - @RequestBody(required = false) NonEvacuatedEnergyParametersInfos nonEvacuatedEnergyParametersInfos, - @RequestHeader(HEADER_USER_ID) String userId) { - studyService.setNonEvacuatedEnergyParametersInfos(studyUuid, nonEvacuatedEnergyParametersInfos, userId); - return ResponseEntity.ok().build(); - } - - @PostMapping(value = "/studies/{studyUuid}/non-evacuated-energy/provider") - @Operation(summary = "set sensitivity analysis non evacuated energy provider for the specified study, no body means reset to default provider") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy provider is set")}) - public ResponseEntity setNonEvacuatedEnergyProvider(@PathVariable("studyUuid") UUID studyUuid, - @RequestBody(required = false) String provider, - @RequestHeader("userId") String userId) { - studyService.updateNonEvacuatedEnergyProvider(studyUuid, provider, userId); - return ResponseEntity.ok().build(); - } - - @GetMapping(value = "/studies/{studyUuid}/non-evacuated-energy/provider") - @Operation(summary = "Get sensitivity analysis non evacuated energy provider for a specified study, empty string means default provider") - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy provider is returned")}) - public ResponseEntity getNonEvacuatedEnergyProvider(@PathVariable("studyUuid") UUID studyUuid) { - return ResponseEntity.ok().body(studyService.getNonEvacuatedEnergyProvider(studyUuid)); - } - - @GetMapping(value = "/non-evacuated-energy-default-provider") - @Operation(summary = "get sensitivity analysis non evacuated energy default provider value") - @ApiResponses(@ApiResponse(responseCode = "200", description = "The sensitivity analysis non evacuated energy default provider has been found")) - public ResponseEntity getDefaultNonEvacuatedEnergyProvider() { - return ResponseEntity.ok().body(studyService.getDefaultNonEvacuatedEnergyProvider()); - } - @GetMapping(value = "/servers/infos") @Operation(summary = "Get the information of all backend servers (if not filter with view parameter)") @ApiResponses(value = { diff --git a/src/main/java/org/gridsuite/study/server/dto/ComputationType.java b/src/main/java/org/gridsuite/study/server/dto/ComputationType.java index 7dc8ae63fd..70d5f2fd32 100644 --- a/src/main/java/org/gridsuite/study/server/dto/ComputationType.java +++ b/src/main/java/org/gridsuite/study/server/dto/ComputationType.java @@ -14,9 +14,6 @@ public enum ComputationType { SENSITIVITY_ANALYSIS("Sensitivity analysis", "sensitivityAnalysisResultUuid", NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_RESULT, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED), - NON_EVACUATED_ENERGY_ANALYSIS("Non evacuated energy analysis", "nonEvacuatedEnergyResultUuid", - NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_RESULT, - NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_FAILED), SHORT_CIRCUIT("Short circuit analysis", "shortCircuitAnalysisResultUuid", NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_STATUS, NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_RESULT, NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_FAILED), diff --git a/src/main/java/org/gridsuite/study/server/dto/DeleteNodeInfos.java b/src/main/java/org/gridsuite/study/server/dto/DeleteNodeInfos.java index 3546430e58..427ec1d0eb 100644 --- a/src/main/java/org/gridsuite/study/server/dto/DeleteNodeInfos.java +++ b/src/main/java/org/gridsuite/study/server/dto/DeleteNodeInfos.java @@ -32,8 +32,6 @@ public class DeleteNodeInfos { private List sensitivityAnalysisResultUuids = new ArrayList<>(); - private List nonEvacuatedEnergyResultUuids = new ArrayList<>(); - private List shortCircuitAnalysisResultUuids = new ArrayList<>(); private List oneBusShortCircuitAnalysisResultUuids = new ArrayList<>(); @@ -78,10 +76,6 @@ public void addSensitivityAnalysisResultUuid(UUID sensitivityAnalysisResultUuid) sensitivityAnalysisResultUuids.add(sensitivityAnalysisResultUuid); } - public void addNonEvacuatedEnergyResultUuid(UUID nonEvacuatedEnergyResultUuid) { - nonEvacuatedEnergyResultUuids.add(nonEvacuatedEnergyResultUuid); - } - public void addShortCircuitAnalysisResultUuid(UUID shortCircuitAnalysisResultUuid) { shortCircuitAnalysisResultUuids.add(shortCircuitAnalysisResultUuid); } diff --git a/src/main/java/org/gridsuite/study/server/dto/InvalidateNodeInfos.java b/src/main/java/org/gridsuite/study/server/dto/InvalidateNodeInfos.java index 0b58c6be41..70d9d516e7 100644 --- a/src/main/java/org/gridsuite/study/server/dto/InvalidateNodeInfos.java +++ b/src/main/java/org/gridsuite/study/server/dto/InvalidateNodeInfos.java @@ -33,7 +33,6 @@ public class InvalidateNodeInfos { private Set loadFlowResultUuids = new HashSet<>(); private Set securityAnalysisResultUuids = new HashSet<>(); private Set sensitivityAnalysisResultUuids = new HashSet<>(); - private Set nonEvacuatedEnergyResultUuids = new HashSet<>(); private Set shortCircuitAnalysisResultUuids = new HashSet<>(); private Set oneBusShortCircuitAnalysisResultUuids = new HashSet<>(); private Set voltageInitResultUuids = new HashSet<>(); @@ -70,10 +69,6 @@ public List getSensitivityAnalysisResultUuids() { return sensitivityAnalysisResultUuids.stream().toList(); } - public List getNonEvacuatedEnergyResultUuids() { - return nonEvacuatedEnergyResultUuids.stream().toList(); - } - public List getShortCircuitAnalysisResultUuids() { return shortCircuitAnalysisResultUuids.stream().toList(); } @@ -118,10 +113,6 @@ public void addSensitivityAnalysisResultUuid(UUID sensitivityAnalysisResultUuid) sensitivityAnalysisResultUuids.add(sensitivityAnalysisResultUuid); } - public void addNonEvacuatedEnergyResultUuid(UUID nonEvacuatedEnergyResultUuid) { - nonEvacuatedEnergyResultUuids.add(nonEvacuatedEnergyResultUuid); - } - public void addShortCircuitAnalysisResultUuid(UUID shortCircuitAnalysisResultUuid) { shortCircuitAnalysisResultUuids.add(shortCircuitAnalysisResultUuid); } @@ -164,7 +155,6 @@ public void add(InvalidateNodeInfos invalidateNodeInfos) { loadFlowResultUuids.addAll(invalidateNodeInfos.getLoadFlowResultUuids()); securityAnalysisResultUuids.addAll(invalidateNodeInfos.getSecurityAnalysisResultUuids()); sensitivityAnalysisResultUuids.addAll(invalidateNodeInfos.getSensitivityAnalysisResultUuids()); - nonEvacuatedEnergyResultUuids.addAll(invalidateNodeInfos.getNonEvacuatedEnergyResultUuids()); shortCircuitAnalysisResultUuids.addAll(invalidateNodeInfos.getShortCircuitAnalysisResultUuids()); oneBusShortCircuitAnalysisResultUuids.addAll(invalidateNodeInfos.getOneBusShortCircuitAnalysisResultUuids()); voltageInitResultUuids.addAll(invalidateNodeInfos.getVoltageInitResultUuids()); diff --git a/src/main/java/org/gridsuite/study/server/dto/NodeModificationInfos.java b/src/main/java/org/gridsuite/study/server/dto/NodeModificationInfos.java index d1572d6c05..5c7809333d 100644 --- a/src/main/java/org/gridsuite/study/server/dto/NodeModificationInfos.java +++ b/src/main/java/org/gridsuite/study/server/dto/NodeModificationInfos.java @@ -32,8 +32,6 @@ public class NodeModificationInfos { private UUID sensitivityAnalysisUuid; - private UUID nonEvacuatedEnergyUuid; - private UUID shortCircuitAnalysisUuid; private UUID oneBusShortCircuitAnalysisUuid; diff --git a/src/main/java/org/gridsuite/study/server/dto/RootNetworkNodeInfo.java b/src/main/java/org/gridsuite/study/server/dto/RootNetworkNodeInfo.java index 5c6d80807b..b4a58516ce 100644 --- a/src/main/java/org/gridsuite/study/server/dto/RootNetworkNodeInfo.java +++ b/src/main/java/org/gridsuite/study/server/dto/RootNetworkNodeInfo.java @@ -44,8 +44,6 @@ public class RootNetworkNodeInfo { private UUID sensitivityAnalysisResultUuid; - private UUID nonEvacuatedEnergyResultUuid; - private UUID dynamicSimulationResultUuid; private UUID dynamicSecurityAnalysisResultUuid; @@ -67,7 +65,6 @@ public RootNetworkNodeInfoEntity toEntity() { .voltageInitResultUuid(voltageInitResultUuid) .securityAnalysisResultUuid(securityAnalysisResultUuid) .sensitivityAnalysisResultUuid(sensitivityAnalysisResultUuid) - .nonEvacuatedEnergyResultUuid(nonEvacuatedEnergyResultUuid) .dynamicSimulationResultUuid(dynamicSimulationResultUuid) .dynamicSecurityAnalysisResultUuid(dynamicSecurityAnalysisResultUuid) .stateEstimationResultUuid(stateEstimationResultUuid) diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyContingencies.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyContingencies.java deleted file mode 100644 index 29c4294c0c..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyContingencies.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.dto.sensianalysis.EquipmentsContainer; - -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy contingencies") -public class NonEvacuatedEnergyContingencies { - List contingencies; - - boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorCappingsByType.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorCappingsByType.java deleted file mode 100644 index 5da65d18aa..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorCappingsByType.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import com.powsybl.iidm.network.EnergySource; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.dto.sensianalysis.EquipmentsContainer; - -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy generators cappings by type") -public class NonEvacuatedEnergyGeneratorCappingsByType { - List generators; - - EnergySource energySource; - - boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappings.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappings.java deleted file mode 100644 index 3fd77e6344..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappings.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy generators cappings") -public class NonEvacuatedEnergyGeneratorsCappings { - Double sensitivityThreshold; - - @Builder.Default - List generators = new ArrayList<>(); -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyInputData.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyInputData.java deleted file mode 100644 index cfae7ceaf0..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyInputData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import com.powsybl.sensitivity.SensitivityAnalysisParameters; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; -import java.util.Map; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy input data") -public class NonEvacuatedEnergyInputData { - private List nonEvacuatedEnergyStagesDefinition; - - private List nonEvacuatedEnergyStagesSelection; - - private NonEvacuatedEnergyGeneratorsCappings nonEvacuatedEnergyGeneratorsCappings; - - private List nonEvacuatedEnergyMonitoredBranches; - - private List nonEvacuatedEnergyContingencies; - - @Schema(description = "Sensitivity parameters") - private SensitivityAnalysisParameters parameters; - - @Schema(description = "Loadflow model-specific parameters") - private Map loadFlowSpecificParameters; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranches.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranches.java deleted file mode 100644 index 8441aead32..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranches.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.dto.sensianalysis.EquipmentsContainer; - -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy monitored branches") -public class NonEvacuatedEnergyMonitoredBranches { - List branches; - - boolean activated; - - boolean istN; - - String limitNameN; - - @JsonProperty("nCoefficient") - float nCoefficient; - - boolean istNm1; - - String limitNameNm1; - - float nm1Coefficient; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyParametersInfos.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyParametersInfos.java deleted file mode 100644 index 1bcbe02256..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyParametersInfos.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Getter -@Setter -@AllArgsConstructor -@Builder -@NoArgsConstructor -public class NonEvacuatedEnergyParametersInfos { - @Builder.Default - List stagesDefinition = new ArrayList<>(); - - @Builder.Default - List stagesSelection = new ArrayList<>(); - - @Builder.Default - NonEvacuatedEnergyGeneratorsCappings generatorsCappings = new NonEvacuatedEnergyGeneratorsCappings(); - - @Builder.Default - List monitoredBranches = new ArrayList<>(); - - @Builder.Default - List contingencies = new ArrayList<>(); -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStageDefinition.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStageDefinition.java deleted file mode 100644 index 49362ab4b3..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStageDefinition.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.powsybl.iidm.network.EnergySource; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.dto.sensianalysis.EquipmentsContainer; - -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@EqualsAndHashCode -@Schema(description = "Sensitivity analysis non evacuated energy stage definition") -public class NonEvacuatedEnergyStageDefinition { - List generators; - - EnergySource energySource; - - @JsonProperty("pMaxPercents") - List pMaxPercents; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStagesSelection.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStagesSelection.java deleted file mode 100644 index ea8453d56e..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStagesSelection.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Franck Lecuyer - */ -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Schema(description = "Sensitivity analysis non evacuated energy stages selection") -public class NonEvacuatedEnergyStagesSelection { - String name; - - @Builder.Default - List stagesDefinitionIndex = new ArrayList<>(); - - @JsonProperty("pMaxPercentsIndex") - List pMaxPercentsIndex; - - boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStatus.java b/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStatus.java deleted file mode 100644 index 2b3f572b2f..0000000000 --- a/src/main/java/org/gridsuite/study/server/dto/nonevacuatedenergy/NonEvacuatedEnergyStatus.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.dto.nonevacuatedenergy; - -/** - * @author Franck Lecuyer - */ -public enum NonEvacuatedEnergyStatus { - NOT_DONE, - RUNNING, - COMPLETED, - FAILED -} diff --git a/src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NetworkModificationNode.java b/src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NetworkModificationNode.java index afb2560777..3d1537e352 100644 --- a/src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NetworkModificationNode.java +++ b/src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NetworkModificationNode.java @@ -48,8 +48,6 @@ public class NetworkModificationNode extends AbstractNode { private UUID sensitivityAnalysisResultUuid; - private UUID nonEvacuatedEnergyResultUuid; - private UUID dynamicSimulationResultUuid; private UUID dynamicSecurityAnalysisResultUuid; @@ -70,7 +68,6 @@ public void completeDtoFromRootNetworkNodeInfo(RootNetworkNodeInfoEntity rootNet this.setVoltageInitResultUuid(rootNetworkNodeInfoEntity.getVoltageInitResultUuid()); this.setSecurityAnalysisResultUuid(rootNetworkNodeInfoEntity.getSecurityAnalysisResultUuid()); this.setSensitivityAnalysisResultUuid(rootNetworkNodeInfoEntity.getSensitivityAnalysisResultUuid()); - this.setNonEvacuatedEnergyResultUuid(rootNetworkNodeInfoEntity.getNonEvacuatedEnergyResultUuid()); this.setDynamicSimulationResultUuid(rootNetworkNodeInfoEntity.getDynamicSimulationResultUuid()); this.setDynamicSecurityAnalysisResultUuid(rootNetworkNodeInfoEntity.getDynamicSecurityAnalysisResultUuid()); this.setStateEstimationResultUuid(rootNetworkNodeInfoEntity.getStateEstimationResultUuid()); diff --git a/src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java b/src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java index c07c817c1d..eac185c418 100644 --- a/src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java +++ b/src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java @@ -90,9 +90,6 @@ public class RootNetworkNodeInfoEntity { @Column(name = "sensitivityAnalysisResultUuid") private UUID sensitivityAnalysisResultUuid; - @Column(name = "nonEvacuatedEnergyResultUuid") - private UUID nonEvacuatedEnergyResultUuid; - @Column(name = "dynamicSimulationResultUuid") private UUID dynamicSimulationResultUuid; @@ -129,7 +126,6 @@ public RootNetworkNodeInfo toDto() { .loadFlowResultUuid(loadFlowResultUuid) .loadFlowWithRatioTapChangers(loadFlowWithRatioTapChangers) .nodeBuildStatus(nodeBuildStatus.toDto()) - .nonEvacuatedEnergyResultUuid(nonEvacuatedEnergyResultUuid) .oneBusShortCircuitAnalysisResultUuid(oneBusShortCircuitAnalysisResultUuid) .securityAnalysisResultUuid(securityAnalysisResultUuid) .stateEstimationResultUuid(stateEstimationResultUuid) diff --git a/src/main/java/org/gridsuite/study/server/notification/NotificationService.java b/src/main/java/org/gridsuite/study/server/notification/NotificationService.java index 49f2c6d192..ec38e8f5ca 100644 --- a/src/main/java/org/gridsuite/study/server/notification/NotificationService.java +++ b/src/main/java/org/gridsuite/study/server/notification/NotificationService.java @@ -61,9 +61,6 @@ public class NotificationService { public static final String UPDATE_TYPE_SENSITIVITY_ANALYSIS_RESULT = "sensitivityAnalysisResult"; public static final String UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS = "sensitivityAnalysis_status"; public static final String UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED = "sensitivityAnalysis_failed"; - public static final String UPDATE_TYPE_NON_EVACUATED_ENERGY_RESULT = "nonEvacuatedEnergyResult"; - public static final String UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS = "nonEvacuatedEnergy_status"; - public static final String UPDATE_TYPE_NON_EVACUATED_ENERGY_FAILED = "nonEvacuatedEnergy_failed"; public static final String UPDATE_TYPE_SHORT_CIRCUIT_RESULT = "shortCircuitAnalysisResult"; public static final String UPDATE_TYPE_SHORT_CIRCUIT_STATUS = "shortCircuitAnalysis_status"; public static final String UPDATE_TYPE_SHORT_CIRCUIT_FAILED = "shortCircuitAnalysis_failed"; diff --git a/src/main/java/org/gridsuite/study/server/repository/StudyEntity.java b/src/main/java/org/gridsuite/study/server/repository/StudyEntity.java index 6e9824a91c..a239468a55 100644 --- a/src/main/java/org/gridsuite/study/server/repository/StudyEntity.java +++ b/src/main/java/org/gridsuite/study/server/repository/StudyEntity.java @@ -9,7 +9,6 @@ import jakarta.persistence.*; import lombok.*; import org.gridsuite.study.server.dto.RootNetworkIndexationStatus; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyParametersEntity; import org.gridsuite.study.server.repository.rootnetwork.RootNetworkEntity; import org.gridsuite.study.server.repository.voltageinit.StudyVoltageInitParametersEntity; @@ -67,9 +66,6 @@ public class StudyEntity extends AbstractManuallyAssignedIdentifierEntity @Column(name = "sensitivityAnalysisProvider") private String sensitivityAnalysisProvider; - @Column(name = "nonEvacuatedEnergyProvider") - private String nonEvacuatedEnergyProvider; - @Column(name = "dynamicSimulationProvider") private String dynamicSimulationProvider; @@ -111,14 +107,6 @@ public class StudyEntity extends AbstractManuallyAssignedIdentifierEntity @Column(name = "diagramGridLayoutUuid") private UUID diagramGridLayoutUuid; - @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) - @JoinColumn(name = "nonEvacuatedEnergyParametersEntity_id", - referencedColumnName = "id", - foreignKey = @ForeignKey( - name = "nonEvacuatedEnergyParameters_id_fk" - )) - private NonEvacuatedEnergyParametersEntity nonEvacuatedEnergyParameters; - @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "study_voltage_init_parameters_id", foreignKey = @ForeignKey( diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyContingenciesEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyContingenciesEntity.java deleted file mode 100644 index 728d6b69e9..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyContingenciesEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.ForeignKey; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.repository.EquipmentsContainerEmbeddable; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyContingencies") -public class NonEvacuatedEnergyContingenciesEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyContingency", - joinColumns = @JoinColumn(name = "NonEvacuatedEnergyContingenciesId", foreignKey = @ForeignKey(name = "nonEvacuatedEnergyContingenciesEntity_contingencies_fk")) - ) - private List contingencies; - - @Column(name = "activated", columnDefinition = "boolean default true") - private boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsByTypeEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsByTypeEntity.java deleted file mode 100644 index 33111d51e2..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsByTypeEntity.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import com.powsybl.iidm.network.EnergySource; -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.EnumType; -import jakarta.persistence.Enumerated; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.repository.EquipmentsContainerEmbeddable; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyGeneratorsCappingsByType") -public class NonEvacuatedEnergyGeneratorsCappingsByTypeEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @Enumerated(EnumType.STRING) - @Column(name = "energy_source") - private EnergySource energySource; - - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyGenerators", - joinColumns = @JoinColumn(name = "non_evacuated_energy_generators_cappings_by_type_id") - ) - private List generators; - - @Column(name = "activated", columnDefinition = "boolean default true") - private boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsEntity.java deleted file mode 100644 index 63a1fe064f..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyGeneratorsCappingsEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToMany; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyGeneratorsCappings") -public class NonEvacuatedEnergyGeneratorsCappingsEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @Column(name = "sensitivity_threshold") - private double sensitivityThreshold; - - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_evacuated_energy_generators_cappings_id") - private List generatorsCappings = new ArrayList<>(); - - public void addGenerators(NonEvacuatedEnergyGeneratorsCappingsByTypeEntity generatorsCappingsByTypeEntity) { - generatorsCappings.add(generatorsCappingsByTypeEntity); - } -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranchesEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranchesEntity.java deleted file mode 100644 index daf64981c3..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyMonitoredBranchesEntity.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.ForeignKey; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.repository.EquipmentsContainerEmbeddable; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyMonitoredBranches") -public class NonEvacuatedEnergyMonitoredBranchesEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyMonitoredBranch", - joinColumns = @JoinColumn(name = "NonEvacuatedEnergyMonitoredBranchesId", foreignKey = @ForeignKey(name = "nonEvacuatedEnergyMonitoredBranchesEntity_monitoredBranches_fk")) - ) - private List monitoredBranches; - - @Column(name = "ist_n") - private boolean istN; - - @Column(name = "limit_name_n") - private String limitNameN; - - @Column(name = "n_coefficient") - private float nCoefficient; - - @Column(name = "ist_nm1") - private boolean istNm1; - - @Column(name = "limit_name_nm1") - private String limitNameNm1; - - @Column(name = "nm1_coefficient") - private float nm1Coefficient; - - @Column(name = "activated", columnDefinition = "boolean default true") - private boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyParametersEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyParametersEntity.java deleted file mode 100644 index 259f92109f..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyParametersEntity.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToMany; -import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Entity -@Builder -@Table(name = "nonEvacuatedEnergyParameters") -public class NonEvacuatedEnergyParametersEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_Evacuated_Energy_Parameters_id") - private List stagesDefinition; - - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_Evacuated_Energy_Parameters_id") - private List stagesSelection; - - @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_Evacuated_Energy_Parameters_id") - private NonEvacuatedEnergyGeneratorsCappingsEntity generatorsCappings; - - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_Evacuated_Energy_Parameters_id") - private List monitoredBranches; - - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "non_Evacuated_Energy_Parameters_id") - private List contingencies; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStageDefinitionEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStageDefinitionEntity.java deleted file mode 100644 index 6feb3019ae..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStageDefinitionEntity.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import com.powsybl.iidm.network.EnergySource; -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.EnumType; -import jakarta.persistence.Enumerated; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.gridsuite.study.server.repository.EquipmentsContainerEmbeddable; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyStageDefinition") -public class NonEvacuatedEnergyStageDefinitionEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyStageDefinitionGenerators", - joinColumns = @JoinColumn(name = "non_evacuated_energy_stage_definition_id") - ) - private List generators; - - @Enumerated(EnumType.STRING) - @Column(name = "energy_source") - private EnergySource energySource; - - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyStageDefinitionPmaxPercent", - joinColumns = @JoinColumn(name = "non_evacuated_energy_stage_definition_id") - ) - private List pMaxPercents; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStagesSelectionEntity.java b/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStagesSelectionEntity.java deleted file mode 100644 index fd35f3ec34..0000000000 --- a/src/main/java/org/gridsuite/study/server/repository/nonevacuatedenergy/NonEvacuatedEnergyStagesSelectionEntity.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.repository.nonevacuatedenergy; - -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; -import java.util.UUID; - -/** - * @author Franck Lecuyer - */ -@NoArgsConstructor -@Getter -@Setter -@Entity -@Table(name = "nonEvacuatedEnergyStagesSelection") -public class NonEvacuatedEnergyStagesSelectionEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private UUID id; - - @Column(name = "name") - private String name; - - @Column(name = "stages_definition_index") - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyStagesSelectionDefinitionIndex", - joinColumns = @JoinColumn(name = "non_evacuated_energy_stages_selection_id") - ) - List stageDefinitionIndex; - - @Column(name = "pmax_percent_index") - @ElementCollection - @CollectionTable( - name = "nonEvacuatedEnergyStageSelectionPmaxPercentIndex", - joinColumns = @JoinColumn(name = "non_evacuated_energy_stages_selection_id") - ) - List pMaxPercentsIndex; - - @Column(name = "activated", columnDefinition = "boolean default true") - private boolean activated; -} diff --git a/src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java b/src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java index a7e98d391c..5fec7d0fe9 100644 --- a/src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java +++ b/src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java @@ -31,8 +31,6 @@ public interface RootNetworkNodeInfoRepository extends JpaRepository findAllBySensitivityAnalysisResultUuidNotNull(); - List findAllByNonEvacuatedEnergyResultUuidNotNull(); - List findAllByShortCircuitAnalysisResultUuidNotNull(); List findAllByOneBusShortCircuitAnalysisResultUuidNotNull(); diff --git a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java index b8b5ed1f98..576219f3b9 100644 --- a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java +++ b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java @@ -697,21 +697,6 @@ public Consumer> consumeDsaFailed() { return message -> consumeCalculationFailed(message, DYNAMIC_SECURITY_ANALYSIS); } - @Bean - public Consumer> consumeNonEvacuatedEnergyResult() { - return message -> consumeCalculationResult(message, NON_EVACUATED_ENERGY_ANALYSIS); - } - - @Bean - public Consumer> consumeNonEvacuatedEnergyStopped() { - return message -> consumeCalculationStopped(message, NON_EVACUATED_ENERGY_ANALYSIS); - } - - @Bean - public Consumer> consumeNonEvacuatedEnergyFailed() { - return message -> consumeCalculationFailed(message, NON_EVACUATED_ENERGY_ANALYSIS); - } - @Bean public Consumer> consumeSaResult() { return message -> consumeCalculationResult(message, SECURITY_ANALYSIS); diff --git a/src/main/java/org/gridsuite/study/server/service/NonEvacuatedEnergyService.java b/src/main/java/org/gridsuite/study/server/service/NonEvacuatedEnergyService.java deleted file mode 100644 index e51ae6b9ed..0000000000 --- a/src/main/java/org/gridsuite/study/server/service/NonEvacuatedEnergyService.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - Copyright (c) 2022, RTE (http://www.rte-france.com) - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.gridsuite.study.server.service; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.lang3.StringUtils; -import org.gridsuite.study.server.RemoteServicesProperties; -import org.gridsuite.study.server.StudyException; -import org.gridsuite.study.server.dto.NodeReceiver; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyContingencies; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyGeneratorCappingsByType; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyGeneratorsCappings; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyInputData; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyMonitoredBranches; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyStageDefinition; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyParametersInfos; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyStagesSelection; -import org.gridsuite.study.server.dto.nonevacuatedenergy.NonEvacuatedEnergyStatus; -import org.gridsuite.study.server.repository.EquipmentsContainerEmbeddable; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyContingenciesEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyGeneratorsCappingsByTypeEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyGeneratorsCappingsEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyMonitoredBranchesEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyParametersEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyStageDefinitionEntity; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyStagesSelectionEntity; -import org.gridsuite.study.server.service.common.AbstractComputationService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpStatusCodeException; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; - -import java.io.UncheckedIOException; -import java.net.URI; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.UUID; - -import static org.gridsuite.study.server.StudyConstants.*; -import static org.gridsuite.study.server.StudyException.Type.NON_EVACUATED_ENERGY_ERROR; -import static org.gridsuite.study.server.StudyException.Type.NON_EVACUATED_ENERGY_NOT_FOUND; -import static org.gridsuite.study.server.StudyException.Type.NON_EVACUATED_ENERGY_RUNNING; -import static org.gridsuite.study.server.utils.StudyUtils.handleHttpError; - -/** - * @author Franck Lecuyer - */ -@Service -public class NonEvacuatedEnergyService extends AbstractComputationService { - - static final String RESULT_UUID = "resultUuid"; - - private String sensitivityAnalysisServerBaseUri; - - private RestTemplate restTemplate; - - private final ObjectMapper objectMapper; - - @Autowired - NonEvacuatedEnergyService(RemoteServicesProperties remoteServicesProperties, - ObjectMapper objectMapper, - RestTemplate restTemplate) { - this.sensitivityAnalysisServerBaseUri = remoteServicesProperties.getServiceUri("sensitivity-analysis-server"); - this.objectMapper = objectMapper; - this.restTemplate = restTemplate; - } - - public void setSensitivityAnalysisServerBaseUri(String sensitivityAnalysisServerBaseUri) { - this.sensitivityAnalysisServerBaseUri = sensitivityAnalysisServerBaseUri + DELIMITER; - } - - public void assertNonEvacuatedEnergyNotRunning(UUID resultUuid) { - String nonEvacuatedEnergyStatus = getNonEvacuatedEnergyStatus(resultUuid); - if (NonEvacuatedEnergyStatus.RUNNING.name().equals(nonEvacuatedEnergyStatus)) { - throw new StudyException(NON_EVACUATED_ENERGY_RUNNING); - } - } - - public UUID runNonEvacuatedEnergy(UUID nodeUuid, UUID rootNetworkUuid, UUID networkUuid, - String variantId, - UUID reportUuid, - String provider, - NonEvacuatedEnergyInputData nonEvacuatedEnergyInputData, - UUID loadFlowParametersUuid, - String userId) { - String receiver; - try { - receiver = URLEncoder.encode(objectMapper.writeValueAsString(new NodeReceiver(nodeUuid, rootNetworkUuid)), StandardCharsets.UTF_8); - } catch (JsonProcessingException e) { - throw new UncheckedIOException(e); - } - var uriComponentsBuilder = UriComponentsBuilder - .fromPath(DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/networks/{networkUuid}/non-evacuated-energy/run-and-save") - .queryParam("reportUuid", reportUuid.toString()) - .queryParam("reporterId", nodeUuid.toString()) - .queryParam("reportType", StudyService.ReportType.NON_EVACUATED_ENERGY_ANALYSIS.reportKey); - if (!provider.isEmpty()) { - uriComponentsBuilder.queryParam("provider", provider); - } - if (loadFlowParametersUuid != null) { - uriComponentsBuilder.queryParam("loadFlowParametersUuid", loadFlowParametersUuid); - } - if (!StringUtils.isBlank(variantId)) { - uriComponentsBuilder.queryParam(QUERY_PARAM_VARIANT_ID, variantId); - } - var path = uriComponentsBuilder - .queryParam(QUERY_PARAM_RECEIVER, receiver) - .buildAndExpand(networkUuid).toUriString(); - - HttpHeaders headers = new HttpHeaders(); - headers.set(HEADER_USER_ID, userId); - headers.setContentType(MediaType.APPLICATION_JSON); - - HttpEntity httpEntity = new HttpEntity<>(nonEvacuatedEnergyInputData, headers); - - return restTemplate.exchange(sensitivityAnalysisServerBaseUri + path, HttpMethod.POST, httpEntity, UUID.class).getBody(); - } - - public String getNonEvacuatedEnergyResult(UUID resultUuid) { - String result; - if (resultUuid == null) { - return null; - } - - // initializing from uri string (not from path string) allows build() to escape selector content - URI uri = UriComponentsBuilder.fromUriString(sensitivityAnalysisServerBaseUri) - .pathSegment(SENSITIVITY_ANALYSIS_API_VERSION, "non-evacuated-energy", "results", resultUuid.toString()) - .build().encode().toUri(); - try { - result = restTemplate.getForObject(uri, String.class); - } catch (HttpStatusCodeException e) { - if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { - throw new StudyException(NON_EVACUATED_ENERGY_NOT_FOUND); - } else { - throw handleHttpError(e, NON_EVACUATED_ENERGY_ERROR); - } - } - return result; - } - - public String getNonEvacuatedEnergyStatus(UUID resultUuid) { - String result; - - if (resultUuid == null) { - return null; - } - - String path = UriComponentsBuilder.fromPath(DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/non-evacuated-energy/results/{resultUuid}/status") - .buildAndExpand(resultUuid).toUriString(); - try { - result = restTemplate.getForObject(sensitivityAnalysisServerBaseUri + path, String.class); - } catch (HttpStatusCodeException e) { - if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { - throw new StudyException(NON_EVACUATED_ENERGY_NOT_FOUND); - } - throw e; - } - return result; - } - - public void stopNonEvacuatedEnergy(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, UUID resultUuid, String userId) { - Objects.requireNonNull(studyUuid); - Objects.requireNonNull(nodeUuid); - - if (resultUuid == null) { - return; - } - - HttpHeaders headers = new HttpHeaders(); - headers.set(HEADER_USER_ID, userId); - headers.setContentType(MediaType.APPLICATION_JSON); - - String receiver; - try { - receiver = URLEncoder.encode(objectMapper.writeValueAsString(new NodeReceiver(nodeUuid, rootNetworkUuid)), StandardCharsets.UTF_8); - } catch (JsonProcessingException e) { - throw new UncheckedIOException(e); - } - String path = UriComponentsBuilder - .fromPath(DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/non-evacuated-energy/results/{resultUuid}/stop") - .queryParam(QUERY_PARAM_RECEIVER, receiver).buildAndExpand(resultUuid).toUriString(); - - restTemplate.exchange(sensitivityAnalysisServerBaseUri + path, HttpMethod.PUT, new HttpEntity<>(headers), Void.class); - } - - public void invalidateNonEvacuatedEnergyStatus(List uuids) { - if (!uuids.isEmpty()) { - String path = UriComponentsBuilder - .fromPath(DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/non-evacuated-energy/results/invalidate-status") - .queryParam(RESULT_UUID, uuids).build().toUriString(); - - restTemplate.put(sensitivityAnalysisServerBaseUri + path, Void.class); - } - } - - public void deleteNonEvacuatedEnergyResults(List resultsUuids) { - deleteCalculationResults(resultsUuids, DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/non-evacuated-energy/results", restTemplate, sensitivityAnalysisServerBaseUri); - } - - public void deleteAllNonEvacuatedEnergyResults() { - deleteNonEvacuatedEnergyResults(null); - } - - public Integer getNonEvacuatedEnergyAnalysisResultsCount() { - String path = UriComponentsBuilder - .fromPath(DELIMITER + SENSITIVITY_ANALYSIS_API_VERSION + "/supervision/non-evacuated-energy/results-count").toUriString(); - return restTemplate.getForObject(sensitivityAnalysisServerBaseUri + path, Integer.class); - } - - public static NonEvacuatedEnergyParametersEntity toEntity(NonEvacuatedEnergyParametersInfos parameters) { - Objects.requireNonNull(parameters); - - List stageDefinitionEntities = new ArrayList<>(); - if (parameters.getStagesDefinition() != null) { - for (NonEvacuatedEnergyStageDefinition stageDefinition : parameters.getStagesDefinition()) { - NonEvacuatedEnergyStageDefinitionEntity stageDefinitionEntity = new NonEvacuatedEnergyStageDefinitionEntity(); - stageDefinitionEntity.setEnergySource(stageDefinition.getEnergySource()); - stageDefinitionEntity.setGenerators(EquipmentsContainerEmbeddable.toEmbeddableContainerEquipments(stageDefinition.getGenerators())); - stageDefinitionEntity.setPMaxPercents(stageDefinition.getPMaxPercents()); - stageDefinitionEntities.add(stageDefinitionEntity); - } - } - - List stagesSelectionEntities = new ArrayList<>(); - if (parameters.getStagesSelection() != null) { - for (NonEvacuatedEnergyStagesSelection stagesSelection : parameters.getStagesSelection()) { - NonEvacuatedEnergyStagesSelectionEntity stagesSelectionEntity = new NonEvacuatedEnergyStagesSelectionEntity(); - stagesSelectionEntity.setName(stagesSelection.getName()); - stagesSelectionEntity.setActivated(stagesSelection.isActivated()); - stagesSelectionEntity.setPMaxPercentsIndex(stagesSelection.getPMaxPercentsIndex()); - stagesSelectionEntity.setStageDefinitionIndex(stagesSelection.getStagesDefinitionIndex()); - stagesSelectionEntities.add(stagesSelectionEntity); - } - } - - NonEvacuatedEnergyGeneratorsCappingsEntity generatorsCappingsEntity = new NonEvacuatedEnergyGeneratorsCappingsEntity(); - if (parameters.getGeneratorsCappings() != null) { - generatorsCappingsEntity.setSensitivityThreshold(parameters.getGeneratorsCappings().getSensitivityThreshold()); - for (NonEvacuatedEnergyGeneratorCappingsByType generatorsCappingsByType : parameters.getGeneratorsCappings().getGenerators()) { - NonEvacuatedEnergyGeneratorsCappingsByTypeEntity generatorsCappingsByTypeEntity = new NonEvacuatedEnergyGeneratorsCappingsByTypeEntity(); - generatorsCappingsByTypeEntity.setActivated(generatorsCappingsByType.isActivated()); - generatorsCappingsByTypeEntity.setEnergySource(generatorsCappingsByType.getEnergySource()); - generatorsCappingsByTypeEntity.setGenerators(EquipmentsContainerEmbeddable.toEmbeddableContainerEquipments(generatorsCappingsByType.getGenerators())); - generatorsCappingsEntity.addGenerators(generatorsCappingsByTypeEntity); - } - } - - List monitoredBranchesEntities = new ArrayList<>(); - if (parameters.getMonitoredBranches() != null) { - for (NonEvacuatedEnergyMonitoredBranches monitoredBranches : parameters.getMonitoredBranches()) { - NonEvacuatedEnergyMonitoredBranchesEntity monitoredBranchesEntity = new NonEvacuatedEnergyMonitoredBranchesEntity(); - monitoredBranchesEntity.setActivated(monitoredBranches.isActivated()); - monitoredBranchesEntity.setIstN(monitoredBranches.isIstN()); - monitoredBranchesEntity.setLimitNameN(monitoredBranches.getLimitNameN()); - monitoredBranchesEntity.setNCoefficient(monitoredBranches.getNCoefficient()); - monitoredBranchesEntity.setIstNm1(monitoredBranches.isIstNm1()); - monitoredBranchesEntity.setLimitNameNm1(monitoredBranches.getLimitNameNm1()); - monitoredBranchesEntity.setNm1Coefficient(monitoredBranches.getNm1Coefficient()); - monitoredBranchesEntity.setMonitoredBranches(EquipmentsContainerEmbeddable.toEmbeddableContainerEquipments(monitoredBranches.getBranches())); - monitoredBranchesEntities.add(monitoredBranchesEntity); - } - } - - List contingenciesEntities = new ArrayList<>(); - if (parameters.getContingencies() != null) { - for (NonEvacuatedEnergyContingencies contingencies : parameters.getContingencies()) { - NonEvacuatedEnergyContingenciesEntity contingenciesEntity = new NonEvacuatedEnergyContingenciesEntity(); - contingenciesEntity.setActivated(contingencies.isActivated()); - contingenciesEntity.setContingencies(EquipmentsContainerEmbeddable.toEmbeddableContainerEquipments(contingencies.getContingencies())); - contingenciesEntities.add(contingenciesEntity); - } - } - - return new NonEvacuatedEnergyParametersEntity(null, stageDefinitionEntities, stagesSelectionEntities, - generatorsCappingsEntity, monitoredBranchesEntities, contingenciesEntities); - } - - public static NonEvacuatedEnergyParametersInfos fromEntity(NonEvacuatedEnergyParametersEntity entity) { - Objects.requireNonNull(entity); - - List stageDefinitionParam = entity.getStagesDefinition().stream().map(stageDefinitionEntity -> - new NonEvacuatedEnergyStageDefinition(EquipmentsContainerEmbeddable.fromEmbeddableContainerEquipments(stageDefinitionEntity.getGenerators()), - stageDefinitionEntity.getEnergySource(), new ArrayList<>(stageDefinitionEntity.getPMaxPercents())) - ).toList(); - - List stagesSelectionParam = entity.getStagesSelection().stream().map(stagesSelectionEntity -> - new NonEvacuatedEnergyStagesSelection(stagesSelectionEntity.getName(), - new ArrayList<>(stagesSelectionEntity.getStageDefinitionIndex()), - new ArrayList<>(stagesSelectionEntity.getPMaxPercentsIndex()), - stagesSelectionEntity.isActivated()) - ).toList(); - - NonEvacuatedEnergyGeneratorsCappings generatorsCappingsParam = new NonEvacuatedEnergyGeneratorsCappings(entity.getGeneratorsCappings().getSensitivityThreshold(), - entity.getGeneratorsCappings().getGeneratorsCappings().stream().map(generatorsCappingsByTypeEntity -> - new NonEvacuatedEnergyGeneratorCappingsByType(EquipmentsContainerEmbeddable.fromEmbeddableContainerEquipments(generatorsCappingsByTypeEntity.getGenerators()), - generatorsCappingsByTypeEntity.getEnergySource(), generatorsCappingsByTypeEntity.isActivated())).toList()); - - List monitoredBranchesParam = entity.getMonitoredBranches().stream().map(monitoredBranchesEntity -> - new NonEvacuatedEnergyMonitoredBranches(EquipmentsContainerEmbeddable.fromEmbeddableContainerEquipments(monitoredBranchesEntity.getMonitoredBranches()), - monitoredBranchesEntity.isActivated(), monitoredBranchesEntity.isIstN(), monitoredBranchesEntity.getLimitNameN(), monitoredBranchesEntity.getNCoefficient(), - monitoredBranchesEntity.isIstNm1(), monitoredBranchesEntity.getLimitNameNm1(), monitoredBranchesEntity.getNm1Coefficient()) - ).toList(); - - List contingenciesParam = entity.getContingencies().stream().map(contingenciesEntity -> - new NonEvacuatedEnergyContingencies(EquipmentsContainerEmbeddable.fromEmbeddableContainerEquipments(contingenciesEntity.getContingencies()), contingenciesEntity.isActivated()) - ).toList(); - - return new NonEvacuatedEnergyParametersInfos(stageDefinitionParam, stagesSelectionParam, generatorsCappingsParam, - monitoredBranchesParam, contingenciesParam); - } - - public static NonEvacuatedEnergyParametersInfos getDefaultNonEvacuatedEnergyParametersInfos() { - return NonEvacuatedEnergyParametersInfos.builder() - .stagesDefinition(List.of()) - .stagesSelection(List.of()) - .generatorsCappings(new NonEvacuatedEnergyGeneratorsCappings(0., List.of())) - .monitoredBranches(List.of()) - .contingencies(List.of()) - .build(); - } - - @Override - public List getEnumValues(String enumName, UUID resultUuidOpt) { - return List.of(); - } -} diff --git a/src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java b/src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java index 2c01b50c58..d87de33ab3 100644 --- a/src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java +++ b/src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java @@ -60,7 +60,6 @@ public class RootNetworkNodeInfoService { private final LoadFlowService loadFlowService; private final SecurityAnalysisService securityAnalysisService; private final SensitivityAnalysisService sensitivityAnalysisService; - private final NonEvacuatedEnergyService nonEvacuatedEnergyService; private final ShortCircuitService shortCircuitService; private final VoltageInitService voltageInitService; private final DynamicSimulationService dynamicSimulationService; @@ -74,7 +73,6 @@ public RootNetworkNodeInfoService(RootNetworkNodeInfoRepository rootNetworkNodeI LoadFlowService loadFlowService, SecurityAnalysisService securityAnalysisService, SensitivityAnalysisService sensitivityAnalysisService, - NonEvacuatedEnergyService nonEvacuatedEnergyService, ShortCircuitService shortCircuitService, VoltageInitService voltageInitService, DynamicSimulationService dynamicSimulationService, @@ -87,7 +85,6 @@ public RootNetworkNodeInfoService(RootNetworkNodeInfoRepository rootNetworkNodeI this.loadFlowService = loadFlowService; this.securityAnalysisService = securityAnalysisService; this.sensitivityAnalysisService = sensitivityAnalysisService; - this.nonEvacuatedEnergyService = nonEvacuatedEnergyService; this.shortCircuitService = shortCircuitService; this.voltageInitService = voltageInitService; this.dynamicSimulationService = dynamicSimulationService; @@ -154,8 +151,6 @@ public void updateComputationResultUuid(UUID nodeUuid, UUID rootNetworkUuid, UUI case SECURITY_ANALYSIS -> rootNetworkNodeInfoEntity.setSecurityAnalysisResultUuid(computationResultUuid); case SENSITIVITY_ANALYSIS -> rootNetworkNodeInfoEntity.setSensitivityAnalysisResultUuid(computationResultUuid); - case NON_EVACUATED_ENERGY_ANALYSIS -> - rootNetworkNodeInfoEntity.setNonEvacuatedEnergyResultUuid(computationResultUuid); case SHORT_CIRCUIT -> rootNetworkNodeInfoEntity.setShortCircuitAnalysisResultUuid(computationResultUuid); case SHORT_CIRCUIT_ONE_BUS -> rootNetworkNodeInfoEntity.setOneBusShortCircuitAnalysisResultUuid(computationResultUuid); @@ -198,11 +193,6 @@ public void fillDeleteNodeInfo(UUID nodeUuid, DeleteNodeInfos deleteNodeInfos) { deleteNodeInfos.addSensitivityAnalysisResultUuid(sensitivityAnalysisResultUuid); } - UUID nonEvacuatedEnergyResultUuid = getComputationResultUuid(rootNetworkNodeInfoEntity, NON_EVACUATED_ENERGY_ANALYSIS); - if (nonEvacuatedEnergyResultUuid != null) { - deleteNodeInfos.addNonEvacuatedEnergyResultUuid(nonEvacuatedEnergyResultUuid); - } - UUID shortCircuitAnalysisResultUuid = getComputationResultUuid(rootNetworkNodeInfoEntity, SHORT_CIRCUIT); if (shortCircuitAnalysisResultUuid != null) { deleteNodeInfos.addShortCircuitAnalysisResultUuid(shortCircuitAnalysisResultUuid); @@ -281,7 +271,6 @@ private static void invalidateComputationResults(RootNetworkNodeInfoEntity rootN } rootNetworkNodeInfoEntity.setSecurityAnalysisResultUuid(null); rootNetworkNodeInfoEntity.setSensitivityAnalysisResultUuid(null); - rootNetworkNodeInfoEntity.setNonEvacuatedEnergyResultUuid(null); rootNetworkNodeInfoEntity.setShortCircuitAnalysisResultUuid(null); rootNetworkNodeInfoEntity.setOneBusShortCircuitAnalysisResultUuid(null); rootNetworkNodeInfoEntity.setDynamicSimulationResultUuid(null); @@ -329,8 +318,6 @@ private void fillComputationResultUuids(RootNetworkNodeInfoEntity rootNetworkNod .ifPresent(invalidateNodeInfos::addSecurityAnalysisResultUuid); Optional.ofNullable(getComputationResultUuid(rootNetworkNodeInfoEntity, SENSITIVITY_ANALYSIS)) .ifPresent(invalidateNodeInfos::addSensitivityAnalysisResultUuid); - Optional.ofNullable(getComputationResultUuid(rootNetworkNodeInfoEntity, NON_EVACUATED_ENERGY_ANALYSIS)) - .ifPresent(invalidateNodeInfos::addNonEvacuatedEnergyResultUuid); Optional.ofNullable(getComputationResultUuid(rootNetworkNodeInfoEntity, SHORT_CIRCUIT)) .ifPresent(invalidateNodeInfos::addShortCircuitAnalysisResultUuid); Optional.ofNullable(getComputationResultUuid(rootNetworkNodeInfoEntity, SHORT_CIRCUIT_ONE_BUS)) @@ -357,7 +344,6 @@ private static UUID getComputationResultUuid(RootNetworkNodeInfoEntity rootNetwo case LOAD_FLOW -> rootNetworkNodeInfoEntity.getLoadFlowResultUuid(); case SECURITY_ANALYSIS -> rootNetworkNodeInfoEntity.getSecurityAnalysisResultUuid(); case SENSITIVITY_ANALYSIS -> rootNetworkNodeInfoEntity.getSensitivityAnalysisResultUuid(); - case NON_EVACUATED_ENERGY_ANALYSIS -> rootNetworkNodeInfoEntity.getNonEvacuatedEnergyResultUuid(); case SHORT_CIRCUIT -> rootNetworkNodeInfoEntity.getShortCircuitAnalysisResultUuid(); case SHORT_CIRCUIT_ONE_BUS -> rootNetworkNodeInfoEntity.getOneBusShortCircuitAnalysisResultUuid(); case VOLTAGE_INITIALIZATION -> rootNetworkNodeInfoEntity.getVoltageInitResultUuid(); @@ -466,9 +452,6 @@ public void updateRootNetworkNode(UUID nodeUuid, UUID rootNetworkUuid, RootNetwo if (rootNetworkNodeInfo.getSensitivityAnalysisResultUuid() != null) { rootNetworkNodeInfoEntity.setSensitivityAnalysisResultUuid(rootNetworkNodeInfo.getSensitivityAnalysisResultUuid()); } - if (rootNetworkNodeInfo.getNonEvacuatedEnergyResultUuid() != null) { - rootNetworkNodeInfoEntity.setNonEvacuatedEnergyResultUuid(rootNetworkNodeInfo.getNonEvacuatedEnergyResultUuid()); - } if (rootNetworkNodeInfo.getShortCircuitAnalysisResultUuid() != null) { rootNetworkNodeInfoEntity.setShortCircuitAnalysisResultUuid(rootNetworkNodeInfo.getShortCircuitAnalysisResultUuid()); } @@ -499,7 +482,6 @@ public Stream> getDeleteRootNetworkNodeInfosFutures(List studyServerExecutionService.runAsync(() -> securityAnalysisService.deleteSecurityAnalysisResults(rootNetworkNodeInfo.stream() .map(RootNetworkNodeInfo::getSecurityAnalysisResultUuid).filter(Objects::nonNull).toList())), studyServerExecutionService.runAsync(() -> sensitivityAnalysisService.deleteSensitivityAnalysisResults(rootNetworkNodeInfo.stream().map(RootNetworkNodeInfo::getSensitivityAnalysisResultUuid).filter(Objects::nonNull).toList())), - studyServerExecutionService.runAsync(() -> nonEvacuatedEnergyService.deleteNonEvacuatedEnergyResults(rootNetworkNodeInfo.stream().map(RootNetworkNodeInfo::getNonEvacuatedEnergyResultUuid).filter(Objects::nonNull).toList())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(rootNetworkNodeInfo.stream().map(RootNetworkNodeInfo::getShortCircuitAnalysisResultUuid).filter(Objects::nonNull).toList())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(rootNetworkNodeInfo.stream().map(RootNetworkNodeInfo::getOneBusShortCircuitAnalysisResultUuid).filter(Objects::nonNull).toList())), studyServerExecutionService.runAsync(() -> voltageInitService.deleteVoltageInitResults(rootNetworkNodeInfo.stream().map(RootNetworkNodeInfo::getVoltageInitResultUuid).filter(Objects::nonNull).toList())), @@ -531,7 +513,6 @@ public void assertComputationNotRunning(UUID nodeUuid, UUID rootNetworkUuid) { dynamicSimulationService.assertDynamicSimulationNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, DYNAMIC_SIMULATION)); dynamicSecurityAnalysisService.assertDynamicSecurityAnalysisNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, DYNAMIC_SECURITY_ANALYSIS)); sensitivityAnalysisService.assertSensitivityAnalysisNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, SENSITIVITY_ANALYSIS)); - nonEvacuatedEnergyService.assertNonEvacuatedEnergyNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS)); shortCircuitService.assertShortCircuitAnalysisNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, SHORT_CIRCUIT), getComputationResultUuid(nodeUuid, rootNetworkUuid, SHORT_CIRCUIT_ONE_BUS)); voltageInitService.assertVoltageInitNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, VOLTAGE_INITIALIZATION)); stateEstimationService.assertStateEstimationNotRunning(getComputationResultUuid(nodeUuid, rootNetworkUuid, STATE_ESTIMATION)); @@ -604,12 +585,6 @@ public String getSensitivityResultsFilterOptions(UUID nodeUuid, UUID rootNetwork return sensitivityAnalysisService.getSensitivityResultsFilterOptions(resultUuid, selector); } - @Transactional(readOnly = true) - public String getNonEvacuatedEnergyResult(UUID nodeUuid, UUID rootNetworkUuid) { - UUID resultUuid = getComputationResultUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS); - return nonEvacuatedEnergyService.getNonEvacuatedEnergyResult(resultUuid); - } - @Transactional(readOnly = true) public String getShortCircuitAnalysisResult(ResultParameters resultParameters, FaultResultsMode mode, ShortcircuitAnalysisType type, String filters, String globalFilters, boolean paged, Pageable pageable) { RootNetworkNodeInfoEntity rootNetworkNodeInfoEntity = rootNetworkNodeInfoRepository.findByNodeInfoIdAndRootNetworkId(resultParameters.getNodeUuid(), resultParameters.getRootNetworkUuid()).orElse(null); @@ -700,12 +675,6 @@ public String getSensitivityAnalysisStatus(UUID nodeUuid, UUID rootNetworkUuid) return sensitivityAnalysisService.getSensitivityAnalysisStatus(resultUuid); } - @Transactional(readOnly = true) - public String getNonEvacuatedEnergyStatus(UUID nodeUuid, UUID rootNetworkUuid) { - UUID resultUuid = getComputationResultUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS); - return nonEvacuatedEnergyService.getNonEvacuatedEnergyStatus(resultUuid); - } - @Transactional(readOnly = true) public String getShortCircuitAnalysisStatus(UUID nodeUuid, UUID rootNetworkUuid, ShortcircuitAnalysisType type) { UUID resultUuid = getComputationResultUuid(nodeUuid, rootNetworkUuid, @@ -746,12 +715,6 @@ public void stopSensitivityAnalysis(UUID studyUuid, UUID nodeUuid, UUID rootNetw sensitivityAnalysisService.stopSensitivityAnalysis(studyUuid, nodeUuid, rootNetworkUuid, resultUuid, userId); } - @Transactional - public void stopNonEvacuatedEnergy(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, String userId) { - UUID resultUuid = getComputationResultUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS); - nonEvacuatedEnergyService.stopNonEvacuatedEnergy(studyUuid, nodeUuid, rootNetworkUuid, resultUuid, userId); - } - @Transactional public void stopShortCircuitAnalysis(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, String userId) { UUID resultUuid = getComputationResultUuid(nodeUuid, rootNetworkUuid, SHORT_CIRCUIT); diff --git a/src/main/java/org/gridsuite/study/server/service/StudyService.java b/src/main/java/org/gridsuite/study/server/service/StudyService.java index c5b89334cf..801491ac07 100644 --- a/src/main/java/org/gridsuite/study/server/service/StudyService.java +++ b/src/main/java/org/gridsuite/study/server/service/StudyService.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.powsybl.iidm.network.ThreeSides; import com.powsybl.loadflow.LoadFlowParameters; -import com.powsybl.sensitivity.SensitivityAnalysisParameters; import io.micrometer.common.util.StringUtils; import jakarta.servlet.http.HttpServletResponse; import lombok.NonNull; @@ -34,7 +33,6 @@ import org.gridsuite.study.server.dto.modification.ModificationsSearchResultByNode; import org.gridsuite.study.server.dto.modification.NetworkModificationResult; import org.gridsuite.study.server.dto.modification.NetworkModificationsResult; -import org.gridsuite.study.server.dto.nonevacuatedenergy.*; import org.gridsuite.study.server.dto.sequence.NodeSequenceType; import org.gridsuite.study.server.dto.voltageinit.parameters.StudyVoltageInitParameters; import org.gridsuite.study.server.dto.voltageinit.parameters.VoltageInitParametersInfos; @@ -50,7 +48,6 @@ import org.gridsuite.study.server.notification.NotificationService; import org.gridsuite.study.server.notification.dto.NetworkImpactsInfos; import org.gridsuite.study.server.repository.*; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyParametersEntity; import org.gridsuite.study.server.repository.rootnetwork.RootNetworkEntity; import org.gridsuite.study.server.repository.rootnetwork.RootNetworkRequestEntity; import org.gridsuite.study.server.repository.voltageinit.StudyVoltageInitParametersEntity; @@ -108,8 +105,6 @@ public class StudyService { StudyServerExecutionService studyServerExecutionService; - private final String defaultNonEvacuatedEnergyProvider; - private final String defaultDynamicSimulationProvider; private final StudyRepository studyRepository; @@ -131,7 +126,6 @@ public class StudyService { private final DynamicSimulationService dynamicSimulationService; private final DynamicSecurityAnalysisService dynamicSecurityAnalysisService; private final SensitivityAnalysisService sensitivityAnalysisService; - private final NonEvacuatedEnergyService nonEvacuatedEnergyService; private final DynamicSimulationEventService dynamicSimulationEventService; private final StudyConfigService studyConfigService; private final DiagramGridLayoutService diagramGridLayoutService; @@ -154,7 +148,6 @@ public enum ReportType { SENSITIVITY_ANALYSIS("SensitivityAnalysis"), DYNAMIC_SIMULATION("DynamicSimulation"), DYNAMIC_SECURITY_ANALYSIS("DynamicSecurityAnalysis"), - NON_EVACUATED_ENERGY_ANALYSIS("NonEvacuatedEnergyAnalysis"), VOLTAGE_INITIALIZATION("VoltageInit"), STATE_ESTIMATION("StateEstimation"); @@ -169,7 +162,6 @@ public enum ReportType { @Autowired public StudyService( - @Value("${non-evacuated-energy.default-provider}") String defaultNonEvacuatedEnergyProvider, @Value("${dynamic-simulation.default-provider}") String defaultDynamicSimulationProvider, StudyRepository studyRepository, StudyCreationRequestRepository studyCreationRequestRepository, @@ -193,7 +185,6 @@ public StudyService( ActionsService actionsService, CaseService caseService, SensitivityAnalysisService sensitivityAnalysisService, - NonEvacuatedEnergyService nonEvacuatedEnergyService, DynamicSimulationService dynamicSimulationService, DynamicSecurityAnalysisService dynamicSecurityAnalysisService, VoltageInitService voltageInitService, @@ -206,7 +197,6 @@ public StudyService( RootNetworkService rootNetworkService, RootNetworkNodeInfoService rootNetworkNodeInfoService, DirectoryService directoryService) { - this.defaultNonEvacuatedEnergyProvider = defaultNonEvacuatedEnergyProvider; this.defaultDynamicSimulationProvider = defaultDynamicSimulationProvider; this.studyRepository = studyRepository; this.studyCreationRequestRepository = studyCreationRequestRepository; @@ -221,7 +211,6 @@ public StudyService( this.studyServerExecutionService = studyServerExecutionService; this.notificationService = notificationService; this.sensitivityAnalysisService = sensitivityAnalysisService; - this.nonEvacuatedEnergyService = nonEvacuatedEnergyService; this.loadflowService = loadflowService; this.shortCircuitService = shortCircuitService; this.singleLineDiagramService = singleLineDiagramService; @@ -744,10 +733,6 @@ private StudyEntity duplicateStudyEntity(StudyEntity sourceStudyEntity, UUID new copiedSensitivityAnalysisParametersUuid = sensitivityAnalysisService.duplicateSensitivityAnalysisParameters(sourceStudyEntity.getSensitivityAnalysisParametersUuid()); } - NonEvacuatedEnergyParametersInfos nonEvacuatedEnergyParametersInfos = sourceStudyEntity.getNonEvacuatedEnergyParameters() == null ? - NonEvacuatedEnergyService.getDefaultNonEvacuatedEnergyParametersInfos() : - NonEvacuatedEnergyService.fromEntity(sourceStudyEntity.getNonEvacuatedEnergyParameters()); - UUID copiedVoltageInitParametersUuid = null; if (sourceStudyEntity.getVoltageInitParametersUuid() != null) { copiedVoltageInitParametersUuid = voltageInitService.duplicateVoltageInitParameters(sourceStudyEntity.getVoltageInitParametersUuid()); @@ -777,7 +762,6 @@ private StudyEntity duplicateStudyEntity(StudyEntity sourceStudyEntity, UUID new .id(newStudyId) .loadFlowParametersUuid(copiedLoadFlowParametersUuid) .securityAnalysisParametersUuid(copiedSecurityAnalysisParametersUuid) - .nonEvacuatedEnergyProvider(sourceStudyEntity.getNonEvacuatedEnergyProvider()) .dynamicSimulationProvider(sourceStudyEntity.getDynamicSimulationProvider()) .dynamicSimulationParameters(DynamicSimulationService.toEntity(dynamicSimulationParameters, objectMapper)) .shortCircuitParametersUuid(copiedShortCircuitParametersUuid) @@ -785,7 +769,6 @@ private StudyEntity duplicateStudyEntity(StudyEntity sourceStudyEntity, UUID new .sensitivityAnalysisParametersUuid(copiedSensitivityAnalysisParametersUuid) .networkVisualizationParametersUuid(copiedNetworkVisualizationParametersUuid) .spreadsheetConfigCollectionUuid(copiedSpreadsheetConfigCollectionUuid) - .nonEvacuatedEnergyParameters(NonEvacuatedEnergyService.toEntity(nonEvacuatedEnergyParametersInfos)) .stateEstimationParametersUuid(copiedStateEstimationParametersUuid) .diagramGridLayoutUuid(diagramGridLayoutId) .build()); @@ -1205,17 +1188,6 @@ public void createOrUpdateNetworkVisualizationParameters(StudyEntity studyEntity } } - @Transactional(readOnly = true) - public NonEvacuatedEnergyParametersInfos getNonEvacuatedEnergyParametersInfos(UUID studyUuid) { - return getNonEvacuatedEnergyParametersInfos(studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND))); - } - - private NonEvacuatedEnergyParametersInfos getNonEvacuatedEnergyParametersInfos(StudyEntity studyEntity) { - return studyEntity.getNonEvacuatedEnergyParameters() != null ? - NonEvacuatedEnergyService.fromEntity(studyEntity.getNonEvacuatedEnergyParameters()) : - NonEvacuatedEnergyService.getDefaultNonEvacuatedEnergyParametersInfos(); - } - @Transactional public boolean setLoadFlowParameters(UUID studyUuid, String parameters, String userId) { StudyEntity studyEntity = studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND)); @@ -1223,13 +1195,11 @@ public boolean setLoadFlowParameters(UUID studyUuid, String parameters, String u invalidateAllStudyLoadFlowStatus(studyUuid); invalidateSecurityAnalysisStatusOnAllNodes(studyUuid); invalidateSensitivityAnalysisStatusOnAllNodes(studyUuid); - invalidateNonEvacuatedEnergyAnalysisStatusOnAllNodes(studyUuid); invalidateDynamicSimulationStatusOnAllNodes(studyUuid); invalidateDynamicSecurityAnalysisStatusOnAllNodes(studyUuid); notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_LOADFLOW_STATUS); notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_SECURITY_ANALYSIS_STATUS); notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS); - notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_DYNAMIC_SIMULATION_STATUS); notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_DYNAMIC_SECURITY_ANALYSIS_STATUS); notificationService.emitElementUpdated(studyUuid, userId); @@ -1286,10 +1256,6 @@ public String getDefaultSensitivityAnalysisProvider() { return sensitivityAnalysisService.getSensitivityAnalysisDefaultProvider(); } - public String getDefaultNonEvacuatedEnergyProvider() { - return defaultNonEvacuatedEnergyProvider; - } - public String getDefaultDynamicSimulationProvider() { return defaultDynamicSimulationProvider; } @@ -1515,10 +1481,6 @@ public void invalidateSensitivityAnalysisStatusOnAllNodes(UUID studyUuid) { sensitivityAnalysisService.invalidateSensitivityAnalysisStatus(rootNetworkNodeInfoService.getComputationResultUuids(studyUuid, SENSITIVITY_ANALYSIS)); } - public void invalidateNonEvacuatedEnergyAnalysisStatusOnAllNodes(UUID studyUuid) { - nonEvacuatedEnergyService.invalidateNonEvacuatedEnergyStatus(rootNetworkNodeInfoService.getComputationResultUuids(studyUuid, NON_EVACUATED_ENERGY_ANALYSIS)); - } - public void invalidateDynamicSimulationStatusOnAllNodes(UUID studyUuid) { dynamicSimulationService.invalidateStatus(rootNetworkNodeInfoService.getComputationResultUuids(studyUuid, DYNAMIC_SIMULATION)); } @@ -1583,7 +1545,6 @@ private StudyEntity saveStudyThenCreateBasicTree(UUID studyUuid, NetworkInfos ne StudyEntity studyEntity = StudyEntity.builder() .id(studyUuid) - .nonEvacuatedEnergyProvider(defaultNonEvacuatedEnergyProvider) .dynamicSimulationProvider(defaultDynamicSimulationProvider) .loadFlowParametersUuid(loadFlowParametersUuid) .shortCircuitParametersUuid(shortCircuitParametersUuid) @@ -2117,7 +2078,6 @@ private void deleteInvalidationInfos(InvalidateNodeInfos invalidateNodeInfos) { studyServerExecutionService.runAsync(() -> loadflowService.deleteLoadFlowResults(invalidateNodeInfos.getLoadFlowResultUuids())), studyServerExecutionService.runAsync(() -> securityAnalysisService.deleteSecurityAnalysisResults(invalidateNodeInfos.getSecurityAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> sensitivityAnalysisService.deleteSensitivityAnalysisResults(invalidateNodeInfos.getSensitivityAnalysisResultUuids())), - studyServerExecutionService.runAsync(() -> nonEvacuatedEnergyService.deleteNonEvacuatedEnergyResults(invalidateNodeInfos.getNonEvacuatedEnergyResultUuids())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(invalidateNodeInfos.getShortCircuitAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(invalidateNodeInfos.getOneBusShortCircuitAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> voltageInitService.deleteVoltageInitResults(invalidateNodeInfos.getVoltageInitResultUuids())), @@ -2257,7 +2217,6 @@ public void deleteNodes(UUID studyUuid, List nodeIds, boolean deleteChildr studyServerExecutionService.runAsync(() -> loadflowService.deleteLoadFlowResults(deleteNodeInfos.getLoadFlowResultUuids())), studyServerExecutionService.runAsync(() -> securityAnalysisService.deleteSecurityAnalysisResults(deleteNodeInfos.getSecurityAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> sensitivityAnalysisService.deleteSensitivityAnalysisResults(deleteNodeInfos.getSensitivityAnalysisResultUuids())), - studyServerExecutionService.runAsync(() -> nonEvacuatedEnergyService.deleteNonEvacuatedEnergyResults(deleteNodeInfos.getNonEvacuatedEnergyResultUuids())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(deleteNodeInfos.getShortCircuitAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> shortCircuitService.deleteShortCircuitAnalysisResults(deleteNodeInfos.getOneBusShortCircuitAnalysisResultUuids())), studyServerExecutionService.runAsync(() -> voltageInitService.deleteVoltageInitResults(deleteNodeInfos.getVoltageInitResultUuids())), @@ -3190,16 +3149,6 @@ public boolean setSensitivityAnalysisParameters(UUID studyUuid, String parameter return userProfileIssue; } - @Transactional - public void setNonEvacuatedEnergyParametersInfos(UUID studyUuid, NonEvacuatedEnergyParametersInfos parameters, String userId) { - updateNonEvacuatedEnergyParameters(studyUuid, - NonEvacuatedEnergyService.toEntity(parameters != null ? parameters : - NonEvacuatedEnergyService.getDefaultNonEvacuatedEnergyParametersInfos())); - notificationService.emitElementUpdated(studyUuid, userId); - notificationService.emitComputationParamsChanged(studyUuid, NON_EVACUATED_ENERGY_ANALYSIS); - - } - public boolean createOrUpdateSensitivityAnalysisParameters(UUID studyUuid, String parameters, String userId) { StudyEntity studyEntity = studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND)); @@ -3242,11 +3191,6 @@ private void removeSensitivityAnalysisParameters(@Nullable UUID sensitivityAnaly } } - public void updateNonEvacuatedEnergyParameters(UUID studyUuid, NonEvacuatedEnergyParametersEntity nonEvacuatedEnergyParametersEntity) { - Optional studyEntity = studyRepository.findById(studyUuid); - studyEntity.ifPresent(studyEntity1 -> studyEntity1.setNonEvacuatedEnergyParameters(nonEvacuatedEnergyParametersEntity)); - } - @Transactional public void invalidateLoadFlowStatus(UUID studyUuid, String userId) { invalidateAllStudyLoadFlowStatus(studyUuid); @@ -3269,87 +3213,12 @@ public void invalidateShortCircuitStatus(UUID studyUuid) { notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_STATUS); } - @Transactional - public UUID runNonEvacuatedEnergy(@NonNull UUID studyUuid, @NonNull UUID nodeUuid, @NonNull UUID rootNetworkUuid, String userId) { - StudyEntity studyEntity = studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND)); - networkModificationTreeService.blockNode(rootNetworkUuid, nodeUuid); - - return handleNonEvacuatedEnergyRequest(studyEntity, nodeUuid, rootNetworkUuid, userId); - } - - private UUID handleNonEvacuatedEnergyRequest(StudyEntity studyEntity, UUID nodeUuid, UUID rootNetworkUuid, String userId) { - UUID prevResultUuid = rootNetworkNodeInfoService.getComputationResultUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS); - if (prevResultUuid != null) { - nonEvacuatedEnergyService.deleteNonEvacuatedEnergyResults(List.of(prevResultUuid)); - } - - UUID networkUuid = rootNetworkService.getNetworkUuid(rootNetworkUuid); - String provider = getNonEvacuatedEnergyProvider(studyEntity.getId()); - String variantId = networkModificationTreeService.getVariantId(nodeUuid, rootNetworkUuid); - UUID reportUuid = networkModificationTreeService.getComputationReports(nodeUuid, rootNetworkUuid).getOrDefault(NON_EVACUATED_ENERGY_ANALYSIS.name(), UUID.randomUUID()); - networkModificationTreeService.updateComputationReportUuid(nodeUuid, rootNetworkUuid, NON_EVACUATED_ENERGY_ANALYSIS, reportUuid); - - NonEvacuatedEnergyParametersInfos nonEvacuatedEnergyParametersInfos = getNonEvacuatedEnergyParametersInfos(studyEntity); - SensitivityAnalysisParameters sensitivityAnalysisParameters = SensitivityAnalysisParameters.load(); - sensitivityAnalysisParameters.setFlowFlowSensitivityValueThreshold(nonEvacuatedEnergyParametersInfos.getGeneratorsCappings().getSensitivityThreshold()); - - NonEvacuatedEnergyInputData nonEvacuatedEnergyInputData = new NonEvacuatedEnergyInputData(); - nonEvacuatedEnergyInputData.setParameters(sensitivityAnalysisParameters); - - nonEvacuatedEnergyInputData.setNonEvacuatedEnergyStagesDefinition(nonEvacuatedEnergyParametersInfos.getStagesDefinition()); - - nonEvacuatedEnergyInputData.setNonEvacuatedEnergyStagesSelection(nonEvacuatedEnergyParametersInfos.getStagesSelection() - .stream() - .filter(NonEvacuatedEnergyStagesSelection::isActivated) - .collect(Collectors.toList())); - - List generatorsCappingsByType = nonEvacuatedEnergyParametersInfos.getGeneratorsCappings().getGenerators() - .stream() - .filter(NonEvacuatedEnergyGeneratorCappingsByType::isActivated) - .collect(Collectors.toList()); - NonEvacuatedEnergyGeneratorsCappings generatorsCappings = new NonEvacuatedEnergyGeneratorsCappings(nonEvacuatedEnergyParametersInfos.getGeneratorsCappings().getSensitivityThreshold(), generatorsCappingsByType); - nonEvacuatedEnergyInputData.setNonEvacuatedEnergyGeneratorsCappings(generatorsCappings); - - nonEvacuatedEnergyInputData.setNonEvacuatedEnergyMonitoredBranches(nonEvacuatedEnergyParametersInfos.getMonitoredBranches() - .stream() - .filter(NonEvacuatedEnergyMonitoredBranches::isActivated) - .collect(Collectors.toList())); - - nonEvacuatedEnergyInputData.setNonEvacuatedEnergyContingencies(nonEvacuatedEnergyParametersInfos.getContingencies() - .stream() - .filter(NonEvacuatedEnergyContingencies::isActivated) - .collect(Collectors.toList())); - - UUID result = nonEvacuatedEnergyService.runNonEvacuatedEnergy(nodeUuid, rootNetworkUuid, networkUuid, variantId, reportUuid, provider, nonEvacuatedEnergyInputData, studyEntity.getLoadFlowParametersUuid(), userId); - - updateComputationResultUuid(nodeUuid, rootNetworkUuid, result, NON_EVACUATED_ENERGY_ANALYSIS); - notificationService.emitStudyChanged(studyEntity.getId(), nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); - return result; - } - - @Transactional - public void updateNonEvacuatedEnergyProvider(UUID studyUuid, String provider, String userId) { - updateProvider(studyUuid, userId, studyEntity -> { - studyEntity.setNonEvacuatedEnergyProvider(provider != null ? provider : defaultNonEvacuatedEnergyProvider); - invalidateNonEvacuatedEnergyAnalysisStatusOnAllNodes(studyUuid); - notificationService.emitStudyChanged(studyUuid, null, null, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); - notificationService.emitComputationParamsChanged(studyUuid, NON_EVACUATED_ENERGY_ANALYSIS); - }); - } - - public String getNonEvacuatedEnergyProvider(UUID studyUuid) { - return studyRepository.findById(studyUuid) - .map(StudyEntity::getNonEvacuatedEnergyProvider) - .orElse(""); - } - private void emitAllComputationStatusChanged(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, InvalidateNodeTreeParameters.ComputationsInvalidationMode computationsInvalidationMode) { if (!InvalidateNodeTreeParameters.ComputationsInvalidationMode.isPreserveLoadFlowResults(computationsInvalidationMode)) { notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_LOADFLOW_STATUS); } notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_SECURITY_ANALYSIS_STATUS); notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS); - notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_STATUS); notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_STATUS); notificationService.emitStudyChanged(studyUuid, nodeUuid, rootNetworkUuid, NotificationService.UPDATE_TYPE_VOLTAGE_INIT_STATUS); diff --git a/src/main/java/org/gridsuite/study/server/service/SupervisionService.java b/src/main/java/org/gridsuite/study/server/service/SupervisionService.java index 6f89d99e56..addf53f51b 100644 --- a/src/main/java/org/gridsuite/study/server/service/SupervisionService.java +++ b/src/main/java/org/gridsuite/study/server/service/SupervisionService.java @@ -67,8 +67,6 @@ public class SupervisionService { private final SensitivityAnalysisService sensitivityAnalysisService; - private final NonEvacuatedEnergyService nonEvacuatedEnergyService; - private final ShortCircuitService shortCircuitService; private final VoltageInitService voltageInitService; @@ -94,7 +92,6 @@ public SupervisionService(StudyService studyService, DynamicSecurityAnalysisService dynamicSecurityAnalysisService, SecurityAnalysisService securityAnalysisService, SensitivityAnalysisService sensitivityAnalysisService, - NonEvacuatedEnergyService nonEvacuatedEnergyService, ShortCircuitService shortCircuitService, VoltageInitService voltageInitService, EquipmentInfosService equipmentInfosService, @@ -112,7 +109,6 @@ public SupervisionService(StudyService studyService, this.dynamicSecurityAnalysisService = dynamicSecurityAnalysisService; this.securityAnalysisService = securityAnalysisService; this.sensitivityAnalysisService = sensitivityAnalysisService; - this.nonEvacuatedEnergyService = nonEvacuatedEnergyService; this.shortCircuitService = shortCircuitService; this.voltageInitService = voltageInitService; this.equipmentInfosService = equipmentInfosService; @@ -135,8 +131,6 @@ public Integer deleteComputationResults(ComputationType computationType, boolean dryRun ? securityAnalysisService.getSecurityAnalysisResultsCount() : deleteSecurityAnalysisResults(); case SENSITIVITY_ANALYSIS -> dryRun ? sensitivityAnalysisService.getSensitivityAnalysisResultsCount() : deleteSensitivityAnalysisResults(); - case NON_EVACUATED_ENERGY_ANALYSIS -> - dryRun ? nonEvacuatedEnergyService.getNonEvacuatedEnergyAnalysisResultsCount() : deleteNonEvacuatedEnergyAnalysisResults(); case SHORT_CIRCUIT, SHORT_CIRCUIT_ONE_BUS -> dryRun ? shortCircuitService.getShortCircuitResultsCount() : deleteShortcircuitResults(); case VOLTAGE_INITIALIZATION -> @@ -256,24 +250,6 @@ private Integer deleteSensitivityAnalysisResults() { return rootNetworkNodeInfoEntities.size(); } - private Integer deleteNonEvacuatedEnergyAnalysisResults() { - AtomicReference startTime = new AtomicReference<>(); - startTime.set(System.nanoTime()); - - List rootNetworkNodeInfoEntities = rootNetworkNodeInfoRepository.findAllByNonEvacuatedEnergyResultUuidNotNull(); - List reportsToDelete = new ArrayList<>(); - rootNetworkNodeInfoEntities.forEach(rootNetworkNodeInfo -> { - rootNetworkNodeInfo.setNonEvacuatedEnergyResultUuid(null); - reportsToDelete.add(rootNetworkNodeInfo.getComputationReports().get(ComputationType.NON_EVACUATED_ENERGY_ANALYSIS.name())); - rootNetworkNodeInfo.getComputationReports().remove(ComputationType.NON_EVACUATED_ENERGY_ANALYSIS.name()); - }); - reportService.deleteReports(reportsToDelete); - nonEvacuatedEnergyService.deleteAllNonEvacuatedEnergyResults(); - LOGGER.trace(DELETION_LOG_MESSAGE, ComputationType.NON_EVACUATED_ENERGY_ANALYSIS, TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime.get())); - - return rootNetworkNodeInfoEntities.size(); - } - private Integer deleteShortcircuitResults() { AtomicReference startTime = new AtomicReference<>(); startTime.set(System.nanoTime()); diff --git a/src/main/resources/config/application.yaml b/src/main/resources/config/application.yaml index c2cc32a42c..88f7a98fb8 100644 --- a/src/main/resources/config/application.yaml +++ b/src/main/resources/config/application.yaml @@ -14,7 +14,6 @@ spring: consumeShortCircuitAnalysisDebug;consumeShortCircuitAnalysisResult;consumeShortCircuitAnalysisStopped;consumeShortCircuitAnalysisFailed;consumeShortCircuitAnalysisCancelFailed;\ consumeVoltageInitDebug;consumeVoltageInitResult;consumeVoltageInitStopped;consumeVoltageInitFailed;consumeVoltageInitCancelFailed;\ consumeLoadFlowResult;consumeLoadFlowStopped;consumeLoadFlowFailed;consumeLoadFlowCancelFailed;\ - consumeNonEvacuatedEnergyResult;consumeNonEvacuatedEnergyStopped;consumeNonEvacuatedEnergyFailed;consumeNonEvacuatedEnergyCancelFailed;\ consumeStateEstimationResult;consumeStateEstimationStopped;consumeStateEstimationFailed" stream: bindings: @@ -97,18 +96,6 @@ spring: consumeSensitivityAnalysisCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}sensitivityanalysis.cancelfailed group: studySensitivityAnalysisCancelFailedGroup - consumeNonEvacuatedEnergyResult-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.result - group: studyNonEvacuatedEnergyResultGroup - consumeNonEvacuatedEnergyStopped-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.stopped - group: studyNonEvacuatedEnergyStoppedGroup - consumeNonEvacuatedEnergyFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.run.dlx - group: dlq - consumeNonEvacuatedEnergyCancelFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.cancelfailed - group: studyNonEvacuatedEnergyCancelFailedGroup consumeShortCircuitAnalysisDebug-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}shortcircuitanalysis.debug group: studyShortCircuitAnalysisDebugGroup @@ -165,9 +152,6 @@ powsybl-ws: database: name: study -non-evacuated-energy: - default-provider: OpenLoadFlow - dynamic-simulation: default-provider: Dynawo diff --git a/src/main/resources/db/changelog/changesets/changelog_20250925T151431Z.xml b/src/main/resources/db/changelog/changesets/changelog_20250925T151431Z.xml new file mode 100644 index 0000000000..23cf65ed80 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20250925T151431Z.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index c221a3d012..a5e242ef1e 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -344,3 +344,6 @@ databaseChangeLog: - include: file: changesets/changelog_20250910T092726Z.xml relativeToChangelogFile: true + - include: + file: changesets/changelog_20250925T151431Z.xml + relativeToChangelogFile: true diff --git a/src/test/java/org/gridsuite/study/server/FilterServiceTest.java b/src/test/java/org/gridsuite/study/server/FilterServiceTest.java index be3847b07c..2d26c7c78f 100644 --- a/src/test/java/org/gridsuite/study/server/FilterServiceTest.java +++ b/src/test/java/org/gridsuite/study/server/FilterServiceTest.java @@ -108,7 +108,7 @@ void tearDown() { } private StudyEntity insertDummyStudy(UUID networkUuid, UUID caseUuid) { - StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, null, null, null, null, null, null); + StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, null, null, null, null, null); var study = studyRepository.save(studyEntity); networkModificationTreeService.createRoot(studyEntity); return study; diff --git a/src/test/java/org/gridsuite/study/server/LoadFLowUnitTest.java b/src/test/java/org/gridsuite/study/server/LoadFLowUnitTest.java index 384b1c92bb..299327a5a1 100644 --- a/src/test/java/org/gridsuite/study/server/LoadFLowUnitTest.java +++ b/src/test/java/org/gridsuite/study/server/LoadFLowUnitTest.java @@ -160,7 +160,7 @@ private void testRerunLoadFlowSecurityNode(boolean withRatioTapChangers) { // node invalidation verify(networkModificationTreeService, times(1)).invalidateNodeTree(nodeUuid, rootNetworkUuid, expectedInvalidationParameters); verify(networkModificationService, times(1)).deleteIndexedModifications(invalidateNodeInfos.getGroupUuids(), networkUuid); - verify(notificationService, times(9)).emitStudyChanged(eq(studyUuid), eq(nodeUuid), eq(rootNetworkUuid), anyString()); + verify(notificationService, times(8)).emitStudyChanged(eq(studyUuid), eq(nodeUuid), eq(rootNetworkUuid), anyString()); // node build ArgumentCaptor rerunLoadFlowWorkflowInfosArgumentCaptor = ArgumentCaptor.forClass(RerunLoadFlowInfos.class); diff --git a/src/test/java/org/gridsuite/study/server/LoadFlowTest.java b/src/test/java/org/gridsuite/study/server/LoadFlowTest.java index 28732cb4b1..724cd4f72c 100644 --- a/src/test/java/org/gridsuite/study/server/LoadFlowTest.java +++ b/src/test/java/org/gridsuite/study/server/LoadFlowTest.java @@ -33,7 +33,6 @@ import org.gridsuite.study.server.notification.NotificationService; import org.gridsuite.study.server.repository.StudyEntity; import org.gridsuite.study.server.repository.StudyRepository; -import org.gridsuite.study.server.repository.nonevacuatedenergy.NonEvacuatedEnergyParametersEntity; import org.gridsuite.study.server.repository.rootnetwork.RootNetworkNodeInfoRepository; import org.gridsuite.study.server.service.*; import org.gridsuite.study.server.utils.TestUtils; @@ -718,8 +717,6 @@ private void createOrUpdateParametersAndDoChecks(UUID studyNameUserIdUuid, Strin message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); - assertEquals(NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); - message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); assertEquals(NotificationService.UPDATE_TYPE_DYNAMIC_SIMULATION_STATUS, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); assertEquals(NotificationService.UPDATE_TYPE_DYNAMIC_SECURITY_ANALYSIS_STATUS, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); @@ -1012,10 +1009,8 @@ private void updateLoadflowResultUuid(UUID nodeId, UUID rootNetworkUuid, UUID re } private StudyEntity insertDummyStudy(UUID networkUuid, UUID caseUuid, UUID loadFlowParametersUuid) { - NonEvacuatedEnergyParametersEntity defaultNonEvacuatedEnergyParametersEntity = NonEvacuatedEnergyService.toEntity(NonEvacuatedEnergyService.getDefaultNonEvacuatedEnergyParametersInfos()); StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, - loadFlowParametersUuid, null, null, null, - defaultNonEvacuatedEnergyParametersEntity, null); + loadFlowParametersUuid, null, null, null, null); var study = studyRepository.save(studyEntity); networkModificationTreeService.createRoot(studyEntity); return study; @@ -1076,7 +1071,6 @@ private void checkUpdateModelsStatusMessagesReceived(UUID studyUuid, UUID nodeUu checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_LOADFLOW_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SECURITY_ANALYSIS_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS); - checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_VOLTAGE_INIT_STATUS); diff --git a/src/test/java/org/gridsuite/study/server/NetworkMapTest.java b/src/test/java/org/gridsuite/study/server/NetworkMapTest.java index 79eafc16da..50f6577474 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkMapTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkMapTest.java @@ -629,7 +629,7 @@ void testGetAllNetworkElementsInfos(final MockWebServer server) throws Exception } private StudyEntity insertDummyStudy(final MockWebServer server, UUID networkUuid, UUID caseUuid) { - StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, LOADFLOW_PARAMETERS_UUID, null, null, null, null, null); + StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, LOADFLOW_PARAMETERS_UUID, null, null, null, null); var study = studyRepository.save(studyEntity); networkModificationTreeService.createBasicTree(studyEntity); var requests = TestUtils.getRequestsDone(1, server); diff --git a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java index b5415ffec6..871ed682e5 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java @@ -127,10 +127,8 @@ class NetworkModificationTest { private static final String SECURITY_ANALYSIS_STATUS_JSON = "\"CONVERGED\""; private static final String SENSITIVITY_ANALYSIS_RESULT_UUID = "b3a84c9b-9594-4e85-8ec7-07ea965d24eb"; - private static final String SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID = "b3a84c9b-9594-4e85-8ec7-07ea965d24eb"; private static final String SENSITIVITY_ANALYSIS_STATUS_JSON = "{\"status\":\"COMPLETED\"}"; private static final LoadFlowStatus LOADFLOW_STATUS = LoadFlowStatus.CONVERGED; - private static final String SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_STATUS_JSON = "{\"status\":\"COMPLETED\"}"; private static final String SHORTCIRCUIT_ANALYSIS_RESULT_UUID = "72f94d64-4fc6-11ed-bdc3-0242ac120002"; private static final String ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID = "72f94d88-4fc6-11ed-bdc3-0242ac120009"; @@ -198,9 +196,6 @@ class NetworkModificationTest { @Autowired private SensitivityAnalysisService sensitivityAnalysisService; - @Autowired - private NonEvacuatedEnergyService nonEvacuatedEnergyService; - @Autowired private ShortCircuitService shortCircuitService; @@ -274,7 +269,6 @@ void setup(final MockWebServer server) { loadFlowService.setLoadFlowServerBaseUri(baseUrl); securityAnalysisService.setSecurityAnalysisServerBaseUri(baseUrl); sensitivityAnalysisService.setSensitivityAnalysisServerBaseUri(baseUrl); - nonEvacuatedEnergyService.setSensitivityAnalysisServerBaseUri(baseUrl); shortCircuitService.setShortCircuitServerBaseUri(baseUrl); voltageInitService.setVoltageInitServerBaseUri(baseUrl); stateEstimationService.setStateEstimationServerServerBaseUri(baseUrl); @@ -359,15 +353,6 @@ public MockResponse dispatch(RecordedRequest request) { return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), SENSITIVITY_ANALYSIS_STATUS_JSON); } return new MockResponse(500); - } else if (("/v1/non-evacuated-energy/results/invalidate-status?resultUuid=" + SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID).equals(path)) { - return new MockResponse(200); - } else if (("/v1/non-evacuated-energy/results/" + SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID + "/status").equals(path)) { - return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_STATUS_JSON); - } else if (("/v1/non-evacuated-energy/results?resultsUuids=" + SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID).equals(path)) { - if (request.getMethod().equals("DELETE")) { - return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_STATUS_JSON); - } - return new MockResponse(500); } else if (("/v1/results/invalidate-status?resultUuid=" + SHORTCIRCUIT_ANALYSIS_RESULT_UUID).equals(path)) { return new MockResponse(200); } else if (("/v1/results/invalidate-status?resultUuid=" + ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID).equals(path)) { @@ -2380,7 +2365,6 @@ void testNodesInvalidation(final MockWebServer server) throws Exception { RootNetworkNodeInfoEntity rootNetworkNodeInfoEntity = rootNetworkNodeInfoRepository.findByNodeInfoIdAndRootNetworkId(modificationNode1Uuid, studyTestUtils.getOneRootNetworkUuid(studyNameUserIdUuid)).orElseThrow(() -> new StudyException(StudyException.Type.ROOT_NETWORK_NOT_FOUND)); rootNetworkNodeInfoEntity.setSecurityAnalysisResultUuid(UUID.fromString(SECURITY_ANALYSIS_RESULT_UUID)); rootNetworkNodeInfoEntity.setSensitivityAnalysisResultUuid(UUID.fromString(SENSITIVITY_ANALYSIS_RESULT_UUID)); - rootNetworkNodeInfoEntity.setNonEvacuatedEnergyResultUuid(UUID.fromString(SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID)); rootNetworkNodeInfoEntity.setShortCircuitAnalysisResultUuid(UUID.fromString(SHORTCIRCUIT_ANALYSIS_RESULT_UUID)); rootNetworkNodeInfoEntity.setOneBusShortCircuitAnalysisResultUuid(UUID.fromString(ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID)); rootNetworkNodeInfoEntity.setVoltageInitResultUuid(UUID.fromString(VOLTAGE_INIT_RESULT_UUID)); @@ -2410,11 +2394,10 @@ void testNodesInvalidation(final MockWebServer server) throws Exception { checkElementUpdatedMessageSent(studyNameUserIdUuid, userId); wireMockUtils.verifyNetworkModificationPut(stubUuid, MODIFICATION_UUID, generatorAttributesUpdated); - var requests = TestUtils.getRequestsWithBodyDone(15, server); + var requests = TestUtils.getRequestsWithBodyDone(13, server); assertEquals(1, requests.stream().filter(r -> r.getPath().matches("/v1/reports")).count()); assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/results\\?resultsUuids=" + SECURITY_ANALYSIS_RESULT_UUID))); assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/results\\?resultsUuids=" + SENSITIVITY_ANALYSIS_RESULT_UUID))); - assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/non-evacuated-energy/results\\?resultsUuids=" + SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID))); assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/results\\?resultsUuids=" + SHORTCIRCUIT_ANALYSIS_RESULT_UUID))); assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/results\\?resultsUuids=" + ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID))); assertTrue(requests.stream().anyMatch(r -> r.getPath().matches("/v1/results\\?resultsUuids=" + VOLTAGE_INIT_RESULT_UUID))); @@ -2467,7 +2450,6 @@ void testRemoveLoadFlowComputationReport(final MockWebServer server) throws Exce rootNetworkNodeInfoEntity.setDynamicSimulationResultUuid(DYNAMIC_SIMULATION_RESULT_UUID); rootNetworkNodeInfoEntity.setDynamicSecurityAnalysisResultUuid(DYNAMIC_SECURITY_ANALYSIS_RESULT_UUID); rootNetworkNodeInfoEntity.setSensitivityAnalysisResultUuid(UUID.fromString(SENSITIVITY_ANALYSIS_RESULT_UUID)); - rootNetworkNodeInfoEntity.setNonEvacuatedEnergyResultUuid(UUID.fromString(SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID)); rootNetworkNodeInfoEntity.setShortCircuitAnalysisResultUuid(UUID.fromString(SHORTCIRCUIT_ANALYSIS_RESULT_UUID)); rootNetworkNodeInfoEntity.setOneBusShortCircuitAnalysisResultUuid(UUID.fromString(ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID)); rootNetworkNodeInfoEntity.setVoltageInitResultUuid(UUID.fromString(VOLTAGE_INIT_RESULT_UUID)); @@ -2478,7 +2460,6 @@ void testRemoveLoadFlowComputationReport(final MockWebServer server) throws Exce ComputationType.DYNAMIC_SIMULATION.name(), UUID.randomUUID(), ComputationType.DYNAMIC_SECURITY_ANALYSIS.name(), UUID.randomUUID(), ComputationType.SENSITIVITY_ANALYSIS.name(), UUID.randomUUID(), - ComputationType.NON_EVACUATED_ENERGY_ANALYSIS.name(), UUID.randomUUID(), ComputationType.SHORT_CIRCUIT.name(), UUID.randomUUID(), ComputationType.SHORT_CIRCUIT_ONE_BUS.name(), UUID.randomUUID(), ComputationType.VOLTAGE_INITIALIZATION.name(), UUID.randomUUID(), @@ -2512,14 +2493,13 @@ void testRemoveLoadFlowComputationReport(final MockWebServer server) throws Exce wireMockUtils.verifyNetworkModificationPostWithVariant(stubPostId, getModificationContextJsonString(mapper, modificationBody)); wireMockUtils.verifyNetworkModificationDeleteIndex(deleteModificationIndexStub); - var requests = TestUtils.getRequestsDone(22, server); // 1 status LF + 2 x 10 computations + 1 report + var requests = TestUtils.getRequestsDone(20, server); // 1 status LF + 2 x 9 computations + 1 report List.of( LOADFLOW_RESULT_UUID, SECURITY_ANALYSIS_RESULT_UUID, DYNAMIC_SIMULATION_RESULT_UUID, DYNAMIC_SECURITY_ANALYSIS_RESULT_UUID, SENSITIVITY_ANALYSIS_RESULT_UUID, - SENSITIVITY_ANALYSIS_NON_EVACUATED_ENERGY_RESULT_UUID, SHORTCIRCUIT_ANALYSIS_RESULT_UUID, ONE_BUS_SHORTCIRCUIT_ANALYSIS_RESULT_UUID, VOLTAGE_INIT_RESULT_UUID, @@ -2771,7 +2751,6 @@ private void checkUpdateModelsStatusMessagesReceived(UUID studyUuid, UUID nodeUu checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_LOADFLOW_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SECURITY_ANALYSIS_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS); - checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_SHORT_CIRCUIT_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_STATUS); checkUpdateModelStatusMessagesReceived(studyUuid, nodeUuid, NotificationService.UPDATE_TYPE_VOLTAGE_INIT_STATUS); @@ -2872,7 +2851,7 @@ private void checkNodesInvalidationMessagesReceived(UUID studyNameUserIdUuid, Li } private StudyEntity insertDummyStudy(UUID networkUuid, UUID caseUuid, String caseFormat) { - StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, caseFormat, "", null, UUID.randomUUID(), null, null, null, null, null); + StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, caseFormat, "", null, UUID.randomUUID(), null, null, null, null); var study = studyRepository.save(studyEntity); networkModificationTreeService.createRoot(studyEntity); return study; diff --git a/src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java b/src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java index 264adf1ab6..0aa5bce4c6 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java @@ -136,9 +136,6 @@ class NetworkModificationTreeTest { @Autowired private SensitivityAnalysisService sensitivityAnalysisService; - @Autowired - private NonEvacuatedEnergyService nonEvacuatedEnergyService; - @Autowired private NetworkMapService networkMapService; @@ -257,7 +254,6 @@ public Set