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

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

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

Network.getGenerators介绍

[英]Get all generators.
[中]把所有的发电机都拿来。

代码示例

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

public static ArrayList<String> getGeneratorsIds(Network network) {
  Objects.requireNonNull(network, "network is null");
  ArrayList<String> generatorsIds = new ArrayList<String>();
  for (Generator generator : network.getGenerators()) {
    generatorsIds.add(generator.getId());
  }
  Collections.sort(generatorsIds);
  return generatorsIds;
}

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

public static ArrayList<String> getConnectedGeneratorsIds(Network network) {
  Objects.requireNonNull(network, "network is null");
  ArrayList<String> generatorsIds = new ArrayList<String>();
  for (Generator generator : network.getGenerators()) {
    if (isConnected(generator)) {
      generatorsIds.add(generator.getId());
    }
  }
  Collections.sort(generatorsIds);
  return generatorsIds;
}

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

private List<Generator> filterGenerators(Network network, boolean isFiltered) {
  List<Generator> filtGens = new ArrayList<>();
  for (Generator g : Identifiables.sort(network.getGenerators())) {
    if (!filteredGenerator(g, isFiltered)) {
      filtGens.add(g);
    }
  }
  return filtGens;
}

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

public static List<Generator> getRedispatchableGenerators(Network network, String[] generatorsToSkip, float redispatchLimitsPercentage) {
  List<Generator> redispatchableGenerators = new ArrayList<Generator>();
  for (Generator generator : network.getGenerators()) {
    if (isRedispatchable(generator, redispatchLimitsPercentage)) {
      if (generatorsToSkip != null) { // check if there are generators to skip
        if (!Arrays.asList(generatorsToSkip).contains(generator.getId())) { // check if this generator have to be skipped
          redispatchableGenerators.add(generator);
        }
      } else {
        redispatchableGenerators.add(generator);
      }
    }
  }
  return redispatchableGenerators;
}

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

public static Map<String, Double> getParticipationFactor(Network network) {
  Map<String, Double> partecipationFactor = new HashMap<String, Double>();
  for (Generator generator : network.getGenerators()) {
    partecipationFactor.put(generator.getId(), generator.getMaxP());
  }
  return partecipationFactor;
}

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

public static List<Generator> filterRedispatchableGenerators(Network network, String[] generatorsToUse, float redispatchLimitsPercentage) {
  List<Generator> redispatchableGenerators = new ArrayList<Generator>();
  for (Generator generator : network.getGenerators()) {
    if (isRedispatchable(generator, redispatchLimitsPercentage)) {
      if (generatorsToUse != null) { // check if there are generators to use
        if (Arrays.asList(generatorsToUse).contains(generator.getId())) { // check if this generator can be used
          redispatchableGenerators.add(generator);
        }
      } else {
        redispatchableGenerators.add(generator);
      }
    }
  }
  return redispatchableGenerators;
}

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

public static ArrayList<String> getRenewableGeneratorsIds(Network network) {
  Objects.requireNonNull(network, "network is null");
  ArrayList<String> generatorsIds = new ArrayList<String>();
  for (Generator generator : network.getGenerators()) {
    if (generator.getEnergySource().isIntermittent()) {
      generatorsIds.add(generator.getId());
    }
  }
  Collections.sort(generatorsIds);
  return generatorsIds;
}

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

public DataMiningFacadeParams(Network network, boolean generationSampled, boolean boundariesSampled, Interval interval) {
  gensIds = new ArrayList<>();
  if (generationSampled) {
    for (Generator gen : network.getGenerators()) {
      if (gen.getEnergySource().isIntermittent()) {
        gensIds.add(gen.getId());
      }
    }
  }
  // it seems that elements order in iidm model is not the same
  // after two subsequent network initialization from file
  Collections.sort(gensIds);
  loadsIds = new ArrayList<>();
  for (Load load : network.getLoads()) {
    loadsIds.add(load.getId());
  }
  Collections.sort(loadsIds);
  danglingLinesIds = new ArrayList<>();
  if (boundariesSampled) {
    for (DanglingLine dl : network.getDanglingLines()) {
      danglingLinesIds.add(dl.getId());
    }
  }
  Collections.sort(danglingLinesIds);
  countries = EnumSet.copyOf(network.getCountries());
  this.interval = interval;
}

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

