Skip to content

Commit d36509d

Browse files
Merge remote-tracking branch 'origin/main' into move_shortcircuit_parameters
2 parents 43b122d + 2227bf2 commit d36509d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1012
-162
lines changed

pom.xml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@
4242
</developers>
4343

4444
<properties>
45-
<gridsuite-dependencies.version>29</gridsuite-dependencies.version>
45+
<gridsuite-dependencies.version>30</gridsuite-dependencies.version>
4646
<log4j2-mock-version>0.0.2</log4j2-mock-version>
4747
<testcontainers.version>1.18.3</testcontainers.version>
4848
<liquibase-hibernate-package>org.gridsuite.study.server</liquibase-hibernate-package>
4949
<apache.httpclient.version>5.3</apache.httpclient.version>
50-
<!-- FIXME: powsybl-network-store modules'version is overloaded in the dependencies section.The overloads and this property below have to be removed at next powsybl-ws-dependencies.version upgrade -->
51-
<powsybl-network-store.version>1.11.1</powsybl-network-store.version>
5250
</properties>
5351

5452
<build>
@@ -84,24 +82,6 @@
8482
<dependencyManagement>
8583
<dependencies>
8684
<!-- overrides of imports -->
87-
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
88-
<dependency>
89-
<groupId>com.powsybl</groupId>
90-
<artifactId>powsybl-network-store-iidm-impl</artifactId>
91-
<version>${powsybl-network-store.version}</version>
92-
</dependency>
93-
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
94-
<dependency>
95-
<groupId>com.powsybl</groupId>
96-
<artifactId>powsybl-network-store-client</artifactId>
97-
<version>${powsybl-network-store.version}</version>
98-
</dependency>
99-
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
100-
<dependency>
101-
<groupId>com.powsybl</groupId>
102-
<artifactId>powsybl-network-store-model</artifactId>
103-
<version>${powsybl-network-store.version}</version>
104-
</dependency>
10585

10686
<!-- imports -->
10787
<dependency>

src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ protected ResponseEntity<Object> handleStudyException(StudyException exception)
4343
VOLTAGE_INIT_PARAMETERS_NOT_FOUND,
4444
SECURITY_ANALYSIS_PARAMETERS_NOT_FOUND,
4545
LOADFLOW_PARAMETERS_NOT_FOUND,
46-
SENSITIVITY_ANALYSIS_PARAMETERS_NOT_FOUND
46+
SENSITIVITY_ANALYSIS_PARAMETERS_NOT_FOUND,
47+
STATE_ESTIMATION_NOT_FOUND
4748
-> ResponseEntity.status(HttpStatus.NOT_FOUND).body(exception.getType());
4849
case CASE_NOT_FOUND -> ResponseEntity.status(HttpStatus.FAILED_DEPENDENCY).body(exception.getMessage());
4950
case STUDY_ALREADY_EXISTS -> ResponseEntity.status(HttpStatus.CONFLICT).body(type);
@@ -54,7 +55,8 @@ protected ResponseEntity<Object> handleStudyException(StudyException exception)
5455
NON_EVACUATED_ENERGY_RUNNING,
5556
DYNAMIC_SIMULATION_RUNNING,
5657
SHORT_CIRCUIT_ANALYSIS_RUNNING,
57-
VOLTAGE_INIT_RUNNING
58+
VOLTAGE_INIT_RUNNING,
59+
STATE_ESTIMATION_RUNNING
5860
-> ResponseEntity.status(HttpStatus.FORBIDDEN).body(type);
5961
case NOT_ALLOWED,
6062
BAD_NODE_TYPE,

