本文整理了Java中com.powsybl.iidm.network.Terminal.setP()
方法的一些代码示例,展示了Terminal.setP()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.setP()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Terminal
类名称:Terminal
方法名:setP
[英]Set the active power in MW injected at the terminal.
Depends on the working variant.
[中]设置终端注入的有功功率,单位为MW。
取决于工作变量。
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
private static void updateInjection(XMLStreamReader reader, Network network) {
String id = reader.getAttributeValue(null, "id");
double p = XmlUtil.readOptionalDoubleAttribute(reader, "p");
double q = XmlUtil.readOptionalDoubleAttribute(reader, "q");
Injection inj = (Injection) network.getIdentifiable(id);
inj.getTerminal().setP(p).setQ(q);
}
代码示例来源: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-ampl-converter
private Void readLcc(String[] tokens) {
int num = Integer.parseInt(tokens[1]);
int busNum = Integer.parseInt(tokens[2]);
double p = readDouble(tokens[3]);
double q = readDouble(tokens[4]);
String id = mapper.getId(AmplSubset.LCC_CONVERTER_STATION, num);
LccConverterStation lcc = network.getLccConverterStation(id);
lcc.getTerminal().setP(p).setQ(q);
busConnection(lcc.getTerminal(), busNum);
return null;
}
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
protected static void readPQ(Integer index, Terminal t, XMLStreamReader reader) {
double p = XmlUtil.readOptionalDoubleAttribute(reader, "p" + indexToString(index));
double q = XmlUtil.readOptionalDoubleAttribute(reader, "q" + indexToString(index));
t.setP(p)
.setQ(q);
}
代码示例来源: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-loadflow-results-completion
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));
}
}
}
代码示例来源: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
public static void clearSv(Network network) {
g.getTerminal().setP(Float.NaN).setQ(Float.NaN);
l.getTerminal().setP(Float.NaN).setQ(Float.NaN);
sc.getTerminal().setP(Float.NaN).setQ(Float.NaN);
dl.getTerminal().setP(Float.NaN).setQ(Float.NaN);
l.getTerminal1().setP(Float.NaN).setQ(Float.NaN);
l.getTerminal2().setP(Float.NaN).setQ(Float.NaN);
twt.getTerminal1().setP(Float.NaN).setQ(Float.NaN);
twt.getTerminal2().setP(Float.NaN).setQ(Float.NaN);
twt.getLeg1().getTerminal().setP(Float.NaN).setQ(Float.NaN);
twt.getLeg2().getTerminal().setP(Float.NaN).setQ(Float.NaN);
twt.getLeg3().getTerminal().setP(Float.NaN).setQ(Float.NaN);
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private boolean readThreeWindingsTransformerBranch(String id, double p, double q, int busNum) {
if (id.endsWith(AmplConstants.LEG1_SUFFIX)) {
ThreeWindingsTransformer tht = network.getThreeWindingsTransformer(id.substring(0, id.indexOf(AmplConstants.LEG1_SUFFIX)));
if (tht != null) {
tht.getLeg1().getTerminal().setP(p).setQ(q);
busConnection(tht.getLeg1().getTerminal(), busNum);
} else {
throw new AmplException("Invalid branch (leg1) id '" + id + "'");
}
} else if (id.endsWith(AmplConstants.LEG2_SUFFIX)) {
ThreeWindingsTransformer tht = network.getThreeWindingsTransformer(id.substring(0, id.indexOf(AmplConstants.LEG2_SUFFIX)));
if (tht != null) {
tht.getLeg2().getTerminal().setP(p).setQ(q);
busConnection(tht.getLeg1().getTerminal(), busNum);
} else {
throw new AmplException("Invalid branch (leg2) id '" + id + "'");
}
} else if (id.endsWith(AmplConstants.LEG3_SUFFIX)) {
ThreeWindingsTransformer tht = network.getThreeWindingsTransformer(id.substring(0, id.indexOf(AmplConstants.LEG3_SUFFIX)));
if (tht != null) {
tht.getLeg3().getTerminal().setP(p).setQ(q);
busConnection(tht.getLeg1().getTerminal(), busNum);
} else {
throw new AmplException("Invalid branch (leg3) id '" + id + "'");
}
} else {
return false;
}
return true;
}
代码示例来源:origin: com.powsybl/powsybl-cgmes-conversion
void convertedTerminal(String terminalId, Terminal t, int n, PowerFlow f) {
// Record the mapping between CGMES and IIDM terminals
context.terminalMapping().add(terminalId, t, n);
// Update the power flow at terminal
if (f.defined()) {
t.setP(f.p());
t.setQ(f.q());
}
}
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private Void readBranch(String[] tokens) {
int num = Integer.parseInt(tokens[1]);
int busNum = Integer.parseInt(tokens[2]);
int busNum2 = Integer.parseInt(tokens[3]);
double p1 = readDouble(tokens[4]);
double p2 = readDouble(tokens[5]);
double q1 = readDouble(tokens[6]);
double q2 = readDouble(tokens[7]);
String id = mapper.getId(AmplSubset.BRANCH, num);
Branch br = network.getBranch(id);
if (br != null) {
br.getTerminal1().setP(p1).setQ(q1);
br.getTerminal2().setP(p2).setQ(q2);
busConnection(br.getTerminal1(), busNum);
busConnection(br.getTerminal2(), busNum2);
return null;
}
if (readThreeWindingsTransformerBranch(id, p1, q1, busNum)) {
return null;
}
DanglingLine dl = network.getDanglingLine(id);
if (dl != null) {
dl.getTerminal().setP(p1).setQ(q1);
busConnection(dl.getTerminal(), busNum);
} else {
throw new AmplException("Invalid branch id '" + id + "'");
}
return null;
}
代码示例来源: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-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;
}
代码示例来源:origin: com.powsybl/powsybl-ampl-converter
private Void readGenerator(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 targetP = readDouble(tokens[5]);
double targetQ = readDouble(tokens[6]);
double p = readDouble(tokens[7]);
double q = readDouble(tokens[8]);
String id = mapper.getId(AmplSubset.GENERATOR, num);
Generator g = network.getGenerator(id);
if (g == null) {
throw new AmplException("Invalid generator id '" + id + "'");
}
g.setVoltageRegulatorOn(vregul);
g.setTargetP(targetP);
g.setTargetQ(targetQ);
Terminal t = g.getTerminal();
t.setP(p).setQ(q);
double vb = t.getVoltageLevel().getNominalV();
g.setTargetV(targetV * vb);
busConnection(t, busNum);
return null;
}
代码示例来源:origin: itesla/ipst
offlineDb.storeTaskStatus(workflowId, 0, OfflineTaskType.LOAD_FLOW, OfflineTaskStatus.SUCCEED, null);
Load l = n.getLoad("LOAD");
l.getTerminal().setP(10);
offlineDb.storeState(workflowId, 0, n, null);
l.getTerminal().setP(11);
offlineDb.storeState(workflowId, 1, n, null);
offlineDb.storeTaskStatus(workflowId, 0, OfflineTaskType.STABILIZATION, OfflineTaskStatus.SUCCEED, null);
代码示例来源:origin: com.powsybl/powsybl-cim1-converter
addTerminalMapping(tn, load.getTerminal());
if (svpf != null) {
load.getTerminal().setP(p).setQ(q);
代码示例来源:origin: com.powsybl/powsybl-security-analysis-api
@Override
public void modify(Network network, ComputationManager computationManager) {
network.getLine("NHV1_NHV2_2").getTerminal1().disconnect();
network.getLine("NHV1_NHV2_2").getTerminal2().disconnect();
network.getLine("NHV1_NHV2_1").getTerminal2().setP(600.0);
}
});
代码示例来源: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: com.powsybl/powsybl-iidm-reducer
private void replaceLineByDanglingLine(Line line, VoltageLevel vl, Terminal terminal) {
Branch.Side side = line.getSide(terminal);
DanglingLineAdder dlAdder = vl.newDanglingLine()
.setId(line.getId())
.setName(line.getName())
.setR(line.getR() / 2)
.setX(line.getX() / 2)
.setB(side == Branch.Side.ONE ? line.getB1() : line.getB2())
.setG(side == Branch.Side.ONE ? line.getG1() : line.getG2())
.setP0(checkP(terminal))
.setQ0(checkQ(terminal));
fillNodeOrBus(dlAdder, terminal);
line.remove();
DanglingLine dl = dlAdder.add();
dl.getTerminal()
.setP(terminal.getP())
.setQ(terminal.getQ());
observers.forEach(o -> o.lineReplaced(line, dl));
}
代码示例来源:origin: com.powsybl/powsybl-iidm-test
line.getTerminal1().setP(560.0).setQ(550.0);
line.getTerminal2().setP(560.0).setQ(550.0);
line.newCurrentLimits1().setPermanentLimit(500).add();
line.newCurrentLimits2()
line.getTerminal1().setP(560.0).setQ(550.0);
line.getTerminal2().setP(560.0).setQ(550.0);
line.newCurrentLimits1()
.setPermanentLimit(1100)
内容来源于网络,如有侵权,请联系作者删除!