Skip to content

Commit

Permalink
Remove Hvdc Ac emulation OpenLoadFlow parameter. (#498)
Browse files Browse the repository at this point in the history
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
  • Loading branch information
annetill authored Apr 8, 2022
1 parent 2004b93 commit 46d68e5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 46 deletions.
27 changes: 4 additions & 23 deletions src/main/java/com/powsybl/openloadflow/OpenLoadFlowParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public class OpenLoadFlowParameters extends AbstractExtension<LoadFlowParameters

public static final boolean VOLTAGE_PER_REACTIVE_POWER_CONTROL_DEFAULT_VALUE = false;

public static final boolean HVDC_AC_EMULATION_DEFAULT_VALUE = false;

public static final String SLACK_BUS_SELECTION_PARAM_NAME = "slackBusSelectionMode";

public static final String SLACK_BUSES_IDS_PARAM_NAME = "slackBusesIds";
Expand Down Expand Up @@ -93,8 +91,6 @@ public class OpenLoadFlowParameters extends AbstractExtension<LoadFlowParameters

public static final String TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME = "transformerVoltageControlMode";

public static final String HVDC_AC_EMULATION_PARAM_NAME = "hvdcAcEmulation";

public static final List<String> SPECIFIC_PARAMETERS_NAMES = List.of(SLACK_BUS_SELECTION_PARAM_NAME,
SLACK_BUSES_IDS_PARAM_NAME,
LOW_IMPEDANCE_BRANCH_MODE_PARAM_NAME,
Expand All @@ -109,8 +105,7 @@ public class OpenLoadFlowParameters extends AbstractExtension<LoadFlowParameters
MAX_ITERATION_NAME,
NEWTON_RAPHSON_CONV_EPS_PER_EQ_NAME,
VOLTAGE_INIT_MODE_OVERRIDE_NAME,
TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME,
HVDC_AC_EMULATION_PARAM_NAME);
TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME);

public enum VoltageInitModeOverride {
NONE,
Expand Down Expand Up @@ -162,8 +157,6 @@ public enum LowImpedanceBranchMode {

private TransformerVoltageControlMode transformerVoltageControlMode = TRANSFORMER_VOLTAGE_CONTROL_MODE_DEFAULT_VALUE;

private boolean hvdcAcEmulation = HVDC_AC_EMULATION_DEFAULT_VALUE;

@Override
public String getName() {
return "open-load-flow-parameters";
Expand Down Expand Up @@ -312,14 +305,6 @@ public OpenLoadFlowParameters setTransformerVoltageControlMode(TransformerVoltag
return this;
}

public boolean isHvdcAcEmulation() {
return hvdcAcEmulation; }

public OpenLoadFlowParameters setHvdcAcEmulation(boolean hvdcAcEmulation) {
this.hvdcAcEmulation = hvdcAcEmulation;
return this;
}

public static OpenLoadFlowParameters load() {
return load(PlatformConfig.defaultConfig());
}
Expand All @@ -344,8 +329,7 @@ public static OpenLoadFlowParameters load(PlatformConfig platformConfig) {
.setMaxIteration(config.getIntProperty(MAX_ITERATION_NAME, NewtonRaphsonParameters.DEFAULT_MAX_ITERATION))
.setNewtonRaphsonConvEpsPerEq(config.getDoubleProperty(NEWTON_RAPHSON_CONV_EPS_PER_EQ_NAME, DefaultNewtonRaphsonStoppingCriteria.DEFAULT_CONV_EPS_PER_EQ))
.setVoltageInitModeOverride(config.getEnumProperty(VOLTAGE_INIT_MODE_OVERRIDE_NAME, VoltageInitModeOverride.class, VOLTAGE_INIT_MODE_OVERRIDE_DEFAULT_VALUE))
.setTransformerVoltageControlMode(config.getEnumProperty(TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME, TransformerVoltageControlMode.class, TRANSFORMER_VOLTAGE_CONTROL_MODE_DEFAULT_VALUE))
.setHvdcAcEmulation(config.getBooleanProperty(HVDC_AC_EMULATION_PARAM_NAME, HVDC_AC_EMULATION_DEFAULT_VALUE)));
.setTransformerVoltageControlMode(config.getEnumProperty(TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME, TransformerVoltageControlMode.class, TRANSFORMER_VOLTAGE_CONTROL_MODE_DEFAULT_VALUE)));
return parameters;
}

Expand Down Expand Up @@ -381,8 +365,6 @@ public static OpenLoadFlowParameters load(Map<String, String> properties) {
.ifPresent(prop -> parameters.setVoltageInitModeOverride(VoltageInitModeOverride.valueOf(prop)));
Optional.ofNullable(properties.get(TRANSFORMER_VOLTAGE_CONTROL_MODE_NAME))
.ifPresent(prop -> parameters.setTransformerVoltageControlMode(TransformerVoltageControlMode.valueOf(prop)));
Optional.ofNullable(properties.get(HVDC_AC_EMULATION_PARAM_NAME))
.ifPresent(prop -> parameters.setHvdcAcEmulation(Boolean.parseBoolean(prop)));
return parameters;
}

Expand All @@ -404,7 +386,6 @@ public String toString() {
", newtonRaphsonConvEpsPerEq=" + newtonRaphsonConvEpsPerEq +
", voltageInitModeOverride=" + voltageInitModeOverride +
", transformerVoltageControlMode=" + transformerVoltageControlMode +
", hvdcAcEmulation=" + hvdcAcEmulation +
')';
}

Expand Down Expand Up @@ -465,7 +446,7 @@ public static void logAc(LoadFlowParameters parameters, OpenLoadFlowParameters p
LOGGER.info("Voltage per reactive power control: {}", parametersExt.isVoltagePerReactivePowerControl());
LOGGER.info("Reactive Power Remote control: {}", parametersExt.hasReactivePowerRemoteControl());
LOGGER.info("Shunt voltage control: {}", parameters.isShuntCompensatorVoltageControlOn());
LOGGER.info("Hvdc Ac emulation: {}", parametersExt.isHvdcAcEmulation());
LOGGER.info("Hvdc Ac emulation: {}", parameters.isHvdcAcEmulation());
}

static VoltageInitializer getVoltageInitializer(LoadFlowParameters parameters, LfNetworkParameters networkParameters, MatrixFactory matrixFactory, Reporter reporter) {
Expand Down Expand Up @@ -525,7 +506,7 @@ static LfNetworkParameters getNetworkParameters(LoadFlowParameters parameters, O
parameters.isDc(),
parameters.isShuntCompensatorVoltageControlOn(),
!parameters.isNoGeneratorReactiveLimits(),
parametersExt.isHvdcAcEmulation());
parameters.isHvdcAcEmulation());
}

