-
Notifications
You must be signed in to change notification settings - Fork 2
TU sensitivity computation with wiremock #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
| "\"sensitivityInjectionsSet\":[],\"sensitivityInjection\":[],\"sensitivityHVDC\":[],\"sensitivityPST\":[],\"sensitivityNodes\":[]}"; | ||
| public static final String SENSITIVITY_ANALYSIS_UPDATED_PARAMETERS_JSON = "{\"flowFlowSensitivityValueThreshold\":90.0,\"angleFlowSensitivityValueThreshold\":0.6,\"flowVoltageSensitivityValueThreshold\":0.1,\"sensitivityInjectionsSet\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"injections\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"distributionType\":\"PROPORTIONAL\",\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityInjection\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"injections\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityHVDC\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"sensitivityType\":\"DELTA_MW\",\"hvdcs\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityPST\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"sensitivityType\":\"DELTA_MW\",\"psts\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityNodes\":[{\"monitoredVoltageLevels\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"equipmentsInVoltageRegulation\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}]}"; | ||
|
|
||
| private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"lowVoltageAbsoluteThreshold\":30.0,\"lowVoltageProportionalThreshold\":0.4,\"highVoltageAbsoluteThreshold\":0.0,\"highVoltageProportionalThreshold\":0.0,\"flowProportionalThreshold\":0.1}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a copy pasted security analysis parameters json, not a sensitivity analysis parameters json.
It looks like this data is useless and could just be
| private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"lowVoltageAbsoluteThreshold\":30.0,\"lowVoltageProportionalThreshold\":0.4,\"highVoltageAbsoluteThreshold\":0.0,\"highVoltageProportionalThreshold\":0.0,\"flowProportionalThreshold\":0.1}"; | |
| private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "dummy sensitivity analysis parameters"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"flowFlowSensitivityValueThreshold\":30.0,\"voltageVoltageSensitivityValueThreshold\":0.4,\"flowVoltageSensitivityValueThreshold\":0.0,\"angleFlowSensitivityValueThreshold\":0.0}";
I updated it
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
Mathieu-Deharbe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the length of time. I took quite some time to understand the new system well. And so I brought back quite a few extra small things. Do with it what you want.
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
| // Verify message sent to frontend | ||
| Message<byte[]> message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); | ||
| assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); | ||
| assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID)); | ||
| String updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE); | ||
| assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED, updateType); | ||
| assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like this could be replaced by a call to checkMessagesReceived.
| message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); | ||
| assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); | ||
| assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID)); | ||
| updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE); | ||
| assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType); | ||
| assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED, updateType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too looks like it could be replaced by a call to checkMessagesReceived.
| message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); | ||
| assertEquals(studyUuid2, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); | ||
| assertEquals(studyUuid2, message.getHeaders().get(HEADER_STUDY_UUID)); | ||
| updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE); | ||
| assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType); | ||
|
|
||
| assertTrue(TestUtils.getRequestsDone(1, server).stream().anyMatch(r -> r.matches("/v1/networks/" + NETWORK_UUID_3_STRING + "/run-and-save.*?receiver=.*nodeUuid.*"))); | ||
| } | ||
|
|
||
| private StudyEntity insertDummyStudy(UUID networkUuid, UUID caseUuid, UUID sensitivityAnalysisParametersUuid) { | ||
| StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, UUID.randomUUID(), null, null, sensitivityAnalysisParametersUuid, null, null); | ||
| var study = studyRepository.save(studyEntity); | ||
| networkModificationTreeService.createRoot(studyEntity); | ||
| return study; | ||
| } | ||
| assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too looks like it could be replaced by a call to checkMessagesReceived.
src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
Outdated
Show resolved
Hide resolved
| Message<byte[]> message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); | ||
| assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID)); | ||
| assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, message.getHeaders().get(HEADER_UPDATE_TYPE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too looks like it could be replaced by a call to checkMessagesReceived.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); | ||
| assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID)); | ||
| assertEquals(UPDATE_TYPE_COMPUTATION_PARAMETERS, message.getHeaders().get(HEADER_UPDATE_TYPE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too looks like it could be replaced by a call to checkMessagesReceived.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| // run-and-save called | ||
| wireMockServer.verify(postRequestedFor( | ||
| urlPathMatching("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save.*")) | ||
| .withQueryParam("reportType", equalTo("SensitivityAnalysis")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is longer. Do as you wish.
| .withQueryParam("reportType", equalTo("SensitivityAnalysis")) | |
| .withQueryParam("reportType", equalTo(SENSITIVITY_ANALYSIS.reportKey)) |
|



PR Summary