本文整理了Java中com.powsybl.iidm.network.Branch.getTerminal1()
方法的一些代码示例,展示了Branch.getTerminal1()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getTerminal1()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Branch
类名称:Branch
方法名:getTerminal1
[英]Get the first terminal.
[中]到第一个终点站。
代码示例来源:origin: com.powsybl/powsybl-iidm-api
private void visitBranch(Branch branch, Branch.Side side) {
switch (side) {
case ONE:
visitTerminal(branch.getTerminal1());
break;
case TWO:
visitTerminal(branch.getTerminal2());
break;
default:
throw new AssertionError();
}
}
代码示例来源: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-reducer
/**
* Return true if the given {@link Branch} should be kept in the network, false otherwise
*/
private boolean test(Branch branch) {
Objects.requireNonNull(branch);
VoltageLevel vl1 = branch.getTerminal1().getVoltageLevel();
VoltageLevel vl2 = branch.getTerminal2().getVoltageLevel();
return test(vl1) && test(vl2);
}
代码示例来源:origin: itesla/ipst
double baseVoltage1 = branch.getTerminal1().getVoltageLevel().getNominalV();
double baseVoltage2 = branch.getTerminal2().getVoltageLevel().getNominalV();
if (Double.compare(baseVoltage1, baseVoltage2) != 0) {
代码示例来源:origin: itesla/ipst
LOGGER.info("#------------------------ --------------- --------------- --------------- --------------- ");
for (Branch trafo : network.getTwoWindingsTransformers()) {
LOGGER.info(String.format("%s %15.8f %15.8f %15.8f %15.8f", trafo.getId(), trafo.getTerminal1().getQ(), trafo.getTerminal2().getQ(), trafo.getTerminal1().getP(), trafo.getTerminal2().getP()));
代码示例来源:origin: com.powsybl/powsybl-iidm-impl
protected static void addNextTerminals(TerminalExt otherTerminal, List<TerminalExt> nextTerminals) {
Objects.requireNonNull(otherTerminal);
Objects.requireNonNull(nextTerminals);
Connectable otherConnectable = otherTerminal.getConnectable();
if (otherConnectable instanceof Branch) {
Branch branch = (Branch) otherConnectable;
if (branch.getTerminal1() == otherTerminal) {
nextTerminals.add((TerminalExt) branch.getTerminal2());
} else if (branch.getTerminal2() == otherTerminal) {
nextTerminals.add((TerminalExt) branch.getTerminal1());
} else {
throw new AssertionError();
}
} else if (otherConnectable instanceof ThreeWindingsTransformer) {
ThreeWindingsTransformer ttc = (ThreeWindingsTransformer) otherConnectable;
if (ttc.getLeg1().getTerminal() == otherTerminal) {
nextTerminals.add((TerminalExt) ttc.getLeg2().getTerminal());
nextTerminals.add((TerminalExt) ttc.getLeg3().getTerminal());
} else if (ttc.getLeg2().getTerminal() == otherTerminal) {
nextTerminals.add((TerminalExt) ttc.getLeg1().getTerminal());
nextTerminals.add((TerminalExt) ttc.getLeg3().getTerminal());
} else if (ttc.getLeg3().getTerminal() == otherTerminal) {
nextTerminals.add((TerminalExt) ttc.getLeg1().getTerminal());
nextTerminals.add((TerminalExt) ttc.getLeg2().getTerminal());
} else {
throw new AssertionError();
}
}
}
代码示例来源:origin: itesla/ipst
public static boolean isInMainCc(Branch branch, boolean noswitch) {
return (ConnectedComponents.getCcNum(EchUtil.getBus(branch.getTerminal1(), noswitch)) == ComponentConstants.MAIN_NUM)
&& (ConnectedComponents.getCcNum(EchUtil.getBus(branch.getTerminal2(), noswitch)) == ComponentConstants.MAIN_NUM);
}
代码示例来源:origin: com.powsybl/powsybl-iidm-impl
private static void checkRemovability(Substation substation, Branch branch) {
Substation s1 = branch.getTerminal1().getVoltageLevel().getSubstation();
Substation s2 = branch.getTerminal2().getVoltageLevel().getSubstation();
if ((s1 != substation) || (s2 != substation)) {
throw createIsolationException(substation);
}
}
代码示例来源:origin: itesla/ipst
public static LinkedHashMap<String, Double> getBranchesData(Network network) {
LinkedHashMap<String, Double> branchesData = new LinkedHashMap<>();
network.getBranchStream().forEach(branch -> {
addBranchSideData(branchesData, branch.getId(), branch.getTerminal1(), branch.getCurrentLimits1() == null ? Double.NaN : branch.getCurrentLimits1().getPermanentLimit());
addBranchSideData(branchesData, branch.getId(), branch.getTerminal2(), branch.getCurrentLimits2() == null ? Double.NaN : branch.getCurrentLimits2().getPermanentLimit());
});
return branchesData;
}
代码示例来源:origin: itesla/ipst
private void visitBranch(Branch branch, Branch.Side side, double r, double x, double g1, double b1, double g2, double b2, double ratio) {
Terminal t = side == Branch.Side.ONE ? branch.getTerminal1() : branch.getTerminal2();
Terminal otherT = t == branch.getTerminal1() ? branch.getTerminal2() : branch.getTerminal1();
Bus otherBus = otherT.getBusView().getBus();
if (otherBus != null && !Double.isNaN(otherBus.getV())) {
if (t == branch.getTerminal1()) {
代码示例来源: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
public static BranchParallelIndexes build(Network network, EurostagEchExportConfig config, EurostagFakeNodes fakeNodes) {
Multimap<String, Identifiable> map = HashMultimap.create();
for (Branch branch : Iterables.concat(network.getLines(), network.getTwoWindingsTransformers())) {
ConnectionBus bus1 = ConnectionBus.fromTerminal(branch.getTerminal1(), config, fakeNodes);
ConnectionBus bus2 = ConnectionBus.fromTerminal(branch.getTerminal2(), config, fakeNodes);
if (bus1.getId().compareTo(bus2.getId()) < 0) {
代码示例来源: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-api
Bus b1 = branch.getTerminal1().getBusView().getBus();
Bus b2 = branch.getTerminal2().getBusView().getBus();
if (b1 != null && b2 != null) {
代码示例来源:origin: itesla/ipst
private static void dumpLimits(EurostagDictionary dictionary, BufferedWriter writer, Branch branch) throws IOException {
dumpLimits(dictionary, writer, branch.getId(),
branch.getCurrentLimits1(),
branch.getCurrentLimits2(),
branch.getTerminal1().getVoltageLevel().getNominalV(),
branch.getTerminal2().getVoltageLevel().getNominalV());
}
代码示例来源:origin: itesla/ipst
@Override
public void createModelicaName(ModExportContext modContext, DDBManager ddbManager, SimulatorInst modelicaSim) {
Equipments.ConnectionInfo terminal1Info = Equipments.getConnectionInfoInBusBreakerView(branch.getTerminal1());
Equipments.ConnectionInfo terminal2Info = Equipments.getConnectionInfoInBusBreakerView(branch.getTerminal2());
代码示例来源:origin: com.powsybl/powsybl-iidm-converter-api
static void addBusOfOtherSideOfOpenBranches(Set<String> buses, Network n, ExportOptions options) {
// and also bus at the other side of open branches
n.getBranchStream().forEach(branch -> {
Terminal t1 = branch.getTerminal1();
Terminal t2 = branch.getTerminal2();
if (options.getTopologyLevel() == TopologyLevel.BUS_BRANCH) {
Bus b1 = t1.getBusView().getConnectableBus();
Bus b2 = t2.getBusView().getConnectableBus();
if ((b1 != null && b1.isInMainConnectedComponent()) && b2 != null && !b2.isInMainConnectedComponent()) {
buses.add(b2.getId());
} else if (b1 != null && !b1.isInMainConnectedComponent() && b2 != null && b2.isInMainConnectedComponent()) {
buses.add(b1.getId());
}
} else {
Bus b1 = t1.getBusBreakerView().getConnectableBus();
Bus b2 = t2.getBusBreakerView().getConnectableBus();
if (b1.isInMainConnectedComponent() && !b2.isInMainConnectedComponent()) {
buses.add(b2.getId());
} else if (!b1.isInMainConnectedComponent() && b2.isInMainConnectedComponent()) {
buses.add(b1.getId());
}
}
});
}
代码示例来源: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-iidm-impl
@Override
public <T extends Connectable> T getConnectable(String id, Class<T> aClass) {
// the fastest way to get the equipment is to look in the object store
// and then check if it is connected to this substation
T connectable = substation.getNetwork().getObjectStore().get(id, aClass);
if (connectable == null) {
return null;
} else if (connectable instanceof Injection) {
return ((Injection) connectable).getTerminal().getVoltageLevel() == this
? connectable : null;
} else if (connectable instanceof Branch) {
return ((Branch) connectable).getTerminal1().getVoltageLevel() == this
|| ((Branch) connectable).getTerminal2().getVoltageLevel() == this
? connectable : null;
} else if (connectable instanceof ThreeWindingsTransformer) {
return ((ThreeWindingsTransformer) connectable).getLeg1().getTerminal().getVoltageLevel() == this
|| ((ThreeWindingsTransformer) connectable).getLeg2().getTerminal().getVoltageLevel() == this
|| ((ThreeWindingsTransformer) connectable).getLeg3().getTerminal().getVoltageLevel() == this
? connectable : null;
} else {
throw new AssertionError();
}
}
代码示例来源:origin: itesla/ipst
if (branch != null) {
double newLimit = getNewUpperLimit(violation, margin);
if (branch.getTerminal1().getI() == violation.getValue()) {
LOGGER.debug("State {}: changing current limit 1 of branch {}: {} -> {}",
stateId,
内容来源于网络,如有侵权,请联系作者删除!