Skip to content

Commit

Permalink
Add tests for TwoWindingsTransformerToBeEstimated and ThreeWindingsTr…
Browse files Browse the repository at this point in the history
…ansformerToBeEstimated extensions (#39)

* Add tests for TwoWindingsTransformerToBeEstimated and ThreeWindingsTransformerToBeEstimated extensions

Signed-off-by: Franck LECUYER <[email protected]>
  • Loading branch information
FranckLecuyer authored Jun 17, 2024
1 parent e8bbd59 commit 34bccba
Showing 1 changed file with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ public void testMeasurements() {
try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = service.getNetwork(service.getNetworkIds().keySet().iterator().next());
TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("NHV2_NLOAD");

Measurements measurements = twoWindingsTransformer.getExtension(Measurements.class);
assertNotNull(measurements);

Expand Down Expand Up @@ -1356,7 +1357,6 @@ public void testMeasurements() {

measurement = measurements.getMeasurement("Measurement_ID_1");
assertNull(measurement);

}
}

Expand Down Expand Up @@ -1410,6 +1410,7 @@ public void testDiscreteMeasurements() {

try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = service.getNetwork(service.getNetworkIds().keySet().iterator().next());

TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("NHV2_NLOAD");
DiscreteMeasurements measurements = twoWindingsTransformer.getExtension(DiscreteMeasurements.class);
assertNotNull(measurements);
Expand All @@ -1426,7 +1427,60 @@ public void testDiscreteMeasurements() {

measurement = measurements.getDiscreteMeasurement("Measurement_ID_1");
assertNull(measurement);
}
}

@Test
public void test2wtToBeEstimated() {
try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = EurostagTutorialExample1Factory.create(service.getNetworkFactory());
TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("NHV2_NLOAD");
twoWindingsTransformer.newExtension(TwoWindingsTransformerToBeEstimatedAdder.class)
.withRatioTapChangerStatus(true)
.withPhaseTapChangerStatus(false)
.add();
service.flush(network);
}

try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = service.getNetwork(service.getNetworkIds().keySet().iterator().next());
TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("NHV2_NLOAD");
TwoWindingsTransformerToBeEstimated twoWindingsTransformerToBeEstimated = twoWindingsTransformer.getExtension(TwoWindingsTransformerToBeEstimated.class);
assertNotNull(twoWindingsTransformerToBeEstimated);

assertTrue(twoWindingsTransformerToBeEstimated.shouldEstimateRatioTapChanger());
assertFalse(twoWindingsTransformerToBeEstimated.shouldEstimatePhaseTapChanger());
}
}

@Test
public void test3wtToBeEstimated() {
try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = ThreeWindingsTransformerNetworkFactory.create(service.getNetworkFactory());
ThreeWindingsTransformer threeWindingsTransformer = network.getThreeWindingsTransformer("3WT");
threeWindingsTransformer.newExtension(ThreeWindingsTransformerToBeEstimatedAdder.class)
.withRatioTapChanger1Status(true)
.withPhaseTapChanger1Status(false)
.withRatioTapChanger2Status(false)
.withPhaseTapChanger2Status(true)
.withRatioTapChanger3Status(true)
.withPhaseTapChanger3Status(true)
.add();
service.flush(network);
}

try (NetworkStoreService service = createNetworkStoreService(randomServerPort)) {
Network network = service.getNetwork(service.getNetworkIds().keySet().iterator().next());
ThreeWindingsTransformer threeWindingsTransformer = network.getThreeWindingsTransformer("3WT");
ThreeWindingsTransformerToBeEstimated threeWindingsTransformerToBeEstimated = threeWindingsTransformer.getExtension(ThreeWindingsTransformerToBeEstimated.class);
assertNotNull(threeWindingsTransformerToBeEstimated);

assertTrue(threeWindingsTransformerToBeEstimated.shouldEstimateRatioTapChanger1());
assertFalse(threeWindingsTransformerToBeEstimated.shouldEstimatePhaseTapChanger1());
assertFalse(threeWindingsTransformerToBeEstimated.shouldEstimateRatioTapChanger2());
assertTrue(threeWindingsTransformerToBeEstimated.shouldEstimatePhaseTapChanger2());
assertTrue(threeWindingsTransformerToBeEstimated.shouldEstimateRatioTapChanger3());
assertTrue(threeWindingsTransformerToBeEstimated.shouldEstimatePhaseTapChanger3());
}
}
}

0 comments on commit 34bccba

Please sign in to comment.