diff --git a/pom.xml b/pom.xml index 656885a6b..2dd2b7e7b 100644 --- a/pom.xml +++ b/pom.xml @@ -130,6 +130,20 @@ com.powsybl powsybl-network-store-client + + 1.16.0 + + + + com.powsybl + powsybl-network-store-iidm-impl + 1.16.0 + + + + com.powsybl + powsybl-network-store-model + 1.16.0 com.powsybl diff --git a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideOneLineTest.java b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideOneLineTest.java index 2937b122c..e01a42936 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideOneLineTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideOneLineTest.java @@ -88,8 +88,8 @@ public void testCreateWithErrors() throws Exception { .setId("cantdisconnect") .setVoltageLevel1("v1") .setVoltageLevel2("v3") - .setNode1(0) - .setNode2(0) + .setNode1(3) + .setNode2(7) .setX(12) .setR(7) .add(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideTwoLineTest.java b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideTwoLineTest.java index 3a685d593..375051058 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideTwoLineTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationEnergiseSideTwoLineTest.java @@ -87,8 +87,8 @@ public void testCreateWithErrors() throws Exception { .setId("cantdisconnect") .setVoltageLevel1("v1") .setVoltageLevel2("v3") - .setNode1(0) - .setNode2(0) + .setNode1(100) + .setNode2(100) .setX(12) .setR(7) .add(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationLockoutLineTest.java b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationLockoutLineTest.java index 46143a676..55f50642c 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationLockoutLineTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/OperatingStatusModificationLockoutLineTest.java @@ -56,8 +56,8 @@ protected Network createNetwork(UUID networkUuid) { private Line createLineAndSwitches(SwitchKind switchKind, boolean isFictitious) { VoltageLevel vl2 = getNetwork().getVoltageLevel("vl2"); - createSwitch(vl2, "br12", "br12", switchKind, false, false, isFictitious, 3, 2); - createSwitch(vl2, "br22", "br22", switchKind, false, false, isFictitious, 2, 6); + createSwitch(vl2, "br12", "br12", switchKind, false, false, isFictitious, 0, 3); + createSwitch(vl2, "br22", "br22", switchKind, false, false, isFictitious, 0, 3); return getNetwork().newLine() .setId("line1") @@ -70,7 +70,7 @@ private Line createLineAndSwitches(SwitchKind switchKind, boolean isFictitious) .setG2(0.0) .setB1(0.0) .setB2(0.0) - .setNode1(2) + .setNode1(3) .setNode2(3) .add(); } diff --git a/src/test/java/org/gridsuite/modification/server/modifications/ShuntCompensatorModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/ShuntCompensatorModificationTest.java index ba625f448..af8bf16f4 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/ShuntCompensatorModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/ShuntCompensatorModificationTest.java @@ -97,7 +97,7 @@ public void testWrongSectionCount() { @Test public void testWrongSectionCountChangeSectionCount() { VoltageLevel v5 = getNetwork().getVoltageLevel("v5"); - createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); var shuntCompensator = getNetwork().getShuntCompensator("v7shunt"); var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class); @@ -119,7 +119,7 @@ public void testWrongSectionCountChangeSectionCount() { @Test public void testWrongSectionCountChangeMaximumSectionCount() { VoltageLevel v5 = getNetwork().getVoltageLevel("v5"); - createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); var shuntCompensator = getNetwork().getShuntCompensator("v7shunt"); var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class); @@ -157,7 +157,7 @@ public void testNegativeQmaxAtNominalV() { @Test public void testCreateModificationWithShuntCompensatorType() { VoltageLevel v5 = getNetwork().getVoltageLevel("v5"); - createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); var shuntCompensator = getNetwork().getShuntCompensator("v7shunt"); var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class); @@ -180,7 +180,7 @@ public void testCreateModificationWithShuntCompensatorType() { @Test public void testCreateModificationWithSusceptancePerSection() { VoltageLevel v5 = getNetwork().getVoltageLevel("v5"); - createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); var shuntCompensator = getNetwork().getShuntCompensator("v7shunt"); var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class); @@ -223,9 +223,9 @@ public void testCreateModificationWithSections() { @Test public void testCreateModificationWithQAtNominalV() { VoltageLevel v5 = getNetwork().getVoltageLevel("v5"); - createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); VoltageLevel v6 = getNetwork().getVoltageLevel("v6"); - createShuntCompensator(v6, "v8shunt", "v8shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v8shunt", 50, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v6, "v8shunt", "v8shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v8shunt", 50, ConnectablePosition.Direction.BOTTOM); ShuntCompensatorModificationInfos modificationInfos1 = ShuntCompensatorModificationInfos.builder() .stashed(false) @@ -261,7 +261,7 @@ public void testCreateModificationWithQAtNominalV() { @Override protected ModificationInfos buildModification() { VoltageLevel v2 = getNetwork().getVoltageLevel("v2"); - createShuntCompensator(v2, "v7shunt", "v7shunt", 15, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); + createShuntCompensator(v2, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM); return ShuntCompensatorModificationInfos.builder() .stashed(false) diff --git a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerByFormulaModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerByFormulaModificationTest.java index d5d56e4ce..633bf98ba 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerByFormulaModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerByFormulaModificationTest.java @@ -143,42 +143,48 @@ public void testModifyTwtWithWarning() throws Exception { protected void createEquipments() { Substation s1 = getNetwork().getSubstation("s1"); Substation s3 = getNetwork().getSubstation("s3"); - TwoWindingsTransformer twt1 = createTwoWindingsTransformer(s1, TWT_ID_1, TWT_ID_1, 30, 40, 50, 60, 10, 20, 100, 110, + TwoWindingsTransformer twt1 = createTwoWindingsTransformer(s1, TWT_ID_1, TWT_ID_1, 30, 40, 50, + 60, 10, 20, 100, 100, "v1", "v2", "trf1", 11, ConnectablePosition.Direction.TOP, "trf1", 22, ConnectablePosition.Direction.BOTTOM); twt1.setRatedS(11); addRatioTapChangerSteps(twt1.newRatioTapChanger().setTargetV(50).setLowTapPosition(0).setTapPosition(1).setTargetDeadband(55)); - TwoWindingsTransformer twt2 = createTwoWindingsTransformer(s1, TWT_ID_2, TWT_ID_2, 35, 45, 55, 65, 15, 25, 105, 115, + TwoWindingsTransformer twt2 = createTwoWindingsTransformer(s1, TWT_ID_2, TWT_ID_2, 35, 45, 55, + 65, 15, 25, 101, 100, "v1", "v4", "trf1", 33, ConnectablePosition.Direction.TOP, "trf1", 44, ConnectablePosition.Direction.BOTTOM); twt2.setRatedS(10); addRatioTapChangerSteps(twt2.newRatioTapChanger().setTargetV(53).setLowTapPosition(3).setTapPosition(4).setTargetDeadband(58)); - TwoWindingsTransformer twt3 = createTwoWindingsTransformer(s1, TWT_ID_3, TWT_ID_3, 40, 50, 60, 70, 20, 30, 110, 120, + TwoWindingsTransformer twt3 = createTwoWindingsTransformer(s1, TWT_ID_3, TWT_ID_3, 40, 50, 60, + 70, 20, 30, 101, 101, "v2", "v4", "trf1", 10, ConnectablePosition.Direction.TOP, "trf1", 20, ConnectablePosition.Direction.BOTTOM); twt3.setRatedS(25); addRatioTapChangerSteps(twt3.newRatioTapChanger().setTargetV(56).setLowTapPosition(0).setTapPosition(1).setTargetDeadband(61)); - TwoWindingsTransformer twt4 = createTwoWindingsTransformer(s3, TWT_ID_4, TWT_ID_4, 45, 55, 65, 75, 25, 35, 115, 125, + TwoWindingsTransformer twt4 = createTwoWindingsTransformer(s3, TWT_ID_4, TWT_ID_4, 45, 55, 65, + 75, 25, 35, 100, 100, "v5", "v6", "trf1", 30, ConnectablePosition.Direction.TOP, "trf1", 40, ConnectablePosition.Direction.BOTTOM); twt4.setRatedS(15); addPhaseTapChangerSteps(twt4.newPhaseTapChanger().setRegulationValue(45).setLowTapPosition(1).setTapPosition(2).setTargetDeadband(34)); - TwoWindingsTransformer twt5 = createTwoWindingsTransformer(s3, TWT_ID_5, TWT_ID_5, 50, 60, 70, 80, 30, 40, 120, 130, + TwoWindingsTransformer twt5 = createTwoWindingsTransformer(s3, TWT_ID_5, TWT_ID_5, 50, 60, 70, + 80, 30, 40, 101, 101, "v5", "v6", "trf1", 15, ConnectablePosition.Direction.TOP, "trf1", 26, ConnectablePosition.Direction.BOTTOM); twt5.setRatedS(30); addPhaseTapChangerSteps(twt5.newPhaseTapChanger().setRegulationValue(46).setLowTapPosition(2).setTapPosition(2).setTargetDeadband(35)); - TwoWindingsTransformer twt6 = createTwoWindingsTransformer(s3, TWT_ID_6, TWT_ID_6, 55, 65, 75, 85, 35, 45, 125, 135, + TwoWindingsTransformer twt6 = createTwoWindingsTransformer(s3, TWT_ID_6, TWT_ID_6, 55, 65, 75, 85, + 35, 45, 102, 102, "v5", "v6", "trf1", 38, ConnectablePosition.Direction.TOP, "trf1", 49, ConnectablePosition.Direction.BOTTOM); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java index 71dbbbf83..7ec3a0df4 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java @@ -584,9 +584,14 @@ protected void testUpdateModificationMessage(ModificationInfos modificationInfos @Test @SneakyThrows public void testChangeConnectionStatus() { - changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, false, "Could not disconnect equipment 'trf1' on side ONE"); - changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, false, "Could not disconnect equipment 'trf1' on side TWO"); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, true, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, false, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, true, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, false, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.ONE, true, true, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.ONE, true, false, null); changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.TWO, true, true, null); + changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.TWO, true, false, "Could not disconnect equipment 'trf2' on side TWO"); } @SneakyThrows diff --git a/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java b/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java index 17c63a531..a5c228386 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java +++ b/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java @@ -39,20 +39,21 @@ public static Network createSwitchNetwork(UUID uuid, NetworkFactory networkFacto vl1.getNodeBreakerView().newBusbarSection() .setId("b1") .setName("b1") - .setNode(1) + .setNode(0) .add(); - createSwitch(vl1, "br11", "br11", SwitchKind.BREAKER, false, false, false, 2, 1); - createSwitch(vl1, "b4", "b4", SwitchKind.DISCONNECTOR, false, false, false, 1, 4); - createSwitch(vl1, "br21", "br21", SwitchKind.BREAKER, false, false, true, 4, 5); - VoltageLevel vl2 = createVoltageLevel(s1, "vl2", "vl2", TopologyKind.NODE_BREAKER, 400.0); vl2.getNodeBreakerView().newBusbarSection() .setId("b2") .setName("b2") - .setNode(2) + .setNode(0) .add(); + createSwitch(vl1, "b4", "b4", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + createSwitch(vl1, "br11", "br11", SwitchKind.BREAKER, false, false, false, 1, 2); + createSwitch(vl2, "b5", "b5", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + createSwitch(vl2, "br21", "br21", SwitchKind.BREAKER, false, false, true, 1, 2); + network.newLine() .setId("line2") .setName("line2") @@ -64,8 +65,8 @@ public static Network createSwitchNetwork(UUID uuid, NetworkFactory networkFacto .setG2(0.0) .setB1(0.0) .setB2(0.0) - .setNode1(5) - .setNode2(6) + .setNode1(2) + .setNode2(2) .add(); network.getVariantManager().setWorkingVariant(VariantManagerConstants.INITIAL_VARIANT_ID); @@ -158,10 +159,6 @@ public static Network create(UUID uuid, boolean createHvdcLine, NetworkFactory n createSwitch(v3, "v3dBattery", "v3dBattery", SwitchKind.DISCONNECTOR, true, false, false, 0, 5); createSwitch(v3, "v3bBattery", "v3bBattery", SwitchKind.BREAKER, true, false, false, 5, 6); - Terminal phaseTapChangerTerminal = ModificationUtils.getInstance().getTerminalFromIdentifiable(network, - "v3load", - "LOAD", - "V3"); TwoWindingsTransformer t2 = createTwoWindingsTransformer(s1, "trf1", "trf1", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 4, 14, v1.getId(), v2.getId(), "trf1", 1, ConnectablePosition.Direction.TOP, @@ -197,10 +194,19 @@ public static Network create(UUID uuid, boolean createHvdcLine, NetworkFactory n .endStep() .add(); + createSwitch(v1, "v1btrf1", "v1btrf1", SwitchKind.BREAKER, true, false, false, 4, 5); + createSwitch(v1, "v1dtrf1", "v1dtrf1", SwitchKind.DISCONNECTOR, true, false, false, 5, 0); + createSwitch(v2, "v2btrf1", "v2btrf1", SwitchKind.BREAKER, true, false, false, 14, 15); + createSwitch(v2, "v2dtrf1", "v2dtrf1", SwitchKind.DISCONNECTOR, true, false, false, 15, 1); + TwoWindingsTransformer twt2 = createTwoWindingsTransformer(s1, "trf2", "trf2", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 4, 14, v1.getId(), v2.getId(), - "trf1", 1, ConnectablePosition.Direction.TOP, - "trf1", 2, ConnectablePosition.Direction.TOP); + 40, 150, v1.getId(), v2.getId(), + "trf2", 1, ConnectablePosition.Direction.TOP, + "trf2", 2, ConnectablePosition.Direction.TOP); + Terminal phaseTapChangerTerminal = ModificationUtils.getInstance().getTerminalFromIdentifiable(network, + "v3load", + "LOAD", + "V3"); twt2.newPhaseTapChanger() .setLowTapPosition(0) .setTapPosition(1) @@ -225,10 +231,9 @@ public static Network create(UUID uuid, boolean createHvdcLine, NetworkFactory n .endStep() .add(); - createSwitch(v1, "v1btrf1", "v1btrf1", SwitchKind.BREAKER, true, false, false, 4, 5); - createSwitch(v1, "v1dtrf1", "v1dtrf1", SwitchKind.DISCONNECTOR, true, false, false, 5, 0); - createSwitch(v2, "v2btrf1", "v2btrf1", SwitchKind.BREAKER, true, false, false, 14, 15); - createSwitch(v2, "v2dtrf1", "v2dtrf1", SwitchKind.DISCONNECTOR, true, false, false, 15, 1); + createSwitch(v1, "v1btrf2", "v1btrf2", SwitchKind.BREAKER, true, false, false, 40, 50); + createSwitch(v1, "v1dtrf2", "v1dtrf2", SwitchKind.DISCONNECTOR, true, false, false, 50, 0); + createSwitch(v2, "v2dtrf2", "v2dtrf2", SwitchKind.DISCONNECTOR, true, false, false, 150, 1); ThreeWindingsTransformer t3 = createThreeWindingsTransformer(s1, "trf6", "trf6", v1.getId(), v2.getId(), v4.getId(), 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, @@ -520,11 +525,11 @@ public static Network createForDeleteVoltageLevelOnLine(UUID uuid) { createSwitch(v2, "l1d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5); createSwitch(v2, "l1br2", null, SwitchKind.BREAKER, true, false, false, 5, 4); - createLine(network, "l2", null, "v1", "v3", 4, 4, 10.0, 5.0, 3.5, 5.5, 4.5, 6.5, "l2", 2, ConnectablePosition.Direction.TOP, "l2", 2, ConnectablePosition.Direction.TOP); - createSwitch(v1, "l2d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5); - createSwitch(v1, "l2br2", null, SwitchKind.BREAKER, true, false, false, 5, 4); - createSwitch(v3, "l2d3", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5); - createSwitch(v3, "l2br3", null, SwitchKind.BREAKER, true, false, false, 5, 4); + createLine(network, "l2", null, "v1", "v3", 6, 4, 10.0, 5.0, 3.5, 5.5, 4.5, 6.5, "l2", 2, ConnectablePosition.Direction.TOP, "l2", 2, ConnectablePosition.Direction.TOP); + createSwitch(v1, "l2d1", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 7); + createSwitch(v1, "l2br1", null, SwitchKind.BREAKER, true, false, false, 7, 6); + createSwitch(v3, "l2d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5); + createSwitch(v3, "l2br2", null, SwitchKind.BREAKER, true, false, false, 5, 4); return network; } diff --git a/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java b/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java index 3fbdbe14d..4cbcc91d0 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java +++ b/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java @@ -31,7 +31,7 @@ public static Network create(UUID uuid) { /** * Create a network as following: *
-     *     VL1            VL2             VL3
+     *     S1/VL1        S2/VL2          S3/VL3
      *
      *     ld1            g2              ld3
      *      |              |               |
@@ -43,7 +43,7 @@ public static Network create(UUID uuid) {
      *              l1     |       l2
      *                     | l3
      *                     |
-     *                    bbs4         VL4
+     *                    bbs4         S4/VL4
      *                     |
      *                    d4
      *                     |
@@ -59,55 +59,60 @@ public static Network create(UUID uuid, NetworkFactory networkFactory) {
         Substation s1 = createSubstation(network, "s1", null, Country.FR);
         VoltageLevel v1 = createVoltageLevel(s1, "v1", null, TopologyKind.NODE_BREAKER, 380);
         createBusBarSection(v1, "bbs1", null, 0);
-        createLoad(v1, "ld1", null, 2, 0., 0., "ld1", 0, ConnectablePosition.Direction.BOTTOM);
+
+        // create load on vl1 of substation 1
         createSwitch(v1, "d1", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 1);
         createSwitch(v1, "br1", null, SwitchKind.BREAKER, true, false, false, 1, 2);
+        createLoad(v1, "ld1", null, 2, 0., 0., "ld1", 0, ConnectablePosition.Direction.BOTTOM);
 
         // VL2
         Substation s2 = createSubstation(network, "s2", null, Country.FR);
         VoltageLevel v2 = createVoltageLevel(s2, "v2", null, TopologyKind.NODE_BREAKER, 380);
         createBusBarSection(v2, "bbs2", null, 0);
 
-        createGenerator(v2, "g2", 2, 42.1, 1.0, "g2", 3, ConnectablePosition.Direction.TOP);
+        // create generator g2 on vl2 of substation 2
         createSwitch(v2, "d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 1);
         createSwitch(v2, "br2", null, SwitchKind.BREAKER, true, false, false, 1, 2);
+        createGenerator(v2, "g2", 2, 42.1, 1.0, "g2", 3, ConnectablePosition.Direction.TOP);
 
         // VL3
         Substation s3 = createSubstation(network, "s3", null, Country.FR);
         VoltageLevel v3 = createVoltageLevel(s3, "v3", null, TopologyKind.NODE_BREAKER, 380.0);
         createBusBarSection(v3, "bbs3", null, 0);
 
-        createLoad(v3, "ld3", null, 2, 0., 0., "ld3", 3, ConnectablePosition.Direction.BOTTOM);
+        // create load on vl3 of substation 3
         createSwitch(v3, "d3", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 1);
         createSwitch(v3, "br3", null, SwitchKind.BREAKER, true, false, false, 1, 2);
+        createLoad(v3, "ld3", null, 2, 0., 0., "ld3", 3, ConnectablePosition.Direction.BOTTOM);
 
         // VL4
         Substation s4 = createSubstation(network, "s4", null, Country.FR);
         VoltageLevel v4 = createVoltageLevel(s4, "v4", null, TopologyKind.NODE_BREAKER, 380.0);
         createBusBarSection(v4, "bbs4", null, 0);
 
-        createLoad(v4, "ld4", null, 2, 0., 0., "ld4", 3, ConnectablePosition.Direction.BOTTOM);
+        // create load on vl4 of substation 4
         createSwitch(v4, "d4", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 1);
         createSwitch(v4, "br4", null, SwitchKind.BREAKER, true, false, false, 1, 2);
+        createLoad(v4, "ld4", null, 2, 0., 0., "ld4", 3, ConnectablePosition.Direction.BOTTOM);
 
         // create lines
-        createLine(network, "l1", null, "v1", "v2", 4, 4, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, "l1", 1, ConnectablePosition.Direction.TOP, "l1", 1, ConnectablePosition.Direction.TOP);
         createSwitch(v1, "l1d1", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5);
         createSwitch(v1, "l1br1", null, SwitchKind.BREAKER, true, false, false, 5, 4);
         createSwitch(v2, "l1d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5);
         createSwitch(v2, "l1br2", null, SwitchKind.BREAKER, true, false, false, 5, 4);
+        createLine(network, "l1", null, "v1", "v2", 4, 4, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, "l1", 1, ConnectablePosition.Direction.TOP, "l1", 1, ConnectablePosition.Direction.TOP);
 
-        createLine(network, "l2", null, "v2", "v3", 4, 4, 10.0, 5.0, 3.5, 5.5, 4.5, 6.5, "l2", 2, ConnectablePosition.Direction.TOP, "l2", 2, ConnectablePosition.Direction.TOP);
-        createSwitch(v2, "l2d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5);
-        createSwitch(v2, "l2br2", null, SwitchKind.BREAKER, true, false, false, 5, 4);
+        createSwitch(v2, "l2d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 7);
+        createSwitch(v2, "l2br2", null, SwitchKind.BREAKER, true, false, false, 7, 6);
         createSwitch(v3, "l2d3", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5);
         createSwitch(v3, "l2br3", null, SwitchKind.BREAKER, true, false, false, 5, 4);
+        createLine(network, "l2", null, "v2", "v3", 6, 4, 10.0, 5.0, 3.5, 5.5, 4.5, 6.5, "l2", 2, ConnectablePosition.Direction.TOP, "l2", 2, ConnectablePosition.Direction.TOP);
 
-        createLine(network, "l3", null, "v2", "v4", 5, 4, 12.0, 7.0, 5.5, 7.5, 6.5, 8.5, "l3", 3, ConnectablePosition.Direction.TOP, "l3", 3, ConnectablePosition.Direction.TOP);
-        createSwitch(v2, "l3d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 6);
-        createSwitch(v2, "l3br2", null, SwitchKind.BREAKER, true, false, true, 6, 5);
+        createSwitch(v2, "l3d2", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 9);
+        createSwitch(v2, "l3br2", null, SwitchKind.BREAKER, true, false, true, 9, 8);
         createSwitch(v4, "l3d4", null, SwitchKind.DISCONNECTOR, true, false, false, 0, 5);
         createSwitch(v4, "l3br4", null, SwitchKind.BREAKER, true, false, true, 5, 4);
+        createLine(network, "l3", null, "v2", "v4", 8, 4, 12.0, 7.0, 5.5, 7.5, 6.5, 8.5, "l3", 3, ConnectablePosition.Direction.TOP, "l3", 3, ConnectablePosition.Direction.TOP);
 
         return network;
     }