@Override public Network createNetwork(String id, String sourceFormat) { return new NetworkImpl(id, id, sourceFormat); }
@Override public void invalidateCache() { calculatedBusTopology.invalidateCache(); getNetwork().getConnectedComponentsManager().invalidate(); getNetwork().getSynchronousComponentsManager().invalidate(); }
@Override public int getCountryCount() { return getCountries().size(); }
for (DanglingLine dl2 : Lists.newArrayList(other.getDanglingLines())) { Map<String, DanglingLine> dl1byXnodeCode = new HashMap<>(); for (DanglingLine dl1 : getDanglingLines()) { if (dl1.getUcteXnodeCode() != null) { dl1byXnodeCode.put(dl1.getUcteXnodeCode(), dl1); DanglingLine dl1 = getDanglingLineByTheOther(dl2, dl1byXnodeCode); mergeDanglingLines(lines, dl1, dl2); replaceDanglingLineByLine(lines, mergedLineByBoundary); setIdEraseName(getId() + " + " + otherNetwork.getId());
@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 HvdcLine add() { String id = checkAndGetUniqueId(); String name = getName(); ValidationUtil.checkR(this, r); ValidationUtil.checkConvertersMode(this, convertersMode); ValidationUtil.checkNominalV(this, nominalV); ValidationUtil.checkActivePowerSetpoint(this, activePowerSetpoint); ValidationUtil.checkMaxP(this, maxP); AbstractHvdcConverterStation<?> converterStation1 = getNetwork().getHvdcConverterStation(converterStationId1); if (converterStation1 == null) { throw new PowsyblException("Side 1 converter station " + converterStationId1 + " not found"); } AbstractHvdcConverterStation<?> converterStation2 = getNetwork().getHvdcConverterStation(converterStationId2); if (converterStation2 == null) { throw new PowsyblException("Side 2 converter station " + converterStationId2 + " not found"); } HvdcLineImpl hvdcLine = new HvdcLineImpl(id, name, r, nominalV, maxP, convertersMode, activePowerSetpoint, converterStation1, converterStation2, networkRef); getNetwork().getObjectStore().checkAndAdd(hvdcLine); getNetwork().getListeners().notifyCreation(hvdcLine); return hvdcLine; }
@Override public Component getConnectedComponent() { NetworkImpl.ConnectedComponentsManager ccm = voltageLevel.getNetwork().getConnectedComponentsManager(); ccm.update(); return ccm.getComponent(connectedComponentNumber.get(network.get().getVariantIndex())); }
for (Bus b : network.getBusBreakerView().getBuses()) { setComponentNumber((BusExt) b, -1); Map<String, Integer> id2num = new HashMap<>(); List<BusExt> num2bus = new ArrayList<>(); for (Bus bus : network.getBusView().getBuses()) { num2bus.add((BusExt) bus); id2num.put(bus.getId(), num);
@Override public Component getConnectedComponent() { checkValidity(); NetworkImpl.ConnectedComponentsManager ccm = voltageLevel.getNetwork().getConnectedComponentsManager(); ccm.update(); return terminals.isEmpty() ? null : ccm.getComponent(terminals.get(0).getConnectedComponentNumber()); }
@Override public Stream<Bus> getBusStream() { return networkRef.get().getBusView().getBusStream().filter(bus -> bus.getConnectedComponent() == ComponentImpl.this); } }
private DanglingLine getDanglingLineByTheOther(DanglingLine dl2, Map<String, DanglingLine> dl1byXnodeCode) { DanglingLine dl1 = getDanglingLine(dl2.getId()); if (dl1 == null) { // mapping by ucte xnode code if (dl2.getUcteXnodeCode() != null) { dl1 = dl1byXnodeCode.get(dl2.getUcteXnodeCode()); } } else { // mapping by id if (dl1.getUcteXnodeCode() != null && dl2.getUcteXnodeCode() != null && !dl1.getUcteXnodeCode().equals(dl2.getUcteXnodeCode())) { throw new PowsyblException("Dangling line couple " + dl1.getId() + " have inconsistent Xnodes (" + dl1.getUcteXnodeCode() + "!=" + dl2.getUcteXnodeCode() + ")"); } } return dl1; }
@Override public void invalidateCache() { variants.get().calculatedBusBreakerTopology.invalidateCache(); variants.get().calculatedBusTopology.invalidateCache(); getNetwork().getConnectedComponentsManager().invalidate(); }
@Override public Iterable<Bus> getBuses() { return Iterables.filter(networkRef.get().getBusView().getBuses(), bus -> bus.getConnectedComponent() == ComponentImpl.this); }