本文整理了Java中com.powsybl.iidm.network.Terminal.getBusBreakerView()
方法的一些代码示例,展示了Terminal.getBusBreakerView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.getBusBreakerView()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Terminal
类名称:Terminal
方法名:getBusBreakerView
[英]Get a view to access to bus/breaker topology informations at the terminal.
[中]查看终端的母线/断路器拓扑信息。
代码示例来源:origin: itesla/ipst
private ConnectBusInfo findBus(Terminal terminal, String context) {
ConnectBusInfo busInfo;
Bus bus = null;
boolean connected = true;
bus = terminal.getBusBreakerView().getBus();
if (bus == null) {
connected = false;
bus = terminal.getBusBreakerView().getConnectableBus();
if (bus == null) {
throw new RuntimeException("Cannot find connection bus");
}
}
busInfo = new ConnectBusInfo(bus, connected);
return busInfo;
}
代码示例来源:origin: itesla/ipst
private static double getV(Terminal t) {
Bus b = t.getBusBreakerView().getBus();
return b != null ? b.getV() : Double.NaN;
}
代码示例来源:origin: itesla/ipst
public static boolean isConnected(Load load) {
Bus loadBus = load.getTerminal().getBusBreakerView().getBus();
double voltage = getV(load.getTerminal());
if (loadBus != null && !Double.isNaN(voltage)) {
// load is connected
return true;
}
return false;
}
代码示例来源:origin: itesla/ipst
public Bus getBus(Terminal t, boolean noswitch) {
if (noswitch) {
return t.getBusView().getBus();
} else {
return t.getBusBreakerView().getBus();
}
}
代码示例来源:origin: itesla/ipst
public static boolean isConnected(Generator generator) {
Bus generatorBus = generator.getTerminal().getBusBreakerView().getBus();
double voltage = getV(generator.getTerminal());
if (generatorBus != null && !Double.isNaN(voltage)) {
// generator is connected
return true;
}
return false;
}
代码示例来源:origin: itesla/ipst
public static Bus getBus(Terminal t, boolean noswitch) {
if (noswitch) {
return t.getBusView().getBus();
} else {
return t.getBusBreakerView().getBus();
}
}
代码示例来源: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-iidm-xml-converter
@Override
protected void writeSubElements(Generator g, VoltageLevel vl, NetworkXmlWriterContext context) throws XMLStreamException {
if (g.getRegulatingTerminal() != null
&& !Objects.equals(g.getRegulatingTerminal().getBusBreakerView().getConnectableBus(),
g.getTerminal().getBusBreakerView().getConnectableBus())) {
writeTerminalRef(g.getRegulatingTerminal(), context, "regulatingTerminal");
}
ReactiveLimitsXml.INSTANCE.write(g, context);
}
代码示例来源:origin: com.powsybl/powsybl-iidm-converter-api
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;
}
}
代码示例来源:origin: itesla/ipst
private static void extractLoadsData(Network network, NetworkData networkData) {
for (Load load : network.getLoads()) {
networkData.addLoadData(new LoadData(load.getId(),
(load.getTerminal().getBusBreakerView().getBus() != null)
? load.getTerminal().getBusBreakerView().getBus().getId()
: load.getTerminal().getBusBreakerView().getConnectableBus().getId(),
load.getTerminal().getBusBreakerView().getBus() != null,
load.getTerminal().getVoltageLevel().getNominalV(),
load.getTerminal().getP(),
load.getTerminal().getQ())
);
}
}
代码示例来源: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: 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
private static void extractLinesData(Network network, NetworkData networkData) {
for (Line line : network.getLines()) {
if (line.getTerminal1().getVoltageLevel().getNominalV() >= 110) {
networkData.addLineData(new LineData(line.getId(),
(line.getTerminal1().getBusBreakerView().getBus() != null)
? line.getTerminal1().getBusBreakerView().getBus().getId()
: line.getTerminal1().getBusBreakerView().getConnectableBus().getId(),
(line.getTerminal2().getBusBreakerView().getBus() != null)
? line.getTerminal2().getBusBreakerView().getBus().getId()
: line.getTerminal2().getBusBreakerView().getConnectableBus().getId(),
line.getTerminal1().getI(),
line.getTerminal2().getI(),
(line.getCurrentLimits1() != null) ? line.getCurrentLimits1().getPermanentLimit() : Float.NaN,
(line.getCurrentLimits2() != null) ? line.getCurrentLimits2().getPermanentLimit() : Float.NaN)
);
}
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
private static void addShuntCompensators(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
for (ShuntCompensator sc : network.getShuntCompensators()) {
Terminal.BusBreakerView view = sc.getTerminal().getBusBreakerView();
double q = sc.getCurrentB() * Math.pow(sc.getTerminal().getVoltageLevel().getNominalV(), 2);
if (view.getBus() != null) {
addConnectedShunt(view, q, sc.getId(), balanceMainCC, balanceOtherCC);
} else {
addDisonnectedShunt(view, q, sc.getId(), balanceMainCC, balanceOtherCC);
}
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
private static void addDanglingLines(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
for (DanglingLine dl : network.getDanglingLines()) {
Terminal.BusBreakerView view = dl.getTerminal().getBusBreakerView();
if (view.getBus() != null) {
if (view.getBus().isInMainConnectedComponent()) {
balanceMainCC.connectedLoads.add(dl.getId());
balanceMainCC.connectedLoadVolume += dl.getP0();
} else {
balanceOtherCC.connectedLoads.add(dl.getId());
balanceOtherCC.connectedLoadVolume += dl.getP0();
}
} else {
if (view.getConnectableBus().isInMainConnectedComponent()) {
balanceMainCC.disconnectedLoads.add(dl.getId());
balanceMainCC.disconnectedLoadVolume += dl.getP0();
} else {
balanceOtherCC.disconnectedLoads.add(dl.getId());
balanceOtherCC.disconnectedLoadVolume += dl.getP0();
}
}
}
}
代码示例来源:origin: itesla/ipst
private static void extractTfo2WData(Network network, NetworkData networkData) {
for (TwoWindingsTransformer tfo : network.getTwoWindingsTransformers()) {
networkData.addTfo2WData(new Tfo2WData(tfo.getId(),
(tfo.getTerminal1().getBusBreakerView().getBus() != null)
? tfo.getTerminal1().getBusBreakerView().getBus().getId()
: tfo.getTerminal1().getBusBreakerView().getConnectableBus().getId(),
(tfo.getTerminal2().getBusBreakerView().getBus() != null)
? tfo.getTerminal2().getBusBreakerView().getBus().getId()
: tfo.getTerminal2().getBusBreakerView().getConnectableBus().getId(),
apparentPower(tfo.getTerminal1()),
apparentPower(tfo.getTerminal2()),
tfo.getTerminal1().getVoltageLevel().getNominalV(),
tfo.getTerminal2().getVoltageLevel().getNominalV(),
(tfo.getCurrentLimits1() != null) ? tfo.getCurrentLimits1().getPermanentLimit() : Float.NaN,
(tfo.getCurrentLimits2() != null) ? tfo.getCurrentLimits2().getPermanentLimit() : Float.NaN,
isRegulating(tfo),
correntStepPosition(tfo))
);
}
}
代码示例来源: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: itesla/ipst
private static void extractGeneratorsData(Network network, NetworkData networkData) {
for (Generator generator : network.getGenerators()) {
networkData.addGeneratorData(new GeneratorData(generator.getId(),
(generator.getTerminal().getBusBreakerView().getBus() != null)
? generator.getTerminal().getBusBreakerView().getBus().getId()
: generator.getTerminal().getBusBreakerView().getConnectableBus().getId(),
generator.getTerminal().getBusBreakerView().getBus() != null,
apparentPower(generator.getTerminal()),
generator.getTerminal().getP(),
generator.getTerminal().getQ(),
generator.getRatedS(),
generator.getReactiveLimits().getMaxQ(generator.getTargetP()),
generator.getReactiveLimits().getMinQ(generator.getTargetP()))
// generator.getReactiveLimits().getMaxQ(generator.getTerminal().getP()),
// generator.getReactiveLimits().getMinQ(generator.getTerminal().getP()))
);
}
}
代码示例来源:origin: itesla/ipst
private boolean removeSwitchandBus(VoltageLevel vl, Switch s, Bus toRemove, Bus toKeep) {
List<Terminal> terminals = getTerminals(toRemove);
if (terminals.size() <= 1) {
terminals.forEach(t -> {
boolean reconnect = false;
if (t.isConnected()) {
t.disconnect();
reconnect = true;
}
t.getBusBreakerView().setConnectableBus(toKeep.getId());
if (!s.isOpen() && reconnect) {
t.connect();
}
});
vl.getBusBreakerView().removeSwitch(s.getId());
vl.getBusBreakerView().removeBus(toRemove.getId());
return true;
}
return false;
}
代码示例来源:origin: itesla/ipst
public static boolean isRedispatchable(Generator generator, float redispatchLimitsPercentage) {
return (generator.getTerminal().getBusBreakerView().getBus() != null) // is connected
&& (generator.getEnergySource() == EnergySource.HYDRO || generator.getEnergySource() == EnergySource.THERMAL) // is hydro or thermal
&& (generator.getTerminal().getP() < 0) // inject power
&& (generator.isVoltageRegulatorOn()) // has voltage regulator on
&& (generator.getTargetP() <= getRedispatchPMax(generator, redispatchLimitsPercentage)
&& generator.getTargetP() >= getRedispatchPMin(generator, redispatchLimitsPercentage)); // target P is within redispatch limits
//&& (generator.getTargetP() <= generator.getMaxP() && generator.getTargetP() >= generator.getMinP()) // target P is within limits
}
内容来源于网络,如有侵权,请联系作者删除!