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

x33g5p2x  于2022-01-16 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(152)

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

Bus.isInMainConnectedComponent介绍

[英]Check if the bus belongs to the main connected component
[中]检查总线是否属于主要连接部件

代码示例

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

private static void addDisonnectedShunt(Terminal.BusBreakerView view, double q, String shuntId, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  if (view.getConnectableBus().isInMainConnectedComponent()) {
    if (q > 0) {
      balanceMainCC.disconnectedShuntPositiveVolume += q;
    } else {
      balanceMainCC.disconnectedShuntNegativeVolume += q;
    }
    balanceMainCC.disconnectedShunts.add(shuntId);
  } else {
    if (q > 0) {
      balanceOtherCC.disconnectedShuntPositiveVolume += q;
    } else {
      balanceOtherCC.disconnectedShuntNegativeVolume += q;
    }
    balanceOtherCC.disconnectedShunts.add(shuntId);
  }
}

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

private static void addConnectedShunt(Terminal.BusBreakerView view, double q, String shuntId, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  if (view.getBus().isInMainConnectedComponent()) {
    if (q > 0) {
      balanceMainCC.connectedShuntPositiveVolume += q;
    } else {
      balanceMainCC.connectedShuntNegativeVolume += q;
    }
    balanceMainCC.connectedShunts.add(shuntId);
  } else {
    if (q > 0) {
      balanceOtherCC.connectedShuntPositiveVolume += q;
    } else {
      balanceOtherCC.connectedShuntNegativeVolume += q;
    }
    balanceOtherCC.connectedShunts.add(shuntId);
  }
}

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

private static void addBuses(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  for (Bus b : network.getBusBreakerView().getBuses()) {
    if (b.isInMainConnectedComponent()) {
      balanceMainCC.busCount++;
    } else {
      balanceOtherCC.busCount++;
    }
  }
}

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

static void addBusOfMainCC(Set<String> buses, Network n, ExportOptions options) {
  // keep bus of main cc
  if (options.getTopologyLevel() == TopologyLevel.BUS_BRANCH) {
    for (Bus b : n.getBusView().getBuses()) {
      if (b.isInMainConnectedComponent()) {
        buses.add(b.getId());
      }
    }
  } else {
    for (Bus b : n.getBusBreakerView().getBuses()) {
      if (b.isInMainConnectedComponent()) {
        buses.add(b.getId());
      }
    }
  }
}

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

private static boolean isMainComponent(LegBase<?> leg) {
  Bus bus = leg.getTerminal().getBusView().getBus();
  Bus connectableBus = leg.getTerminal().getBusView().getConnectableBus();
  boolean connectableMainComponent = connectableBus != null && connectableBus.isInMainConnectedComponent();
  return bus != null ? bus.isInMainConnectedComponent() : connectableMainComponent;
}

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

private static void addLoads(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  for (Load l : network.getLoads()) {
    Terminal.BusBreakerView view = l.getTerminal().getBusBreakerView();
    if (view.getBus() != null) {
      if (view.getBus().isInMainConnectedComponent()) {
        balanceMainCC.connectedLoads.add(l.getId());
        balanceMainCC.connectedLoadVolume += l.getP0();
      } else {
        balanceOtherCC.connectedLoads.add(l.getId());
        balanceOtherCC.connectedLoadVolume += l.getP0();
      }
    } else {
      if (view.getConnectableBus().isInMainConnectedComponent()) {
        balanceMainCC.disconnectedLoads.add(l.getId());
        balanceMainCC.disconnectedLoadVolume += l.getP0();
      } else {
        balanceOtherCC.disconnectedLoads.add(l.getId());
        balanceOtherCC.disconnectedLoadVolume += l.getP0();
      }
    }
  }
}

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