public static AcLoadFlowParameters createAcParameters(Network network, LoadFlowParameters parameters, OpenLoadFlowParameters parametersExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void analyse(Network network, List<PropagatedContingency> contingencies,
lfParameters.isDc(),
lfParameters.isShuntCompensatorVoltageControlOn(),
!lfParameters.isNoGeneratorReactiveLimits(),
lfParametersExt.isHvdcAcEmulation());
lfParameters.isHvdcAcEmulation());
List<LfNetwork> lfNetworks = Networks.load(network, lfNetworkParameters, reporter);
LfNetwork lfNetwork = lfNetworks.get(0);
checkContingencies(lfNetwork, contingencies);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void testDcParameters() {
void testAcParameters() {
Network network = Mockito.mock(Network.class);
AcLoadFlowParameters acParameters = OpenLoadFlowParameters.createAcParameters(network, new LoadFlowParameters().setReadSlackBus(true), new OpenLoadFlowParameters(), new DenseMatrixFactory(), new EvenShiloachGraphDecrementalConnectivityFactory<>(), Reporter.NO_OP, false, false);
assertEquals("AcLoadFlowParameters(networkParameters=LfNetworkParameters(slackBusSelector=NetworkSlackBusSelector, connectivityFactory=EvenShiloachGraphDecrementalConnectivityFactory, generatorVoltageRemoteControl=true, minImpedance=false, twtSplitShuntAdmittance=false, breakers=false, plausibleActivePowerLimit=5000.0, addRatioToLinesWithDifferentNominalVoltageAtBothEnds=true, computeMainConnectedComponentOnly=true, countriesToBalance=[], distributedOnConformLoad=false, phaseControl=false, transformerVoltageControl=false, voltagePerReactivePowerControl=false, reactivePowerRemoteControl=false, isDc=false, reactiveLimits=true, hvdcAcEmulation=false), equationSystemCreationParameters=AcEquationSystemCreationParameters(forceA1Var=false), newtonRaphsonParameters=NewtonRaphsonParameters(maxIteration=30, voltageInitializer=UniformValueVoltageInitializer, stoppingCriteria=DefaultNewtonRaphsonStoppingCriteria), outerLoops=[DistributedSlackOuterLoop, ReactiveLimitsOuterLoop], matrixFactory=DenseMatrixFactory)",
assertEquals("AcLoadFlowParameters(networkParameters=LfNetworkParameters(slackBusSelector=NetworkSlackBusSelector, connectivityFactory=EvenShiloachGraphDecrementalConnectivityFactory, generatorVoltageRemoteControl=true, minImpedance=false, twtSplitShuntAdmittance=false, breakers=false, plausibleActivePowerLimit=5000.0, addRatioToLinesWithDifferentNominalVoltageAtBothEnds=true, computeMainConnectedComponentOnly=true, countriesToBalance=[], distributedOnConformLoad=false, phaseControl=false, transformerVoltageControl=false, voltagePerReactivePowerControl=false, reactivePowerRemoteControl=false, isDc=false, reactiveLimits=true, hvdcAcEmulation=true), equationSystemCreationParameters=AcEquationSystemCreationParameters(forceA1Var=false), newtonRaphsonParameters=NewtonRaphsonParameters(maxIteration=30, voltageInitializer=UniformValueVoltageInitializer, stoppingCriteria=DefaultNewtonRaphsonStoppingCriteria), outerLoops=[DistributedSlackOuterLoop, ReactiveLimitsOuterLoop], matrixFactory=DenseMatrixFactory)",
acParameters.toString());
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void testGetExtendedVoltageInitializer() {
@Test
void specificParametersTest() {
var provider = new OpenLoadFlowProvider();
assertEquals(16, provider.getSpecificParametersNames().size());
assertEquals(15, provider.getSpecificParametersNames().size());
LoadFlowParameters parameters = new LoadFlowParameters();

provider.loadSpecificParameters(Collections.emptyMap())
Expand Down
24 changes: 12 additions & 12 deletions src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowVscTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ void testHvdcAcEmulation() {
.add();

LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters();
LoadFlowParameters parameters = new LoadFlowParameters().setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
.setHvdcAcEmulation(true);
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);

LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());

Expand All @@ -157,10 +157,10 @@ void testHvdcAcEmulation2() {

LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters();
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_LOAD);
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_LOAD).setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
.setHvdcAcEmulation(true);
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);

LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());

Expand Down Expand Up @@ -193,10 +193,10 @@ void testHvdcAcEmulationNonSupported() {
.add();

LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters();
LoadFlowParameters parameters = new LoadFlowParameters().setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
.setHvdcAcEmulation(true);
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);

LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());

