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

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

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

Bus.getId介绍

暂无

代码示例

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

private String getBusId(Bus bus) {
  return bus == null ? null : bus.getId();
}

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

public boolean test(Bus b) {
  return buses == null || buses.contains(b.getId());
}

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

private static String getBusId(Bus bus) {
  return bus.getId().replace('-', '_').replace("=", "_");
}

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

protected void addToAdjacencyList(Bus bus1, Bus bus2, Map<String, Integer> id2num, TIntArrayList[] adjacencyList) {
  if (bus1 != null && bus2 != null) {
    int busNum1 = id2num.get(bus1.getId());
    int busNum2 = id2num.get(bus2.getId());
    adjacencyList[busNum1].add(busNum2);
    adjacencyList[busNum2].add(busNum1);
  }
}

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

private int getBusNum(Bus bus) {
  return bus == null ? -1 : mapper.getInt(AmplSubset.BUS, bus.getId());
}

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

private static Bus selectSlackbusCriteria1(Network network, EurostagEchExportConfig config, Set<String> busesToAvoid) {
  return StreamSupport.stream(EchUtil.getBuses(network, config).spliterator(), false)
      .sorted((b1, b2) -> b1.getId().compareTo(b2.getId()))
      .filter(b -> !busesToAvoid.contains(b.getId())
          && b.getConnectedComponent() != null && b.getConnectedComponent().getNum() == ComponentConstants.MAIN_NUM)
       .map(b -> decorate(b))
       .filter(db -> db.regulatingGenerator > 0 && db.maxP > 100) // only keep bus with a regulating generator and a pmax > 100 MW
       .sorted((db1, db2) -> Float.compare((db1.maxP - db1.minP) / 2 - db1.targetP, (db2.maxP - db2.minP) / 2 - db2.targetP)) // select first bus with a high margin
       .limit(1)
      .map(f -> f.bus)
      .findFirst()
      .orElse(null);
}

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

private static void dumpBusesDictionary(Network network, EurostagDictionary dictionary, Path dir, EurostagEchExportConfig exportConfig) throws IOException {
  try (BufferedWriter os = Files.newBufferedWriter(dir.resolve("dict_buses.csv"), StandardCharsets.UTF_8)) {
    for (Bus bus : Identifiables.sort(EchUtil.getBuses(network, dictionary.getConfig()))) {
      if (!(exportConfig.isExportMainCCOnly() && (!EchUtil.isInMainCc(bus)))) {
        os.write(bus.getId() + ";" + dictionary.getEsgId(bus.getId()));
        os.newLine();
      }
    }
  }
}

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

public static int getConnectableBusNum(StringToIntMapper<AmplSubset> mapper, Terminal t) {
  Bus bus = getConnectableBus(t);
  return bus == null ? -1 : mapper.getInt(AmplSubset.BUS, bus.getId());
}

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

public static int getBusNum(StringToIntMapper<AmplSubset> mapper, Terminal t) {
  Bus bus = getBus(t);
  return bus == null ? -1 : mapper.getInt(AmplSubset.BUS, bus.getId());
}

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

private Map<String, List<String>> getBusSwitchMap(VoltageLevel vl) {
  return vl.getBusBreakerView().getSwitchStream().flatMap(s -> Stream.of(
      Maps.immutableEntry(vl.getBusBreakerView().getBus1(s.getId()).getId(), s.getId()),
      Maps.immutableEntry(vl.getBusBreakerView().getBus2(s.getId()).getId(), s.getId())))
            .collect(Collectors.toMap(a -> a.getKey(),
              a -> new ArrayList<>(Collections.singletonList(a.getValue())), (o, n) -> {
                o.addAll(n);
                return o;
              }, HashMap::new));
}

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

public ConnectLoadRecord(ConnectBusInfo busInfo, Load load) {
  super(busInfo.getBus().getId(), load.getId());
}

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

private void busConnection(Terminal t, int busNum) {
  if (busNum == -1) {
    t.disconnect();
  } else {
    String busId = mapper.getId(AmplSubset.BUS, busNum);
    Bus connectable = AmplUtil.getConnectableBus(t);
    if (connectable != null && connectable.getId().equals(busId)) {
      t.connect();
    }
  }
}

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

private static void writeBus(Integer index, Bus bus, Bus connectableBus, NetworkXmlWriterContext context) throws XMLStreamException {
  if (bus != null) {
    context.getWriter().writeAttribute(BUS + indexToString(index), context.getAnonymizer().anonymizeString(bus.getId()));
  }
  if (connectableBus != null) {
    context.getWriter().writeAttribute(CONNECTABLE_BUS + indexToString(index), context.getAnonymizer().anonymizeString(connectableBus.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: itesla/ipst

public ConnectGeneratorRecord(ConnectBusInfo busInfo, Generator gen, boolean isInyection, SourceEngine sourceEngine) {
  super(busInfo.getBus().getId(), gen.getId());
  this.node1 = busInfo.getBus();
  this.node2 = gen;
  this.isConnected = busInfo.isConnected();
  this.isInyection = isInyection;
  this.sourceEngine = sourceEngine;
}

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

public ConnectCapacitorRecord(ConnectBusInfo busInfo, ShuntCompensator shunt) {
    super(busInfo.getBus().getId(), shunt.getId());
    this.isConnected = busInfo.isConnected();
//        this.busInfo = busInfo;
    this.node1 = busInfo.getBus();
    this.node2 = shunt;
  }

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

@Override
protected void writeRootElementAttributes(Switch s, VoltageLevel vl, NetworkXmlWriterContext context) throws XMLStreamException {
  super.writeRootElementAttributes(s, vl, context);
  VoltageLevel.BusBreakerView v = vl.getBusBreakerView();
  Bus bus1 = v.getBus1(s.getId());
  Bus bus2 = v.getBus2(s.getId());
  context.getWriter().writeAttribute("bus1", context.getAnonymizer().anonymizeString(bus1.getId()));
  context.getWriter().writeAttribute("bus2", context.getAnonymizer().anonymizeString(bus2.getId()));
}

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

public boolean test(Connectable<?> connectable) {
    if (buses == null) {
      return true;
    }
    for (Terminal t : connectable.getTerminals()) {
      Bus b = options.getTopologyLevel() == TopologyLevel.BUS_BRANCH ? t.getBusView().getConnectableBus() : t.getBusBreakerView().getConnectableBus();
      if (b != null && !buses.contains(b.getId())) {
        return false;
      }
    }
    return true;
  }
}

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

private static void fillNodeOrBus(InjectionAdder adder, Terminal terminal) {
  if (terminal.getVoltageLevel().getTopologyKind() == TopologyKind.NODE_BREAKER) {
    adder.setNode(terminal.getNodeBreakerView().getNode());
  } else {
    if (terminal.isConnected()) {
      adder.setBus(terminal.getBusBreakerView().getBus().getId());
    }
    adder.setConnectableBus(terminal.getBusBreakerView().getConnectableBus().getId());
  }
}

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

private static void extractLoadsData(Network network, NetworkData networkData) {
  for (Load load : network.getLoads()) {
    networkData.addLoadData(new LoadData(load.getId(),
                       (load.getTerminal().getBusBreakerView().getBus() != null)
                           ? load.getTerminal().getBusBreakerView().getBus().getId()
                           : load.getTerminal().getBusBreakerView().getConnectableBus().getId(),
                       load.getTerminal().getBusBreakerView().getBus() != null,
                       load.getTerminal().getVoltageLevel().getNominalV(),
                       load.getTerminal().getP(),
                       load.getTerminal().getQ())
    );
  }
}

相关文章