Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.gridsuite.study.server.dto.networkexport.ExportNetworkStatus;
import org.gridsuite.study.server.dto.networkexport.NodeExportInfos;
import org.gridsuite.study.server.dto.sensianalysis.SensitivityAnalysisCsvFileInfos;
import org.gridsuite.study.server.dto.sensianalysis.SensitivityAnalysisParametersInfos;
import org.gridsuite.study.server.dto.sequence.NodeSequenceType;
import org.gridsuite.study.server.dto.timeseries.TimeSeriesMetadataInfos;
import org.gridsuite.study.server.dto.timeseries.TimelineEventInfos;
Expand Down Expand Up @@ -2079,7 +2080,7 @@ public ResponseEntity<String> getDynamicMarginCalculationStatus(@Parameter(descr
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The security analysis parameters")})
public ResponseEntity<String> getSecurityAnalysisParametersValues(
@PathVariable("studyUuid") UUID studyUuid,
@RequestHeader(HEADER_USER_ID) String userId) {
@RequestHeader(HEADER_USER_ID) String userId) throws JsonProcessingException {
return ResponseEntity.ok().body(studyService.getSecurityAnalysisParametersValues(studyUuid, userId));
}

Expand Down Expand Up @@ -2186,23 +2187,40 @@ public void setAsText(final String text) throws IllegalArgumentException {
@GetMapping(value = "/studies/{studyUuid}/sensitivity-analysis/parameters")
@Operation(summary = "Get sensitivity analysis parameters on study")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis parameters")})
public ResponseEntity<String> getSensitivityAnalysisParameters(
@PathVariable("studyUuid") UUID studyUuid,
@RequestHeader(HEADER_USER_ID) String userId) {
return ResponseEntity.ok().body(studyService.getSensitivityAnalysisParameters(studyUuid, userId));
public ResponseEntity<SensitivityAnalysisParametersInfos> getStudySensitivityAnalysisParameters(
@PathVariable("studyUuid") UUID studyUuid) {
return ResponseEntity.ok().body(studyService.getSensitivityAnalysisParameters(studyUuid));
}

@PostMapping(value = "/studies/{studyUuid}/sensitivity-analysis/parameters")
@Operation(summary = "set sensitivity analysis parameters on study, reset to default ones if empty body")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis parameters are set"),
@ApiResponse(responseCode = "204", description = "Reset with user profile cannot be done")})
public ResponseEntity<Void> setSensitivityAnalysisParameters(
public ResponseEntity<Void> setStudySensitivityAnalysisParameters(
@PathVariable("studyUuid") UUID studyUuid,
@RequestBody(required = false) String sensitivityAnalysisParameters,
@RequestBody(required = false) SensitivityAnalysisParametersInfos sensitivityAnalysisParameters,
@RequestHeader(HEADER_USER_ID) String userId) {
return studyService.setSensitivityAnalysisParameters(studyUuid, sensitivityAnalysisParameters, userId) ? ResponseEntity.noContent().build() : ResponseEntity.ok().build();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following 2 endpoints are used in explore-app

@GetMapping(value = "/sensitivity-analysis/parameters/{parametersUuid}") // to move to explore-server?
@Operation(summary = "Get sensitivity analysis parameters on study")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis parameters")})
public ResponseEntity<SensitivityAnalysisParametersInfos> getSensitivityAnalysisParameters(
@PathVariable("parametersUuid") UUID parametersUuid) {
return ResponseEntity.ok().body(sensitivityAnalysisService.getSensitivityAnalysisParameters(parametersUuid));
}

@PostMapping(value = "/sensitivity-analysis/parameters/{parametersUuid}") // to move to explore-server?
@Operation(summary = "set sensitivity analysis parameters on study, reset to default ones if empty body")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis parameters are set"), @ApiResponse(responseCode = "204", description = "Reset with user profile cannot be done")})
public ResponseEntity<Void> setSensitivityAnalysisParameters(
@PathVariable("parametersUuid") UUID parametersUuid,
@RequestBody SensitivityAnalysisParametersInfos parameters) {
sensitivityAnalysisService.updateSensitivityAnalysisParameters(parametersUuid, parameters);
return ResponseEntity.ok().build();
}

@PostMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/sensitivity-analysis/factor-count")
@Operation(summary = "Get the factor count of sensitivity parameters")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The factors count of sensitivity parameters")})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* 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;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import static com.fasterxml.jackson.annotation.JsonCreator.Mode.DELEGATING;

/**
* @author Ghazwa Rehili <ghazwa.rehili at rte-france.com>
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class EquipmentsContainer {

@Schema(description = "container id")
private UUID containerId;

@Schema(description = "container name")
private String containerName;

@JsonCreator(mode = DELEGATING)
public EquipmentsContainer(String containerId) {
this.containerId = UUID.fromString(containerId);
}

public static List<EquipmentsContainer> enrichEquipmentsContainer(List<UUID> containerIds, Map<UUID, String> containerNames) {
if (containerIds == null) {
return null;
}
return containerIds.stream()
.map(id -> new EquipmentsContainer(id, containerNames.get(id)))
.toList();
}

public static List<UUID> getEquipmentsContainerUuids(List<EquipmentsContainer> containers) {
if (containers == null) {
return null;
}
return containers.stream()
.map(EquipmentsContainer::getContainerId)
.toList();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.powsybl.loadflow.LoadFlowParameters;
import lombok.*;
import org.gridsuite.study.server.dto.securityanalysis.LimitReductionsByVoltageLevel;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2026, 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.securityanalysis;

import lombok.*;

import java.util.List;
import java.util.UUID;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class ContingencyLists {
private List<UUID> contingencyLists;
private String description;
private boolean activated;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2026, 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.securityanalysis;

import lombok.*;
import org.gridsuite.study.server.dto.EquipmentsContainer;

import java.util.List;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class ContingencyListsInfos {
private List<EquipmentsContainer> contingencyLists;
private String description;
private boolean activated;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* Copyright (c) 2026, 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;
package org.gridsuite.study.server.dto.securityanalysis;

import lombok.*;

import java.util.List;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@Data
@Builder
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2026, 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.securityanalysis;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Builder
public class SecurityAnalysisParameters {
private String provider;

private double lowVoltageAbsoluteThreshold;

private double lowVoltageProportionalThreshold;

private double highVoltageAbsoluteThreshold;

private double highVoltageProportionalThreshold;

private double flowProportionalThreshold;

private List<ContingencyLists> contingencyListsInfos;

private List<LimitReductionsByVoltageLevel> limitReductions;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2026, 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.securityanalysis;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Builder
public class SecurityAnalysisParametersInfos {
private String provider;

private double lowVoltageAbsoluteThreshold;

private double lowVoltageProportionalThreshold;

private double highVoltageAbsoluteThreshold;

private double highVoltageProportionalThreshold;

private double flowProportionalThreshold;

private List<ContingencyListsInfos> contingencyListsInfos;

private List<LimitReductionsByVoltageLevel> limitReductions;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2026, 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.sensianalysis;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
public enum DistributionType {
PROPORTIONAL,
PROPORTIONAL_MAXP,
REGULAR,
VENTILATION
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2026, 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.sensianalysis;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.UUID;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@Getter
@Setter
@Builder
public class SensitivityAnalysisParameters {
private String provider;
private UUID uuid;
private double flowFlowSensitivityValueThreshold;
private double angleFlowSensitivityValueThreshold;
private double flowVoltageSensitivityValueThreshold;
List<SensitivityInjectionsSet> sensitivityInjectionsSet;
List<SensitivityInjection> sensitivityInjection;
List<SensitivityHVDC> sensitivityHVDC;
List<SensitivityPST> sensitivityPST;
List<SensitivityNodes> sensitivityNodes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2026, 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.sensianalysis;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.UUID;

/**
* @author Caroline Jeandat {@literal <caroline.jeandat at rte-france.com>}
*/
@Getter
@Setter
@Builder
public class SensitivityAnalysisParametersInfos {
private String provider;
private UUID uuid;
private double flowFlowSensitivityValueThreshold;
private double angleFlowSensitivityValueThreshold;
private double flowVoltageSensitivityValueThreshold;
List<SensitivityInjectionsSetInfos> sensitivityInjectionsSet;
List<SensitivityInjectionInfos> sensitivityInjection;
List<SensitivityHvdcInfos> sensitivityHVDC;
List<SensitivityPstInfos> sensitivityPST;
List<SensitivityNodesInfos> sensitivityNodes;


}
Loading
Loading