private static void addDanglingLines(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  for (DanglingLine dl : network.getDanglingLines()) {
    Terminal.BusBreakerView view = dl.getTerminal().getBusBreakerView();
    if (view.getBus() != null) {
      if (view.getBus().isInMainConnectedComponent()) {
        balanceMainCC.connectedLoads.add(dl.getId());
        balanceMainCC.connectedLoadVolume += dl.getP0();
      } else {
        balanceOtherCC.connectedLoads.add(dl.getId());
        balanceOtherCC.connectedLoadVolume += dl.getP0();
      }
    } else {
      if (view.getConnectableBus().isInMainConnectedComponent()) {
        balanceMainCC.disconnectedLoads.add(dl.getId());
        balanceMainCC.disconnectedLoadVolume += dl.getP0();
      } else {
        balanceOtherCC.disconnectedLoads.add(dl.getId());
        balanceOtherCC.disconnectedLoadVolume += dl.getP0();
      }
    }
  }
}

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

private static void addGenerators(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) {
  for (Generator g : network.getGenerators()) {
    Terminal.BusBreakerView view = g.getTerminal().getBusBreakerView();
    if (view.getBus() != null) {
      if (view.getBus().isInMainConnectedComponent()) {
        balanceMainCC.connectedMaxGeneration += g.getMaxP();
        balanceMainCC.connectedGeneration += g.getTargetP();
        balanceMainCC.connectedGenerators.add(g.getId());
      } else {
        balanceOtherCC.connectedMaxGeneration += g.getMaxP();
        balanceOtherCC.connectedGeneration += g.getTargetP();
        balanceOtherCC.connectedGenerators.add(g.getId());
      }
    } else {
      if (view.getConnectableBus().isInMainConnectedComponent()) {
        balanceMainCC.disconnectedMaxGeneration += g.getMaxP();
        balanceMainCC.disconnectedGeneration += g.getTargetP();
        balanceMainCC.disconnectedGenerators.add(g.getId());
      } else {
        balanceOtherCC.disconnectedMaxGeneration += g.getMaxP();
        balanceOtherCC.disconnectedGeneration += g.getTargetP();
        balanceOtherCC.disconnectedGenerators.add(g.getId());
      }
    }
  }
}

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

Mockito.when(leg1Bus.getV()).thenReturn(U1);
Mockito.when(leg1Bus.getAngle()).thenReturn(ANGLE1);
Mockito.when(leg1Bus.isInMainConnectedComponent()).thenReturn(MAIN_COMPONENT1);
Mockito.when(leg2Bus.getV()).thenReturn(U2);
Mockito.when(leg2Bus.getAngle()).thenReturn(ANGLE2);
Mockito.when(leg2Bus.isInMainConnectedComponent()).thenReturn(MAIN_COMPONENT2);
Mockito.when(leg3Bus.getV()).thenReturn(U3);
Mockito.when(leg3Bus.getAngle()).thenReturn(ANGLE3);
Mockito.when(leg3Bus.isInMainConnectedComponent()).thenReturn(MAIN_COMPONENT3);

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

boolean connectableMainComponent1 = connectableBus1 != null && connectableBus1.isInMainConnectedComponent();
boolean connectableMainComponent2 = connectableBus2 != null && connectableBus2.isInMainConnectedComponent();
mainComponent1 = bus1 != null ? bus1.isInMainConnectedComponent() : connectableMainComponent1;
mainComponent2 = bus2 != null ? bus2.isInMainConnectedComponent() : connectableMainComponent2;

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

boolean connectableMainComponent1 = connectableBus1 != null && connectableBus1.isInMainConnectedComponent();
boolean connectableMainComponent2 = connectableBus2 != null && connectableBus2.isInMainConnectedComponent();
mainComponent1 = bus1 != null ? bus1.isInMainConnectedComponent() : connectableMainComponent1;
mainComponent2 = bus2 != null ? bus2.isInMainConnectedComponent() : connectableMainComponent2;

代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion

if (terminal.isConnected()
    && Double.isNaN(terminal.getQ())
    && terminal.getBusView().getBus().isInMainConnectedComponent()) {
  double v = terminal.getBusView().getBus().getV();
  double q = -sh.getCurrentB() * v * v;

相关文章