本文整理了Java中com.powsybl.iidm.network.Terminal
类的一些代码示例,展示了Terminal
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal
类的具体详情如下:
包路径:com.powsybl.iidm.network.Terminal
类名称:Terminal
[英]An equipment connection point in a substation topology.
[中]变电站拓扑中的设备连接点。
代码示例来源:origin: itesla/ipst
private static void fillGeneratorState(Generator g, StateVariable sv) {
Terminal t = g.getTerminal();
Bus b = t.getBusBreakerView().getBus();
if (Double.isNaN(t.getP())) {
sv.p = 0;
} else {
sv.p = t.getP();
}
if (Double.isNaN(t.getQ())) {
sv.q = 0;
} else {
sv.q = t.getQ();
}
if (b != null && !Double.isNaN(b.getV()) && !Double.isNaN(b.getAngle())) { // generator is connected
sv.u = b.getV();
sv.theta = b.getAngle();
} else {
sv.u = t.getVoltageLevel().getNominalV();
sv.theta = 0;
}
if (!sv.isValid()) {
throw new RuntimeException("Invalid sv " + g.getId() + ": " + sv);
}
}
代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion
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));
}
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
private static void fillNodeOrBus(InjectionAdder adder, Terminal terminal) {
if (terminal.getVoltageLevel().getTopologyKind() == TopologyKind.NODE_BREAKER) {
adder.setNode(terminal.getNodeBreakerView().getNode());
} else {
if (terminal.isConnected()) {
adder.setBus(terminal.getBusBreakerView().getBus().getId());
}
adder.setConnectableBus(terminal.getBusBreakerView().getConnectableBus().getId());
}
}
代码示例来源:origin: itesla/ipst
private static float apparentPower(Terminal terminal) {
float apparentPower = Float.NaN;
if (!Double.isNaN(terminal.getP()) && !Double.isNaN(terminal.getQ())) {
apparentPower = (float) Math.sqrt(Math.pow(terminal.getP(), 2) + Math.pow(terminal.getQ(), 2));
}
return apparentPower;
}
代码示例来源:origin: itesla/ipst
private void update(Terminal t) {
if (t.getBusView().getBus() != null) {
p = t.getP();
q = t.getQ();
v = t.getBusView().getBus().getV();
i = t.getI();
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
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();
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
private static void updateBranch(XMLStreamReader reader, Network network) {
String id = reader.getAttributeValue(null, "id");
double p1 = XmlUtil.readOptionalDoubleAttribute(reader, "p1");
double q1 = XmlUtil.readOptionalDoubleAttribute(reader, "q1");
double p2 = XmlUtil.readOptionalDoubleAttribute(reader, "p2");
double q2 = XmlUtil.readOptionalDoubleAttribute(reader, "q2");
Branch branch = (Branch) network.getIdentifiable(id);
branch.getTerminal1().setP(p1).setQ(q1);
branch.getTerminal2().setP(p2).setQ(q2);
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
private Load replaceBranchByLoad(Branch<?> branch, VoltageLevel vl, Terminal terminal) {
LoadAdder loadAdder = vl.newLoad()
.setId(branch.getId())
.setName(branch.getName())
.setLoadType(LoadType.FICTITIOUS)
.setP0(checkP(terminal))
.setQ0(checkQ(terminal));
fillNodeOrBus(loadAdder, terminal);
branch.remove();
Load load = loadAdder.add();
load.getTerminal()
.setP(terminal.getP())
.setQ(terminal.getQ());
return load;
}
代码示例来源:origin: itesla/ipst
Terminal t = g.getTerminal();
if (!onlyVoltage) {
if (!Double.isNaN(t.getP())) {
double oldTargetP = g.getTargetP();
double newTargetP = -t.getP();
if (oldTargetP != newTargetP) {
g.setTargetP(newTargetP);
if (!Double.isNaN(t.getQ())) {
double oldTargetQ = g.getTargetQ();
double newTargetQ = -t.getQ();
if (oldTargetQ != newTargetQ) {
g.setTargetQ(newTargetQ);
Bus b = t.getBusView().getBus();
if (b != null) {
if (!Double.isNaN(b.getV())) {
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
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();
}
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private Void readVsc(String[] tokens) {
int num = Integer.parseInt(tokens[1]);
int busNum = Integer.parseInt(tokens[2]);
boolean vregul = Boolean.parseBoolean(tokens[3]);
double targetV = readDouble(tokens[4]);
double targetQ = readDouble(tokens[5]);
double p = readDouble(tokens[6]);
double q = readDouble(tokens[7]);
String id = mapper.getId(AmplSubset.VSC_CONVERTER_STATION, num);
VscConverterStation vsc = network.getVscConverterStation(id);
Terminal t = vsc.getTerminal();
t.setP(p).setQ(q);
vsc.setReactivePowerSetpoint(targetQ);
vsc.setVoltageRegulatorOn(vregul);
double vb = t.getVoltageLevel().getNominalV();
vsc.setVoltageSetpoint(targetV * vb);
busConnection(t, busNum);
return null;
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
public static void printGeneratorsSetpointDiff(Network network, Logger logger) {
for (Generator g : network.getGenerators()) {
double dp = Math.abs(g.getTerminal().getP() + g.getTargetP());
double dq = Math.abs(g.getTerminal().getQ() + g.getTargetQ());
double dv = Math.abs(g.getTerminal().getBusBreakerView().getConnectableBus().getV() - g.getTargetV());
if (dp > 1 || dq > 5 || dv > 0.1) {
logger.warn("Generator {}: ({}, {}, {}) ({}, {}, {}) -> ({}, {}, {})", g.getId(),
dp, dq, dv,
-g.getTargetP(), -g.getTargetQ(), g.getTargetV(),
g.getTerminal().getP(), g.getTerminal().getQ(), g.getTerminal().getBusBreakerView().getConnectableBus().getV());
}
}
}
代码示例来源:origin: itesla/ipst
public String getEsgIdAndIncCounter(Terminal t) {
return getEsgIdAndIncCounter(t.getVoltageLevel());
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
Mockito.when(leg1Terminal.isConnected()).thenReturn(CONNECTED1);
Mockito.when(leg1Terminal.getP()).thenReturn(P1);
Mockito.when(leg1Terminal.getQ()).thenReturn(Q1);
Mockito.when(leg1Terminal.getBusView()).thenReturn(leg1BusView);
Mockito.when(leg2Terminal.isConnected()).thenReturn(CONNECTED2);
Mockito.when(leg2Terminal.getP()).thenReturn(P2);
Mockito.when(leg2Terminal.getQ()).thenReturn(Q2);
Mockito.when(leg2Terminal.getBusView()).thenReturn(leg2BusView);
Mockito.when(leg3Terminal.isConnected()).thenReturn(CONNECTED3);
Mockito.when(leg3Terminal.getP()).thenReturn(P3);
Mockito.when(leg3Terminal.getQ()).thenReturn(Q3);
Mockito.when(leg3Terminal.getBusView()).thenReturn(leg3BusView);
代码示例来源:origin: itesla/ipst
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();
} else {
throw new RuntimeException("Unexpected stator substation topology");
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 {
LOGGER.trace("Removing step up transformer '{}' of generator '{}'", twt.getId(), lvGen.getId());
boolean connected = twt.getTerminal1().isConnected() && twt.getTerminal2().isConnected() && lvGen.getTerminal().isConnected();
float newQ0 = (float) -hlSvAux.q;
boolean connected = aux.getTerminal().getBusBreakerView().getBus() != null;
代码示例来源:origin: itesla/ipst
public Bus getBus(Terminal t, boolean noswitch) {
if (noswitch) {
return t.getBusView().getBus();
} else {
return t.getBusBreakerView().getBus();
}
}
代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion
if (terminal.isConnected()
&& Double.isNaN(terminal.getQ())
&& terminal.getBusView().getBus().isInMainConnectedComponent()) {
double v = terminal.getBusView().getBus().getV();
double q = -sh.getCurrentB() * v * v;
LOGGER.debug("Shunt {}, setting q = {}", sh, q);
terminal.setQ(q);
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
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()));
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
public static ConnectionInfo getConnectionInfoInBusBreakerView(Terminal t) {
Bus bus = t.getBusBreakerView().getBus();
boolean connected;
if (bus != null) {
connected = true;
} else {
connected = false;
bus = t.getBusBreakerView().getConnectableBus();
if (bus == null) {
// otherwise take first bus of the substation at the same voltage
// level...
Iterator<Bus> itVLB = t.getVoltageLevel().getBusBreakerView().getBuses().iterator();
if (itVLB.hasNext()) {
bus = itVLB.next();
} else {
throw new PowsyblException("Cannot find a connection bus");
}
}
}
return new ConnectionInfo(bus, connected);
}
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private void writeDanglingLineMiddleBuses(AmplExportContext context, TableFormatter formatter) throws IOException {
for (DanglingLine dl : network.getDanglingLines()) {
Terminal t = dl.getTerminal();
Bus b = AmplUtil.getBus(dl.getTerminal());
int middleCcNum = getDanglingLineMiddleBusComponentNum(context, dl);
if (connectedComponentToExport(middleCcNum)) {
String middleBusId = getDanglingLineMiddleBusId(dl);
String middleVlId = getDanglingLineMiddleVoltageLevelId(dl);
context.busIdsToExport.add(middleBusId);
int middleBusNum = mapper.getInt(AmplSubset.BUS, middleBusId);
int middleVlNum = mapper.getInt(AmplSubset.VOLTAGE_LEVEL, middleVlId);
SV sv = new SV(t.getP(), t.getQ(), b != null ? b.getV() : Double.NaN, b != null ? b.getAngle() : Double.NaN).otherSide(dl);
double nomV = t.getVoltageLevel().getNominalV();
double v = sv.getU() / nomV;
double theta = Math.toRadians(sv.getA());
formatter.writeCell(variantIndex)
.writeCell(middleBusNum)
.writeCell(middleVlNum)
.writeCell(middleCcNum)
.writeCell(v)
.writeCell(theta)
.writeCell(0.0) // 0 MW injected at dangling line internal bus
.writeCell(0.0) // 0 MVar injected at dangling line internal bus
.writeCell(faultNum)
.writeCell(actionNum)
.writeCell(middleBusId);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!