Skip to content

Commit

Permalink
Fix ActivePowerCompensation Dynaflow name (#404)
Browse files Browse the repository at this point in the history
Add dynaflowName in ActivePowerCompensation enum and use it in DynaFlowConfigSerializer

Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte authored Nov 8, 2024
1 parent 79a2902 commit 1884955
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions dynaflow/src/main/java/com/powsybl/dynaflow/DynaFlowConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ public enum OutputTypes {
}

public enum ActivePowerCompensation {
P,
TARGET_P,
PMAX
P("P"),
TARGET_P("targetP"),
PMAX("PMax");

private final String dynaflowName;

ActivePowerCompensation(String dynaflowName) {
this.dynaflowName = dynaflowName;
}

public String getDynaflowName() {
return dynaflowName;
}
}

public enum StartingPointMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static void serialize(LoadFlowParameters lfParameters, DynaFlowParameter
jsonGenerator.writeBooleanField("InfiniteReactiveLimits", !lfParameters.isUseReactiveLimits());

if (dynaFlowParameters.getActivePowerCompensation() != null) {
jsonGenerator.writeStringField("ActivePowerCompensation", dynaFlowParameters.getActivePowerCompensation().name());
jsonGenerator.writeStringField("ActivePowerCompensation", dynaFlowParameters.getActivePowerCompensation().getDynaflowName());
}
writeNonNullField(jsonGenerator, "SettingPath", dynaFlowParameters.getSettingPath());
writeNonNullField(jsonGenerator, "AssemblingPath", dynaFlowParameters.getAssemblingPath());
Expand Down
2 changes: 1 addition & 1 deletion dynaflow/src/test/resources/params_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"AutomaticSlackBusOn" : true,
"DsoVoltageLevel" : 45.0,
"InfiniteReactiveLimits" : true,
"ActivePowerCompensation" : "PMAX",
"ActivePowerCompensation" : "PMax",
"StartTime" : 0.0,
"StopTime" : 100.0,
"ChosenOutputs" : [ "TIMELINE" ],
Expand Down

0 comments on commit 1884955

Please sign in to comment.