src/main/java/org/gridsuite/study/server/StudyConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private StudyConstants() {
3434
public static final String TIME_SERIES_API_VERSION = "v1";
3535
public static final String DYNAMIC_MAPPING_API_VERSION = ""; // mapping server is now without version, must be v1 in the next time
3636
public static final String FILTER_API_VERSION = "v1";
37+
public static final String STATE_ESTIMATION_API_VERSION = "v1";
3738

3839
public static final String NETWORK_UUID = "networkUuid";
3940
public static final String CASE_UUID = "caseUuid";

src/main/java/org/gridsuite/study/server/StudyController.java

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class StudyController {
7878
private final LoadFlowService loadflowService;
7979
private final CaseService caseService;
8080
private final RemoteServicesInspector remoteServicesInspector;
81+
private final StateEstimationService stateEstimationService;
8182

8283
public StudyController(StudyService studyService,
8384
NetworkService networkStoreService,
@@ -91,7 +92,8 @@ public StudyController(StudyService studyService,
9192
VoltageInitService voltageInitService,
9293
LoadFlowService loadflowService,
9394
CaseService caseService,
94-
RemoteServicesInspector remoteServicesInspector) {
95+
RemoteServicesInspector remoteServicesInspector,
96+
StateEstimationService stateEstimationService) {
9597
this.studyService = studyService;
9698
this.networkModificationTreeService = networkModificationTreeService;
9799
this.networkStoreService = networkStoreService;
@@ -105,6 +107,7 @@ public StudyController(StudyService studyService,
105107
this.loadflowService = loadflowService;
106108
this.caseService = caseService;
107109
this.remoteServicesInspector = remoteServicesInspector;
110+
this.stateEstimationService = stateEstimationService;
108111
}
109112

110113
@InitBinder
@@ -449,18 +452,17 @@ public ResponseEntity<String> getSubstationMapData(
449452
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getSubstationMapData(studyUuid, nodeUuid, substationId, inUpstreamBuiltParentNode));
450453
}
451454

452-
@GetMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements")
455+
@PostMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements")
453456
@Operation(summary = "Get network elements infos")
454457
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The list of network elements infos")})
455458
public ResponseEntity<String> getNetworkElementsInfos(
456459
@PathVariable("studyUuid") UUID studyUuid,
457460
@PathVariable("nodeUuid") UUID nodeUuid,
458-
@Parameter(description = "Substations id") @RequestParam(name = "substationsIds", required = false) List<String> substationsIds,
459-
@Parameter(description = "Element type") @RequestParam(name = "elementType") String elementType,
461+
@RequestBody String equipmentInfos,
460462
@Parameter(description = "Info type") @RequestParam(name = "infoType") String infoType,
461463
@Parameter(description = "Should get in upstream built node ?") @RequestParam(value = "inUpstreamBuiltParentNode", required = false, defaultValue = "false") boolean inUpstreamBuiltParentNode) {
462464

463-
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getNetworkElementsInfos(studyUuid, nodeUuid, substationsIds, elementType, infoType, inUpstreamBuiltParentNode));
465+
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getNetworkElementsInfos(studyUuid, nodeUuid, equipmentInfos, infoType, inUpstreamBuiltParentNode));
464466
}
465467

466468
@GetMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements/{elementId}")
@@ -1902,4 +1904,47 @@ public ResponseEntity<String> exportFilter(
19021904
@Parameter(description = "Filter uuid to be applied") @PathVariable("filterUuid") UUID filterUuid) {
19031905
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.exportFilter(studyUuid, filterUuid));
19041906
}
1907+
1908+
@PostMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/state-estimation/run")
1909+
@Operation(summary = "run state estimation on study")
1910+
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The state estimation has started")})
1911+
public ResponseEntity<Void> runStateEstimation(@Parameter(description = "studyUuid") @PathVariable("studyUuid") UUID studyUuid,
1912+
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid,
1913+
@RequestHeader(HEADER_USER_ID) String userId) {
1914+
studyService.assertIsNodeNotReadOnly(nodeUuid);
1915+
studyService.runStateEstimation(studyUuid, nodeUuid, userId);
1916+
return ResponseEntity.ok().build();
1917+
}
1918+
1919+
@GetMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/state-estimation/result")
1920+
@Operation(summary = "Get a state estimation result on study")
1921+
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The state estimation result"),
1922+
@ApiResponse(responseCode = "204", description = "No state estimation has been done yet"),
1923+
@ApiResponse(responseCode = "404", description = "The state estimation has not been found")})
1924+
public ResponseEntity<String> getStateEstimationResult(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid,
1925+
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) {
1926+
String result = stateEstimationService.getStateEstimationResult(nodeUuid);
1927+
return result != null ? ResponseEntity.ok().body(result) :
1928+
ResponseEntity.noContent().build();
1929+
}
1930+
1931+
@GetMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/state-estimation/status")
1932+
@Operation(summary = "Get the state estimation status on study")
1933+
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The state estimation status"),
1934+
@ApiResponse(responseCode = "204", description = "No state estimation has been done yet"),
1935+
@ApiResponse(responseCode = "404", description = "The state estimation status has not been found")})
1936+
public ResponseEntity<String> getStateEstimationStatus(@Parameter(description = "Study UUID") @PathVariable("studyUuid") UUID studyUuid,
1937+
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) {
1938+
String status = stateEstimationService.getStateEstimationStatus(nodeUuid);
1939+
return status != null ? ResponseEntity.ok().body(status) : ResponseEntity.noContent().build();
1940+
}
1941+
1942+
@PutMapping(value = "/studies/{studyUuid}/nodes/{nodeUuid}/state-estimation/stop")
1943+
@Operation(summary = "stop state estimation on study")
1944+
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The state estimation has been stopped")})
1945+
public ResponseEntity<Void> stopStateEstimation(@Parameter(description = "Study uuid") @PathVariable("studyUuid") UUID studyUuid,
1946+
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) {
1947+
stateEstimationService.stopStateEstimation(studyUuid, nodeUuid);
1948+
return ResponseEntity.ok().build();
1949+
}
19051950
}