Expand All @@ -221,10 +221,10 @@ void testHvdcAcEmulationNonSupported2() {
LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters();
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_LOAD)
.setDc(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
.setDc(true)
.setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,10 +1288,10 @@ void testHvdcAcEmulation() {
.add();

LoadFlowParameters parameters = new LoadFlowParameters();
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX)
.setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);

List<Contingency> contingencies = new ArrayList<>();
contingencies.add(Contingency.line("l12"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,14 +918,15 @@ void testWithHvdcAcEmulation() {

LoadFlowParameters parameters = new LoadFlowParameters();
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX);
parameters.setHvdcAcEmulation(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
.setHvdcAcEmulation(true);
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);

SensitivityAnalysisParameters sensiParameters = createParameters(false);
sensiParameters.setLoadFlowParameters(parameters);
List<SensitivityFactor> factors = List.of(createBranchFlowPerInjectionIncrease("l25", "d2"));

SensitivityAnalysisResult result = sensiRunner.run(network, factors, Collections.emptyList(), Collections.emptyList(), sensiParameters);
assertEquals(0.499, result.getBranchFlow1SensitivityValue("d2", "l25"), LoadFlowAssert.DELTA_POWER);
assertEquals(0.442, result.getBranchFlow1SensitivityValue("d2", "l25"), LoadFlowAssert.DELTA_POWER);
}
}
3 changes: 1 addition & 2 deletions src/test/resources/debug-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"maxIteration" : 30,
"newtonRaphsonConvEpsPerEq" : 1.0E-4,
"voltageInitModeOverride" : "NONE",
"transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL",
"hvdcAcEmulation" : false
"transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL"
}
}
},
Expand Down

0 comments on commit 46d68e5

Please sign in to comment.