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

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(110)

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

Generator.setTargetP介绍

[英]Set the active power target in MW.

Depends on the working variant.
[中]

代码示例

代码示例来源:origin: com.powsybl/powsybl-action-util

@Override
public void reset(Network n) {
  Objects.requireNonNull(n);
  Generator g = n.getGenerator(id);
  if (g != null) {
    g.setTargetP(0);
  }
}

代码示例来源:origin: com.powsybl/powsybl-action-util

@Override
public double scale(Network n, double asked) {
  Objects.requireNonNull(n);
  Generator g = n.getGenerator(id);
  double done = 0;
  if (g != null) {
    Terminal t = g.getTerminal();
    if (!t.isConnected()) {
      connectGenerator(g);
    }
    done = Math.min(asked, g.getMaxP() - g.getTargetP());
    double oldTargetP = g.getTargetP();
    g.setTargetP(g.getTargetP() + done);
    LOGGER.info("Change active power setpoint of {} from {} to {} (pmax={})",
        g.getId(), oldTargetP, g.getTargetP(), g.getMaxP());
  } else {
    LOGGER.warn("Generator {} not found", id);
  }
  return done;
}

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

public static void applyInjections(Network network, String stateId, Map<String, Float> injections) {
  Objects.requireNonNull(network);
  Objects.requireNonNull(stateId);
  Objects.requireNonNull(injections);
  String originalStateId = network.getStateManager().getWorkingStateId();
  network.getStateManager().setWorkingState(stateId);
  injections.keySet().forEach(injection -> {
    Load load = network.getLoad(injection);
    if (load != null) {
      double oldP = load.getTerminal().getP();
      LOGGER.debug("Network {}, state {}: incrementing P of load {} from {} to {}",
             network.getId(), network.getStateManager().getWorkingStateId(), injection, oldP, oldP + injections.get(injection));
      load.getTerminal().setP(oldP + injections.get(injection));
      load.setP0(oldP + injections.get(injection));
    } else {
      Generator generator = network.getGenerator(injection);
      if (generator != null) {
        double oldP = generator.getTerminal().getP();
        LOGGER.debug("Network {}, state {}: incrementing P of generator {} from {} to {}",
               network.getId(), network.getStateManager().getWorkingStateId(), injection, oldP, oldP + injections.get(injection));
        generator.getTerminal().setP(oldP + injections.get(injection));
        generator.setTargetP(-oldP - injections.get(injection));
      } else {
        LOGGER.error("No load or generator with id {} in network {}: cannot apply the injection", injection, network.getId());
      }
    }
  });
  network.getStateManager().setWorkingState(originalStateId);
}

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

double newTargetP = -t.getP();
if (oldTargetP != newTargetP) {
  g.setTargetP(newTargetP);
  LOGGER.debug("LF result reintegration: targetP {} -> {}", oldTargetP, newTargetP);

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

double oldP = g.getTargetP();
  LOGGER.trace(" gen {} - P:{} -> P:{}", g.getId(), oldP, gs.p);
  g.setTargetP(-gs.p);
  g.getTerminal().setP(gs.p);
} else {
  double oldQ = g.getTargetQ();
  LOGGER.trace(" gen {} - P:{}, Q:{} -> P:{}, Q:{} ", g.getId(), oldP, oldQ, gs.p, gs.q);
  g.setTargetP(-gs.p)
      .setTargetQ(-gs.q);
  g.getTerminal().setP(gs.p)

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

private Void readGenerator(String[] tokens) {
  int num = Integer.parseInt(tokens[1]);
  int busNum = Integer.parseInt(tokens[2]);
  boolean vregul = Boolean.parseBoolean(tokens[3]);
  double targetV = readDouble(tokens[4]);
  double targetP = readDouble(tokens[5]);
  double targetQ = readDouble(tokens[6]);
  double p = readDouble(tokens[7]);
  double q = readDouble(tokens[8]);
  String id = mapper.getId(AmplSubset.GENERATOR, num);
  Generator g = network.getGenerator(id);
  if (g == null) {
    throw new AmplException("Invalid generator id '" + id + "'");
  }
  g.setVoltageRegulatorOn(vregul);
  g.setTargetP(targetP);
  g.setTargetQ(targetQ);
  Terminal t = g.getTerminal();
  t.setP(p).setQ(q);
  double vb = t.getVoltageLevel().getNominalV();
  g.setTargetV(targetV * vb);
  busConnection(t, busNum);
  return null;
}

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

redispactchedP += -newP + generator.getTerminal().getP();
generator.getTerminal().setP(newP);
generator.setTargetP(-newP);

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

network.getGenerator(generatorId).setTargetP(-newActivePower);
  network.getGenerator(generatorId).getTerminal().setP(newActivePower);
} else {

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

Generator genBrussels21 = network
    .getGenerator("_550ebe0d-f2b2-48c1-991f-cebea43a21aa")
    .setTargetP(-p)
    .setTargetQ(-q);
genBrussels21.getTerminal().setP(p).setQ(q);
Generator genBrussels10 = network
    .getGenerator("_3a3b27be-b18b-4385-b557-6735d733baf0")
    .setTargetP(-p)
    .setTargetQ(-q);
genBrussels10.getTerminal().setP(p).setQ(q);

相关文章