@@ -78,6 +78,7 @@ public class StudyController {
78
78
private final LoadFlowService loadflowService ;
79
79
private final CaseService caseService ;
80
80
private final RemoteServicesInspector remoteServicesInspector ;
81
+ private final StateEstimationService stateEstimationService ;
81
82
82
83
public StudyController (StudyService studyService ,
83
84
NetworkService networkStoreService ,
@@ -91,7 +92,8 @@ public StudyController(StudyService studyService,
91
92
VoltageInitService voltageInitService ,
92
93
LoadFlowService loadflowService ,
93
94
CaseService caseService ,
94
- RemoteServicesInspector remoteServicesInspector ) {
95
+ RemoteServicesInspector remoteServicesInspector ,
96
+ StateEstimationService stateEstimationService ) {
95
97
this .studyService = studyService ;
96
98
this .networkModificationTreeService = networkModificationTreeService ;
97
99
this .networkStoreService = networkStoreService ;
@@ -105,6 +107,7 @@ public StudyController(StudyService studyService,
105
107
this .loadflowService = loadflowService ;
106
108
this .caseService = caseService ;
107
109
this .remoteServicesInspector = remoteServicesInspector ;
110
+ this .stateEstimationService = stateEstimationService ;
108
111
}
109
112
110
113
@ InitBinder
@@ -449,18 +452,17 @@ public ResponseEntity<String> getSubstationMapData(
449
452
return ResponseEntity .ok ().contentType (MediaType .APPLICATION_JSON ).body (studyService .getSubstationMapData (studyUuid , nodeUuid , substationId , inUpstreamBuiltParentNode ));
450
453
}
451
454
452
- @ GetMapping (value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements" )
455
+ @ PostMapping (value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements" )
453
456
@ Operation (summary = "Get network elements infos" )
454
457
@ ApiResponses (value = {@ ApiResponse (responseCode = "200" , description = "The list of network elements infos" )})
455
458
public ResponseEntity <String > getNetworkElementsInfos (
456
459
@ PathVariable ("studyUuid" ) UUID studyUuid ,
457
460
@ 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 ,
460
462
@ Parameter (description = "Info type" ) @ RequestParam (name = "infoType" ) String infoType ,
461
463
@ Parameter (description = "Should get in upstream built node ?" ) @ RequestParam (value = "inUpstreamBuiltParentNode" , required = false , defaultValue = "false" ) boolean inUpstreamBuiltParentNode ) {
462
464
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 ));
464
466
}
465
467
466
468
@ GetMapping (value = "/studies/{studyUuid}/nodes/{nodeUuid}/network/elements/{elementId}" )
@@ -1902,4 +1904,47 @@ public ResponseEntity<String> exportFilter(
1902
1904
@ Parameter (description = "Filter uuid to be applied" ) @ PathVariable ("filterUuid" ) UUID filterUuid ) {
1903
1905
return ResponseEntity .ok ().contentType (MediaType .APPLICATION_JSON ).body (studyService .exportFilter (studyUuid , filterUuid ));
1904
1906
}
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
+ }
1905
1950
}
0 commit comments