本文整理了Java中com.powsybl.iidm.network.Generator.getId()
方法的一些代码示例,展示了Generator.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generator.getId()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Generator
类名称:Generator
方法名:getId
暂无
代码示例来源:origin: itesla/ipst
public ConnectRegulatorRecord(Internal node1, Generator node2, String pinName1, String pinName2) {
this.node1 = node1;
this.node2 = node2;
this.eqName = node2.getId();
this.node1Pin = pinName1;
this.node2Pin = pinName2;
}
代码示例来源:origin: itesla/ipst
@Override
public String getId() {
return generator.getId();
}
代码示例来源:origin: itesla/ipst
public InitializationData(Generator generator, GeneratorRecord generatorRecord, Map<Internal, RegulatorRecord> regulatorRecordsMap) {
this.generator = generator;
this.generatorRecord = generatorRecord;
this.regulatorRecordsMap = regulatorRecordsMap;
this.modelName = generator.getId().trim() + StaticData.INITIALIZATION;
}
代码示例来源: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
public static InsertionStatus insert(Generator g, EurostagDDB ddb, IdDictionary genDict, IdDictionary auxDict, EurostagStepUpTransformerConfig config, StateBefore stateBefore) throws IOException {
String ddbId = genDict.get(g.getId());
if (ddbId == null || ddbId.trim().isEmpty()) {
LOGGER.trace("CIM id '{}' not found in the dictionnary", g.getId());
return InsertionStatus.ID_NOT_FOUND;
}
Path ddbFile = ddb.findGenerator(ddbId);
if (ddbFile == null) {
LOGGER.trace("Cannot find dynamic data for generator '{}'", ddbId);
return InsertionStatus.DYNAMIC_DATA_NOT_FOUND;
}
return insert(g, ddbFile, auxDict, config, stateBefore);
}
代码示例来源: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
/**
* @param writerMo
* @param modContext
* @param modelicaModelsList
* @param modelicaSim
* @param sourceSim
* @throws IOException
*/
private void exportGeneratorsAsFixedInjections(Writer writerMo, ModExportContext modContext, List<String> modelicaModelsList, SimulatorInst modelicaSim, SimulatorInst sourceSim) throws IOException {
// Export Generators as Fixed Inyections
if ((generatorsInyections.size() != 0) && (!generatorsInyections.isEmpty())) {
LOGGER.info("EXPORTING GENERATORS AS FIXED INYECTIONS");
for (Generator generator : generatorsInyections) {
LOGGER.info("\t Exporting generator inyection " + generator.getId());
ConnectBusInfo busInfo = findBus(generator.getTerminal(), generator.getId());
GeneratorRecord generatorRecord = ModelConverter.getModelicaRecord(generator, busInfo, modContext, _ddbManager, modelicaSim, sourceSim, true, SNREF, this.paramsDictionary, this._sourceEngine);
this.addRecord(generatorRecord, writerMo, modContext, _ddbManager, modelicaSim);
}
}
}
代码示例来源:origin: itesla/ipst
@Override
public void visitGenerator(Generator g) {
TerminalContext context = new TerminalContext();
visitInjection(g, context);
// reactive limit
double qmax = g.getReactiveLimits().getMaxQ(context.p);
valueMap.put(new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.QR), Math.abs(qmax - context.q));
}
代码示例来源:origin: com.powsybl/powsybl-action-util
private static void connectGenerator(Generator g) {
Terminal t = g.getTerminal();
t.connect();
if (g.isVoltageRegulatorOn()) {
Bus bus = t.getBusView().getBus();
if (bus != null) {
// set voltage setpoint to the same as other generators connected to the bus
double targetV = bus.getGeneratorStream().findFirst().map(Generator::getTargetV).orElse(Double.NaN);
// if no other generator connected to the bus, set voltage setpoint to network voltage
if (Double.isNaN(targetV) && !Double.isNaN(bus.getV())) {
g.setTargetV(bus.getV());
}
}
}
LOGGER.info("Connecting {}", g.getId());
}
}
代码示例来源: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: 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
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: 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-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: 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
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()))
);
}
}
内容来源于网络,如有侵权,请联系作者删除!