private static boolean isBusbarSection(Terminal t) { return t != null && t.getConnectable().getType() == ConnectableType.BUSBAR_SECTION; }
private static double checkP(Terminal terminal) { if (!terminal.isConnected()) { return 0.0; } if (Double.isNaN(terminal.getP())) { String connectableId = terminal.getConnectable().getId(); String voltageLevelId = terminal.getVoltageLevel().getId(); throw new PowsyblException("The active power of '" + connectableId + "' (" + voltageLevelId + ") is not set. Do you forget to compute the flows?"); } return terminal.getP(); }
private static double checkQ(Terminal terminal) { if (!terminal.isConnected()) { return 0.0; } if (Double.isNaN(terminal.getQ())) { String connectableId = terminal.getConnectable().getId(); String voltageLevelId = terminal.getVoltageLevel().getId(); throw new PowsyblException("The reactive power of '" + connectableId + "' (" + voltageLevelId + ") is not set. Do you forget to compute the flows?"); } return terminal.getQ(); } }
protected static void writeTerminalRef(Terminal t, NetworkXmlWriterContext context, String elementName) throws XMLStreamException { Connectable c = t.getConnectable(); if (!context.getFilter().test(c)) { throw new PowsyblException("Oups, terminal ref point to a filtered equipment " + c.getId()); } context.getWriter().writeEmptyElement(IIDM_URI, elementName); context.getWriter().writeAttribute("id", context.getAnonymizer().anonymizeString(c.getId())); if (c.getTerminals().size() > 1) { if (c instanceof Injection) { // nothing to do } else if (c instanceof Branch) { Branch branch = (Branch) c; context.getWriter().writeAttribute("side", branch.getSide(t).name()); } else if (c instanceof ThreeWindingsTransformer) { ThreeWindingsTransformer twt = (ThreeWindingsTransformer) c; context.getWriter().writeAttribute("side", twt.getSide(t).name()); } else { throw new AssertionError("Unexpected Connectable instance: " + c.getClass()); } } }
@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()); } } });
private PropertyBag createPowerFlowProperties(CgmesModel cgmes, Terminal terminal) { PropertyBag p = new PropertyBag(SV_POWERFLOW_PROPERTIES); p.put("p", fs(terminal.getP())); p.put("q", fs(terminal.getQ())); // TODO If we could store a terminal identifier in IIDM // we would not need to obtain it querying CGMES for the related equipment p.put(CgmesNames.TERMINAL, cgmes.terminalForEquipment(terminal.getConnectable().getId())); return p; }
PossibleTopology.Equipment pt = new PossibleTopology.Equipment(t.getConnectable().getId(), i); if (!t2eq.containsValue(pt) && eq2bus.containsKey(pt)) { t2eq.put(t, pt);
private void convertPatlCurrentTerminal(double value) { Connectable<?> connectable = terminal.getConnectable(); if (connectable instanceof Branch) { int terminalNumber = context.terminalMapping().number(terminalId); Branch<?> b = (Branch<?>) connectable; if (terminalNumber == 1) { b.newCurrentLimits1().setPermanentLimit(value).add(); } else if (terminalNumber == 2) { b.newCurrentLimits2().setPermanentLimit(value).add(); } else { notAssigned(b); } } else if (connectable instanceof DanglingLine) { ((DanglingLine) connectable).newCurrentLimits().setPermanentLimit(value).add(); } else { notAssigned(connectable); } }