@Override public BusbarSection getBusbarSection(String id) { return getNetwork().getObjectStore().get(id, BusbarSection.class); }
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); }
private void removeAllSwitches() { for (SwitchImpl s : graph.getEdgesObject()) { getNetwork().getObjectStore().remove(s); } graph.removeAllEdges(); switches.clear(); }
private void removeAllSwitches() { for (SwitchImpl s : graph.getEdgesObject()) { getNetwork().getObjectStore().remove(s); } graph.removeAllEdges(); switches.clear(); }
protected String checkAndGetUniqueId() { if (id == null) { throw new PowsyblException(getTypeDescription() + " id is not set"); } String uniqueId; if (ensureIdUnicity) { uniqueId = getNetwork().getObjectStore().getUniqueId(id); } else { if (getNetwork().getObjectStore().contains(id)) { Identifiable obj = getNetwork().getObjectStore().get(id); throw new PowsyblException("The network " + getNetwork().getId() + " already contains an object '" + obj.getClass().getSimpleName() + "' with the id '" + id + "'"); } uniqueId = id; } return uniqueId; }
void addBus(ConfiguredBus bus) { getNetwork().getObjectStore().checkAndAdd(bus); int v = graph.addVertex(); graph.setVertexObject(v, bus); buses.put(bus.getId(), v); }
@Override public void remove() { NetworkImpl network = getNetwork(); network.getObjectStore().remove(this); network.getListeners().notifyRemoval(this); }
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); }
@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 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); }
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 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 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; }
@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; }
@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 VscConverterStationImpl add() { String id = checkAndGetUniqueId(); String name = getName(); TerminalExt terminal = checkAndGetTerminal(); validate(); VscConverterStationImpl converterStation = new VscConverterStationImpl(id, name, getLossFactor(), getNetwork().getRef(), voltageRegulatorOn, reactivePowerSetpoint, voltageSetpoint); converterStation.addTerminal(terminal); getVoltageLevel().attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(converterStation); getNetwork().getListeners().notifyCreation(converterStation); return converterStation; }
@Override public ShuntCompensatorImpl add() { String id = checkAndGetUniqueId(); TerminalExt terminal = checkAndGetTerminal(); ValidationUtil.checkbPerSection(this, bPerSection); ValidationUtil.checkSections(this, currentSectionCount, maximumSectionCount); ShuntCompensatorImpl shunt = new ShuntCompensatorImpl(getNetwork().getRef(), id, getName(), bPerSection, maximumSectionCount, currentSectionCount); shunt.addTerminal(terminal); voltageLevel.attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(shunt); getNetwork().getListeners().notifyCreation(shunt); return shunt; }
@Override public LoadImpl add() { String id = checkAndGetUniqueId(); TerminalExt terminal = checkAndGetTerminal(); ValidationUtil.checkLoadType(this, loadType); ValidationUtil.checkP0(this, p0); ValidationUtil.checkQ0(this, q0); LoadImpl load = new LoadImpl(getNetwork().getRef(), id, getName(), loadType, p0, q0); load.addTerminal(terminal); voltageLevel.attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(load); getNetwork().getListeners().notifyCreation(load); return load; }
@Override public StaticVarCompensatorImpl add() { String id = checkAndGetUniqueId(); String name = getName(); TerminalExt terminal = checkAndGetTerminal(); ValidationUtil.checkBmin(this, bMin); ValidationUtil.checkBmax(this, bMax); ValidationUtil.checkSvcRegulator(this, voltageSetPoint, reactivePowerSetPoint, regulationMode); StaticVarCompensatorImpl svc = new StaticVarCompensatorImpl(id, name, bMin, bMax, voltageSetPoint, reactivePowerSetPoint, regulationMode, getNetwork().getRef()); svc.addTerminal(terminal); vl.attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(svc); getNetwork().getListeners().notifyCreation(svc); return svc; }
@Override public DanglingLineImpl add() { String id = checkAndGetUniqueId(); TerminalExt terminal = checkAndGetTerminal(); ValidationUtil.checkP0(this, p0); ValidationUtil.checkQ0(this, q0); ValidationUtil.checkR(this, r); ValidationUtil.checkX(this, x); ValidationUtil.checkG(this, g); ValidationUtil.checkB(this, b); DanglingLineImpl danglingLine = new DanglingLineImpl(getNetwork().getRef(), id, getName(), p0, q0, r, x, g, b, ucteXnodeCode); danglingLine.addTerminal(terminal); voltageLevel.attach(terminal, false); getNetwork().getObjectStore().checkAndAdd(danglingLine); getNetwork().getListeners().notifyCreation(danglingLine); return danglingLine; }