Skip to content

Commit

Permalink
Fix deprecated API usage (#707)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
  • Loading branch information
geofjamg authored and obrix committed Jan 25, 2023
1 parent 55b621e commit 912bf92
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public List<OuterLoop> configure(LoadFlowParameters parameters, OpenLoadFlowPara
if (parametersExt.isSvcVoltageMonitoring()) {
outerLoops.add(new MonitoringVoltageOuterLoop());
}
if (!parameters.isNoGeneratorReactiveLimits()) {
if (parameters.isUseReactiveLimits()) {
outerLoops.add(new ReactiveLimitsOuterLoop());
}
if (parameters.isTransformerVoltageControlOn()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private LoadFlowResult runAc(Network network, LoadFlowParameters parameters, Rep
for (AcLoadFlowResult result : results) {
// update network state
if (result.getNewtonRaphsonStatus() == NewtonRaphsonStatus.CONVERGED) {
var updateParameters = new LfNetworkStateUpdateParameters(!parameters.isNoGeneratorReactiveLimits(),
var updateParameters = new LfNetworkStateUpdateParameters(parameters.isUseReactiveLimits(),
parameters.isWriteSlackBus(),
parameters.isPhaseShifterRegulationOn(),
parameters.isTransformerVoltageControlOn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void analyse(Network network, List<PropagatedContingency> contingencies,
.setReactivePowerRemoteControl(lfParametersExt.hasReactivePowerRemoteControl())
.setDc(lfParameters.isDc())
.setShuntVoltageControl(lfParameters.isShuntCompensatorVoltageControlOn())
.setReactiveLimits(!lfParameters.isNoGeneratorReactiveLimits())
.setReactiveLimits(lfParameters.isUseReactiveLimits())
.setHvdcAcEmulation(lfParameters.isHvdcAcEmulation())
.setMinPlausibleTargetVoltage(lfParametersExt.getMinPlausibleTargetVoltage())
.setMaxPlausibleTargetVoltage(lfParametersExt.getMaxPlausibleTargetVoltage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void testGetExtendedVoltageInitializer() {
@Test
void specificParametersTest() {
OpenLoadFlowProvider provider = new OpenLoadFlowProvider();
assertEquals(25, provider.getSpecificParametersNames().size());
assertEquals(25, provider.getSpecificParameters().size());
LoadFlowParameters parameters = new LoadFlowParameters();

provider.loadSpecificParameters(Collections.emptyMap())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void setUp() {
bus3 = network.getBusBreakerView().getBus("b3");
twt = network.getThreeWindingsTransformer("3wt");
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void setUp() {
g1 = network.getGenerator("g1");
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
parametersExt = OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down Expand Up @@ -90,7 +90,7 @@ void testWithVoltageRegulationOn() {
assertReactivePowerEquals(-0.202, dl1.getTerminal());

parameters.setDistributedSlack(true)
.setNoGeneratorReactiveLimits(false);
.setUseReactiveLimits(true);
LoadFlowResult result2 = loadFlowRunner.run(network, parameters);
assertTrue(result2.isOk());

Expand All @@ -105,7 +105,7 @@ void testWithVoltageRegulationOn() {
@Test
void testWithXnode() {
Network network = BoundaryFactory.createWithXnode();
parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
parameters.setDistributedSlack(true);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
Expand All @@ -119,7 +119,7 @@ void testWithXnode() {
@Test
void testWithTieLine() {
Network network = BoundaryFactory.createWithTieLine();
parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
parameters.setDistributedSlack(true);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void setUp() {
vlhv2 = network.getVoltageLevel("VLHV2");

loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
parametersExt = OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.FIRST);
Expand Down Expand Up @@ -299,14 +299,14 @@ void noGeneratorBecauseOfReactiveRangeTest() {
.setMaxQ(0)
.add();

parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertFalse(result.isOk());
assertEquals(1, result.getComponentResults().size());
assertEquals(LoadFlowResult.ComponentResult.Status.FAILED, result.getComponentResults().get(0).getStatus());

// but if we do not take into account reactive limits in parameters, calculation should be ok
parameters.setNoGeneratorReactiveLimits(true);
parameters.setUseReactiveLimits(false);
result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
assertEquals(1, result.getComponentResults().size());
Expand Down Expand Up @@ -421,7 +421,7 @@ void testGeneratorReactiveLimits() {
.setVoltageRegulatorOn(true).setTargetV(24.5D)
.setTargetP(607.0D).setTargetQ(301.0D).add();
network.getGenerator("GEN1").newMinMaxReactiveLimits().setMinQ(0).setMaxQ(160).add();
LoadFlowParameters parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(false)
LoadFlowParameters parameters = new LoadFlowParameters().setUseReactiveLimits(true)
.setDistributedSlack(false)
.setVoltageInitMode(LoadFlowParameters.VoltageInitMode.DC_VALUES);
loadFlowRunner.run(network, parameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AcLoadFlowLccTest {
void test() {
Network network = HvdcNetworkFactory.createLcc();
LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
LoadFlowParameters parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AcLoadFlowPhaseShifterTest {
void setUp() {
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.FIRST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void setUp() {
l2 = network.getLine("l2");
shunt = network.getShuntCompensator("SHUNT");
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(false)
parameters = new LoadFlowParameters().setUseReactiveLimits(true)
.setDistributedSlack(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private Network createNetwork() {
void setUp() {
network = createNetwork();
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(false)
parameters = new LoadFlowParameters().setUseReactiveLimits(true)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void setUp() {
line1 = network.getLine("l12");

loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.FIRST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void test() {
Network network = HvdcNetworkFactory.createVsc();
LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down Expand Up @@ -75,7 +75,7 @@ void testRegulatingTerminal() {
vscConverterStation.setVoltageRegulatorOn(true); //FIXME

LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
LoadFlowParameters parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand All @@ -96,7 +96,7 @@ void testRegulatingTerminal2() {

LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
LoadFlowParameters parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void testShunt2() {

assertTrue(NetworkCache.INSTANCE.findEntry(network).isEmpty());
loadFlowRunner.run(network, parameters); // Run a first LF before changing a parameter.
parameters.setSimulShunt(true);
parameters.setShuntCompensatorVoltageControlOn(true);
assertNotNull(NetworkCache.INSTANCE.findEntry(network).orElseThrow().getContexts());
loadFlowRunner.run(network, parameters);
assertActivePowerEquals(0, shunt.getTerminal());
Expand All @@ -229,7 +229,7 @@ void testShunt3() {

assertTrue(NetworkCache.INSTANCE.findEntry(network).isEmpty());
loadFlowRunner.run(network, parameters);
parameters.setSimulShunt(true);
parameters.setShuntCompensatorVoltageControlOn(true);
assertNotNull(NetworkCache.INSTANCE.findEntry(network).orElseThrow().getContexts());
loadFlowRunner.run(network, parameters);
assertActivePowerEquals(0, shunt.getTerminal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void createNetwork() {
void setUp() {
createNetwork();
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(false)
parameters = new LoadFlowParameters().setUseReactiveLimits(true)
.setDistributedSlack(false);
}

Expand All @@ -126,14 +126,14 @@ void diagramTest() {

@Test
void test() {
parameters.setNoGeneratorReactiveLimits(true);
parameters.setUseReactiveLimits(false);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
assertReactivePowerEquals(-109.228, gen.getTerminal());
assertReactivePowerEquals(-152.265, gen2.getTerminal());
assertReactivePowerEquals(-199.998, nhv2Nload.getTerminal2());

parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
assertReactivePowerEquals(-164.315, gen.getTerminal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void setUp() {
g3 = network.getGenerator("g3");
g4 = network.getGenerator("g4");
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(true);
OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void setUp() {
tr3 = network.getTwoWindingsTransformer("tr3");

loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters().setNoGeneratorReactiveLimits(true)
parameters = new LoadFlowParameters().setUseReactiveLimits(false)
.setDistributedSlack(false);
parametersExt = OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.MOST_MESHED)
Expand Down Expand Up @@ -236,7 +236,7 @@ void testWith2Generators() {

@Test
void testWith3GeneratorsAndFirstGeneratorToLimit() {
parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
g1.newMinMaxReactiveLimits()
.setMinQ(-50)
.setMaxQ(50)
Expand Down Expand Up @@ -568,7 +568,7 @@ void testRemoteReactivePowerControl2() {

@Test
void testReactiveRangeCheckMode() {
parameters.setNoGeneratorReactiveLimits(false);
parameters.setUseReactiveLimits(true);
Network network = EurostagTutorialExample1Factory.create();
VoltageLevel vlload = network.getVoltageLevel("VLLOAD");
Bus nload = vlload.getBusBreakerView().getBus("NLOAD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void setUp() {

loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
parametersExt = OpenLoadFlowParameters.create(parameters)
.setSlackBusSelectionMode(SlackBusSelectionMode.FIRST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void setUp() {
network = EurostagFactory.fix(EurostagTutorialExample1Factory.create());
loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
parameters = new LoadFlowParameters()
.setNoGeneratorReactiveLimits(true)
.setUseReactiveLimits(false)
.setDistributedSlack(false);
parametersExt = OpenLoadFlowParameters.create(parameters)
.setMaxSlackBusCount(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ void testSaWithGeneratorContingency() {

LoadFlowParameters parameters = new LoadFlowParameters();
parameters.setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX);
parameters.setNoGeneratorReactiveLimits(true);
parameters.setUseReactiveLimits(false);

List<Contingency> contingencies = List.of(new Contingency("g1", new GeneratorContingency("g1")),
new Contingency("l34", new BranchContingency("l34")),
Expand Down

0 comments on commit 912bf92

Please sign in to comment.