@Override protected NetworkImpl getNetwork() { return voltageLevel.getNetwork(); }
@Override protected NetworkImpl getNetwork() { return BusBreakerVoltageLevel.this.getNetwork(); }
@Override public void invalidateCache() { calculatedBusTopology.invalidateCache(); getNetwork().getConnectedComponentsManager().invalidate(); getNetwork().getSynchronousComponentsManager().invalidate(); }
private void removeAllSwitches() { for (SwitchImpl s : graph.getEdgesObject()) { getNetwork().getObjectStore().remove(s); } graph.removeAllEdges(); switches.clear(); }
private void removeSwitch(String switchId) { Integer e = switches.remove(switchId); if (e == null) { throw new PowsyblException("Switch '" + switchId + "' not found in substation voltage level '" + id + "'"); } SwitchImpl aSwitch = graph.removeEdge(e); getNetwork().getObjectStore().remove(aSwitch); }
void addBus(ConfiguredBus bus) { getNetwork().getObjectStore().checkAndAdd(bus); int v = graph.addVertex(); graph.setVertexObject(v, bus); buses.put(bus.getId(), v); }
private void addSwitch(SwitchImpl aSwitch, String busId1, String busId2) { int v1 = getVertex(busId1, true); int v2 = getVertex(busId2, true); getNetwork().getObjectStore().checkAndAdd(aSwitch); int e = graph.addEdge(v1, v2, aSwitch); switches.put(aSwitch.getId(), e); }
private void removeBus(String busId) { ConfiguredBus bus = getBus(busId, true); if (bus.getTerminalCount() > 0) { throw new ValidationException(this, "Cannot remove bus " + bus.getId() + " because of connectable equipments"); } // TODO improve check efficency for (Map.Entry<String, Integer> entry : switches.entrySet()) { String switchId = entry.getKey(); int e = entry.getValue(); int v1 = graph.getEdgeVertex1(e); int v2 = graph.getEdgeVertex2(e); ConfiguredBus b1 = graph.getVertexObject(v1); ConfiguredBus b2 = graph.getVertexObject(v2); if (bus == b1 || bus == b2) { throw new PowsyblException("Cannot remove bus '" + bus.getId() + "' because switch '" + switchId + "' is connected to it"); } } getNetwork().getObjectStore().remove(bus); int v = buses.remove(bus.getId()); graph.removeVertex(v); }
private void removeAllBuses() { if (graph.getEdgeCount() > 0) { throw new ValidationException(this, "Cannot remove all buses because there is still some switches"); } for (ConfiguredBus bus : graph.getVerticesObj()) { if (bus.getTerminalCount() > 0) { throw new ValidationException(this, "Cannot remove bus " + bus.getId() + " because of connected equipments"); } } for (ConfiguredBus bus : graph.getVerticesObj()) { getNetwork().getObjectStore().remove(bus); } graph.removeAllVertices(); buses.clear(); }
@Override public void detach(final TerminalExt terminal) { assert terminal instanceof BusTerminal; // remove the link terminal -> voltage level terminal.setVoltageLevel(null); // remove the link bus -> terminal String connectableBusId = ((BusTerminal) terminal).getConnectableBusId(); final ConfiguredBus connectableBus = getBus(connectableBusId, true); getNetwork().getVariantManager().forEachVariant(() -> { connectableBus.removeTerminal((BusTerminal) terminal); ((BusTerminal) terminal).setConnectableBusId(null); invalidateCache(); }); }
@Override public void attach(final TerminalExt terminal, boolean test) { checkTerminal(terminal); if (test) { return; } // create the link terminal -> voltage level terminal.setVoltageLevel(this); // create the link bus -> terminal String connectableBusId = ((BusTerminal) terminal).getConnectableBusId(); final ConfiguredBus connectableBus = getBus(connectableBusId, true); getNetwork().getVariantManager().forEachVariant(() -> { connectableBus.addTerminal((BusTerminal) terminal); // invalidate connected components invalidateCache(); }); }