src/main/java/org/gridsuite/study/server/StudyException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public enum Type {
110110
NOT_IMPLEMENTED,
111111
EVALUATE_FILTER_FAILED,
112112
GET_USER_PROFILE_FAILED,
113+
STATE_ESTIMATION_RUNNING,
114+
STATE_ESTIMATION_NOT_FOUND,
115+
STATE_ESTIMATION_ERROR,
113116
}
114117

115118
private final Type type;

src/main/java/org/gridsuite/study/server/SupervisionController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public SupervisionController(SupervisionService supervisionService, StudyService
4949

5050
@DeleteMapping(value = "/computation/results")
5151
@Operation(summary = "delete all results of a given computation")
52-
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "all loadflow results have been deleted")})
52+
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "all computation results have been deleted")})
5353
public ResponseEntity<Integer> deleteComputationResults(@Parameter(description = "Computation type") @RequestParam("type") ComputationType computationType,
5454
@Parameter(description = "Dry run") @RequestParam("dryRun") boolean dryRun) {
5555
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(supervisionService.deleteComputationResults(computationType, dryRun));

src/main/java/org/gridsuite/study/server/dto/ComputationType.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public enum ComputationType {
2828
NotificationService.UPDATE_TYPE_DYNAMIC_SIMULATION_FAILED),
2929
SHORT_CIRCUIT_ONE_BUS("One bus Short circuit analysis", "oneBusShortCircuitAnalysisResultUuid",
3030
NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_STATUS, NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_RESULT,
31-
NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_FAILED);
31+
NotificationService.UPDATE_TYPE_ONE_BUS_SHORT_CIRCUIT_FAILED),
32+
STATE_ESTIMATION("State estimation", "stateEstimationResultUuid",
33+
NotificationService.UPDATE_TYPE_STATE_ESTIMATION_STATUS, NotificationService.UPDATE_TYPE_STATE_ESTIMATION_RESULT,
34+
NotificationService.UPDATE_TYPE_STATE_ESTIMATION_FAILED);
3235

3336
private final String label; // used for logs
3437
private final String resultUuidLabel;

src/main/java/org/gridsuite/study/server/dto/DeleteNodeInfos.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public class DeleteNodeInfos {
4343
private List<UUID> voltageInitResultUuids = new ArrayList<>();
4444
private List<UUID> dynamicSimulationResultUuids = new ArrayList<>();
4545

46+
private List<UUID> stateEstimationResultUuids = new ArrayList<>();
47+
4648
public void addModificationGroupUuid(UUID modificationGroupUuid) {
4749
modificationGroupUuids.add(modificationGroupUuid);
4850
}
@@ -86,4 +88,8 @@ public void addOneBusShortCircuitAnalysisResultUuid(UUID oneBusShortCircuitAnaly
8688
public void addVoltageInitResultUuid(UUID voltageInitResultUuid) {
8789
voltageInitResultUuids.add(voltageInitResultUuid);
8890
}
91+
92+
public void addStateEstimationResultUuid(UUID stateEstimationResultUuid) {
93+
stateEstimationResultUuids.add(stateEstimationResultUuid);
94+
}
8995
}

src/main/java/org/gridsuite/study/server/dto/InvalidateNodeInfos.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public class InvalidateNodeInfos {
4646
private List<UUID> voltageInitResultUuids = new ArrayList<>();
4747
private List<UUID> dynamicSimulationResultUuids = new ArrayList<>();
4848

49+
private List<UUID> stateEstimationResultUuids = new ArrayList<>();
50+
4951
public void addReportUuid(UUID reportUuid) {
5052
reportUuids.add(reportUuid);
5153
}
@@ -92,4 +94,8 @@ public void addVoltageInitResultUuid(UUID voltageInitResultUuid) {
9294
public void addDynamicSimulationResultUuid(UUID dynamicSimulationResultUuid) {
9395
dynamicSimulationResultUuids.add(dynamicSimulationResultUuid);
9496
}
97+
98+
public void addStateEstimationResultUuid(UUID stateEstimationResultUuid) {
99+
stateEstimationResultUuids.add(stateEstimationResultUuid);
100+
}
95101
}

src/main/java/org/gridsuite/study/server/dto/NodeModificationInfos.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ public class NodeModificationInfos {
4040
private UUID voltageInitUuid;
4141

4242
private UUID dynamicSimulationUuid;
43+
44+
private UUID stateEstimationUuid;
4345
}

0 commit comments

Comments
 (0)