System.out.println("Machines = " + Identifiables.sort(_network.getGenerators()).size());
int numMachines = Identifiables.sort(_network.getGenerators()).size();
int numGens = _ddbManager.findEquipmentAllCount();
int numFixInyec = numMachines - numGens;

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

private void computeRedispatchLimits(Network network) {
  for (Generator generator : network.getGenerators()) {
    redispatchLimits.put(generator.getId(), new RedispatchLimits(RedispatchUtils.getRedispatchPMin(generator, config.getRedispatchLimitsPercentage()),
                                   RedispatchUtils.getRedispatchPMax(generator, config.getRedispatchLimitsPercentage())));
  }
}

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

public static void fixGeneratorActiveLimits(Network network, HistoDbClient histoDbClient, Interval interval) throws IOException, InterruptedException {
    // replace strange pmin, pmax by historical limits
    Set<HistoDbAttributeId> attributeIds = new LinkedHashSet<>();
    for (Generator g : network.getGenerators()) {
      if (hasInconsistenceActiveLimits(g)) {
        attributeIds.add(new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.P));
      }
    }
    if (attributeIds.size() > 0) {
      HistoDbStats stats = histoDbClient.queryStats(attributeIds, interval, HistoDbHorizon.SN, true);
      for (Generator g : network.getGenerators()) {
        if (hasInconsistenceActiveLimits(g)) {
          HistoDbNetworkAttributeId attributeId = new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.P);
          double newMinP = -stats.getValue(HistoDbStatsType.MAX, attributeId, Float.NaN);
          double newMaxP = -stats.getValue(HistoDbStatsType.MIN, attributeId, Float.NaN);
          if (!Double.isNaN(newMinP) && !Double.isNaN(newMaxP)) {
            LOGGER.debug("Fix active power limits of generator {}: [{}, {}] -> [{}, {}]",
                g.getId(), g.getMinP(), g.getMaxP(), newMinP, newMaxP);
            g.setMinP(newMinP);
            g.setMaxP(newMaxP);
          }
        }
      }
    }
  }
}

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

public AmplNetworkReader readGenerators() throws IOException {
  // Bug fix, to avoid generators out of main cc to have a different target voltage while connected to same bus (Eurostag check)
  // In that case it will not be part of result file, so not overwritten. So first reset all target voltages to nominal voltage
  for (Generator g : network.getGenerators()) {
    g.setTargetV(g.getTerminal().getVoltageLevel().getNominalV());
  }
  read("_generators", 9, this::readGenerator);
  return this;
}

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

public void load(Network network, HistoDbClient histoDbClient) throws IOException, InterruptedException {
  Set<HistoDbAttributeId> attributeIds = new LinkedHashSet<>();
  for (Load l : network.getLoads()) {
    if (l.getLoadType() != LoadType.FICTITIOUS) {
      attributeIds.add(new HistoDbNetworkAttributeId(l.getId(), HistoDbAttr.P));
    }
  }
  for (DanglingLine dl : network.getDanglingLines()) {
    attributeIds.add(new HistoDbNetworkAttributeId(dl.getId(), HistoDbAttr.P0));
  }
  for (Generator g : network.getGenerators()) {
    attributeIds.add(new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.P));
  }
  HistoDbStats stats = histoDbClient.queryStats(attributeIds, histoInterval, HistoDbHorizon.SN, true);
  for (Load l : network.getLoads()) {
    String id = l.getId();
    loadLimits.put(id, range(id, HistoDbAttr.P, stats));
  }
  for (DanglingLine dl : network.getDanglingLines()) {
    String id = dl.getId();
    danglingLineLimits.put(id, range(id, HistoDbAttr.P0, stats));
  }
  for (Generator g : network.getGenerators()) {
    String id = g.getId();
    generatorLimits.put(id, range(id, HistoDbAttr.P, stats));
  }
}

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

