本文整理了Java中com.powsybl.iidm.network.Load.setP0()
方法的一些代码示例,展示了Load.setP0()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Load.setP0()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Load
类名称:Load
方法名:setP0
[英]Set the constant active power in MW.
Depends on the working variant.
[中]以MW为单位设置恒定有功功率。
取决于工作变量。
代码示例来源:origin: itesla/ipst
public static void applyInjections(Network network, String stateId, Map<String, Float> injections) {
Objects.requireNonNull(network);
Objects.requireNonNull(stateId);
Objects.requireNonNull(injections);
String originalStateId = network.getStateManager().getWorkingStateId();
network.getStateManager().setWorkingState(stateId);
injections.keySet().forEach(injection -> {
Load load = network.getLoad(injection);
if (load != null) {
double oldP = load.getTerminal().getP();
LOGGER.debug("Network {}, state {}: incrementing P of load {} from {} to {}",
network.getId(), network.getStateManager().getWorkingStateId(), injection, oldP, oldP + injections.get(injection));
load.getTerminal().setP(oldP + injections.get(injection));
load.setP0(oldP + injections.get(injection));
} else {
Generator generator = network.getGenerator(injection);
if (generator != null) {
double oldP = generator.getTerminal().getP();
LOGGER.debug("Network {}, state {}: incrementing P of generator {} from {} to {}",
network.getId(), network.getStateManager().getWorkingStateId(), injection, oldP, oldP + injections.get(injection));
generator.getTerminal().setP(oldP + injections.get(injection));
generator.setTargetP(-oldP - injections.get(injection));
} else {
LOGGER.error("No load or generator with id {} in network {}: cannot apply the injection", injection, network.getId());
}
}
});
network.getStateManager().setWorkingState(originalStateId);
}
代码示例来源:origin: itesla/ipst
double oldQ0 = l.getQ0();
LOGGER.trace(" load {} - P:{}, Q:{} -> P:{}, Q:{} ", l.getId(), oldP0, oldQ0, ls.p, ls.q);
l.setP0(ls.p).setQ0(ls.q);
l.getTerminal().setP(ls.p).setQ(ls.q);
代码示例来源:origin: itesla/ipst
LOGGER.debug("Network {} state {}: load {} - P:{} -> P:{} ", network.getId(), network.getStateManager().getWorkingStateId(), loadId, oldActivePower, newActivePower);
if (!Double.isNaN(newActivePower)) {
network.getLoad(loadId).setP0(newActivePower);
network.getLoad(loadId).getTerminal().setP(newActivePower);
} else {
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private Void readLoad(String[] tokens) {
int num = Integer.parseInt(tokens[1]);
int busNum = Integer.parseInt(tokens[2]);
double p = readDouble(tokens[3]);
double q = readDouble(tokens[4]);
double p0 = readDouble(tokens[5]);
double q0 = readDouble(tokens[6]);
String id = mapper.getId(AmplSubset.LOAD, num);
Load l = network.getLoad(id);
if (l != null) {
l.setP0(p0).setQ0(q0);
l.getTerminal().setP(p).setQ(q);
busConnection(l.getTerminal(), busNum);
} else {
DanglingLine dl = network.getDanglingLine(id);
if (dl != null) {
dl.setP0(p0).setQ0(q0);
dl.getTerminal().setP(p).setQ(q);
busConnection(dl.getTerminal(), busNum);
} else {
throw new AmplException("Invalid load id '" + id + "'");
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!