本文整理了Java中com.powsybl.iidm.network.Network.getIdentifiable()
方法的一些代码示例,展示了Network.getIdentifiable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getIdentifiable()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Network
类名称:Network
方法名:getIdentifiable
[英]Get a equipment.
[中]找一台设备。
代码示例来源:origin: com.powsybl/powsybl-action-util
private Scalable getScalable(Network n) {
Objects.requireNonNull(n);
Identifiable identifiable = n.getIdentifiable(id);
if (identifiable instanceof Generator) {
return new GeneratorScalable(id);
} else {
throw new PowsyblException("Unable to create a scalable from " + identifiable.getClass());
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
protected static Terminal readTerminalRef(Network network, String id, String side) {
Identifiable identifiable = network.getIdentifiable(id);
if (identifiable instanceof Injection) {
return ((Injection) identifiable).getTerminal();
} else if (identifiable instanceof Branch) {
return side.equals(Branch.Side.ONE.name()) ? ((Branch) identifiable).getTerminal1()
: ((Branch) identifiable).getTerminal2();
} else if (identifiable instanceof ThreeWindingsTransformer) {
ThreeWindingsTransformer twt = (ThreeWindingsTransformer) identifiable;
return twt.getTerminal(ThreeWindingsTransformer.Side.valueOf(side));
} else {
throw new AssertionError("Unexpected Identifiable instance: " + identifiable.getClass());
}
}
}
代码示例来源: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-security-analysis-api
private static VoltageLevel getVoltageLevel(LimitViolation limitViolation, Network network) {
Objects.requireNonNull(network);
Objects.requireNonNull(limitViolation);
Identifiable identifiable = network.getIdentifiable(limitViolation.getSubjectId());
if (identifiable instanceof Branch) {
Branch branch = (Branch) identifiable;
return branch.getTerminal(limitViolation.getSide()).getVoltageLevel();
} else if (identifiable instanceof Injection) {
Injection injection = (Injection) identifiable;
return injection.getTerminal().getVoltageLevel();
} else if (identifiable instanceof VoltageLevel) {
return (VoltageLevel) identifiable;
} else if (identifiable instanceof Bus) {
Bus bus = (Bus) identifiable;
return bus.getVoltageLevel();
} else {
throw new AssertionError("Unexpected identifiable type: " + identifiable.getClass());
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-xml-converter
Identifiable identifiable = network.getIdentifiable(id2);
if (identifiable == null) {
throw new PowsyblException("Identifiable " + id2 + " not found");
代码示例来源:origin: itesla/ipst
Injection injection = (Injection) network.getIdentifiable(refMachineName);
if (injection == null) {
throw new RuntimeException("id: " + eq.getCimId() + ", name: " + machineName + ", coupling parameter " + parName + "=" + parValue + " - could not find any injection with id: " + refMachineName);
代码示例来源: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-security-analysis-afs
private void addSubjectInfo(RunningContext context, LimitViolationsResult result) {
for (LimitViolation violation : result.getLimitViolations()) {
Identifiable identifiable = context.getNetwork().getIdentifiable(violation.getSubjectId());
if (identifiable instanceof Branch) {
Branch branch = (Branch) identifiable;
Set<Country> countries = new TreeSet<>();
countries.add(branch.getTerminal1().getVoltageLevel().getSubstation().getCountry());
countries.add(branch.getTerminal2().getVoltageLevel().getSubstation().getCountry());
Set<Double> nominalVoltages = new TreeSet<>();
nominalVoltages.add(branch.getTerminal1().getVoltageLevel().getNominalV());
nominalVoltages.add(branch.getTerminal2().getVoltageLevel().getNominalV());
violation.addExtension(SubjectInfoExtension.class, new SubjectInfoExtension(countries, nominalVoltages));
} else if (identifiable instanceof VoltageLevel) {
VoltageLevel vl = (VoltageLevel) identifiable;
violation.addExtension(SubjectInfoExtension.class, new SubjectInfoExtension(vl.getSubstation().getCountry(), vl.getNominalV()));
}
}
}
代码示例来源:origin: itesla/ipst
if (ctg.getEquipments() != null) {
for (Equipment eq:ctg.getEquipments().getEquipment()) {
if (network.getIdentifiable(eq.getId()) != null) {
ctgIds.add(c.getId());
break;
if (network.getIdentifiable(con.getEquipment()) != null) {
constraints.add(new ConstraintImpl(con.getEquipment(), con.getValue(), XmlActionsContingenciesUtils.getConstraintType(con.getType())));
} else if (tieLines.containsKey(con.getEquipment())) {
代码示例来源:origin: com.powsybl/powsybl-security-analysis-api
@Test
public void run() {
Network network = EurostagTutorialExample1Factory.create();
((Bus) network.getIdentifiable("NHV1")).setV(380.0);
((Bus) network.getIdentifiable("NHV2")).setV(380.0);
network.getLine("NHV1_NHV2_1").getTerminal1().setP(560.0).setQ(550.0);
network.getLine("NHV1_NHV2_1").getTerminal2().setP(560.0).setQ(550.0);
代码示例来源:origin: com.powsybl/powsybl-iidm-test
.add();
((Bus) network.getIdentifiable("NHV1")).setV(380).getVoltageLevel().setLowVoltageLimit(400).setHighVoltageLimit(500);
((Bus) network.getIdentifiable("NHV2")).setV(380).getVoltageLevel().setLowVoltageLimit(300).setHighVoltageLimit(500);
内容来源于网络,如有侵权,请联系作者删除!