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

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

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

Network.getGenerator介绍

[英]Get a generator.
[中]找个发电机。

代码示例

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

@Override
public void listGenerators(Network n, List<Generator> generators, List<String> notFoundGenerators) {
  Objects.requireNonNull(n);
  Objects.requireNonNull(generators);
  Generator g = n.getGenerator(id);
  if (g != null) {
    generators.add(g);
  } else {
    if (notFoundGenerators != null) {
      notFoundGenerators.add(id);
    }
  }
}

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

@Override
public double maximumValue(Network n) {
  Objects.requireNonNull(n);
  Generator g = n.getGenerator(id);
  return g != null ? g.getMaxP() : 0;
}

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

private ContingencyElement getElement(Network network, Map<String, String> tieLines, String id) {
  if (network.getLine(id) != null) {
    return new BranchContingency(id);
  } else if (network.getGenerator(id) != null) {
    return new GeneratorContingency(id);
  } else if (tieLines.containsKey(id)) {
    return new BranchContingency(tieLines.get(id));
  } else {
    LOGGER.warn("Contingency element '{}' not found", id);
  }
  return null;
}

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

@Override
public double initialValue(Network n) {
  Objects.requireNonNull(n);
  Generator g = n.getGenerator(id);
  return g != null && !Double.isNaN(g.getTerminal().getP()) ? g.getTerminal().getP() : 0;
}

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

@Override
public void modify(Network network, ComputationManager computationManager) {
  Generator g = network.getGenerator(generatorId);
  if (g == null) {
    throw new PowsyblException("Generator '" + generatorId + "' not found");
  }
  g.getTerminal().connect();
}

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

public static void dumpDataAutomatonA17(Network network, PrintStream out, Map<String, String> iidm2eurostagId, SimulationParameters simulationParameters, DdExportConfig configExport) throws IOException {
  if (configExport.getAutomatonA17()) {
    String refGenId = configExport.getAutomatonA17AngularReferenceGenerator();
    String automatonId = "A17";
    if (refGenId == null) {
      log.warn("Dump automaton {}: an angular reference generator id must be declared (attribute automatonA17AngularReferenceGenerator)", automatonId);
    } else {
      Generator refGen = network.getGenerator(refGenId);
      if (refGen == null) {
        log.warn("Dump automaton {}: skipping generator {}: no generators with this ID exist", automatonId, refGenId);
      } else {
        if (!iidm2eurostagId.containsKey(refGenId)) {
          log.warn("Dump automaton {}: skipping generator {}: no mapped eurostag id exists, for it", automatonId, refGenId);
        } else {
          String refGenEurostagId = iidm2eurostagId.get(refGenId);
          log.debug("Dump automaton {}: generator id: {} mapped to eurostag id: {}", automatonId, refGenId, refGenEurostagId);
          try {
            DtaParser.dumpAutomatonHeader(automatonId, false, out);
            EurostagRecord eRecord = createA17Record(refGenEurostagId, configExport, simulationParameters);
            DtaParser.dumpZone(eRecord, out);
            DtaParser.dumpAutomatonHeader(automatonId, true, out);
          } catch (ParseException e) {
            log.error(e.getMessage(), e);
          }
        }
      }
    }
  }
}

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