public static void printGeneratorsSetpointDiff(Network network, Logger logger) {
  for (Generator g : network.getGenerators()) {
    double dp = Math.abs(g.getTerminal().getP() + g.getTargetP());
    double dq = Math.abs(g.getTerminal().getQ() + g.getTargetQ());
    double dv = Math.abs(g.getTerminal().getBusBreakerView().getConnectableBus().getV() - g.getTargetV());
    if (dp > 1 || dq > 5 || dv > 0.1) {
      logger.warn("Generator {}: ({}, {}, {}) ({}, {}, {}) -> ({}, {}, {})", g.getId(),
          dp, dq, dv,
          -g.getTargetP(), -g.getTargetQ(), g.getTargetV(),
          g.getTerminal().getP(), g.getTerminal().getQ(), g.getTerminal().getBusBreakerView().getConnectableBus().getV());
    }
  }
}

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

protected static void reintegrateLfState(Network network, String workingStateId, boolean onlyVoltage) {
  network.getStateManager().setWorkingState(workingStateId);
  for (Generator g : network.getGenerators()) {
    Terminal t = g.getTerminal();
    if (!onlyVoltage) {

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

public static void prepareBaseCase(Network network, OfflineWorkflowCreationParameters creationParameters,
                  HistoDbClient histoDbClient) throws IOException, InterruptedException {
  clearSv(network);
  // connect loads and intermittent generation and boundary lines (so everything that can be sampled)
  for (Load l : network.getLoads()) {
    l.getTerminal().connect();
  }
  if (creationParameters.isGenerationSampled()) {
    for (Generator g : network.getGenerators()) {
      if (g.getEnergySource().isIntermittent()) {
        g.getTerminal().connect();
      }
    }
  }
  if (creationParameters.isBoundariesSampled()) {
    for (DanglingLine dl : network.getDanglingLines()) {
      dl.getTerminal().connect();
    }
  }
  // TODO also override generator regulating status, phase shitfer regulating status and transformer regulating status?
  // resize voltage limits with historical data
  HistoDbUtil.fixVoltageLimits(network, histoDbClient, creationParameters.getHistoInterval());
  // temporary workaround for Elia data, missing pmin, pmax
  HistoDbUtil.fixGeneratorActiveLimits(network, histoDbClient, creationParameters.getHistoInterval());
}

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

private static void extractGeneratorsData(Network network, NetworkData networkData) {
    for (Generator generator : network.getGenerators()) {
      networkData.addGeneratorData(new GeneratorData(generator.getId(),
                              (generator.getTerminal().getBusBreakerView().getBus() != null)
                                    ? generator.getTerminal().getBusBreakerView().getBus().getId()
                                    : generator.getTerminal().getBusBreakerView().getConnectableBus().getId(),
                              generator.getTerminal().getBusBreakerView().getBus() != null,
                              apparentPower(generator.getTerminal()),
                              generator.getTerminal().getP(),
                              generator.getTerminal().getQ(),
                              generator.getRatedS(),
                              generator.getReactiveLimits().getMaxQ(generator.getTargetP()),
                              generator.getReactiveLimits().getMinQ(generator.getTargetP()))
//                                                           generator.getReactiveLimits().getMaxQ(generator.getTerminal().getP()),
//                                                           generator.getReactiveLimits().getMinQ(generator.getTerminal().getP()))
      );
    }
  }

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

public static void clearSv(Network network) {
  for (Generator g : network.getGenerators()) {
    g.getTerminal().setP(Float.NaN).setQ(Float.NaN);

代码示例来源:origin: com.powsybl/powsybl-cgmes-conversion

powerFlows.add(createPowerFlowProperties(cgmes, l.getTerminal()));
for (Generator g : n.getGenerators()) {
  powerFlows.add(createPowerFlowProperties(cgmes, g.getTerminal()));

相关文章