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

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

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

Network.getLoad介绍

[英]Get a load.
[中]吃点东西。

代码示例

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

Load load = network.getLoad(loadId);
if (load != null) {
  Country country = load.getTerminal().getVoltageLevel().getSubstation().getCountry();

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

if (sample.getLoadsActivePower() != null) {
  double newActivePower = sample.getLoadsActivePower()[i];
  double oldActivePower = network.getLoad(loadId).getTerminal().getP();
  totalPLoadBS += oldActivePower;
  totalPLoadAS += newActivePower;
  LOGGER.debug("Network {} state {}: load {} - P:{} -> P:{} ", network.getId(), network.getStateManager().getWorkingStateId(), loadId, oldActivePower, newActivePower);
  if (!Double.isNaN(newActivePower)) {
    network.getLoad(loadId).setP0(newActivePower);
    network.getLoad(loadId).getTerminal().setP(newActivePower);
  } else {
    LOGGER.debug("Network {} state {}: new sampled P for load {} is NaN: skipping assignment", network.getId(), network.getStateManager().getWorkingStateId(), loadId);
  double oldReactivePower = network.getLoad(loadId).getTerminal().getQ();
  totalQLoadBS += oldReactivePower;
    LOGGER.debug("Network {} state {}: load {} - Q:{} -> Q:{} ", network.getId(), network.getStateManager().getWorkingStateId(), loadId, oldReactivePower, newReactivePower);
    if (!Double.isNaN(newReactivePower)) {
      network.getLoad(loadId).setQ0(newReactivePower);
      network.getLoad(loadId).getTerminal().setQ(newReactivePower);
    } else {
      LOGGER.debug("Network {} state {}: new sampled Q for load {} is NaN: skipping assignment", network.getId(), network.getStateManager().getWorkingStateId(), loadId);

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

if (network.getLoad(equipment).getTerminal().getVoltageLevel().getSubstation().getTso() != null) {
  tsos.add(network.getLoad(equipment).getTerminal().getVoltageLevel().getSubstation().getTso());

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

Load l = network.getLoad(ls.id);
if (l == null) {
  throw new RuntimeException("Load '" + ls.id + "' not found");

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

offlineDb.storeTaskStatus(workflowId, 0, OfflineTaskType.STARTING_POINT_INITIALIZATION, OfflineTaskStatus.SUCCEED, null);
offlineDb.storeTaskStatus(workflowId, 0, OfflineTaskType.LOAD_FLOW, OfflineTaskStatus.SUCCEED, null);
Load l = n.getLoad("LOAD");
l.getTerminal().setP(10);
offlineDb.storeState(workflowId, 0, n, null);

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

private Void readLoad(String[] tokens) {
  int num = Integer.parseInt(tokens[1]);
  int busNum = Integer.parseInt(tokens[2]);
  double p = readDouble(tokens[3]);
  double q = readDouble(tokens[4]);
  double p0 = readDouble(tokens[5]);
  double q0 = readDouble(tokens[6]);
  String id = mapper.getId(AmplSubset.LOAD, num);
  Load l = network.getLoad(id);
  if (l != null) {
    l.setP0(p0).setQ0(q0);
    l.getTerminal().setP(p).setQ(q);
    busConnection(l.getTerminal(), busNum);
  } else {
    DanglingLine dl = network.getDanglingLine(id);
    if (dl != null) {
      dl.setP0(p0).setQ0(q0);
      dl.getTerminal().setP(p).setQ(q);
      busConnection(dl.getTerminal(), busNum);
    } else {
      throw new AmplException("Invalid load id '" + id + "'");
    }
  }
  return null;
}

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

Load load = network.getLoad(loadId);
if (load != null) {
  LoadData loadData = new LoadData(load.getId());

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

Load hvAux = n.getLoad(hvAuxId);
if (hvAux != null && hvAux.getTerminal().getBusBreakerView().getConnectableBus() == hvGenConnectableBus) {
  if (hvAux.getTerminal().getBusView().getBus() != null) {

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

nomV = dl.getTerminal().getVoltageLevel().getNominalV();
} else {
  Load load = network.getLoad(attrId.getEquipmentId());
  if (load != null) {
    entityType = 2;

相关文章