com.powsybl.iidm.network.Network.getBranchStream()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(108)

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

Network.getBranchStream介绍

[英]Get all branches
[中]得到所有的分支

代码示例

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

@Override
public void checkAll(Network network, Consumer<LimitViolation> consumer) {
  network.getBranchStream().forEach(b -> checkCurrent(b, consumer));
  network.getVoltageLevelStream()
      .flatMap(v -> v.getBusView().getBusStream())
      .forEach(b -> checkVoltage(b, consumer));
}

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

相关文章