@Override public void setConnectableBus(String busId) { throw NodeBreakerVoltageLevel.createNotSupportedNodeBreakerTopologyException(); }
private Integer getEdge(String switchId, boolean throwException) { Integer edge = switches.get(switchId); if (throwException && edge == null) { throw createSwitchNotFoundException(switchId); } return edge; }
@Override public void exportTopology(String filename) throws IOException { try (OutputStream outputStream = new FileOutputStream(filename)) { exportTopology(outputStream); } }
public void exportTopology(OutputStream os) { Graph g = new Graph().id("\"" + NodeBreakerVoltageLevel.this.id + "\""); Map<Integer, Node> intToNode = new HashMap<>(); Multimap<String, Integer> busToNodes = ArrayListMultimap.create(); for (int n = 0; n < graph.getVertexCount(); n++) { Node node = new Node().id(Integer.toString(n)); intToNode.put(n, node); Bus bus = getCalculatedBusBreakerTopology().getBus(n); if (bus != null) { busToNodes.put(bus.getId(), n); } else { TerminalExt terminal = graph.getVertexObject(n); if (terminal != null) { AbstractConnectable connectable = terminal.getConnectable(); String label = n + "\\n" + connectable.getType().toString() + "\\n" + connectable.getId(); node.attr(LABEL_ATTRIBUTE, label); g.node(node); } } } exportBuses(g, busToNodes, intToNode); exportEdges(g, intToNode); g.writeTo(os); }
@Override public 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); clean(); getNetwork().getObjectStore().remove(aSwitch); getNetwork().getListeners().notifyRemoval(aSwitch); }
@Override public BusExt getBus() { return ((NodeBreakerVoltageLevel) voltageLevel).getCalculatedBusBreakerTopology().getBus(node); }
List<TerminalExt> nextTerminals = new ArrayList<>(); addNextTerminals(terminal, nextTerminals); traversedTerminals.add(otherTerminal); addNextTerminals(otherTerminal, nextTerminals); return TraverseResult.CONTINUE; } else {
@Override public void attach(TerminalExt terminal, boolean test) { checkTerminal(terminal); if (test) { return; } int node = ((NodeTerminal) terminal).getNode(); if (graph.getVertexObject(node) != null) { throw new ValidationException(terminal.getConnectable(), "an equipment (" + graph.getVertexObject(node).getConnectable().getId() + ") is already connected to node " + node + " of voltage level " + NodeBreakerVoltageLevel.this.id); } // create the link terminal <-> voltage level terminal.setVoltageLevel(NodeBreakerVoltageLevel.this); // create the link terminal <-> graph vertex graph.setVertexObject(node, (NodeTerminal) terminal); }
@Override public VoltageLevel add() { String id = checkAndGetUniqueId(); // TODO : ckeck that there are not another voltage level with same base voltage ValidationUtil.checkNominalV(this, nominalV); ValidationUtil.checkVoltageLimits(this, lowVoltageLimit, highVoltageLimit); ValidationUtil.checkTopologyKind(this, topologyKind); VoltageLevelExt voltageLevel; switch (topologyKind) { case NODE_BREAKER: voltageLevel = new NodeBreakerVoltageLevel(id, getName(), substation, nominalV, lowVoltageLimit, highVoltageLimit); break; case BUS_BREAKER: voltageLevel = new BusBreakerVoltageLevel(id, getName(), substation, nominalV, lowVoltageLimit, highVoltageLimit); break; default: throw new AssertionError(); } getNetwork().getObjectStore().checkAndAdd(voltageLevel); substation.addVoltageLevel(voltageLevel); getNetwork().getListeners().notifyCreation(voltageLevel); return voltageLevel; }
@Override public BusExt getConnectableBus() { return ((NodeBreakerVoltageLevel) voltageLevel).getCalculatedBusBreakerTopology().getConnectableBus(node); }
@Override public void removeBus(String busId) { throw createNotSupportedNodeBreakerTopologyException(); }
@Override public BusAdder newBus() { throw createNotSupportedNodeBreakerTopologyException(); }
@Override public void removeAllBuses() { throw createNotSupportedNodeBreakerTopologyException(); }
@Override public BusBreakerView.SwitchAdder newSwitch() { throw createNotSupportedNodeBreakerTopologyException(); }
@Override public void removeSwitch(String switchId) { throw createNotSupportedNodeBreakerTopologyException(); }
@Override public void removeAllSwitches() { throw createNotSupportedNodeBreakerTopologyException(); }