Skip to content

Commit

Permalink
Topology cleanup used in RemoveFeederBay was not checking if Connecta…
Browse files Browse the repository at this point in the history
…bles were connected to successive nodes in mixed branches (#2629)

* Add new failing test when removing a line in a voltage level with direct shunt.
* Fix remove feeder bay
* Fix remove feeder bay test "testNetworkWithShuntRemoveLinePb"

---------

Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Co-authored-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Co-authored-by: Coline Piloquet <55250145+colinepiloquet@users.noreply.github.com>
Co-authored-by: Nicolas Rol <nicolas.rol@rte-france.com>
Co-authored-by: Anne Tilloy <48123713+annetill@users.noreply.github.com>
Co-authored-by: olperr1 <44769592+olperr1@users.noreply.github.com>
  • Loading branch information
6 people authored Jul 6, 2023
1 parent bd5e6d4 commit 2172a2d
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,29 @@ private void cleanTopology(VoltageLevel.NodeBreakerView nbv, Graph<Integer, Obje
}
}

/**
* Starting from the given node, traverse the graph and remove all the switches and/or internal connections until a
* fork node is encountered or a node on which a connectable is connected
*/
private void cleanMixedTopology(VoltageLevel.NodeBreakerView nbv, Graph<Integer, Object> graph, int node, Reporter reporter) {
// Get the next edge and the opposite node
Set<Object> edges = graph.edgesOf(node);
Object edge = edges.iterator().next();
Integer oppositeNode = getOppositeNode(graph, node, edge);

// Remove the switch or internal connection on the current edge
removeSwitchOrInternalConnection(nbv, graph, edge, reporter);

// List the connectables connected to the opposite node
List<Connectable<?>> connectables = new ArrayList<>();
nbv.getOptionalTerminal(oppositeNode).map(Terminal::getConnectable).ifPresent(connectables::add);

// If there is only one edge on the opposite node and no connectable, continue to remove the elements
if (graph.edgesOf(oppositeNode).size() == 1 && connectables.isEmpty()) {
cleanMixedTopology(nbv, graph, oppositeNode, reporter);
}
}

/**
* Try to remove all edges of the given fork node
*/
Expand Down Expand Up @@ -129,7 +152,7 @@ private void cleanFork(VoltageLevel.NodeBreakerView nbv, Graph<Integer, Object>
// We don't remove the latter ones if more than one, as this would break the connection between them
if (mixed.size() == 1) {
// If only one, we're cleaning the dangling switches and/or internal connections
cleanTopology(nbv, graph, node, reporter);
cleanMixedTopology(nbv, graph, node, reporter);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,75 @@ private static Network createNetworkWithForkFeeder() {
.add();
return network;
}

/**
* Network with direct shunt in voltage level VL1 between line LINE1 and generator G1 :
*
*
* VOLTAGE LEVEL VL2
* =================
*
* VL2_BBS (node 0)
* ---------------------------------
* |
* disc. VL2_D1
* |
* node 1
* |
* break. VL2_B1
* |
* LINE1 (node 2)
* |
* |
* | VOLTAGE LEVEL VL1
* | =================
* |
* LINE1 (node 3) ------------ disc. VL1_D3 ---------------- G1 (node 1)
* | |
* break. VL1_B2 break. VL1_B1
* | |
* node 4 node 2
* | |
* disc. VL1_D2 disc. VL1_D1
* | |
* | VL1_BBS (node 0) |
* ---------------------------------------------------------------------
*
*/
private static Network createNetworkWithShuntRemoveLinePb() {
Network network = Network.create("test", "test");

VoltageLevel vl1 = network.newVoltageLevel().setId("VL1").setNominalV(400.0).setTopologyKind(TopologyKind.NODE_BREAKER).add();
vl1.getNodeBreakerView().newBusbarSection().setId("VL1_BBS").setNode(0).add();
vl1.newGenerator().setId("G1").setNode(1).setTargetP(0).setVoltageRegulatorOn(true).setTargetV(400).setMinP(0).setMaxP(10).add();
vl1.getNodeBreakerView().newBreaker().setId("VL1_B1").setNode1(1).setNode2(2).add();
vl1.getNodeBreakerView().newDisconnector().setId("VL1_D1").setNode1(0).setNode2(2).add();
vl1.getNodeBreakerView().newBreaker().setId("VL1_B2").setNode1(3).setNode2(4).add();
vl1.getNodeBreakerView().newDisconnector().setId("VL1_D2").setNode1(0).setNode2(4).add();
vl1.getNodeBreakerView().newDisconnector().setId("VL1_D3").setNode1(1).setNode2(3).add();

VoltageLevel vl2 = network.newVoltageLevel().setId("VL2").setNominalV(400.0).setTopologyKind(TopologyKind.NODE_BREAKER).add();
vl2.getNodeBreakerView().newBusbarSection().setId("VL2_BBS").setNode(0).add();
vl2.getNodeBreakerView().newBreaker().setId("VL2_B1").setNode1(1).setNode2(2).add();
vl2.getNodeBreakerView().newDisconnector().setId("VL2_D1").setNode1(0).setNode2(1).add();

network.newLine().setId("LINE1").setR(0.1).setX(0.1).setG1(0.0).setB1(0.0).setG2(0.0).setB2(0.0)
.setNode1(3).setVoltageLevel1("VL1")
.setNode2(2).setVoltageLevel2("VL2")
.add();

return network;
}

@Test
void testNetworkWithShuntRemoveLinePb() {
Network network = createNetworkWithShuntRemoveLinePb();
addListener(network);

// removing line 'LINE1'
new RemoveFeederBay("LINE1").apply(network);

Set<String> removedIdentifiables = Set.of("VL2_B1", "VL2_D1", "LINE1", "VL1_B2", "VL1_D2", "VL1_D3");
assertEquals(removedIdentifiables, beforeRemovalObjects);
}
}

0 comments on commit 2172a2d

Please sign in to comment.