private static void connectGenerator(Generator g) { Terminal t = g.getTerminal(); t.connect(); if (g.isVoltageRegulatorOn()) { Bus bus = t.getBusView().getBus(); if (bus != null) { // set voltage setpoint to the same as other generators connected to the bus double targetV = bus.getGeneratorStream().findFirst().map(Generator::getTargetV).orElse(Double.NaN); // if no other generator connected to the bus, set voltage setpoint to network voltage if (Double.isNaN(targetV) && !Double.isNaN(bus.getV())) { g.setTargetV(bus.getV()); } } } LOGGER.info("Connecting {}", g.getId()); } }
private void completeTerminalData(Terminal terminal, ThreeWindingsTransformer.Side side, TwtData twtData) { if (terminal.isConnected() && terminal.getBusView().getBus().isInMainConnectedComponent()) { if (Double.isNaN(terminal.getP())) { LOGGER.debug("Twt {}, Side {}: setting p = {}", twtData.getId(), side, twtData.getComputedP(side)); terminal.setP(twtData.getComputedP(side)); } if (Double.isNaN(terminal.getQ())) { LOGGER.debug("Twt {}, Side {}: setting q = {}", twtData.getId(), side, twtData.getComputedQ(side)); terminal.setQ(twtData.getComputedQ(side)); } } }
private void completeTerminalData(Terminal terminal, Side side, BranchData branchData) { if (terminal.isConnected() && terminal.getBusView().getBus().isInMainConnectedComponent()) { if (Double.isNaN(terminal.getP())) { LOGGER.debug("Branch {}, Side {}: setting p = {}", branchData.getId(), side, branchData.getComputedP(side)); terminal.setP(branchData.getComputedP(side)); } if (Double.isNaN(terminal.getQ())) { LOGGER.debug("Branch {}, Side {}: setting q = {}", branchData.getId(), side, branchData.getComputedQ(side)); terminal.setQ(branchData.getComputedQ(side)); } } }
public static ConnectionBus fromTerminal(Terminal t, EurostagEchExportConfig config, EurostagFakeNodes fakeNodes) { if (config.isNoSwitch()) { Bus bus = t.getBusView().getBus(); boolean connected; if (bus != null) {
public LoadRecord(Load load, ConnectBusInfo busInfo, double snref, SourceEngine sourceEngine) { this.load = load; this.busInfo = busInfo; this.loadId = load.getId(); this.busConnected = busInfo.isConnected(); this.p0 = this.load.getP0(); this.q0 = this.load.getQ0(); this.busVoltage = Double.NaN; this.busAngle = Double.NaN; this.sourceEngine = sourceEngine; if (this.busConnected) { if (load.getTerminal().getBusView().getBus() != null) { if (!Double.isNaN(load.getTerminal().getBusView().getBus().getV())) { busVoltage = load.getTerminal().getBusView().getBus().getV() / load.getTerminal().getVoltageLevel().getNominalV(); } if (!Double.isNaN(load.getTerminal().getBusView().getBus().getAngle())) { busAngle = load.getTerminal().getBusView().getBus().getAngle(); } } addLfParameters(); } else { LOGGER.warn("Load " + this.getModelicaName() + " disconnected."); this.addValue(StaticData.COMMENT + " Load " + this.getModelicaName() + " disconnected."); } if (this.busVoltage == 0) { LOGGER.info("Voltage 0"); } }
@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())); } }
@Override protected BusbarSection readRootElementAttributes(BusbarSectionAdder adder, NetworkXmlReaderContext context) { int node = XmlUtil.readIntAttribute(context.getReader(), "node"); double v = XmlUtil.readOptionalDoubleAttribute(context.getReader(), "v"); double angle = XmlUtil.readOptionalDoubleAttribute(context.getReader(), "angle"); BusbarSection bbs = adder.setNode(node) .add(); context.getEndTasks().add(() -> { Bus b = bbs.getTerminal().getBusView().getBus(); if (b != null) { b.setV(v).setAngle(angle); } }); return bbs; }
private static double getV(LegBase<?> leg) { return leg.getTerminal().isConnected() ? leg.getTerminal().getBusView().getBus().getV() : Double.NaN; }
private static double getTheta(LegBase<?> leg) { return leg.getTerminal().isConnected() ? Math.toRadians(leg.getTerminal().getBusView().getBus().getAngle()) : Double.NaN; }
public static Bus getBus(Terminal t, boolean noswitch) { if (noswitch) { return t.getBusView().getBus(); } else { return t.getBusBreakerView().getBus(); } }
public Bus getBus(Terminal t, boolean noswitch) { if (noswitch) { return t.getBusView().getBus(); } else { return t.getBusBreakerView().getBus(); } }
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; }
public static Bus getBus(Terminal t) { return t.getBusView().getBus(); }