NodeBreakerTopology { public static int newStandardConnection(BusbarSection bb) { Objects.requireNonNull(bb, "Busbar section is null."); int n = bb.getTerminal().getNodeBreakerView().getNode(); VoltageLevel.NodeBreakerView topo = bb.getTerminal().getVoltageLevel().getNodeBreakerView(); int oldCount = topo.getMaximumNodeIndex() + 1; topo.newDisconnector() .setId(String.format("disconnector %s-%d", bb.getId(), oldCount)) .setNode1(n) .setNode2(oldCount) .add(); topo.newBreaker() .setId(String.format("breaker %s-%d", bb.getId(), oldCount + 1)) .setNode1(oldCount) .setNode2(oldCount + 1) .add(); return oldCount + 1; } private  NodeBreakerTopology(); static void removeIsolatedSwitches(VoltageLevel.NodeBreakerView topo); static int newStandardConnection(BusbarSection bb);  }
@Test public void newStandardConnection() throws Exception { Network network = NetworkTest1Factory.create(); VoltageLevel vl = network.getVoltageLevel("voltageLevel1"); VoltageLevel.NodeBreakerView topo = vl.getNodeBreakerView(); int initialSwitchCount = topo.getSwitchCount(); BusbarSection bb = topo.getBusbarSection("voltageLevel1BusbarSection1"); int connectionNode = NodeBreakerTopology.newStandardConnection(bb); Load l = vl.newLoad() .setId("load2") .setP0(10) .setQ0(0) .setNode(connectionNode) .add(); assertEquals(bb.getTerminal().getBusView().getBus(), l.getTerminal().getBusView().getBus()); assertEquals(initialSwitchCount + 2, topo.getSwitchCount()); }