Skip to content

Commit

Permalink
Merge branch 'desactivate_modification' of https://github.com/gridsui…
Browse files Browse the repository at this point in the history
…te/network-modification-server into desactivate_modification
  • Loading branch information
LE SAULNIER Kevin committed Sep 13, 2024
2 parents baa43ef + 22f0cd9 commit e454bca
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 73 deletions.
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-client</artifactId>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. The overloads and this property below have to be removed at next gridsuite-dependencies.version upgrade -->
<version>1.16.0</version>
</dependency>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. This section have to be removed at next gridsuite-dependencies.version upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-iidm-impl</artifactId>
<version>1.16.0</version>
</dependency>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. This section have to be removed at next gridsuite-dependencies.version upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-model</artifactId>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class ModificationControllerTest {
private static final String URI_NETWORK_WITH_TEE_POINT_MODIF = URI_NETWORK_MODIF_BASE + "?networkUuid=" + TEST_NETWORK_WITH_TEE_POINT_ID + URI_NETWORK_MODIF_PARAMS;

private static final String URI_LINE_CATALOG = URI_NETWORK_MODIF_BASE + "/catalog/line_types";
private static final String LINE_TYPES_CATALOG_JSON_FILE_1 = "/line_types_catalog_1.json";
private static final String LINE_TYPES_CATALOG_JSON_FILE_1 = "/lines-catalog.json";
private static final String LINE_TYPES_CATALOG_JSON_FILE_2 = "/line_types_catalog_2.json";

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit e454bca

Please sign in to comment.