com.powsybl.iidm.network.Branch类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中com.powsybl.iidm.network.Branch类的一些代码示例,展示了Branch类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch类的具体详情如下:
包路径:com.powsybl.iidm.network.Branch
类名称:Branch

Branch介绍

[英]An equipment with two terminals.
[中]有两个终端的设备。

代码示例

代码示例来源: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: 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: com.powsybl/powsybl-security-analysis-api

private void checkPermanentLimit(Branch branch, Branch.Side side, double value, Consumer<LimitViolation> consumer) {
  if (LimitViolationUtils.checkPermanentLimit(branch, side, limitReduction, value)) {
    consumer.accept(new LimitViolation(branch.getId(),
        branch.getName(),
        LimitViolationType.CURRENT,
        null,
        Integer.MAX_VALUE,
        branch.getCurrentLimits(side).getPermanentLimit(),
        limitReduction,
        value,
        side));
  }
}

代码示例来源:origin: com.powsybl/powsybl-ampl-converter

private void writeBranchCurrentLimits(TableFormatter formatter) throws IOException {
  for (Branch branch : network.getBranches()) {
    String branchId = branch.getId();
    if (branch.getCurrentLimits1() != null) {
      writeTemporaryCurrentLimits(branch.getCurrentLimits1(), formatter, branchId, true, "_1_");
    }
    if (branch.getCurrentLimits2() != null) {
      writeTemporaryCurrentLimits(branch.getCurrentLimits2(), formatter, branchId, false, "_2_");
    }
  }
}

代码示例来源: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()) {
        } else if (t == branch.getTerminal2()) {
  valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.P), context.p);
  valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.Q), context.q);
  valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.V), context.v);
  valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.I), context.i);

代码示例来源: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,
        branch.getId(),
        violation.getLimit(),
        newLimit);
    branch.newCurrentLimits1().setPermanentLimit(newLimit).add();
    if (applyToBaseCase && !StateManagerConstants.INITIAL_STATE_ID.equals(stateId)) { // change the limit also to basecase
      network.getStateManager().setWorkingState(StateManagerConstants.INITIAL_STATE_ID);
      LOGGER.debug("State {}: changing current limit 1 of branch {}: {} -> {}",
            StateManagerConstants.INITIAL_STATE_ID,
            branch.getId(),
            violation.getLimit(),
            newLimit);
      branch.newCurrentLimits1().setPermanentLimit(newLimit).add();
      network.getStateManager().setWorkingState(stateId);
  } else if (branch.getTerminal2().getI() == violation.getValue()) {
    LOGGER.debug("State {}: changing current limit 2 of branch {}: {} -> {}",
        stateId,
        branch.getId(),
        violation.getLimit(),
        newLimit);
    branch.newCurrentLimits2().setPermanentLimit(newLimit).add();
    if (applyToBaseCase && !StateManagerConstants.INITIAL_STATE_ID.equals(stateId)) { // change the limit also to basecase
      network.getStateManager().setWorkingState(StateManagerConstants.INITIAL_STATE_ID);

代码示例来源:origin: itesla/ipst

UniqueTopology topo1 = uniqueTopos.get(branch.getTerminal1().getVoltageLevel().getId());
UniqueTopology topo2 = uniqueTopos.get(branch.getTerminal2().getVoltageLevel().getId());
if (!topo1.containsEquipment(branch.getId()) && !topo2.containsEquipment(branch.getId())) {
  if (branch.getId().contains(TopologyHistory.FICTIVE_PATTERN)) {
    fictiveEquipmentsRemoved.add(branch.getId());
  } else {
    equipmentsRemoved.add(branch.getId());
  branch.remove();

代码示例来源:origin: com.powsybl/powsybl-iidm-api

Bus b1 = branch.getTerminal1().getBusView().getBus();
Bus b2 = branch.getTerminal2().getBusView().getBus();
if (b1 != null && b2 != null) {
  Node n1 = nodes.get(getBusId(b1));
  Node n2 = nodes.get(getBusId(b2));
  graph.edge(new Edge(n1, n2).attr("tooltip", branch.getName()));

代码示例来源: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-security-analysis-api

@Override
public void checkCurrent(Branch branch, Branch.Side side, double value, Consumer<LimitViolation> consumer) {
  Branch.Overload overload = LimitViolationUtils.checkTemporaryLimits(branch, side, limitReduction, value);
  if (currentLimitTypes.contains(Security.CurrentLimitType.TATL) && (overload != null)) {
    consumer.accept(new LimitViolation(branch.getId(),
        branch.getName(),
        LimitViolationType.CURRENT,
        overload.getPreviousLimitName(),
        overload.getTemporaryLimit().getAcceptableDuration(),
        overload.getPreviousLimit(),
        limitReduction,
        branch.getTerminal(side).getI(),
        side));
  } else if (currentLimitTypes.contains(Security.CurrentLimitType.PATL)) {
    checkPermanentLimit(branch, side, value, consumer);
  }
}

代码示例来源: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-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

@Override
public void createModelicaName(ModExportContext modContext, DDBManager ddbManager, SimulatorInst modelicaSim) {
  Equipments.ConnectionInfo terminal1Info = Equipments.getConnectionInfoInBusBreakerView(branch.getTerminal1());
  Equipments.ConnectionInfo terminal2Info = Equipments.getConnectionInfoInBusBreakerView(branch.getTerminal2());
  nodeName2 = parseName(bus2.getId());
  String branchName = parseName(branch.getId()); //CIM ID

代码示例来源: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: 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: itesla/ipst

if (equipIds != null && !equipIds.contains(l.getId())) {
  continue;
if (l.getTerminal1().getBusView().getBus() != null) {
  if ((regions == null || !Collections.disjoint(regions,
      l.getTerminal1().getVoltageLevel().getSubstation().getGeographicalTags()))
      && (countries == null || countries.contains(
          l.getTerminal1().getVoltageLevel().getSubstation().getCountry().toString()))) {
    String terminalId = l.getId() + "__TO__" + l.getTerminal1().getVoltageLevel().getId();
    if (measureTypes == null || measureTypes.contains("P")) {
      attributes.add(new Attribute(terminalId + "_P"));
if (l.getTerminal2().getBusView().getBus() != null) {
  if ((regions == null || !Collections.disjoint(regions,
      l.getTerminal2().getVoltageLevel().getSubstation().getGeographicalTags()))
      && (countries == null || countries.contains(
          l.getTerminal2().getVoltageLevel().getSubstation().getCountry().toString()))) {
    String terminalId = l.getId() + "__TO__" + l.getTerminal2().getVoltageLevel().getId();
    if (measureTypes == null || measureTypes.contains("P")) {
      attributes.add(new Attribute(terminalId + "_P"));

代码示例来源: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: 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-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();
    }
  }
}

相关文章