com.powsybl.iidm.network.Line类的使用及代码示例

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

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

Line介绍

[英]An AC line.

The equivalent π model used is:

To create a line, see LineAdder
[中]交流线路。
使用的等效π模型为:
要创建线,请参见LineAdder

代码示例

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

@Override
protected void writeRootElementAttributes(Line l, Network n, NetworkXmlWriterContext context) throws XMLStreamException {
  XmlUtil.writeDouble("r", l.getR(), context.getWriter());
  XmlUtil.writeDouble("x", l.getX(), context.getWriter());
  XmlUtil.writeDouble("g1", l.getG1(), context.getWriter());
  XmlUtil.writeDouble("b1", l.getB1(), context.getWriter());
  XmlUtil.writeDouble("g2", l.getG2(), context.getWriter());
  XmlUtil.writeDouble("b2", l.getB2(), context.getWriter());
  writeNodeOrBus(1, l.getTerminal1(), context);
  writeNodeOrBus(2, l.getTerminal2(), context);
  if (context.getOptions().isWithBranchSV()) {
    writePQ(1, l.getTerminal1(), context.getWriter());
    writePQ(2, l.getTerminal2(), context.getWriter());
  }
}

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

this.addRecord(writerMo, "// LINES");
for (Line line : linesList) {
  LOGGER.info("Exporting line " + line.getId());
  if (line.getTerminal1().getBusBreakerView().getBus() == null && line.getTerminal2().getBusBreakerView().getBus() == null) {
    LOGGER.info("LINE " + line.getId() + " OUT OF SERVICE.");
  if ((line.getB1() == line.getB2()) && (line.getG1() == line.getG2())) {
    LineRecord lineRecord = ModelConverter.getModelicaRecord(line, modContext, _ddbManager, modelicaSim, SNREF);
    this.addRecord(lineRecord, writerMo, modContext, _ddbManager, modelicaSim);
  } else {
    LOGGER.warn("The model has an asymmetric line: {}.", line.getId());
    LineRecord lineRecord = ModelConverter.getModelicaRecord(line, modContext, _ddbManager, modelicaSim, SNREF);
    this.addRecord(lineRecord, writerMo, modContext, _ddbManager, modelicaSim);

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

private static void extractLinesData(Network network, NetworkData networkData) {
  for (Line line : network.getLines()) {
    if (line.getTerminal1().getVoltageLevel().getNominalV() >= 110) {
      networkData.addLineData(new LineData(line.getId(),
                         (line.getTerminal1().getBusBreakerView().getBus() != null)
                           ? line.getTerminal1().getBusBreakerView().getBus().getId()
                           : line.getTerminal1().getBusBreakerView().getConnectableBus().getId(),
                         (line.getTerminal2().getBusBreakerView().getBus() != null)
                           ? line.getTerminal2().getBusBreakerView().getBus().getId()
                           : line.getTerminal2().getBusBreakerView().getConnectableBus().getId(),
                         line.getTerminal1().getI(),
                         line.getTerminal2().getI(),
                         (line.getCurrentLimits1() != null) ? line.getCurrentLimits1().getPermanentLimit() : Float.NaN,
                         (line.getCurrentLimits2() != null) ? line.getCurrentLimits2().getPermanentLimit() : Float.NaN)
      );
    }
  }
}

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

@Override
protected boolean hasSubElements(Line l) {
  return l.getCurrentLimits1() != null || l.getCurrentLimits2() != null;
}

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

@Override
public void visitLine(Line l, Line.Side side) {
  visitBranch(l, side, l.getR(), l.getX(), l.getG1(), l.getB1(), l.getG2(), l.getB2(), 1);
}

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

/**
 * Add IIDM parameters to Line Modelica Model in p.u
 */
@Override
public void setParameters(double snref) {
  //super.iidmbranchParameters = new ArrayList<IIDMParameter>();
  double tNominalV = ((Line) this.line).getTerminal2().getVoltageLevel().getNominalV();
  double voltage = !Double.isNaN(tNominalV) ? tNominalV : 0;
  double z = (voltage * voltage) / snref;
  super.addParameter(this.iidmbranchParameters, StaticData.R, this.line.getR() / z);
  super.addParameter(this.iidmbranchParameters, StaticData.X, this.line.getX() / z);
  super.addParameter(this.iidmbranchParameters, StaticData.G, this.line.getG1() * z);
  super.addParameter(this.iidmbranchParameters, StaticData.B, this.line.getB1() * z);
}

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

LOGGER.info("#------------------------ --------------- --------------- --------------- --------------- ");
for (Line line : network.getLines()) {
  LOGGER.info(String.format("%s %15.8f %15.8f %15.8f %15.8f", line.getId(), line.getTerminal1().getQ(), line.getTerminal2().getQ(), line.getTerminal1().getP(), line.getTerminal2().getP()));

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

private void replaceLineByDanglingLine(Line line, VoltageLevel vl, Terminal terminal) {
  Branch.Side side = line.getSide(terminal);
  DanglingLineAdder dlAdder = vl.newDanglingLine()
      .setId(line.getId())
      .setName(line.getName())
      .setR(line.getR() / 2)
      .setX(line.getX() / 2)
      .setB(side == Branch.Side.ONE ? line.getB1() : line.getB2())
      .setG(side == Branch.Side.ONE ? line.getG1() : line.getG2())
      .setP0(checkP(terminal))
      .setQ0(checkQ(terminal));
  fillNodeOrBus(dlAdder, terminal);
  line.remove();
  DanglingLine dl = dlAdder.add();
  dl.getTerminal()
      .setP(terminal.getP())
      .setQ(terminal.getQ());
  observers.forEach(o -> o.lineReplaced(line, dl));
}

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

line.getTerminal1().setP(560.0).setQ(550.0);
line.getTerminal2().setP(560.0).setQ(550.0);
line.newCurrentLimits1().setPermanentLimit(500).add();
line.newCurrentLimits2()
  .setPermanentLimit(1100)
  .beginTemporaryLimit()
line.getTerminal1().setP(560.0).setQ(550.0);
line.getTerminal2().setP(560.0).setQ(550.0);
line.newCurrentLimits1()
  .setPermanentLimit(1100)
  .beginTemporaryLimit()
  .endTemporaryLimit()
  .add();
line.newCurrentLimits2().setPermanentLimit(500).add();

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

@Override
protected void reduce(Line line) {
  Terminal terminal1 = line.getTerminal1();
  Terminal terminal2 = line.getTerminal2();
  VoltageLevel vl1 = terminal1.getVoltageLevel();
  VoltageLevel vl2 = terminal2.getVoltageLevel();
  if (getPredicate().test(vl1)) {
    reduce(line, vl1, terminal1);
  } else if (getPredicate().test(vl2)) {
    reduce(line, vl2, terminal2);
  } else {
    line.remove();
  }
  observers.forEach(o -> o.lineRemoved(line));
}

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

private static void fillLines(StringToIntMapper<AmplSubset> mapper, Network network) {
  for (Line l : network.getLines()) {
    mapper.newInt(AmplSubset.BRANCH, l.getId());
    if (l.isTieLine()) {
      TieLine tl = (TieLine) l;
      mapper.newInt(AmplSubset.VOLTAGE_LEVEL, AmplUtil.getXnodeVoltageLevelId(tl));
      mapper.newInt(AmplSubset.BUS, AmplUtil.getXnodeBusId(tl));
      mapper.newInt(AmplSubset.BRANCH, tl.getHalf1().getId());
      mapper.newInt(AmplSubset.BRANCH, tl.getHalf2().getId());
    }
    // limits
    if (l.getCurrentLimits1() != null) {
      createLimitsIds(mapper, l.getCurrentLimits1(), l.getId(), "_1_");
    }
    if (l.getCurrentLimits2() != null) {
      createLimitsIds(mapper, l.getCurrentLimits2(), l.getId(), "_2_");
    }
  }
}

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

if (!l.isTieLine()) {
  continue;
    .writeCell("")
    .writeCell(0)
    .writeCell(l.getTerminal1().getVoltageLevel().getNominalV())
    .writeCell(Float.NaN)
    .writeCell(Float.NaN)

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

@Override
public List<Contingency> getContingencies(Network network) {
  List<Contingency> contingencies = new ArrayList<>(lineContigencyCount);
  for (Line l : Iterables.limit(network.getLines(), lineContigencyCount)) {
    contingencies.add(new Contingency(l.getId(), Arrays.<ContingencyElement>asList(new BranchContingency(l.getId()))));
  }
  return contingencies;
}

代码示例来源: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: com.powsybl/powsybl-iidm-api

public SV otherSideY1Y2(Line l) {
  return otherSide(l.getR(), l.getX(), l.getG1(), l.getB1(), l.getG2(), l.getB2(), 1);
}

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

this.addRecord(writerMo, "// Connecting LINES");
for (Line line : connectLinesList) {
  LOGGER.info("\t Exporting line connect " + line.getId());
  Equipments.ConnectionInfo info1 = Equipments.getConnectionInfoInBusBreakerView(line.getTerminal1());
  Bus b = info1.getConnectionBus();
  if (!Double.isNaN(b.getV())) {
  Equipments.ConnectionInfo info2 = Equipments.getConnectionInfoInBusBreakerView(line.getTerminal2());
  b = info2.getConnectionBus();
  if (!Double.isNaN(b.getV())) {

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

((Bus) network.getIdentifiable("NHV1")).setV(380.0);
((Bus) network.getIdentifiable("NHV2")).setV(380.0);
network.getLine("NHV1_NHV2_1").getTerminal1().setP(560.0).setQ(550.0);
network.getLine("NHV1_NHV2_1").getTerminal2().setP(560.0).setQ(550.0);
network.getLine("NHV1_NHV2_1").newCurrentLimits1().setPermanentLimit(1500.0).add();
network.getLine("NHV1_NHV2_1").newCurrentLimits2()
  .setPermanentLimit(1200.0)
  .beginTemporaryLimit()

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

@Override
protected void writeSubElements(Line l, Network n, NetworkXmlWriterContext context) throws XMLStreamException {
  if (l.getCurrentLimits1() != null) {
    writeCurrentLimits(1, l.getCurrentLimits1(), context.getWriter());
  }
  if (l.getCurrentLimits2() != null) {
    writeCurrentLimits(2, l.getCurrentLimits2(), context.getWriter());
  }
}

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

public BranchData(Line line, double epsilonX, boolean applyReactanceCorrection) {
  Objects.requireNonNull(line);
  id = line.getId();
  Bus bus1 = line.getTerminal1().getBusView().getBus();
  Bus bus2 = line.getTerminal2().getBusView().getBus();
  Bus connectableBus1 = line.getTerminal1().getBusView().getConnectableBus();
  Bus connectableBus2 = line.getTerminal2().getBusView().getConnectableBus();
  r = line.getR();
  x = line.getX();
  double fixedX = getFixedX(x, epsilonX, applyReactanceCorrection);
  z = Math.hypot(r, fixedX);
  alpha1 = 0f;
  alpha2 = 0f;
  g1 = line.getG1();
  g2 = line.getG2();
  b1 = line.getB1();
  b2 = line.getB2();
  p1 = line.getTerminal1().getP();
  q1 = line.getTerminal1().getQ();
  p2 = line.getTerminal2().getP();
  q2 = line.getTerminal2().getQ();

相关文章