LOGGER.info("contingency: {} - element BranchContingency, id: {}", contingency, id);
  elements.add(new BranchContingency(id));
} else if (network.getGenerator(id) != null) {
  LOGGER.info("contingency: {} - element GeneratorContingency, id: {}", contingency, id);
  elements.add(new GeneratorContingency(id));

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

@Override
public void modify(Network network, ComputationManager computationManager) {
  Float deltaP = (Float) actionsParameters.getValue(ActionParameters.REDISPATCHING_DELTAP_PARAMETER);
  if (deltaP == null) {
    throw new PowsyblException("Missing delta P parameter for redispatching of generators " + generatorIds);
  }
  for (String generatorId : generatorIds) {
    Generator g = network.getGenerator(generatorId);
    if (g == null) {
      throw new PowsyblException("Generator '" + generatorId + "' not found");
    }
  }
  Redispatcher redispatcher = new RedispatcherFactoryImpl().create(network);
  RedispatchingParameters parameters = new RedispatchingParameters(deltaP);
  parameters.setGeneratorsToUse(generatorIds.toArray(new String[generatorIds.size()]));
  redispatcher.redispatch(parameters);
}

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

ArrayList<StochasticVariable> stochasticVariables = new ArrayList<StochasticVariable>();
for (String generatorId : generatorsIds) {
  Generator generator = network.getGenerator(generatorId);
  if (generator != null) {
    String stochasticVariablesType = null;

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

public EquipmentTypes  equipmentType(String equipment) {
  if (network.getGenerator(equipment) != null) {
    return EquipmentTypes.GEN;
  }
  if (network.getLoad(equipment) != null) {
    return EquipmentTypes.LOAD;
  }
  if (network.getLine(equipment) != null) {
    return EquipmentTypes.LINE;
  }
  if (network.getTwoWindingsTransformer(equipment) != null) {
    return EquipmentTypes.TWOWINDTRASF;
  }
  if (network.getThreeWindingsTransformer(equipment) != null) {
    return EquipmentTypes.THREEWINDTRASF;
  }
  if (network.getVoltageLevel(equipment) != null) {
    return EquipmentTypes.VOLTAGELEVEL;
  }
  if (network.getShunt(equipment) != null) {
    return EquipmentTypes.SHUNT;
  }
  if (network.getSubstation(equipment) != null) {
    return EquipmentTypes.SUBSTATION;
  }
  logger.warn(" Type not found for equipment:" + equipment + " return NULL");
  return null;
}

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

public Double getQ(String equipment) {
  logger.debug("  network " + network.getName() + " equipment: " + equipment);
  Double returnValue = null;
  EquipmentTypes     eqType = equipmentType(equipment);
  if (eqType != null) {
    switch (eqType) {
      case GEN:
        logger.debug(" equipment == generator");
        returnValue = network.getGenerator(equipment).getTerminal().getQ();
        break;
      case LOAD:
        logger.debug("  equipment == load");
        returnValue = network.getLoad(equipment).getQ0();
        break;
      case LINE:
        logger.debug("  equipment == line");
        if (network.getLine(equipment).getTerminal1() != null) {
          returnValue = network.getLine(equipment).getTerminal1().getQ();
        }
        if (network.getLine(equipment).getTerminal2() != null) {
          returnValue = network.getLine(equipment).getTerminal2().getQ();
        }
        break;
    }
  }
  if (returnValue != null) {
    logger.debug(" RETURN Q: " + returnValue + " for Network: " + network.getName() + " Equipment: " + equipment);
  }
  return  returnValue;
}

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

public Double getP(String equipment) {
  logger.debug("  network " + network.getName()  + " equipment: " + equipment);
  Double returnValue = null;
  EquipmentTypes     eqType = equipmentType(equipment);
  if (eqType != null) {
    switch (eqType) {
      case GEN:
        logger.debug("  equipment == generator");
        returnValue = network.getGenerator(equipment).getTerminal().getP();
        break;
      case LOAD:
        logger.debug("  equipment == load");
        returnValue = network.getLoad(equipment).getP0();
        break;
      case LINE:
        logger.debug(" equipment == line");
        if (network.getLine(equipment).getTerminal1() != null) {
          returnValue = network.getLine(equipment).getTerminal1().getP();
        }
        if (network.getLine(equipment).getTerminal2() != null) {
          returnValue = network.getLine(equipment).getTerminal2().getP();
        }
        break;
    }
  }
  if (returnValue != null) {
    logger.debug(" RETURN P: " + returnValue + " for Network: " + network.getName() + " Equipment: " + equipment);
  }
  return returnValue;
}

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

case GEN:
  logger.debug(" equipment == generator");
  if (network.getGenerator(equipment).getTerminal().getVoltageLevel().getSubstation().getTso() != null) {
    tsos.add(network.getGenerator(equipment).getTerminal().getVoltageLevel().getSubstation().getTso());

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

@Override
public void apply(Network network) {
  for (InjectionSample gs : generators) {
    Generator g = network.getGenerator(gs.id);
    if (g == null) {
      throw new RuntimeException("Generator '" + gs.id + "' not found");

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

Generator generator = network.getGenerator(generatorId);
if (generator != null) {
  GeneratorData generatorData = new GeneratorData(generator.getId());

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

nomV = load.getTerminal().getVoltageLevel().getNominalV();
} else {
  Generator generator = network.getGenerator(attrId.getEquipmentId());
  if (generator != null) {
    entityType = 3;

相关文章