Skip to content

Commit c64d453

Browse files
authored
fix check and application when missing data on angle droop active power modification (#140)
Signed-off-by: Etienne LESOT <[email protected]>
1 parent 239d61e commit c64d453

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/main/java/org/gridsuite/modification/modifications/VscModification.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ private void checkDroop(HvdcLine hvdcLine) {
107107
}
108108

109109
//--- the extension doesn't exist yet ---//
110-
boolean isPresentAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null;
111-
boolean isPresentDroop = modificationInfos.getDroop() != null;
112-
boolean isPresentP0 = modificationInfos.getP0() != null;
110+
boolean isPresentAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null && modificationInfos.getAngleDroopActivePowerControl().getValue() != null;
111+
boolean isPresentDroop = modificationInfos.getDroop() != null && modificationInfos.getDroop().getValue() != null;
112+
boolean isPresentP0 = modificationInfos.getP0() != null && modificationInfos.getP0().getValue() != null;
113113
// all fields are provided => OK extension will be created
114114
if (isPresentAngleDroopActivePowerControl && isPresentDroop && isPresentP0) {
115115
return;
@@ -280,7 +280,10 @@ private void modifyExistingHvdcAngleDroopActivePowerControl(HvdcAngleDroopActive
280280

281281
private boolean shouldCreateDroopActivePowerControlExtension() {
282282
return shouldCreateDroopActivePowerControlExtension(
283-
modificationInfos.getAngleDroopActivePowerControl() != null, modificationInfos.getDroop() != null, modificationInfos.getP0() != null);
283+
modificationInfos.getAngleDroopActivePowerControl() != null &&
284+
modificationInfos.getAngleDroopActivePowerControl().getValue() != null,
285+
modificationInfos.getDroop() != null && modificationInfos.getDroop().getValue() != null,
286+
modificationInfos.getP0() != null && modificationInfos.getP0().getValue() != null);
284287
}
285288

286289
private List<ReportNode> hvdcAngleDroopActivePowerControlAdder(HvdcLine hvdcLine) {

src/test/java/org/gridsuite/modification/modifications/VscModificationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ private VscModificationInfos buildModificationWithDroopAbsentInfos(boolean isPre
225225
VscModificationInfos modificationInfos = (VscModificationInfos) buildModification();
226226
// reset null depending to test arguments
227227
if (!isPresentAngleDroopActivePowerControl) {
228-
modificationInfos.setAngleDroopActivePowerControl(null);
228+
modificationInfos.setAngleDroopActivePowerControl(new AttributeModification<>(null, null));
229229
}
230230
if (!isPresentDroop) {
231-
modificationInfos.setDroop(null);
231+
modificationInfos.setDroop(new AttributeModification<>(null, null));
232232
}
233233
if (!isPresentP0) {
234-
modificationInfos.setP0(null);
234+
modificationInfos.setP0(new AttributeModification<>(null, null));
235235
}
236236
return modificationInfos;
237237
}

0 commit comments

Comments
 (0)