@Override public void addListener(NetworkListener listener) { listeners.add(listener); }
@Override public void remove() { NetworkImpl network = getNetwork(); network.getObjectStore().remove(this); network.getListeners().notifyRemoval(this); }
@Override public SubstationImpl setTso(String tso) { String oldValue = this.tso; this.tso = tso; getNetwork().getListeners().notifyUpdate(this, "tso", oldValue, tso); return this; }
@Override public ConfiguredBus add() { String id = checkAndGetUniqueId(); ConfiguredBusImpl bus = new ConfiguredBusImpl(id, voltageLevel); voltageLevel.addBus(bus); getNetwork().getListeners().notifyCreation(bus); return bus; }
@Override public void removeListener(NetworkListener listener) { listeners.remove(listener); } }
@Override public Switch add() { String id = checkAndGetUniqueId(); if (busId1 == null) { throw new ValidationException(this, "first connection bus is not set"); } if (busId2 == null) { throw new ValidationException(this, "second connection bus is not set"); } SwitchImpl aSwitch = new SwitchImpl(BusBreakerVoltageLevel.this, id, getName(), SwitchKind.BREAKER, open, true, fictitious); addSwitch(aSwitch, busId1, busId2); getNetwork().getListeners().notifyCreation(aSwitch); return aSwitch; }
@Override public Substation add() { String id = checkAndGetUniqueId(); ValidationUtil.checkCountry(this, country); SubstationImpl substation = new SubstationImpl(id, getName(), country, tso, networkRef); if (tags != null) { for (String tag : tags) { substation.addGeographicalTag(tag); } } getNetwork().getObjectStore().checkAndAdd(substation); getNetwork().getListeners().notifyCreation(substation); return substation; }
protected void notifyUpdate(String attribute, Object oldValue, Object newValue) { network.get().getListeners().notifyUpdate(this, attribute, oldValue, newValue); }
@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 Switch add() { String id = checkAndGetUniqueId(); if (node1 == null) { throw new ValidationException(this, "first connection node is not set"); } if (node2 == null) { throw new ValidationException(this, "second connection node is not set"); } if (kind == null) { throw new ValidationException(this, "kind is not set"); } SwitchImpl aSwitch = new SwitchImpl(NodeBreakerVoltageLevel.this, id, getName(), kind, open, retained, fictitious); getNetwork().getObjectStore().checkAndAdd(aSwitch); int e = graph.addEdge(node1, node2, aSwitch); switches.put(id, e); invalidateCache(); getNetwork().getListeners().notifyCreation(aSwitch); return aSwitch; }
protected void notifyUpdate(String attribute, Object oldValue, Object newValue) { getNetwork().getListeners().notifyUpdate(this, attribute, oldValue, newValue); }
@Override public void remove() { NetworkImpl network = getNetwork(); network.getObjectStore().remove(this); for (TerminalExt terminal : terminals) { VoltageLevelExt vl = terminal.getVoltageLevel(); vl.detach(terminal); vl.clean(); } network.getListeners().notifyRemoval(this); }
@Override public BusbarSection add() { String id = checkAndGetUniqueId(); TerminalExt terminal = new NodeTerminal(getNetwork().getRef(), node); BusbarSectionImpl section = new BusbarSectionImpl(id, getName()); section.addTerminal(terminal); voltageLevel.attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(section); getNetwork().getListeners().notifyCreation(section); return section; }
private void notifyUpdate(String attribute, Object oldValue, Object newValue) { getNetwork().getListeners().notifyUpdate(this, attribute, oldValue, newValue); }
@Override public void remove() { Substations.checkRemovability(this); Set<VoltageLevelExt> vls = new HashSet<>(voltageLevels); for (VoltageLevelExt vl : vls) { // Remove all branches, transformers and HVDC lines List<Connectable> connectables = Lists.newArrayList(vl.getConnectables()); for (Connectable connectable : connectables) { ConnectableType type = connectable.getType(); if (VoltageLevels.MULTIPLE_TERMINALS_CONNECTABLE_TYPES.contains(type)) { connectable.remove(); } else if (type == ConnectableType.HVDC_CONVERTER_STATION) { HvdcLine hvdcLine = getNetwork().getHvdcLine((HvdcConverterStation) connectable); if (hvdcLine != null) { hvdcLine.remove(); } } } // Then remove the voltage level (bus, switches and injections) from the network vl.remove(); } // Remove this substation from the network getNetwork().getObjectStore().remove(this); getNetwork().getListeners().notifyRemoval(this); }
@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; }
protected void notifyUpdate(String attribute, Object oldValue, Object newValue) { getNetwork().getListeners().notifyUpdate(this, attribute, oldValue, newValue); }
@Override public void remove() { VoltageLevels.checkRemovability(this); // Remove all connectables List<Connectable> connectables = Lists.newArrayList(getConnectables()); for (Connectable connectable : connectables) { connectable.remove(); } // Remove the topology removeTopology(); // Remove this voltage level from the network getSubstation().remove(this); getNetwork().getObjectStore().remove(this); getNetwork().getListeners().notifyRemoval(this); }
@Override public LccConverterStation add() { String id = checkAndGetUniqueId(); String name = getName(); TerminalExt terminal = checkAndGetTerminal(); validate(); LccConverterStationImpl converterStation = new LccConverterStationImpl(id, name, getLossFactor(), powerFactor); converterStation.addTerminal(terminal); getVoltageLevel().attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(converterStation); getNetwork().getListeners().notifyCreation(converterStation); return converterStation; }
@Override public void setFictitious(boolean fictitious) { boolean oldValue = this.fictitious; if (oldValue != fictitious) { this.fictitious = fictitious; voltageLevel.invalidateCache(); NetworkImpl network = voltageLevel.getNetwork(); network.getListeners().notifyUpdate(this, "fictitious", oldValue, fictitious); } }