Skip to content

Commit

Permalink
Add tests to improve coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien Murgey <sebastien.murgey@rte-france.com>
  • Loading branch information
murgeyseb committed Oct 17, 2023
1 parent 7a9a387 commit b35ea00
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,36 @@ void testNetPositionIsZeroWhenDanglingLineBorderPIsNaN() {
assertEquals(0, countryAreaCH.create(testNetwork).getNetPosition(), 1e-3);
assertEquals(0, countryAreaIT.create(testNetwork).getNetPosition(), 1e-3);
}

@Test
void testNetPositionPartOfLineIsZeroWhenLineTerminal1PIsNaN() {
Network network = Network.read("testCaseSpecialDevices.xiidm", getClass().getResourceAsStream("/testCaseSpecialDevices.xiidm"));
network.getLine("LINE_FR_ES").getTerminal1().setP(Double.NaN);
assertEquals(75, countryAreaFactoryFR.create(network).getNetPosition(), 1e-3);
assertEquals(-75, countryAreaFactoryES.create(network).getNetPosition(), 1e-3);
}

@Test
void testNetPositionPartOfLineIsZeroWhenLineTerminal2PIsNaN() {
Network network = Network.read("testCaseSpecialDevices.xiidm", getClass().getResourceAsStream("/testCaseSpecialDevices.xiidm"));
network.getLine("LINE_FR_ES").getTerminal2().setP(Double.NaN);
assertEquals(75, countryAreaFactoryFR.create(network).getNetPosition(), 1e-3);
assertEquals(-75, countryAreaFactoryES.create(network).getNetPosition(), 1e-3);
}

@Test
void testNetPositionPartOfHvdcIsZeroWhenHvdcTerminal1PIsNaN() {
Network network = Network.read("testCaseSpecialDevices.xiidm", getClass().getResourceAsStream("/testCaseSpecialDevices.xiidm"));
network.getHvdcLine("HVDC_FR_ES").getConverterStation1().getTerminal().setP(Double.NaN);
assertEquals(75, countryAreaFactoryFR.create(network).getNetPosition(), 1e-3);
assertEquals(-75, countryAreaFactoryES.create(network).getNetPosition(), 1e-3);
}

@Test
void testNetPositionPartOfHvdcIsZeroWhenHvdcTerminal2PIsNaN() {
Network network = Network.read("testCaseSpecialDevices.xiidm", getClass().getResourceAsStream("/testCaseSpecialDevices.xiidm"));
network.getHvdcLine("HVDC_FR_ES").getConverterStation2().getTerminal().setP(Double.NaN);
assertEquals(75, countryAreaFactoryFR.create(network).getNetPosition(), 1e-3);
assertEquals(-75, countryAreaFactoryES.create(network).getNetPosition(), 1e-3);
}
}

0 comments on commit b35ea00

Please sign in to comment.