@Override public void dumpDtaFile(Path workingDir, String fileName, Network network, Map<String, Character> parallelIndexes, String eurostagVersion, Map<String, String> iidm2eurostagId, SimulationParameters simulationParameters) { Objects.requireNonNull(workingDir); Objects.requireNonNull(fileName); Objects.requireNonNull(network); Objects.requireNonNull(parallelIndexes); Objects.requireNonNull(eurostagVersion); Objects.requireNonNull(iidm2eurostagId); LOGGER.info("exporting dynamic data for network: {}", network.getId()); //uses the first connected generator that is available in the iidm2eurostag map Generator generator = network.getGeneratorStream() .filter(gen -> (iidm2eurostagId.containsKey(gen.getId())) && (gen.getTerminal().isConnected())) .findFirst() .orElseThrow(() -> new RuntimeException("could not find a suitable generator in network: " + network + ", to be used in: " + fileName)); Bus bus = generator.getTerminal().getBusBreakerView().getConnectableBus(); if ((bus == null) || (!iidm2eurostagId.containsKey(bus.getId()))) { bus = generator.getTerminal().getBusView().getConnectableBus(); if ((bus == null) || (!iidm2eurostagId.containsKey(bus.getId()))) { throw new RuntimeException("suitable node not found"); } } DynamicDatabaseMockUtils mockUtils = new DynamicDatabaseMockUtils(); String mappedGenName = mockUtils.formatString8(iidm2eurostagId.get(generator.getId())); String mappedNodeName = mockUtils.formatString8(iidm2eurostagId.get(bus.getId())); LOGGER.info("generator: iidm {}, eurostag {}", generator.getId(), mappedGenName); LOGGER.info("node: iidm {}, eurostag {}", bus.getId(), mappedNodeName); mockUtils.copyDynamicDataFiles(MINIMAL_DTA_TEMPLATE, workingDir, fileName, ImmutableMap.of("NODENAME", mappedNodeName, "MINIMALI", mappedGenName), MOCK_REG_FILES_PREFIXES); }
static void addBusOfOtherSideOfOpenBranches(Set<String> buses, Network n, ExportOptions options) { // and also bus at the other side of open branches n.getBranchStream().forEach(branch -> { Terminal t1 = branch.getTerminal1(); Terminal t2 = branch.getTerminal2(); if (options.getTopologyLevel() == TopologyLevel.BUS_BRANCH) { Bus b1 = t1.getBusView().getConnectableBus(); Bus b2 = t2.getBusView().getConnectableBus(); if ((b1 != null && b1.isInMainConnectedComponent()) && b2 != null && !b2.isInMainConnectedComponent()) { buses.add(b2.getId()); } else if (b1 != null && !b1.isInMainConnectedComponent() && b2 != null && b2.isInMainConnectedComponent()) { buses.add(b1.getId()); } } else { Bus b1 = t1.getBusBreakerView().getConnectableBus(); Bus b2 = t2.getBusBreakerView().getConnectableBus(); if (b1.isInMainConnectedComponent() && !b2.isInMainConnectedComponent()) { buses.add(b2.getId()); } else if (!b1.isInMainConnectedComponent() && b2.isInMainConnectedComponent()) { buses.add(b1.getId()); } } }); }
public boolean test(Connectable<?> connectable) { if (buses == null) { return true; } for (Terminal t : connectable.getTerminals()) { Bus b = options.getTopologyLevel() == TopologyLevel.BUS_BRANCH ? t.getBusView().getConnectableBus() : t.getBusBreakerView().getConnectableBus(); if (b != null && !buses.contains(b.getId())) { return false; } } return true; } }
if (twt.getTerminal1().getBusView().getConnectableBus() == lvBus) { hvVl = twt.getTerminal2().getVoltageLevel(); hvBus = twt.getTerminal2().getBusBreakerView().getConnectableBus(); } else if (twt.getTerminal2().getBusView().getConnectableBus() == lvBus) { hvVl = twt.getTerminal1().getVoltageLevel(); hvBus = twt.getTerminal1().getBusBreakerView().getConnectableBus(); if (twt.getTerminal2().getBusView().getConnectableBus().getId().equals(lvBus.getId())) { otherSideSv = transformerModel.toSv1(new StateVariable(-sv.p, -sv.q, sv.u, sv.theta)); } else if (twt.getTerminal1().getBusView().getConnectableBus().getId().equals(lvBus.getId())) { otherSideSv = transformerModel.toSv2(new StateVariable(-sv.p, -sv.q, sv.u, sv.theta)); } else {
connectedBus = vscConv.getTerminal().getBusView().getConnectableBus(); if (connectedBus == null) { throw new RuntimeException("VSCConverter " + vscConv.getId() + " : connected bus not found!");
Bus connectableBus1 = twt.getTerminal1().getBusView().getConnectableBus(); Bus connectableBus2 = twt.getTerminal2().getBusView().getConnectableBus();
} else { connected = false; bus = t.getBusView().getConnectableBus(); if (bus == null) {
Bus connectableBus1 = line.getTerminal1().getBusView().getConnectableBus(); Bus connectableBus2 = line.getTerminal2().getBusView().getConnectableBus();
@Override public void visitTerminal(Terminal t) { Connectable c = t.getConnectable(); Bus b = t.getBusView().getBus(); if (b == null) { if (c.getType() == ConnectableType.LOAD || c.getType() == ConnectableType.GENERATOR || c.getType() == ConnectableType.SHUNT_COMPENSATOR) { // add the injection in the topo set even if not connected but just connectable to this bus // see WP4.2 data mining topology spec for more detailed information b = t.getBusView().getConnectableBus(); } } if (b != null) { topoTmp.put(b.getId(), c.getId()); } else { // connect the equipment to its own bus topoTmp.put(c.getId() + "FICTIVE_BUS", c.getId()); } } });
protected static void writeNodeOrBus(Integer index, Terminal t, NetworkXmlWriterContext context) throws XMLStreamException { TopologyLevel topologyLevel = TopologyLevel.min(t.getVoltageLevel().getTopologyKind(), context.getOptions().getTopologyLevel()); switch (topologyLevel) { case NODE_BREAKER: writeNode(index, t, context); break; case BUS_BREAKER: writeBus(index, t.getBusBreakerView().getBus(), t.getBusBreakerView().getConnectableBus(), context); break; case BUS_BRANCH: writeBus(index, t.getBusView().getBus(), t.getBusView().getConnectableBus(), context); break; default: throw new AssertionError("Unexpected TopologyLevel value: " + topologyLevel); } if (index != null) { context.getWriter().writeAttribute("voltageLevelId" + index, context.getAnonymizer().anonymizeString(t.getVoltageLevel().getId())); } }
public static Bus getConnectableBus(Terminal t) { return t.getBusView().getConnectableBus(); }
private static boolean isMainComponent(LegBase<?> leg) { Bus bus = leg.getTerminal().getBusView().getBus(); Bus connectableBus = leg.getTerminal().getBusView().getConnectableBus(); boolean connectableMainComponent = connectableBus != null && connectableBus.isInMainConnectedComponent(); return bus != null ? bus.isInMainConnectedComponent() : connectableMainComponent; }