Skip to content

Commit

Permalink
fix serialization of new parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Didier Vidal <[email protected]>
  • Loading branch information
vidaldid-rte committed Dec 17, 2024
1 parent f107f3e commit 0c143d0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/main/java/com/powsybl/openloadflow/OpenLoadFlowParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ public enum ReactiveRangeCheckMode {

private double areaInterchangePMaxMismatch = AREA_INTERCHANGE_P_MAX_MISMATCH_DEFAULT_VALUE;

private boolean remoteVoltageControlIgnoreQpercent = REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_DEFAULT_VALUE;
private boolean remoteVoltageControlIgnoreQPercent = REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_DEFAULT_VALUE;

public static double checkParameterValue(double parameterValue, boolean condition, String parameterName) {
if (!condition) {
Expand Down Expand Up @@ -1332,12 +1332,12 @@ public OpenLoadFlowParameters setAreaInterchangePMaxMismatch(double areaIntercha
return this;
}

public boolean isRemoteVoltageControlIgnoreQpercent() {
return remoteVoltageControlIgnoreQpercent;
public boolean isRemoteVoltageControlIgnoreQPercent() {
return remoteVoltageControlIgnoreQPercent;
}

public OpenLoadFlowParameters setRemoteVoltageControlIgnoreQpercent(boolean remoteVoltageControlIgnoreQpercent) {
this.remoteVoltageControlIgnoreQpercent = remoteVoltageControlIgnoreQpercent;
public OpenLoadFlowParameters setRemoteVoltageControlIgnoreQPercent(boolean remoteVoltageControlIgnoreQPercent) {
this.remoteVoltageControlIgnoreQPercent = remoteVoltageControlIgnoreQPercent;
return this;
}

Expand Down Expand Up @@ -1420,7 +1420,7 @@ public static OpenLoadFlowParameters load(PlatformConfig platformConfig) {
.setAreaInterchangeControl(config.getBooleanProperty(AREA_INTERCHANGE_CONTROL_PARAM_NAME, AREA_INTERCHANGE_CONTROL_DEFAULT_VALUE))
.setAreaInterchangeControlAreaType(config.getStringProperty(AREA_INTERCHANGE_CONTROL_AREA_TYPE_PARAM_NAME, LfNetworkParameters.AREA_INTERCHANGE_CONTROL_AREA_TYPE_DEFAULT_VALUE))
.setAreaInterchangePMaxMismatch(config.getDoubleProperty(AREA_INTERCHANGE_P_MAX_MISMATCH_PARAM_NAME, AREA_INTERCHANGE_P_MAX_MISMATCH_DEFAULT_VALUE))
.setRemoteVoltageControlIgnoreQpercent(config.getBooleanProperty(REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_PARAM_NAME, REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_DEFAULT_VALUE)));
.setRemoteVoltageControlIgnoreQPercent(config.getBooleanProperty(REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_PARAM_NAME, REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_DEFAULT_VALUE)));
return parameters;
}

Expand Down Expand Up @@ -1582,7 +1582,7 @@ public OpenLoadFlowParameters update(Map<String, String> properties) {
Optional.ofNullable(properties.get(AREA_INTERCHANGE_P_MAX_MISMATCH_PARAM_NAME))
.ifPresent(prop -> this.setAreaInterchangePMaxMismatch(Double.parseDouble(prop)));
Optional.ofNullable(properties.get(REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_PARAM_NAME))
.ifPresent(prop -> this.setRemoteVoltageControlIgnoreQpercent(Boolean.parseBoolean(prop)));
.ifPresent(prop -> this.setRemoteVoltageControlIgnoreQPercent(Boolean.parseBoolean(prop)));
return this;
}

Expand Down Expand Up @@ -1659,7 +1659,7 @@ public Map<String, Object> toMap() {
map.put(AREA_INTERCHANGE_CONTROL_PARAM_NAME, areaInterchangeControl);
map.put(AREA_INTERCHANGE_CONTROL_AREA_TYPE_PARAM_NAME, areaInterchangeControlAreaType);
map.put(AREA_INTERCHANGE_P_MAX_MISMATCH_PARAM_NAME, areaInterchangePMaxMismatch);
map.put(REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_PARAM_NAME, remoteVoltageControlIgnoreQpercent);
map.put(REMOTE_VOLTAGE_CONTROL_IGNORE_QPERCENT_PARAM_NAME, remoteVoltageControlIgnoreQPercent);
return map;
}

Expand Down Expand Up @@ -1817,7 +1817,7 @@ static LfNetworkParameters getNetworkParameters(LoadFlowParameters parameters, O
.setFictitiousGeneratorVoltageControlCheckMode(parametersExt.getFictitiousGeneratorVoltageControlCheckMode())
.setAreaInterchangeControl(parametersExt.isAreaInterchangeControl())
.setAreaInterchangeControlAreaType(parametersExt.getAreaInterchangeControlAreaType())
.setRemoteVoltageControlIgnoreQPercent(parametersExt.isRemoteVoltageControlIgnoreQpercent());
.setRemoteVoltageControlIgnoreQPercent(parametersExt.isRemoteVoltageControlIgnoreQPercent());
}

public static AcLoadFlowParameters createAcParameters(Network network, LoadFlowParameters parameters, OpenLoadFlowParameters parametersExt,
Expand Down Expand Up @@ -1917,7 +1917,7 @@ public static DcLoadFlowParameters createDcParameters(LoadFlowParameters paramet
.setReferenceBusSelector(ReferenceBusSelector.fromMode(parametersExt.getReferenceBusSelectionMode()))
.setAreaInterchangeControl(parametersExt.isAreaInterchangeControl())
.setAreaInterchangeControlAreaType(parametersExt.getAreaInterchangeControlAreaType())
.setRemoteVoltageControlIgnoreQPercent(parametersExt.isRemoteVoltageControlIgnoreQpercent());
.setRemoteVoltageControlIgnoreQPercent(parametersExt.isRemoteVoltageControlIgnoreQPercent());

var equationSystemCreationParameters = new DcEquationSystemCreationParameters()
.setUpdateFlows(true)
Expand Down Expand Up @@ -2046,7 +2046,7 @@ public static boolean equals(LoadFlowParameters parameters1, LoadFlowParameters
extension1.isAreaInterchangeControl() == extension2.isAreaInterchangeControl() &&
Objects.equals(extension1.getAreaInterchangeControlAreaType(), extension2.getAreaInterchangeControlAreaType()) &&
extension1.getAreaInterchangePMaxMismatch() == extension2.getAreaInterchangePMaxMismatch() &&
extension1.isRemoteVoltageControlIgnoreQpercent() == extension2.isRemoteVoltageControlIgnoreQpercent();
extension1.isRemoteVoltageControlIgnoreQPercent() == extension2.isRemoteVoltageControlIgnoreQPercent();
}

public static LoadFlowParameters clone(LoadFlowParameters parameters) {
Expand Down Expand Up @@ -2143,7 +2143,7 @@ public static LoadFlowParameters clone(LoadFlowParameters parameters) {
.setAreaInterchangeControl(extension.isAreaInterchangeControl())
.setAreaInterchangeControlAreaType(extension.getAreaInterchangeControlAreaType())
.setAreaInterchangePMaxMismatch(extension.getAreaInterchangePMaxMismatch())
.setRemoteVoltageControlIgnoreQpercent(extension.isRemoteVoltageControlIgnoreQpercent());
.setRemoteVoltageControlIgnoreQPercent(extension.isRemoteVoltageControlIgnoreQPercent());

if (extension2 != null) {
parameters2.addExtension(OpenLoadFlowParameters.class, extension2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void analyse(Network network, List<PropagatedContingency> contingencies,
.setReferenceBusSelector(ReferenceBusSelector.DEFAULT_SELECTOR) // not supported yet
.setAreaInterchangeControl(lfParametersExt.isAreaInterchangeControl())
.setAreaInterchangeControlAreaType(lfParametersExt.getAreaInterchangeControlAreaType())
.setRemoteVoltageControlIgnoreQPercent(lfParametersExt.isRemoteVoltageControlIgnoreQpercent());
.setRemoteVoltageControlIgnoreQPercent(lfParametersExt.isRemoteVoltageControlIgnoreQPercent());

// create networks including all necessary switches
try (LfNetworkList lfNetworks = Networks.load(network, lfNetworkParameters, topoConfig, reportNode)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void testWith3GeneratorsAndCoordinatedReactiveControlExtensions() {
assertReactivePowerEquals(-63.07, g2.getTerminal());
assertReactivePowerEquals(-21.023, g3.getTerminal());

parametersExt.setRemoteVoltageControlIgnoreQpercent(true);
parametersExt.setRemoteVoltageControlIgnoreQPercent(true);
g1.newMinMaxReactiveLimits().setMaxQ(100).setMinQ(-100).add();
g2.newMinMaxReactiveLimits().setMaxQ(100).setMinQ(-100).add();
g3.newMinMaxReactiveLimits().setMaxQ(200).setMinQ(-200).add();
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/debug-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"areaInterchangeControl" : false,
"areaInterchangeControlAreaType" : "ControlArea",
"areaInterchangePMaxMismatch" : 2.0,
"remoteVoltageControlIgnoreQpercent" : false
"remoteVoltageControlIgnoreQPercent" : false
}
}
},
Expand Down

0 comments on commit 0c143d0

Please sign in to comment.