Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix converter station modification issue in unbuilt state #503

Merged
merged 12 commits into from
Aug 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,22 @@ public void check(Network network) throws NetworkModificationException {
|| modificationInfos.getConverterStation2() == null) {
throw new NetworkModificationException(MODIFY_BATTERY_ERROR, "Missing required attributes to modify the equipment");
}
VscConverterStation converterStation1 = ModificationUtils.getInstance().getVscConverterStation(network, modificationInfos.getConverterStation1().getEquipmentId());
VscConverterStation converterStation2 = ModificationUtils.getInstance().getVscConverterStation(network, modificationInfos.getConverterStation2().getEquipmentId());
HvdcLine hvdcLine = ModificationUtils.getInstance().getHvdcLine(network, modificationInfos.getEquipmentId());

VscConverterStation converterStation1 = ModificationUtils.getInstance().getVscConverterStation(network, hvdcLine.getConverterStation1().getId());
VscConverterStation converterStation2 = ModificationUtils.getInstance().getVscConverterStation(network, hvdcLine.getConverterStation2().getId());
checkConverterStation(modificationInfos.getConverterStation1(), converterStation1);
checkConverterStation(modificationInfos.getConverterStation2(), converterStation2);

checkToModifyDroop();

}

private void checkToModifyDroop() {
AAJELLAL marked this conversation as resolved.
Show resolved Hide resolved
// if droop is set p0 should be also
if (modificationInfos.getP0() == null && modificationInfos.getDroop() != null) {
throw new NetworkModificationException(MODIFY_VSC_ERROR, "P0 is required to modify the equipment");
}
}

@Override
Expand Down Expand Up @@ -92,8 +104,8 @@ private void modifyVsc(@NonNull Network network, @NonNull HvdcLine hvdcLine, Vsc
operatorActivePowerLimit(hvdcLine, modificationInfos, subReportNode);

// stations
modifyConverterStation(network, modificationInfos.getConverterStation1(), subReportNode);
modifyConverterStation(network, modificationInfos.getConverterStation2(), subReportNode);
modifyConverterStation(ModificationUtils.getInstance().getVscConverterStation(network, hvdcLine.getConverterStation1().getId()), modificationInfos.getConverterStation1(), subReportNode);
modifyConverterStation(ModificationUtils.getInstance().getVscConverterStation(network, hvdcLine.getConverterStation2().getId()), modificationInfos.getConverterStation2(), subReportNode);

PropertiesUtils.applyProperties(hvdcLine, subReportNode, modificationInfos.getProperties(), "VscProperties");
}
Expand Down Expand Up @@ -245,11 +257,11 @@ private List<ReportNode> hvdcAngleDroopActivePowerControlAdder(HvdcLine hvdcLine
return reports;
}

private void modifyConverterStation(Network network, ConverterStationModificationInfos converterStationModificationInfos, ReportNode subReportNode) {
private void modifyConverterStation(VscConverterStation converterStation, ConverterStationModificationInfos converterStationModificationInfos, ReportNode subReportNode) {
if (converterStationModificationInfos == null || !isConverterStationModified(converterStationModificationInfos)) {
return;
}
VscConverterStation converterStation = ModificationUtils.getInstance().getVscConverterStation(network, converterStationModificationInfos.getEquipmentId());

ReportNode converterStationReportNode = subReportNode.newReportNode()
.withMessageTemplate("Converter Station", "Converter station ${id} modified")
.withUntypedValue("id", converterStation.getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected ModificationInfos buildModification() {
.operatorActivePowerLimitFromSide2ToSide1(new AttributeModification<>(8F, OperationType.SET))
.droop(new AttributeModification<>(1F, OperationType.SET))
.angleDroopActivePowerControl(new AttributeModification<>(true, OperationType.SET))
.converterStation1(buildConverterStationWithMinMaxReactiveLimits())
.converterStation2(buildConverterStationWithReactiveCapabilityCurve())
.converterStation1(buildConverterStationWithReactiveCapabilityCurve())
.converterStation2(buildConverterStationWithMinMaxReactiveLimits())
.properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME).value(PROPERTY_VALUE).build()))
.build();
}
Expand Down Expand Up @@ -171,7 +171,7 @@ protected void assertAfterNetworkModificationCreation() {
Assert.assertEquals(2, reactiveLimits1.getPointCount());
Collection<ReactiveCapabilityCurve.Point> points = vscConverterStation1.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints();
List<ReactiveCapabilityCurve.Point> vscPoints = new ArrayList<>(points);
List<ReactiveCapabilityCurveModificationInfos> modificationPoints = vscModificationInfos.getConverterStation2().getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurveModificationInfos> modificationPoints = vscModificationInfos.getConverterStation1().getReactiveCapabilityCurvePoints();
if (!CollectionUtils.isEmpty(points)) {
IntStream.range(0, vscPoints.size())
.forEach(i -> {
Expand Down Expand Up @@ -262,6 +262,21 @@ public void testUnchangedHVDCangleDroopActivePowerControl() throws Exception {
Assert.assertTrue(activePowerControl.isEnabled());
}

//Test : p0 sould be required if drop is enabled
@Test
public void testHvdcAngleDroopActivePowerControlWithoutP0() {
AAJELLAL marked this conversation as resolved.
Show resolved Hide resolved
var networkuuid = UUID.randomUUID();
Network networkWitoutExt = NetworkCreation.createWithVSC(networkuuid, true);
VscModificationInfos modificationInfos = (VscModificationInfos) buildModification();
modificationInfos.setAngleDroopActivePowerControl(new AttributeModification<>(true, OperationType.SET));
{
modificationInfos.setDroop(new AttributeModification<>(10F, OperationType.SET));
modificationInfos.setP0(null);
VscModification vscModification = new VscModification(modificationInfos);
Assert.assertThrows(NetworkModificationException.class, () -> vscModification.check(networkWitoutExt));
}
}

@Override
@SneakyThrows
protected void testUpdateModificationMessage(ModificationInfos modificationInfos) {
Expand Down
Loading