Skip to content

Commit 6bcd0d2

Browse files
committed
enhance TU to add bypass topo
1 parent a1482d3 commit 6bcd0d2

File tree

1 file changed

+87
-31
lines changed

1 file changed

+87
-31
lines changed

src/test/java/org/gridsuite/network/map/mapper/BusbarSectionFinderTraverserTest.java

Lines changed: 87 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
import org.gridsuite.network.map.dto.definition.extension.BusbarSectionFinderTraverser;
88
import org.junit.jupiter.api.BeforeEach;
99
import org.junit.jupiter.api.Test;
10-
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1110
import org.springframework.boot.test.context.SpringBootTest;
1211

1312
import static org.junit.jupiter.api.Assertions.*;
1413

1514
/**
1615
* @author Slimane Amar <slimane.amar at rte-france.com>
1716
*/
18-
@AutoConfigureMockMvc
17+
1918
@SpringBootTest
2019
public class BusbarSectionFinderTraverserTest {
2120

@@ -37,8 +36,8 @@ public static void createSwitch(VoltageLevel vl, String id, SwitchKind kind, boo
3736
@BeforeEach
3837
void setUp() {
3938
network = EurostagTutorialExample1Factory.createWithMoreGenerators(new NetworkFactoryImpl());
40-
/** VLGEN7 - Fork topology
41-
*
39+
/*
40+
* VLGEN7 - Fork topology with bypass
4241
* BUS1 ═══════X════════ BUS2 ═══════════════/════ BUS3
4342
* (node0) (node5) (node7)
4443
* | | |
@@ -53,12 +52,49 @@ void setUp() {
5352
* fork point Disconnector4
5453
* (node8) [open = false]
5554
* | |
56-
* ┌───┴───┐ LINE9
57-
* | | (→VLGEN9)
58-
* LINE7 LINE8
59-
* (→VLGEN4) (→VLGEN8)
55+
* ┌───┴───┐ ┌──────┴──────┐
56+
* | | | |
57+
* LINE7 LINE8 Breaker10 Disconnector7
58+
* (→VLGEN4) (→VLGEN8) [open = true] [open = false]
59+
* | |
60+
* Disconnector5 |
61+
* [open = false] |
62+
* | |
63+
* |_____________|
64+
* |
65+
* bypass point
66+
* (node11)
67+
* |
68+
* Disconnector6
69+
* [open = false]
70+
* |
71+
* LINE9
72+
* (→VLGEN9)
73+
*
74+
* TOPOLOGY SUMMARY:
75+
* ================
76+
*
77+
* VLGEN7 Node Mapping:
78+
* - Node 0: BUS1 (Primary Busbar)
79+
* - Node 5: BUS2 (Secondary Busbar)
80+
* - Node 9: BUS3 (Third Busbar)
81+
* - Node 13: BUS4 (Fourth Busbar)
82+
* - Node 8: Fork point (connects BUS1 & BUS2 to LINE7 & LINE8)
83+
* - Node 11: Bypass point (convergence for breaker and bypass paths to LINE9)
84+
*
85+
* Fork Configuration:
86+
* - BUS1 is DISCONNECTED (SECT_BUS1 open)
87+
* - BUS2 feeds the fork through SECT_BUS2 (closed) → FORK_SW2 (closed)
88+
* - Fork splits to LINE7 and LINE8
89+
*
90+
* Bypass Configuration:
91+
* - BUS4 connects to LINE9 via two parallel paths:
92+
* Path 1: BRKR10 (OPEN) → DISC5 → Node 11
93+
* Path 2: DISC7 (CLOSED) → DISC_BYPASS_CONV → Node 11 (Bypass active)
94+
* - With BRKR10 open and DISC7 closed, LINE9 operates via bypass
6095
*/
6196

97+
// ============ VLGEN4 - Source voltage level ============
6298
Substation p4 = network.newSubstation()
6399
.setId("P4")
64100
.setCountry(Country.FR)
@@ -86,7 +122,10 @@ void setUp() {
86122
.withBusbarIndex(1)
87123
.withSectionIndex(2)
88124
.add();
125+
createSwitch(vlgen4, "DISC_VLGEN4", SwitchKind.DISCONNECTOR, false, 0, 10);
126+
createSwitch(vlgen4, "BRKR_VLGEN4", SwitchKind.BREAKER, false, 10, 15);
89127

128+
// ============ VLGEN7 - Main voltage level with fork and bypass topology ============
90129
VoltageLevel vlgen7 = network.newVoltageLevel()
91130
.setId("VLGEN7")
92131
.setName("Fork Distribution Point")
@@ -96,7 +135,7 @@ void setUp() {
96135
.setTopologyKind(TopologyKind.NODE_BREAKER)
97136
.add();
98137

99-
// Create busbarSections
138+
// Create 4 busbars
100139
vlgen7.getNodeBreakerView().newBusbarSection()
101140
.setId("BUS1_NGEN7")
102141
.setName("Primary Busbar VLGEN7")
@@ -120,36 +159,47 @@ void setUp() {
120159
.setNode(13)
121160
.add();
122161

123-
createSwitch(vlgen7, "SECT_BUS1", SwitchKind.DISCONNECTOR, true, 0, 6); // OPEN
124-
createSwitch(vlgen7, "SECT_BUS2", SwitchKind.DISCONNECTOR, false, 5, 7); // CLOSED
125-
createSwitch(vlgen7, "SECT_BUS3", SwitchKind.DISCONNECTOR, false, 9, 10); // CLOSED
126-
createSwitch(vlgen7, "SECT_BUS4", SwitchKind.DISCONNECTOR, false, 13, 14); // CLOSED
162+
// Bus coupling disconnectors (SECT)
163+
createSwitch(vlgen7, "SECT_BUS1", SwitchKind.DISCONNECTOR, true, 0, 6); // OPEN - BUS1 disconnected
164+
createSwitch(vlgen7, "SECT_BUS2", SwitchKind.DISCONNECTOR, false, 5, 7); // CLOSED - BUS2 connected
165+
createSwitch(vlgen7, "SECT_BUS3", SwitchKind.DISCONNECTOR, false, 9, 10); // CLOSED - BUS3 connected
166+
createSwitch(vlgen7, "SECT_BUS4", SwitchKind.DISCONNECTOR, false, 13, 14); // CLOSED - BUS4 connected
127167

128-
createSwitch(vlgen7, "FORK_SW1", SwitchKind.DISCONNECTOR, false, 6, 8); // BUS1 to fork (CLOSED via node 6)
129-
createSwitch(vlgen7, "FORK_SW2", SwitchKind.DISCONNECTOR, false, 7, 8); // BUS2 to fork (CLOSED via node 7)
168+
// Fork connections - BUS1 and BUS2 to fork point (node 8)
169+
createSwitch(vlgen7, "FORK_SW1", SwitchKind.DISCONNECTOR, false, 6, 8); // BUS1 to fork
170+
createSwitch(vlgen7, "FORK_SW2", SwitchKind.DISCONNECTOR, false, 7, 8); // BUS2 to fork
130171

131-
// LINE7 connection from fork
172+
// LINE7 connection from fork point (node 8)
132173
createSwitch(vlgen7, "DISC_LINE7", SwitchKind.DISCONNECTOR, false, 8, 1);
133174
createSwitch(vlgen7, "BRKR_LINE7", SwitchKind.BREAKER, false, 1, 2);
134175

135-
// LINE8 connection from fork
176+
// LINE8 connection from fork point (node 8)
136177
createSwitch(vlgen7, "DISC_LINE8", SwitchKind.DISCONNECTOR, false, 8, 3);
137178
createSwitch(vlgen7, "BRKR_LINE8", SwitchKind.BREAKER, false, 3, 4);
138179

139-
// LINE9 connection from BUS4 (Fixed connection point)
140-
createSwitch(vlgen7, "DISC_LINE9", SwitchKind.DISCONNECTOR, false, 14, 12); // Connect from node 14
141-
createSwitch(vlgen7, "BRKR_LINE9", SwitchKind.BREAKER, false, 12, 11);
180+
// ============ BYPASS TOPOLOGY - BUS4 with bypass for LINE9 ============
181+
// BUS3 to BUS4 coupler section (already created above: SECT_BUS3)
142182

143-
// Assuming VLGEN4 exists, create its switches
144-
createSwitch(vlgen4, "DISC_VLGEN4", SwitchKind.DISCONNECTOR, false, 0, 10);
145-
createSwitch(vlgen4, "BRKR_VLGEN4", SwitchKind.BREAKER, false, 10, 15);
183+
// Path 1: Breaker10 (OPEN) - Main breaker path
184+
createSwitch(vlgen7, "BRKR10", SwitchKind.BREAKER, true, 14, 15); // OPEN - Main breaker
185+
createSwitch(vlgen7, "DISC5", SwitchKind.DISCONNECTOR, false, 15, 11); // CLOSED - After breaker
186+
187+
// Path 2: Disconnector7 (CLOSED) - Bypass path
188+
createSwitch(vlgen7, "DISC7", SwitchKind.DISCONNECTOR, false, 14, 16); // CLOSED - Bypass disconnector
189+
190+
// Convergence to bypass point (node 11)
191+
createSwitch(vlgen7, "DISC_BYPASS_CONV", SwitchKind.DISCONNECTOR, false, 16, 11); // Bypass convergence
146192

147-
// LINE7 - Fork Branch 1
193+
// LINE9 connection from bypass point (node 11)
194+
createSwitch(vlgen7, "DISC6", SwitchKind.DISCONNECTOR, false, 11, 12); // CLOSED - Before LINE9
195+
createSwitch(vlgen7, "BRKR_LINE9", SwitchKind.BREAKER, false, 12, 17); // LINE9 breaker
196+
197+
// ============ LINE7 - Fork Branch 1 (VLGEN4 → VLGEN7) ============
148198
network.newLine()
149199
.setId("LINE7_FORK")
150200
.setName("Fork Branch 1 - Primary Line")
151201
.setVoltageLevel1("VLGEN4")
152-
.setNode1(15) // Fixed node reference
202+
.setNode1(15)
153203
.setVoltageLevel2("VLGEN7")
154204
.setNode2(2)
155205
.setR(3.0)
@@ -174,7 +224,7 @@ void setUp() {
174224
.add()
175225
.add();
176226

177-
// VLGEN8 - Fork destination 2
227+
// ============ VLGEN8 - Fork destination 2 ============
178228
VoltageLevel vlgen8 = network.newVoltageLevel()
179229
.setId("VLGEN8")
180230
.setName("Fork Destination Point 2")
@@ -183,10 +233,16 @@ void setUp() {
183233
.setLowVoltageLimit(20.0)
184234
.setTopologyKind(TopologyKind.NODE_BREAKER)
185235
.add();
236+
vlgen8.getNodeBreakerView().newBusbarSection()
237+
.setId("BUS_NGEN8")
238+
.setName("Main Busbar VLGEN8")
239+
.setNode(0)
240+
.add();
241+
186242
createSwitch(vlgen8, "DISC_VLGEN8", SwitchKind.DISCONNECTOR, false, 0, 1);
187243
createSwitch(vlgen8, "BRKR_VLGEN8", SwitchKind.BREAKER, false, 1, 2);
188244

189-
// LINE8 - Fork Branch 2
245+
// ============ LINE8 - Fork Branch 2 (VLGEN7 → VLGEN8) ============
190246
network.newLine()
191247
.setId("LINE8_FORK")
192248
.setName("Fork Branch 2 - Secondary Line")
@@ -215,7 +271,7 @@ void setUp() {
215271
.add()
216272
.add();
217273

218-
// VLGEN9 - Independent line destination
274+
// ============ VLGEN9 - Independent line destination ============
219275
VoltageLevel vlgen9 = network.newVoltageLevel()
220276
.setId("VLGEN9")
221277
.setName("Independent Line Destination")
@@ -234,12 +290,12 @@ void setUp() {
234290
createSwitch(vlgen9, "DISC_VLGEN9", SwitchKind.DISCONNECTOR, false, 0, 1);
235291
createSwitch(vlgen9, "BRKR_VLGEN9", SwitchKind.BREAKER, false, 1, 2);
236292

237-
// LINE9 - Independent line from BUS4
293+
// ============ LINE9 - Independent line from BUS4 with bypass ============
238294
network.newLine()
239295
.setId("LINE9_INDEPENDENT")
240296
.setName("Independent Line from BUS4")
241297
.setVoltageLevel1("VLGEN7")
242-
.setNode1(11)
298+
.setNode1(17) // Connected via bypass topology
243299
.setVoltageLevel2("VLGEN9")
244300
.setNode2(2)
245301
.setR(2.0)
@@ -299,7 +355,7 @@ void testLine9FindsBus4DirectPath() {
299355
BusbarSectionFinderTraverser.BusbarSectionResult result = BusbarSectionFinderTraverser.findBestBusbar(terminal);
300356
assertNotNull(result);
301357
assertEquals("BUS4_NGEN7", result.busbarSectionId());
302-
assertEquals(3, result.depth());
358+
assertEquals(5, result.depth());
303359
assertNotNull(result.lastSwitch());
304360
assertEquals("SECT_BUS4", result.lastSwitch().id());
305361
assertFalse(result.lastSwitch().isOpen());

0 commit comments

Comments
 (0)