Skip to content

Commit

Permalink
Make the unit test more complex to fail
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <[email protected]>
  • Loading branch information
flo-dup committed Jan 21, 2025
1 parent ff6a39c commit 1461740
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ public void afterRemoval(String id) {
}

@Test
void testFaultyRemoveVoltageLevel() {
void testLoops() {
Network network = Network.create("test", "test");
var s = network.newSubstation().setId("s").add();

// First voltage level (which will be removed)
// First voltage level (which will be removed):
// two busbars linked with a coupler, two lines, one diamond-shaped cell (two breakers in parallel)
var vl1 = s.newVoltageLevel().setId("vl1").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(225).add();
vl1.getNodeBreakerView().newBusbarSection().setId("bbs1").setNode(0).add();
vl1.getNodeBreakerView().newBusbarSection().setId("bbs2").setNode(1).add();
vl1.getNodeBreakerView().newSwitch().setId("Coupler").setNode1(0).setNode2(1).setKind(SwitchKind.BREAKER).add();
vl1.getNodeBreakerView().newSwitch().setId("d_l1_bbs1").setNode1(0).setNode2(2).setKind(SwitchKind.DISCONNECTOR).add();
vl1.getNodeBreakerView().newSwitch().setId("d_l2_bbs1").setNode1(0).setNode2(3).setKind(SwitchKind.DISCONNECTOR).add();
vl1.getNodeBreakerView().newSwitch().setId("d_l1_bbs2").setNode1(1).setNode2(2).setKind(SwitchKind.DISCONNECTOR).add();
vl1.getNodeBreakerView().newSwitch().setId("d_l2_bbs1").setNode1(0).setNode2(3).setKind(SwitchKind.DISCONNECTOR).add();
vl1.getNodeBreakerView().newSwitch().setId("d_l2_bbs2").setNode1(1).setNode2(3).setKind(SwitchKind.DISCONNECTOR).add();
vl1.getNodeBreakerView().newSwitch().setId("b_l2_bbs2_A").setNode1(3).setNode2(4).setKind(SwitchKind.BREAKER).setOpen(true).add();
vl1.getNodeBreakerView().newSwitch().setId("b_l2_bbs2_B").setNode1(3).setNode2(4).setKind(SwitchKind.BREAKER).setOpen(false).add();

// Second voltage level
// Second voltage level, only there to host the lines
var vl2 = s.newVoltageLevel().setId("vl2").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(225).add();
vl2.getNodeBreakerView().newBusbarSection().setId("bbs").setNode(0).add();
vl2.getNodeBreakerView().newInternalConnection().setNode1(0).setNode2(1).add();
Expand All @@ -76,7 +79,7 @@ void testFaultyRemoveVoltageLevel() {
// Parallel lines between voltage levels
var line1 = network.newLine().setId("line1").setVoltageLevel1(vl1.getId()).setVoltageLevel2(vl2.getId()).setNode1(2).setNode2(1)
.setR(0.01).setX(20.0).setG1(0.0).setB1(0.0).setG2(0.0).setB2(0.0).add();
network.newLine(line1).setId("line2").setNode1(3).setNode2(2).add();
network.newLine(line1).setId("line2").setNode1(4).setNode2(2).add();

addListener(network);

Expand Down

0 comments on commit 1461740

Please sign in to comment.