Skip to content

Commit

Permalink
Fix error when active power is null in Vsc creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddik Yengui committed Sep 25, 2023
1 parent 5ff8b8b commit 49b4a7a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.powsybl.iidm.modification.topology.CreateFeederBayBuilder;
import com.powsybl.iidm.network.Bus;
import com.powsybl.iidm.network.HvdcLine;
import com.powsybl.iidm.network.HvdcLineAdder;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TopologyKind;
import com.powsybl.iidm.network.VoltageLevel;
Expand Down Expand Up @@ -78,18 +79,21 @@ public void apply(Network network, Reporter subReporter) {

VscConverterStation converterStation2 = createConverterStation(network, modificationInfos.getConverterStation2(), subReporter, "Converter station 2");

HvdcLine hvdcLine = network.newHvdcLine()
HvdcLineAdder hvdcLineAdder = network.newHvdcLine()
.setId(modificationInfos.getEquipmentId())
.setName(modificationInfos.getEquipmentName())
.setNominalV(modificationInfos.getDcNominalVoltage())
.setR(modificationInfos.getDcResistance())
.setMaxP(modificationInfos.getMaximumActivePower())
.setActivePowerSetpoint(modificationInfos.getActivePower())
.setConvertersMode(modificationInfos.getConvertersMode())
.setConverterStationId1(converterStation1 != null ? converterStation1.getId() : null)
.setConverterStationId2(converterStation2 != null ? converterStation2.getId() : null)
.add();
.setConverterStationId2(converterStation2 != null ? converterStation2.getId() : null);

if (modificationInfos.getActivePower() != null) {
hvdcLineAdder.setActivePowerSetpoint(modificationInfos.getActivePower());
}

HvdcLine hvdcLine = hvdcLineAdder.add();
if (modificationInfos.getOperatorActivePowerLimitFromSide1ToSide2() != null ||
modificationInfos.getOperatorActivePowerLimitFromSide2ToSide1() != null) {
hvdcLine.newExtension(HvdcOperatorActivePowerRangeAdder.class)
Expand Down

0 comments on commit 49b4a7a

Please sign in to comment.