Skip to content

Commit

Permalink
Change integration test for criteria failed simulation
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Sep 17, 2024
1 parent d32b6e0 commit 19ff085
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,15 @@ void testIeee14WithDump() throws IOException {

@Test
void testIeee14WithSimulationCriteria() {

Supplier<DynamicSimulationResult> resultSupplier = setupIEEE14Simulation();
ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("integrationTest", "Integration test").build();
Supplier<DynamicSimulationResult> resultSupplier = setupIEEE14Simulation(reportNode);
dynawoSimulationParameters.setCriteriaFilePath(Path.of(Objects.requireNonNull(getClass().getResource("/ieee14/criteria.crt")).getPath()));
DynamicSimulationResult result = resultSupplier.get();

assertEquals(DynamicSimulationResult.Status.SUCCESS, result.getStatus());
assertTrue(result.getStatusText().isEmpty());
assertEquals(41, result.getCurves().size());
DoubleTimeSeries ts1 = result.getCurve("_GEN____1_SM_generator_UStatorPu");
assertEquals("_GEN____1_SM_generator_UStatorPu", ts1.getMetadata().getName());
assertEquals(587, ts1.toArray().length);
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(23, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
assertEquals(DynamicSimulationResult.Status.FAILURE, result.getStatus());
ReportNode dynawoLog = reportNode.getChildren().get(2);
assertEquals("dynawoLog", dynawoLog.getMessageKey());
assertTrue(dynawoLog.getChildren().stream().anyMatch(r -> r.getMessage().contains("one simulation's criteria is not respected")));
}

@Test
Expand Down Expand Up @@ -310,6 +305,10 @@ void testIEEE14SignalN() {
}

private Supplier<DynamicSimulationResult> setupIEEE14Simulation() {
return setupIEEE14Simulation(NO_OP);
}

private Supplier<DynamicSimulationResult> setupIEEE14Simulation(ReportNode reportNode) {
Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm")));

GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier(
Expand All @@ -334,7 +333,7 @@ private Supplier<DynamicSimulationResult> setupIEEE14Simulation() {
.setTimelineExportMode(DynawoSimulationParameters.ExportMode.XML);

return () -> provider.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier,
VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP)
VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, reportNode)
.join();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<criteria xmlns="http://www.rte-france.com/dynawo">
<busCriteria>
<parameters id ="minimum bus voltage" scope="DYNAMIC" type="LOCAL_VALUE" uMinPu="0.6"/>
<parameters id ="minimum bus voltage" scope="DYNAMIC" type="LOCAL_VALUE" uMinPu="10.5"/>
<component id="_BUS___10_TN"/>
</busCriteria>
<busCriteria>
Expand Down

0 comments on commit 19ff085

Please sign in to comment.