From b7671322ee25cba1c13a276d72d9df868244a88a Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 27 Nov 2024 17:47:01 +0100 Subject: [PATCH 1/9] Divide OpenReacRunnerTest into several TUs Signed-off-by: p-arvy --- .../powsybl/openreac/OpenReacRunnerTest.java | 520 ------------------ .../AbstractOpenReacRunnerTest.java | 134 +++++ .../optimization/OpenReacAmplIOTest.java | 141 +++++ .../OpenReacOptimizationTest.java | 273 +++++++++ .../OpenReacParametrizationTest.java | 91 +++ .../TestLocalCommandExecutor.java | 2 +- 6 files changed, 640 insertions(+), 521 deletions(-) delete mode 100644 open-reac/src/test/java/com/powsybl/openreac/OpenReacRunnerTest.java create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java rename open-reac/src/test/java/com/powsybl/openreac/{ => optimization}/TestLocalCommandExecutor.java (97%) diff --git a/open-reac/src/test/java/com/powsybl/openreac/OpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/OpenReacRunnerTest.java deleted file mode 100644 index 4a0179f7..00000000 --- a/open-reac/src/test/java/com/powsybl/openreac/OpenReacRunnerTest.java +++ /dev/null @@ -1,520 +0,0 @@ -/** - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openreac; - -import com.google.common.jimfs.Configuration; -import com.google.common.jimfs.Jimfs; -import com.powsybl.commons.report.ReportNode; -import com.powsybl.commons.report.TypedValue; -import com.powsybl.commons.test.ComparisonUtils; -import com.powsybl.computation.ComputationManager; -import com.powsybl.computation.local.LocalCommandExecutor; -import com.powsybl.computation.local.LocalComputationConfig; -import com.powsybl.computation.local.LocalComputationManager; -import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; -import com.powsybl.iidm.network.*; -import com.powsybl.loadflow.LoadFlow; -import com.powsybl.loadflow.LoadFlowResult; -import com.powsybl.openreac.network.HvdcNetworkFactory; -import com.powsybl.openreac.network.VoltageControlNetworkFactory; -import com.powsybl.openreac.parameters.input.OpenReacParameters; -import com.powsybl.openreac.parameters.input.algo.OpenReacAmplLogLevel; -import com.powsybl.openreac.parameters.input.algo.ReactiveSlackBusesMode; -import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective; -import com.powsybl.openreac.parameters.input.algo.OpenReacSolverLogLevel; -import com.powsybl.openreac.parameters.output.OpenReacResult; -import com.powsybl.openreac.parameters.output.OpenReacStatus; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.FileSystem; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * @author Geoffroy Jamgotchian {@literal } - * @author Nicolas PIERRE {@literal } - */ -class OpenReacRunnerTest { - protected FileSystem fileSystem; - protected Path tmpDir; - - @BeforeEach - public void setUp() throws IOException { - fileSystem = Jimfs.newFileSystem(Configuration.unix()); - tmpDir = Files.createDirectory(fileSystem.getPath("tmp")); - } - - @AfterEach - void tearDown() throws IOException { - fileSystem.close(); - } - - private void assertEqualsToRef(Path p, String refFileName) throws IOException { - try (InputStream actual = Files.newInputStream(p)) { - ComparisonUtils.assertTxtEquals(Objects.requireNonNull(getClass().getResourceAsStream(refFileName)), actual); - } - } - - private Path getAmplExecPath() throws IOException { - Path execFolder; - try (Stream walk = Files.walk(tmpDir)) { - execFolder = walk.limit(2).collect(Collectors.toList()).get(1); - } - return execFolder; - } - - @Test - void testDefaultParamAlgoExport() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - OpenReacParameters parameters = new OpenReacParameters(); - - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of("empty_case/reactiveopf_results_indic.txt")); - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, - new OpenReacConfig(true), computationManager); - Path execFolder = getAmplExecPath(); - assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/openreac-input-algo-parameters/default.txt"); - } - } - - @Test - void testModifiedParamAlgoExport() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - OpenReacParameters parameters = new OpenReacParameters() - .setObjective(OpenReacOptimisationObjective.SPECIFIC_VOLTAGE_PROFILE) - .setObjectiveDistance(69) - .setLogLevelAmpl(OpenReacAmplLogLevel.WARNING) - .setLogLevelSolver(OpenReacSolverLogLevel.ONLY_RESULTS) - .setMinPlausibleLowVoltageLimit(0.7888) - .setMaxPlausibleHighVoltageLimit(1.3455) - .setReactiveSlackBusesMode(ReactiveSlackBusesMode.NO_GENERATION) - .setActivePowerVariationRate(0.88) - .setMinPlausibleActivePowerThreshold(0.45) - .setLowImpedanceThreshold(1e-5) - .setMinNominalVoltageIgnoredBus(2.) - .setMinNominalVoltageIgnoredVoltageBounds(0.75) - .setPQMax(3987.76) - .setLowActivePowerDefaultLimit(12.32) - .setHighActivePowerDefaultLimit(1452.66) - .setDefaultQmaxPmaxRatio(0.24) - .setDefaultMinimalQPRange(2.) - .setDefaultVariableScalingFactor(1.1222) - .setDefaultConstraintScalingFactor(0.7889) - .setReactiveSlackVariableScalingFactor(0.2) - .setTwoWindingTransformerRatioVariableScalingFactor(0.0045) - .setShuntVariableScalingFactor(0.101); - - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of("empty_case/reactiveopf_results_indic.txt")); - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, - new OpenReacConfig(true), computationManager); - Path execFolder = getAmplExecPath(); - assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/openreac-input-algo-parameters/modified_param_algo.txt"); - } - } - - @Test - void testInputFile() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - - OpenReacParameters parameters = new OpenReacParameters().setObjective( - OpenReacOptimisationObjective.BETWEEN_HIGH_AND_LOW_VOLTAGE_LIMIT) - .setObjectiveDistance(70) - .setReactiveSlackBusesMode(ReactiveSlackBusesMode.CONFIGURED) - .addVariableTwoWindingsTransformers(network.getTwoWindingsTransformerStream() - .limit(1) - .map(TwoWindingsTransformer::getId) - .collect(Collectors.toList())) - .addConstantQGenerators( - network.getGeneratorStream().limit(1).map(Generator::getId).collect(Collectors.toList())) - .addVariableShuntCompensators( - network.getShuntCompensatorStream().limit(1).map(ShuntCompensator::getId).collect(Collectors.toList())) - .addConfiguredReactiveSlackBuses( - network.getBusView().getBusStream().limit(1).map(Bus::getId).collect(Collectors.toList())); - - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of("empty_case/reactiveopf_results_indic.txt")); - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, - new OpenReacConfig(true), computationManager); - Path execFolder = getAmplExecPath(); - assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/expected_inputs/param_algo.txt"); - assertEqualsToRef(execFolder.resolve("param_generators_reactive.txt"), "/expected_inputs/param_generators_reactive.txt"); - assertEqualsToRef(execFolder.resolve("param_shunts.txt"), "/expected_inputs/param_shunts.txt"); - assertEqualsToRef(execFolder.resolve("param_transformers.txt"), "/expected_inputs/param_transformers.txt"); - assertEqualsToRef(execFolder.resolve("param_buses_with_reactive_slack.txt"), "/expected_inputs/param_buses_with_reactive_slack.txt"); - } - } - - @Test - void testOutputFileParsing() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - // To parse correctly data from output files, there must be an ID in the Ampl mapper - // For this we add dummy elements to the network, - // they will get exported, but the ampl mapper will have IDs for them. - // All the values are bad, and they are not used. - // RTC - network.getTwoWindingsTransformerStream() - .forEach(t -> t.newRatioTapChanger() - .setLowTapPosition(0) - .setTapPosition(0) - .beginStep() - .setR(0.01) - .setX(0.0001) - .setB(0) - .setG(0) - .setRho(1.1) - .endStep() - .add()); - // SVC - VoltageLevel vl = network.getVoltageLevelStream().iterator().next(); - vl.getBusBreakerView().newBus().setId("bus-1").add(); - vl.newStaticVarCompensator() - .setId("dummyStaticVarCompensator") - .setBus("bus-1") - .setBmin(1.1) - .setBmax(1.3) - .setRegulationMode(StaticVarCompensator.RegulationMode.OFF) - .add(); - // VSC - vl.newVscConverterStation() - .setId("dummyVscConverterStation") - .setConnectableBus("bus-1") - .setBus("bus-1") - .setLossFactor(1.1f) - .setVoltageSetpoint(405.0) - .setVoltageRegulatorOn(true) - .add(); - - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of("mock_outputs/reactiveopf_results_generators.csv", - "mock_outputs/reactiveopf_results_indic.txt", - "mock_outputs/reactiveopf_results_rtc.csv", - "mock_outputs/reactiveopf_results_shunts.csv", - "mock_outputs/reactiveopf_results_static_var_compensators.csv", - "mock_outputs/reactiveopf_results_vsc_converter_stations.csv", - "mock_outputs/reactiveopf_results_voltages.csv")); - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - OpenReacResult openReacResult = OpenReacRunner.run(network, - network.getVariantManager().getWorkingVariantId(), new OpenReacParameters(), new OpenReacConfig(true), - computationManager); - - assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); - assertEquals(1, openReacResult.getShuntsModifications().size()); - assertEquals(2, openReacResult.getTapPositionModifications().size()); - assertEquals(1, openReacResult.getSvcModifications().size()); - assertEquals(1, openReacResult.getVscModifications().size()); - assertEquals(7, openReacResult.getGeneratorModifications().size()); - assertEquals(3, openReacResult.getVoltageProfile().size()); - assertEquals(87, openReacResult.getIndicators().size()); - assertTrue(openReacResult.getReactiveSlacks().isEmpty()); - } - } - - @Test - void testRunAsync() throws IOException { - Network network = IeeeCdfNetworkFactory.create14(); - String subFolder = "openreac-output-ieee14"; - OpenReacParameters parameters = new OpenReacParameters(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of(subFolder + "/reactiveopf_results_generators.csv", - subFolder + "/reactiveopf_results_indic.txt", - subFolder + "/reactiveopf_results_rtc.csv", - subFolder + "/reactiveopf_results_shunts.csv", - subFolder + "/reactiveopf_results_static_var_compensators.csv", - subFolder + "/reactiveopf_results_vsc_converter_stations.csv", - subFolder + "/reactiveopf_results_voltages.csv")); - // To really run open reac, use the commented line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path -// try (ComputationManager computationManager = new LocalComputationManager()) { - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - CompletableFuture openReacResults = OpenReacRunner.runAsync(network, - network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true), - computationManager); - OpenReacResult openReacResult = openReacResults.join(); - assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); - } - } - - private void testAllModifAndLoadFlow(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { - runAndApplyAllModifications(network, subFolder, parameters, true, reportNode); - LoadFlowResult loadFlowResult = LoadFlow.run(network); - assertTrue(loadFlowResult.isFullyConverged()); - } - - @Test - void testOnlyGenerator() throws IOException { - Network network = IeeeCdfNetworkFactory.create14(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - testAllModifAndLoadFlow(network, "openreac-output-ieee14", new OpenReacParameters(), ReportNode.NO_OP); - } - - @Test - void testHvdc() throws IOException { - Network network = HvdcNetworkFactory.createNetworkWithGenerators2(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - network.getVscConverterStation("cs3").getTerminal().setP(0.0); - network.getVscConverterStation("cs4").getTerminal().setP(0.0); - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addConstantQGenerators(List.of("g1", "g2", "g5", "g6")); - testAllModifAndLoadFlow(network, "openreac-output-vsc", parameters, ReportNode.NO_OP); - } - - @Test - void testSvc() throws IOException { - Network network = VoltageControlNetworkFactory.createWithStaticVarCompensator(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - network.getVoltageLevelStream().forEach(vl -> vl.setLowVoltageLimit(380).setHighVoltageLimit(420)); - network.getStaticVarCompensator("svc1").setVoltageSetpoint(390).setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE); - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addConstantQGenerators(List.of("g1")); - testAllModifAndLoadFlow(network, "openreac-output-svc", parameters, ReportNode.NO_OP); - } - - @Test - void testShunt() throws IOException { - Network network = create(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - ShuntCompensator shunt = network.getShuntCompensator("SHUNT"); - assertFalse(shunt.getTerminal().isConnected()); - assertEquals(393, shunt.getTargetV()); - - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addVariableShuntCompensators(List.of(shunt.getId())); - ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); - testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); - - assertEquals(3, reportNode.getChildren().size()); - ReportNode reportShunts = reportNode.getChildren().get(2); - assertEquals(2, reportShunts.getChildren().size()); - assertEquals("shuntCompensatorDeltaOverThresholdCount", reportShunts.getChildren().get(0).getMessageKey()); - Map values = reportShunts.getChildren().get(0).getValues(); - assertEquals("1", values.get("shuntsCount").toString()); - assertEquals(TypedValue.INFO_SEVERITY.getValue(), values.get("reportSeverity").toString()); - - assertEquals("shuntCompensatorDeltaDiscretizedOptimizedOverThreshold", reportShunts.getChildren().get(1).getMessageKey()); - values = reportShunts.getChildren().get(1).getValues(); - assertEquals("SHUNT", values.get("shuntCompensatorId").toString()); - assertEquals("25", values.get("maxSectionCount").toString()); - assertEquals("160.0", values.get("discretizedValue").toString()); - assertEquals("123.4", values.get("optimalValue").toString()); - assertEquals(TypedValue.TRACE_SEVERITY.getValue(), values.get("reportSeverity").toString()); - - assertTrue(shunt.getTerminal().isConnected()); // shunt has been reconnected - assertEquals(420.8, shunt.getTargetV()); // targetV has been updated - } - - @Test - void testShuntWithDeltaBetweenDiscretizedAndOptimalReactiveValueUnderThreshold() throws IOException { - Network network = create(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - ShuntCompensator shunt = network.getShuntCompensator("SHUNT"); - assertFalse(shunt.getTerminal().isConnected()); - assertEquals(393, shunt.getTargetV()); - - OpenReacParameters parameters = new OpenReacParameters(); - parameters.setShuntCompensatorActivationAlertThreshold(100.); - parameters.addVariableShuntCompensators(List.of(shunt.getId())); - ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); - testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); - - assertEquals(2, reportNode.getChildren().size()); - - assertTrue(shunt.getTerminal().isConnected()); // shunt has been reconnected - assertEquals(420.8, shunt.getTargetV()); // targetV has been updated - } - - @Test - void testTransformer() throws IOException { - Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - RatioTapChanger rtc = network.getTwoWindingsTransformer("T2wT").getRatioTapChanger() - .setTapPosition(2) - .setTargetDeadband(0) - .setRegulating(true); - assertEquals(2, rtc.getTapPosition()); - assertEquals(33.0, rtc.getTargetV()); - - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addConstantQGenerators(List.of("GEN_1")); - parameters.addVariableTwoWindingsTransformers(List.of("T2wT")); - testAllModifAndLoadFlow(network, "openreac-output-transfo", parameters, ReportNode.NO_OP); - assertEquals(0, rtc.getTapPosition()); - assertEquals(22.935, rtc.getTargetV()); - } - - @Test - void testRealNetwork() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network - OpenReacParameters parameters = new OpenReacParameters(); - testAllModifAndLoadFlow(network, "openreac-output-real-network", parameters, ReportNode.NO_OP); - } - - @Test - void testWarmStart() throws IOException { - Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); - setDefaultVoltageLimits(network); - String subFolder = "openreac-output-warm-start"; - OpenReacParameters parameters = new OpenReacParameters(); - - runAndApplyAllModifications(network, subFolder, parameters, false, ReportNode.NO_OP); // without warm start, no update - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_1").getV()); - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_1").getAngle()); - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_2").getV()); - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_2").getAngle()); - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_3").getV()); - assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_3").getAngle()); - - runAndApplyAllModifications(network, subFolder, parameters, true, ReportNode.NO_OP); - assertEquals(119.592, network.getBusBreakerView().getBus("BUS_1").getV()); - assertEquals(0.802, network.getBusBreakerView().getBus("BUS_1").getAngle(), 0.001); - assertEquals(118.8, network.getBusBreakerView().getBus("BUS_2").getV()); - assertEquals(0, network.getBusBreakerView().getBus("BUS_2").getAngle()); - assertEquals(22.935, network.getBusBreakerView().getBus("BUS_3").getV()); - assertEquals(-4.698, network.getBusBreakerView().getBus("BUS_3").getAngle(), 0.001); - } - - private void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, - boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of(subFolder + "/reactiveopf_results_generators.csv", - subFolder + "/reactiveopf_results_indic.txt", - subFolder + "/reactiveopf_results_rtc.csv", - subFolder + "/reactiveopf_results_shunts.csv", - subFolder + "/reactiveopf_results_static_var_compensators.csv", - subFolder + "/reactiveopf_results_vsc_converter_stations.csv", - subFolder + "/reactiveopf_results_voltages.csv")); - // To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path -// try (ComputationManager computationManager = new LocalComputationManager()) { - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { - OpenReacResult openReacResult = OpenReacRunner.run(network, - network.getVariantManager().getWorkingVariantId(), parameters, - new OpenReacConfig(true), computationManager, reportNode, null); - assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); - openReacResult.setUpdateNetworkWithVoltages(updateNetworkWithVoltages); - openReacResult.applyAllModifications(network); - } - } - - public static Network create() { - Network network = Network.create("svc", "test"); - Substation s1 = network.newSubstation() - .setId("S1") - .add(); - Substation s2 = network.newSubstation() - .setId("S2") - .add(); - VoltageLevel vl1 = s1.newVoltageLevel() - .setId("vl1") - .setNominalV(400) - .setHighVoltageLimit(420) - .setLowVoltageLimit(380) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl1.getBusBreakerView().newBus() - .setId("b1") - .add(); - vl1.newGenerator() - .setId("g1") - .setConnectableBus("b1") - .setBus("b1") - .setTargetP(101.3664) - .setTargetV(390) - .setMinP(0) - .setMaxP(150) - .setVoltageRegulatorOn(true) - .add(); - VoltageLevel vl2 = s2.newVoltageLevel() - .setId("vl2") - .setNominalV(400) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl2.getBusBreakerView().newBus() - .setId("b2") - .add(); - vl2.newLoad() - .setId("ld1") - .setConnectableBus("b2") - .setBus("b2") - .setP0(101) - .setQ0(150) - .add(); - VoltageLevel vl3 = s2.newVoltageLevel() - .setId("vl3") - .setNominalV(400) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl3.getBusBreakerView().newBus() - .setId("b3") - .add(); - vl3.newShuntCompensator() - .setId("SHUNT") - // .setBus("b3") - .setConnectableBus("b3") - .setSectionCount(0) - .setVoltageRegulatorOn(true) - .setTargetV(393) - .setTargetDeadband(5.0) - .newLinearModel() - .setMaximumSectionCount(25) - .setBPerSection(1e-3) - .add() - .add(); - network.newLine() - .setId("l1") - .setBus1("b1") - .setBus2("b2") - .setR(1) - .setX(3) - .add(); - network.newLine() - .setId("l2") - .setBus1("b3") - .setBus2("b2") - .setR(1) - .setX(3) - .add(); - return network; - } - - void setDefaultVoltageLimits(Network network) { - for (VoltageLevel vl : network.getVoltageLevels()) { - if (vl.getLowVoltageLimit() <= 0 || Double.isNaN(vl.getLowVoltageLimit())) { - vl.setLowVoltageLimit(0.5 * vl.getNominalV()); - } - if (Double.isNaN(vl.getHighVoltageLimit())) { - vl.setHighVoltageLimit(1.5 * vl.getNominalV()); - } - } - } -} diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java new file mode 100644 index 00000000..52dab131 --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openreac.optimization; + +import com.google.common.jimfs.Configuration; +import com.google.common.jimfs.Jimfs; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.commons.test.ComparisonUtils; +import com.powsybl.computation.ComputationManager; +import com.powsybl.computation.local.LocalCommandExecutor; +import com.powsybl.computation.local.LocalComputationConfig; +import com.powsybl.computation.local.LocalComputationManager; +import com.powsybl.iidm.network.*; +import com.powsybl.loadflow.LoadFlow; +import com.powsybl.loadflow.LoadFlowResult; +import com.powsybl.openreac.OpenReacConfig; +import com.powsybl.openreac.OpenReacRunner; +import com.powsybl.openreac.parameters.input.OpenReacParameters; +import com.powsybl.openreac.parameters.output.OpenReacResult; +import com.powsybl.openreac.parameters.output.OpenReacStatus; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * @author Geoffroy Jamgotchian {@literal } + * @author Nicolas PIERRE {@literal } + */ +abstract class AbstractOpenReacRunnerTest { + protected FileSystem fileSystem; + protected Path tmpDir; + + @BeforeEach + public void setUp() throws IOException { + fileSystem = Jimfs.newFileSystem(Configuration.unix()); + tmpDir = Files.createDirectory(fileSystem.getPath("tmp")); + } + + @AfterEach + void tearDown() throws IOException { + fileSystem.close(); + } + + protected void assertEqualsToRef(Path p, String refFileName) throws IOException { + try (InputStream actual = Files.newInputStream(p)) { + ComparisonUtils.assertTxtEquals(Objects.requireNonNull(getClass().getResourceAsStream(refFileName)), actual); + } + } + + protected Path getAmplExecPath() throws IOException { + Path execFolder; + try (Stream walk = Files.walk(tmpDir)) { + execFolder = walk.limit(2).collect(Collectors.toList()).get(1); + } + return execFolder; + } + + /** + * Runs OpenReac, apply the results and run a load flow. + */ + protected void testAllModifAndLoadFlow(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { + runAndApplyAllModifications(network, subFolder, parameters, true, reportNode); + LoadFlowResult loadFlowResult = LoadFlow.run(network); + assertTrue(loadFlowResult.isFullyConverged()); + } + + /** + * Runs OpenReac and apply the results on the network. + * The application of the voltage plan calculated by optimization is optional. + */ + protected void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, + boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { + OpenReacResult openReacResult = runOpenReac(network, subFolder, parameters, reportNode); + assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); + openReacResult.setUpdateNetworkWithVoltages(updateNetworkWithVoltages); + openReacResult.applyAllModifications(network); + } + + /** + * Runs OpenReac and returns associated result. + * Note that OpenReac is not really executed by default. If the execution line is not uncommented, + * the results are retrieved and stored in an {@link OpenReacResult} object. + */ + protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { + // set default voltage limits to every voltage levels of the network + setDefaultVoltageLimits(network); + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of(subFolder + "/reactiveopf_results_generators.csv", + subFolder + "/reactiveopf_results_indic.txt", + subFolder + "/reactiveopf_results_rtc.csv", + subFolder + "/reactiveopf_results_shunts.csv", + subFolder + "/reactiveopf_results_static_var_compensators.csv", + subFolder + "/reactiveopf_results_vsc_converter_stations.csv", + subFolder + "/reactiveopf_results_voltages.csv")); + // To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path +// try (ComputationManager computationManager = new LocalComputationManager()) { + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + return OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, + new OpenReacConfig(true), computationManager, reportNode, null); + } + } + + /** + * Add voltage limits to voltage levels with undefined limits. + * OpenReac needs voltage limits to run optimization. + */ + void setDefaultVoltageLimits(Network network) { + for (VoltageLevel vl : network.getVoltageLevels()) { + if (vl.getLowVoltageLimit() <= 0 || Double.isNaN(vl.getLowVoltageLimit())) { + vl.setLowVoltageLimit(0.5 * vl.getNominalV()); + } + if (Double.isNaN(vl.getHighVoltageLimit())) { + vl.setHighVoltageLimit(1.5 * vl.getNominalV()); + } + } + } +} diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java new file mode 100644 index 00000000..d8b31d34 --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openreac.optimization; + +import com.powsybl.computation.ComputationManager; +import com.powsybl.computation.local.LocalCommandExecutor; +import com.powsybl.computation.local.LocalComputationConfig; +import com.powsybl.computation.local.LocalComputationManager; +import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; +import com.powsybl.iidm.network.*; +import com.powsybl.openreac.OpenReacConfig; +import com.powsybl.openreac.OpenReacRunner; +import com.powsybl.openreac.parameters.input.OpenReacParameters; +import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective; +import com.powsybl.openreac.parameters.input.algo.ReactiveSlackBusesMode; +import com.powsybl.openreac.parameters.output.OpenReacResult; +import com.powsybl.openreac.parameters.output.OpenReacStatus; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.ForkJoinPool; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * @author Geoffroy Jamgotchian {@literal } + * @author Nicolas PIERRE {@literal } + */ +public class OpenReacAmplIOTest extends AbstractOpenReacRunnerTest { + + @Test + void testInputFile() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network + + OpenReacParameters parameters = new OpenReacParameters().setObjective( + OpenReacOptimisationObjective.BETWEEN_HIGH_AND_LOW_VOLTAGE_LIMIT) + .setObjectiveDistance(70) + .setReactiveSlackBusesMode(ReactiveSlackBusesMode.CONFIGURED) + .addVariableTwoWindingsTransformers(network.getTwoWindingsTransformerStream() + .limit(1) + .map(TwoWindingsTransformer::getId) + .collect(Collectors.toList())) + .addConstantQGenerators( + network.getGeneratorStream().limit(1).map(Generator::getId).collect(Collectors.toList())) + .addVariableShuntCompensators( + network.getShuntCompensatorStream().limit(1).map(ShuntCompensator::getId).collect(Collectors.toList())) + .addConfiguredReactiveSlackBuses( + network.getBusView().getBusStream().limit(1).map(Bus::getId).collect(Collectors.toList())); + + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of("empty_case/reactiveopf_results_indic.txt")); + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, + new OpenReacConfig(true), computationManager); + Path execFolder = getAmplExecPath(); + assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/expected_inputs/param_algo.txt"); + assertEqualsToRef(execFolder.resolve("param_generators_reactive.txt"), "/expected_inputs/param_generators_reactive.txt"); + assertEqualsToRef(execFolder.resolve("param_shunts.txt"), "/expected_inputs/param_shunts.txt"); + assertEqualsToRef(execFolder.resolve("param_transformers.txt"), "/expected_inputs/param_transformers.txt"); + assertEqualsToRef(execFolder.resolve("param_buses_with_reactive_slack.txt"), "/expected_inputs/param_buses_with_reactive_slack.txt"); + } + } + + @Test + void testOutputFileParsing() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network + // To parse correctly data from output files, there must be an ID in the Ampl mapper + // For this we add dummy elements to the network, + // they will get exported, but the ampl mapper will have IDs for them. + // All the values are bad, and they are not used. + // RTC + network.getTwoWindingsTransformerStream() + .forEach(t -> t.newRatioTapChanger() + .setLowTapPosition(0) + .setTapPosition(0) + .beginStep() + .setR(0.01) + .setX(0.0001) + .setB(0) + .setG(0) + .setRho(1.1) + .endStep() + .add()); + // SVC + VoltageLevel vl = network.getVoltageLevelStream().iterator().next(); + vl.getBusBreakerView().newBus().setId("bus-1").add(); + vl.newStaticVarCompensator() + .setId("dummyStaticVarCompensator") + .setBus("bus-1") + .setBmin(1.1) + .setBmax(1.3) + .setRegulationMode(StaticVarCompensator.RegulationMode.OFF) + .add(); + // VSC + vl.newVscConverterStation() + .setId("dummyVscConverterStation") + .setConnectableBus("bus-1") + .setBus("bus-1") + .setLossFactor(1.1f) + .setVoltageSetpoint(405.0) + .setVoltageRegulatorOn(true) + .add(); + + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of("mock_outputs/reactiveopf_results_generators.csv", + "mock_outputs/reactiveopf_results_indic.txt", + "mock_outputs/reactiveopf_results_rtc.csv", + "mock_outputs/reactiveopf_results_shunts.csv", + "mock_outputs/reactiveopf_results_static_var_compensators.csv", + "mock_outputs/reactiveopf_results_vsc_converter_stations.csv", + "mock_outputs/reactiveopf_results_voltages.csv")); + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + OpenReacResult openReacResult = OpenReacRunner.run(network, + network.getVariantManager().getWorkingVariantId(), new OpenReacParameters(), new OpenReacConfig(true), + computationManager); + + assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); + assertEquals(1, openReacResult.getShuntsModifications().size()); + assertEquals(2, openReacResult.getTapPositionModifications().size()); + assertEquals(1, openReacResult.getSvcModifications().size()); + assertEquals(1, openReacResult.getVscModifications().size()); + assertEquals(7, openReacResult.getGeneratorModifications().size()); + assertEquals(3, openReacResult.getVoltageProfile().size()); + assertEquals(87, openReacResult.getIndicators().size()); + assertTrue(openReacResult.getReactiveSlacks().isEmpty()); + } + } + +} diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java new file mode 100644 index 00000000..b7a2ff18 --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java @@ -0,0 +1,273 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openreac.optimization; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.commons.report.TypedValue; +import com.powsybl.computation.ComputationManager; +import com.powsybl.computation.local.LocalCommandExecutor; +import com.powsybl.computation.local.LocalComputationConfig; +import com.powsybl.computation.local.LocalComputationManager; +import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; +import com.powsybl.iidm.network.*; +import com.powsybl.openreac.OpenReacConfig; +import com.powsybl.openreac.OpenReacRunner; +import com.powsybl.openreac.network.HvdcNetworkFactory; +import com.powsybl.openreac.network.VoltageControlNetworkFactory; +import com.powsybl.openreac.parameters.input.OpenReacParameters; +import com.powsybl.openreac.parameters.output.OpenReacResult; +import com.powsybl.openreac.parameters.output.OpenReacStatus; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; + +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author Geoffroy Jamgotchian {@literal } + * @author Nicolas PIERRE {@literal } + */ +public class OpenReacOptimizationTest extends AbstractOpenReacRunnerTest { + + @Test + void testRunAsync() throws IOException { + Network network = IeeeCdfNetworkFactory.create14(); + String subFolder = "openreac-output-ieee14"; + OpenReacParameters parameters = new OpenReacParameters(); + setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of(subFolder + "/reactiveopf_results_generators.csv", + subFolder + "/reactiveopf_results_indic.txt", + subFolder + "/reactiveopf_results_rtc.csv", + subFolder + "/reactiveopf_results_shunts.csv", + subFolder + "/reactiveopf_results_static_var_compensators.csv", + subFolder + "/reactiveopf_results_vsc_converter_stations.csv", + subFolder + "/reactiveopf_results_voltages.csv")); + // To really run open reac, use the commented line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path +// try (ComputationManager computationManager = new LocalComputationManager()) { + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + CompletableFuture openReacResults = OpenReacRunner.runAsync(network, + network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true), + computationManager); + OpenReacResult openReacResult = openReacResults.join(); + assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); + } + } + + @Test + void testOnlyGenerator() throws IOException { + Network network = IeeeCdfNetworkFactory.create14(); + testAllModifAndLoadFlow(network, "openreac-output-ieee14", new OpenReacParameters(), ReportNode.NO_OP); + } + + @Test + void testHvdc() throws IOException { + Network network = HvdcNetworkFactory.createNetworkWithGenerators2(); + network.getVscConverterStation("cs3").getTerminal().setP(0.0); + network.getVscConverterStation("cs4").getTerminal().setP(0.0); + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addConstantQGenerators(List.of("g1", "g2", "g5", "g6")); + testAllModifAndLoadFlow(network, "openreac-output-vsc", parameters, ReportNode.NO_OP); + } + + @Test + void testSvc() throws IOException { + Network network = VoltageControlNetworkFactory.createWithStaticVarCompensator(); + network.getVoltageLevelStream().forEach(vl -> vl.setLowVoltageLimit(380).setHighVoltageLimit(420)); + network.getStaticVarCompensator("svc1").setVoltageSetpoint(390).setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE); + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addConstantQGenerators(List.of("g1")); + testAllModifAndLoadFlow(network, "openreac-output-svc", parameters, ReportNode.NO_OP); + } + + @Test + void testShunt() throws IOException { + Network network = create(); + ShuntCompensator shunt = network.getShuntCompensator("SHUNT"); + assertFalse(shunt.getTerminal().isConnected()); + assertEquals(393, shunt.getTargetV()); + + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addVariableShuntCompensators(List.of(shunt.getId())); + ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); + testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); + + assertEquals(3, reportNode.getChildren().size()); + ReportNode reportShunts = reportNode.getChildren().get(2); + assertEquals(2, reportShunts.getChildren().size()); + assertEquals("shuntCompensatorDeltaOverThresholdCount", reportShunts.getChildren().get(0).getMessageKey()); + Map values = reportShunts.getChildren().get(0).getValues(); + assertEquals("1", values.get("shuntsCount").toString()); + assertEquals(TypedValue.INFO_SEVERITY.getValue(), values.get("reportSeverity").toString()); + + assertEquals("shuntCompensatorDeltaDiscretizedOptimizedOverThreshold", reportShunts.getChildren().get(1).getMessageKey()); + values = reportShunts.getChildren().get(1).getValues(); + assertEquals("SHUNT", values.get("shuntCompensatorId").toString()); + assertEquals("25", values.get("maxSectionCount").toString()); + assertEquals("160.0", values.get("discretizedValue").toString()); + assertEquals("123.4", values.get("optimalValue").toString()); + assertEquals(TypedValue.TRACE_SEVERITY.getValue(), values.get("reportSeverity").toString()); + + assertTrue(shunt.getTerminal().isConnected()); // shunt has been reconnected + assertEquals(420.8, shunt.getTargetV()); // targetV has been updated + } + + @Test + void testShuntWithDeltaBetweenDiscretizedAndOptimalReactiveValueUnderThreshold() throws IOException { + Network network = create(); + ShuntCompensator shunt = network.getShuntCompensator("SHUNT"); + assertFalse(shunt.getTerminal().isConnected()); + assertEquals(393, shunt.getTargetV()); + + OpenReacParameters parameters = new OpenReacParameters(); + parameters.setShuntCompensatorActivationAlertThreshold(100.); + parameters.addVariableShuntCompensators(List.of(shunt.getId())); + ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); + testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); + + assertEquals(2, reportNode.getChildren().size()); + + assertTrue(shunt.getTerminal().isConnected()); // shunt has been reconnected + assertEquals(420.8, shunt.getTargetV()); // targetV has been updated + } + + @Test + void testTransformer() throws IOException { + Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); + RatioTapChanger rtc = network.getTwoWindingsTransformer("T2wT").getRatioTapChanger() + .setTapPosition(2) + .setTargetDeadband(0) + .setRegulating(true); + assertEquals(2, rtc.getTapPosition()); + assertEquals(33.0, rtc.getTargetV()); + + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addConstantQGenerators(List.of("GEN_1")); + parameters.addVariableTwoWindingsTransformers(List.of("T2wT")); + testAllModifAndLoadFlow(network, "openreac-output-transfo", parameters, ReportNode.NO_OP); + assertEquals(0, rtc.getTapPosition()); + assertEquals(22.935, rtc.getTargetV()); + } + + @Test + void testRealNetwork() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + OpenReacParameters parameters = new OpenReacParameters(); + testAllModifAndLoadFlow(network, "openreac-output-real-network", parameters, ReportNode.NO_OP); + } + + @Test + void testWarmStart() throws IOException { + Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); + String subFolder = "openreac-output-warm-start"; + OpenReacParameters parameters = new OpenReacParameters(); + + runAndApplyAllModifications(network, subFolder, parameters, false, ReportNode.NO_OP); // without warm start, no update + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_1").getV()); + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_1").getAngle()); + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_2").getV()); + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_2").getAngle()); + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_3").getV()); + assertEquals(Double.NaN, network.getBusBreakerView().getBus("BUS_3").getAngle()); + + runAndApplyAllModifications(network, subFolder, parameters, true, ReportNode.NO_OP); + assertEquals(119.592, network.getBusBreakerView().getBus("BUS_1").getV()); + assertEquals(0.802, network.getBusBreakerView().getBus("BUS_1").getAngle(), 0.001); + assertEquals(118.8, network.getBusBreakerView().getBus("BUS_2").getV()); + assertEquals(0, network.getBusBreakerView().getBus("BUS_2").getAngle()); + assertEquals(22.935, network.getBusBreakerView().getBus("BUS_3").getV()); + assertEquals(-4.698, network.getBusBreakerView().getBus("BUS_3").getAngle(), 0.001); + } + + public static Network create() { + Network network = Network.create("svc", "test"); + Substation s1 = network.newSubstation() + .setId("S1") + .add(); + Substation s2 = network.newSubstation() + .setId("S2") + .add(); + VoltageLevel vl1 = s1.newVoltageLevel() + .setId("vl1") + .setNominalV(400) + .setHighVoltageLimit(420) + .setLowVoltageLimit(380) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl1.getBusBreakerView().newBus() + .setId("b1") + .add(); + vl1.newGenerator() + .setId("g1") + .setConnectableBus("b1") + .setBus("b1") + .setTargetP(101.3664) + .setTargetV(390) + .setMinP(0) + .setMaxP(150) + .setVoltageRegulatorOn(true) + .add(); + VoltageLevel vl2 = s2.newVoltageLevel() + .setId("vl2") + .setNominalV(400) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl2.getBusBreakerView().newBus() + .setId("b2") + .add(); + vl2.newLoad() + .setId("ld1") + .setConnectableBus("b2") + .setBus("b2") + .setP0(101) + .setQ0(150) + .add(); + VoltageLevel vl3 = s2.newVoltageLevel() + .setId("vl3") + .setNominalV(400) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl3.getBusBreakerView().newBus() + .setId("b3") + .add(); + vl3.newShuntCompensator() + .setId("SHUNT") + // .setBus("b3") + .setConnectableBus("b3") + .setSectionCount(0) + .setVoltageRegulatorOn(true) + .setTargetV(393) + .setTargetDeadband(5.0) + .newLinearModel() + .setMaximumSectionCount(25) + .setBPerSection(1e-3) + .add() + .add(); + network.newLine() + .setId("l1") + .setBus1("b1") + .setBus2("b2") + .setR(1) + .setX(3) + .add(); + network.newLine() + .setId("l2") + .setBus1("b3") + .setBus2("b2") + .setR(1) + .setX(3) + .add(); + return network; + } + +} diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java new file mode 100644 index 00000000..c850c96a --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openreac.optimization; + +import com.powsybl.computation.ComputationManager; +import com.powsybl.computation.local.LocalCommandExecutor; +import com.powsybl.computation.local.LocalComputationConfig; +import com.powsybl.computation.local.LocalComputationManager; +import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; +import com.powsybl.iidm.network.Network; +import com.powsybl.openreac.OpenReacConfig; +import com.powsybl.openreac.OpenReacRunner; +import com.powsybl.openreac.parameters.input.OpenReacParameters; +import com.powsybl.openreac.parameters.input.algo.OpenReacAmplLogLevel; +import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective; +import com.powsybl.openreac.parameters.input.algo.OpenReacSolverLogLevel; +import com.powsybl.openreac.parameters.input.algo.ReactiveSlackBusesMode; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.ForkJoinPool; + +/** + * @author Geoffroy Jamgotchian {@literal } + * @author Nicolas PIERRE {@literal } + */ +public class OpenReacParametrizationTest extends AbstractOpenReacRunnerTest { + + @Test + void testDefaultParamAlgoExport() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network + OpenReacParameters parameters = new OpenReacParameters(); + + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of("empty_case/reactiveopf_results_indic.txt")); + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, + new OpenReacConfig(true), computationManager); + Path execFolder = getAmplExecPath(); + assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/openreac-input-algo-parameters/default.txt"); + } + } + + @Test + void testModifiedParamAlgoExport() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network + OpenReacParameters parameters = new OpenReacParameters() + .setObjective(OpenReacOptimisationObjective.SPECIFIC_VOLTAGE_PROFILE) + .setObjectiveDistance(69) + .setLogLevelAmpl(OpenReacAmplLogLevel.WARNING) + .setLogLevelSolver(OpenReacSolverLogLevel.ONLY_RESULTS) + .setMinPlausibleLowVoltageLimit(0.7888) + .setMaxPlausibleHighVoltageLimit(1.3455) + .setReactiveSlackBusesMode(ReactiveSlackBusesMode.NO_GENERATION) + .setActivePowerVariationRate(0.88) + .setMinPlausibleActivePowerThreshold(0.45) + .setLowImpedanceThreshold(1e-5) + .setMinNominalVoltageIgnoredBus(2.) + .setMinNominalVoltageIgnoredVoltageBounds(0.75) + .setPQMax(3987.76) + .setLowActivePowerDefaultLimit(12.32) + .setHighActivePowerDefaultLimit(1452.66) + .setDefaultQmaxPmaxRatio(0.24) + .setDefaultMinimalQPRange(2.) + .setDefaultVariableScalingFactor(1.1222) + .setDefaultConstraintScalingFactor(0.7889) + .setReactiveSlackVariableScalingFactor(0.2) + .setTwoWindingTransformerRatioVariableScalingFactor(0.0045) + .setShuntVariableScalingFactor(0.101); + + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of("empty_case/reactiveopf_results_indic.txt")); + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { + OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, + new OpenReacConfig(true), computationManager); + Path execFolder = getAmplExecPath(); + assertEqualsToRef(execFolder.resolve("param_algo.txt"), "/openreac-input-algo-parameters/modified_param_algo.txt"); + } + } + +} diff --git a/open-reac/src/test/java/com/powsybl/openreac/TestLocalCommandExecutor.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/TestLocalCommandExecutor.java similarity index 97% rename from open-reac/src/test/java/com/powsybl/openreac/TestLocalCommandExecutor.java rename to open-reac/src/test/java/com/powsybl/openreac/optimization/TestLocalCommandExecutor.java index cffaba1f..fa55a0ae 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/TestLocalCommandExecutor.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/TestLocalCommandExecutor.java @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package com.powsybl.openreac; +package com.powsybl.openreac.optimization; import com.powsybl.computation.local.LocalCommandExecutor; From 8da89b08f17688747f0be11bb4ddae8dd886ee93 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 27 Nov 2024 18:48:26 +0100 Subject: [PATCH 2/9] Add TUs for ACOPF indicators Signed-off-by: p-arvy --- .../AbstractOpenReacRunnerTest.java | 14 +- ... OpenReacOptimizationAndLoadFlowTest.java} | 7 +- .../OpenReacOptimizationIndicatorsTest.java | 192 ++++++++++++++++++ 3 files changed, 208 insertions(+), 5 deletions(-) rename open-reac/src/test/java/com/powsybl/openreac/optimization/{OpenReacOptimizationTest.java => OpenReacOptimizationAndLoadFlowTest.java} (97%) create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index 52dab131..0ef48f70 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -12,7 +12,6 @@ import com.powsybl.commons.test.ComparisonUtils; import com.powsybl.computation.ComputationManager; import com.powsybl.computation.local.LocalCommandExecutor; -import com.powsybl.computation.local.LocalComputationConfig; import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.iidm.network.*; import com.powsybl.loadflow.LoadFlow; @@ -92,6 +91,13 @@ protected void runAndApplyAllModifications(Network network, String subFolder, Op openReacResult.applyAllModifications(network); } + /** + * Runs OpenReac and returns associated result. + */ + protected OpenReacResult runOpenReac(Network network, String subFolder) throws IOException { + return runOpenReac(network, subFolder, new OpenReacParameters(), ReportNode.NO_OP); + } + /** * Runs OpenReac and returns associated result. * Note that OpenReac is not really executed by default. If the execution line is not uncommented, @@ -109,9 +115,9 @@ protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReac subFolder + "/reactiveopf_results_vsc_converter_stations.csv", subFolder + "/reactiveopf_results_voltages.csv")); // To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path -// try (ComputationManager computationManager = new LocalComputationManager()) { - try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), - localCommandExecutor, ForkJoinPool.commonPool())) { + try (ComputationManager computationManager = new LocalComputationManager()) { +// try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), +// localCommandExecutor, ForkJoinPool.commonPool())) { return OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true), computationManager, reportNode, null); } diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java similarity index 97% rename from open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java rename to open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java index b7a2ff18..fa431d9e 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java @@ -14,6 +14,8 @@ import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.*; +import com.powsybl.loadflow.LoadFlow; +import com.powsybl.loadflow.LoadFlowResult; import com.powsybl.openreac.OpenReacConfig; import com.powsybl.openreac.OpenReacRunner; import com.powsybl.openreac.network.HvdcNetworkFactory; @@ -36,7 +38,7 @@ * @author Geoffroy Jamgotchian {@literal } * @author Nicolas PIERRE {@literal } */ -public class OpenReacOptimizationTest extends AbstractOpenReacRunnerTest { +public class OpenReacOptimizationAndLoadFlowTest extends AbstractOpenReacRunnerTest { @Test void testRunAsync() throws IOException { @@ -187,6 +189,9 @@ void testWarmStart() throws IOException { assertEquals(0, network.getBusBreakerView().getBus("BUS_2").getAngle()); assertEquals(22.935, network.getBusBreakerView().getBus("BUS_3").getV()); assertEquals(-4.698, network.getBusBreakerView().getBus("BUS_3").getAngle(), 0.001); + + LoadFlowResult loadFlowResult = LoadFlow.run(network); + assertTrue(loadFlowResult.isFullyConverged()); } public static Network create() { diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java new file mode 100644 index 00000000..8fabdb72 --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java @@ -0,0 +1,192 @@ +/** + * Copyright (c) 2024, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.openreac.optimization; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; +import com.powsybl.iidm.network.Network; +import com.powsybl.openreac.network.HvdcNetworkFactory; +import com.powsybl.openreac.network.VoltageControlNetworkFactory; +import com.powsybl.openreac.parameters.input.OpenReacParameters; +import com.powsybl.openreac.parameters.input.algo.OpenReacAmplLogLevel; +import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective; +import com.powsybl.openreac.parameters.input.algo.OpenReacSolverLogLevel; +import com.powsybl.openreac.parameters.input.algo.ReactiveSlackBusesMode; +import com.powsybl.openreac.parameters.output.OpenReacResult; +import com.powsybl.openreac.parameters.output.OpenReacStatus; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author Pierre ARVY {@literal } + */ +public class OpenReacOptimizationIndicatorsTest extends AbstractOpenReacRunnerTest { + + // TODO : find some parameters that are working. Take things that seem good + @Test + void testInputIndicators() throws IOException { + Network network = IeeeCdfNetworkFactory.create57(); + OpenReacParameters parameters = new OpenReacParameters() + .setObjective(OpenReacOptimisationObjective.SPECIFIC_VOLTAGE_PROFILE) + .setObjectiveDistance(69) + .setLogLevelAmpl(OpenReacAmplLogLevel.WARNING) + .setLogLevelSolver(OpenReacSolverLogLevel.ONLY_RESULTS) + .setMinPlausibleLowVoltageLimit(0.7888) + .setMaxPlausibleHighVoltageLimit(1.3455) + .setReactiveSlackBusesMode(ReactiveSlackBusesMode.NO_GENERATION) + .setActivePowerVariationRate(0.88) + .setMinPlausibleActivePowerThreshold(0.45) + .setLowImpedanceThreshold(1e-5) + .setMinNominalVoltageIgnoredBus(2.) + .setMinNominalVoltageIgnoredVoltageBounds(0.75) + .setPQMax(3987.76) + .setLowActivePowerDefaultLimit(12.32) + .setHighActivePowerDefaultLimit(1452.66) + .setDefaultQmaxPmaxRatio(0.24) + .setDefaultMinimalQPRange(2.) + .setDefaultVariableScalingFactor(1.1222) + .setDefaultConstraintScalingFactor(0.7889) + .setReactiveSlackVariableScalingFactor(0.2) + .setTwoWindingTransformerRatioVariableScalingFactor(0.0045) + .setShuntVariableScalingFactor(0.101); + OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + + // verify buses outside main SC have been excluded + assertEquals("INFO", result.getIndicators().get("log_level_ampl")); + assertEquals("2", result.getIndicators().get("log_level_knitro")); + assertEquals("2", result.getIndicators().get("objective_choice")); + assertEquals("0.69", result.getIndicators().get("ratio_voltage_target")); + assertEquals("2", result.getIndicators().get("coeff_alpha")); + assertEquals("2", result.getIndicators().get("Pnull")); + assertEquals("2", result.getIndicators().get("Znull")); + assertEquals("2", result.getIndicators().get("epsilon_nominal_voltage")); + assertEquals("2", result.getIndicators().get("min_plausible_low_voltage_limit")); + assertEquals("2", result.getIndicators().get("max_plausible_high_voltage_limit")); + assertEquals("2", result.getIndicators().get("ignore_voltage_bounds")); + assertEquals("16", result.getIndicators().get("buses_with_reactive_slacks")); + assertEquals("12", result.getIndicators().get("PQmax")); + assertEquals("4", result.getIndicators().get("defaultPmax")); + assertEquals("1", result.getIndicators().get("defaultPmin")); + assertEquals("1", result.getIndicators().get("defaultQmaxPmaxRatio")); + assertEquals("1", result.getIndicators().get("defaultQmin")); + assertEquals("1", result.getIndicators().get("defaultQmax")); + assertEquals("1", result.getIndicators().get("minimalQPrange")); + assertEquals("1", result.getIndicators().get("default_variable_scaling_factor")); + assertEquals("1", result.getIndicators().get("default_constraint_scaling_factor")); + assertEquals("1", result.getIndicators().get("reactive_slack_variable_scaling_factor")); + assertEquals("1", result.getIndicators().get("transformer_ratio_variable_scaling_factor")); + assertEquals("1", result.getIndicators().get("shunt_variable_scaling_factor")); + } + + @Test + void testBusIndicators() throws IOException { + Network network = HvdcNetworkFactory.createLccWithBiggerComponents(); + network.getBusBreakerView().getBus("b1").setV(400); + OpenReacResult result = runOpenReac(network, ""); + + // verify buses outside main SC have been excluded + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals("16", result.getIndicators().get("nb_substations")); + assertEquals("16", result.getIndicators().get("nb_bus_in_data_file")); + assertEquals("16", result.getIndicators().get("nb_bus_in_ACDC_CC")); + assertEquals("12", result.getIndicators().get("nb_bus_in_AC_CC")); + assertEquals("4", result.getIndicators().get("nb_bus_in_ACDC_but_out_AC_CC")); + assertEquals("1", result.getIndicators().get("nb_bus_with_voltage_value")); + } + + @Test + void testBranchesIndicators() throws IOException { + Network network = VoltageControlNetworkFactory.createWithSimpleRemoteControl(); + network.getLine("l12").getTerminal2().disconnect(); + network.getLine("l24").getTerminal1().disconnect(); + OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + + // verify opened branches have been excluded + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals("4", result.getIndicators().get("nb_branch_in_data_file")); + assertEquals("2", result.getIndicators().get("nb_branch_in_AC_CC")); + assertEquals("1", result.getIndicators().get("nb_branch_with_nonsmall_impedance")); + assertEquals("1", result.getIndicators().get("nb_branch_with_zero_or_small_impedance")); + } + + // TODO : unit excluded from opti and fixed + + @Test + void testTransformersIndicators() throws IOException { + Network network = VoltageControlNetworkFactory.createNetworkWith2T2wt(); + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addVariableTwoWindingsTransformers(List.of("T2wT1")); + OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + + // verify only one rtc has been optimized + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals("1", result.getIndicators().get("nb_transformers_with_variable_ratio")); + assertEquals("1", result.getIndicators().get("nb_transformers_with_fixed_ratio")); + } + + // TODO : VSC and LCC converter stations + + @Test + void testShunts() throws IOException { + Network network = OpenReacOptimizationAndLoadFlowTest.create(); + // add one shunt that will be fixed in optimization + network.getVoltageLevel("vl3").newShuntCompensator() + .setId("SHUNT2") + .setBus("b3") + .setConnectableBus("b3") + .setSectionCount(0) + .setVoltageRegulatorOn(true) + .setTargetV(393) + .setTargetDeadband(5.0) + .newLinearModel() + .setMaximumSectionCount(25) + .setBPerSection(1e-3) + .add() + .add(); + // add one shunt that will not be considered in optimization, as it is neither optimized nor connected + network.getVoltageLevel("vl3").newShuntCompensator() + .setId("SHUNT3") + // .setBus("b3") + .setConnectableBus("b3") + .setSectionCount(0) + .setVoltageRegulatorOn(true) + .setTargetV(393) + .setTargetDeadband(5.0) + .newLinearModel() + .setMaximumSectionCount(25) + .setBPerSection(1e-3) + .add() + .add(); + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addVariableShuntCompensators(List.of("SHUNT")); + OpenReacResult result = runOpenReac(network, ""); + + // verify only one shunt has been optimized + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals("3", result.getIndicators().get("nb_shunt_in_data_file")); + assertEquals("3", result.getIndicators().get("nb_shunt_connectable_or_in_AC_CC")); + assertEquals("1", result.getIndicators().get("nb_shunt_with_fixed_value")); + assertEquals("1", result.getIndicators().get("nb_shunt_with_variable_value")); // FIXME + } + + @Test + void testSvcIndicators() throws IOException { + Network network = VoltageControlNetworkFactory.createWithStaticVarCompensator(); + OpenReacResult result = runOpenReac(network, ""); + + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals("1", result.getIndicators().get("nb_svc_in_data_file")); + assertEquals("1", result.getIndicators().get("nb_svc_in_AC_CC")); + assertEquals("0", result.getIndicators().get("nb_svc_up_and_operating")); + } + +} From 50548d22dfc43c75faf39c6fdaf150eeb853ff2e Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 4 Dec 2024 17:11:56 +0100 Subject: [PATCH 3/9] Add tests on equipment bounds in optimization of OpenReac Signed-off-by: p-arvy --- .../OpecReacOptimizationBoundsTest.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java new file mode 100644 index 00000000..c95bc0cf --- /dev/null +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2024, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.openreac.optimization; + +import com.powsybl.iidm.network.Network; +import com.powsybl.openreac.network.VoltageControlNetworkFactory; +import com.powsybl.openreac.parameters.output.OpenReacResult; +import com.powsybl.openreac.parameters.output.OpenReacStatus; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Test the equipment bounds in OpenReac optimization. + * + * @author Pierre ARVY {@literal } + */ +class OpecReacOptimizationBoundsTest extends AbstractOpenReacRunnerTest { + + @Test + void testGeneratorsMaxPBounds() throws IOException { + Network network = VoltageControlNetworkFactory.createWithTwoVoltageControls(); + // due to the disconnection, the network is now imbalanced + // and max p of generators is not enough to provide balance + network.getLine("l45").getTerminal2().disconnect(); + OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); + + // increase max p of generators to allow power balance + network.getGenerator("g2").setMaxP(2.5); + network.getGenerator("g3").setMaxP(2.5); + result = runOpenReac(network, "openreac-output-branches-opened"); + assertEquals(OpenReacStatus.OK, result.getStatus()); + } + + @Test + void testGeneratorsMinPBounds() throws IOException { + Network network = VoltageControlNetworkFactory.createWithTwoVoltageControls(); + // due to the modifications, the network is now imbalanced + // and min p of generators is not small enough to provide balance + network.getLine("l45").getTerminal2().disconnect(); + network.getLoad("l4").setP0(3); + network.getGenerator("g2").setMinP(2); + network.getGenerator("g3").setMinP(2); + OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); + + // decrease min p of generators to allow power balance + // but targetP will be fixed in optimization, because it is too close of maxP + network.getGenerator("g2").setMinP(1); + network.getGenerator("g3").setMinP(1); + result = runOpenReac(network, "openreac-output-branches-opened"); + assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); + + // increase max p of generators to allow modification of targetP in optimization + network.getGenerator("g2").setMaxP(2.5); + network.getGenerator("g3").setMaxP(2.5); + result = runOpenReac(network, "openreac-output-branches-opened"); + assertEquals(OpenReacStatus.OK, result.getStatus()); + } + +} From 802dd1d8ed80f8f7a60b7d7323bf9c25d5e04522 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 4 Dec 2024 17:12:16 +0100 Subject: [PATCH 4/9] Improve tests on ouput indicators of OpenReac Signed-off-by: p-arvy --- .../OpenReacOptimizationIndicatorsTest.java | 228 ++++++++++++------ 1 file changed, 159 insertions(+), 69 deletions(-) diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java index 8fabdb72..6a059afd 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java @@ -10,6 +10,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.StaticVarCompensator; import com.powsybl.openreac.network.HvdcNetworkFactory; import com.powsybl.openreac.network.VoltageControlNetworkFactory; import com.powsybl.openreac.parameters.input.OpenReacParameters; @@ -27,64 +28,67 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** + * Test the indicators returned by OpenReac optimization. + * Note that some indicators might depend on optimization process, + * and can not be tested in unit tests. + * * @author Pierre ARVY {@literal } */ -public class OpenReacOptimizationIndicatorsTest extends AbstractOpenReacRunnerTest { +class OpenReacOptimizationIndicatorsTest extends AbstractOpenReacRunnerTest { - // TODO : find some parameters that are working. Take things that seem good @Test - void testInputIndicators() throws IOException { + void testParametrizationIndicators() throws IOException { Network network = IeeeCdfNetworkFactory.create57(); OpenReacParameters parameters = new OpenReacParameters() .setObjective(OpenReacOptimisationObjective.SPECIFIC_VOLTAGE_PROFILE) - .setObjectiveDistance(69) + .setObjectiveDistance(70) .setLogLevelAmpl(OpenReacAmplLogLevel.WARNING) .setLogLevelSolver(OpenReacSolverLogLevel.ONLY_RESULTS) - .setMinPlausibleLowVoltageLimit(0.7888) - .setMaxPlausibleHighVoltageLimit(1.3455) + .setMinPlausibleLowVoltageLimit(0.655) + .setMaxPlausibleHighVoltageLimit(1.425) .setReactiveSlackBusesMode(ReactiveSlackBusesMode.NO_GENERATION) - .setActivePowerVariationRate(0.88) - .setMinPlausibleActivePowerThreshold(0.45) + .setActivePowerVariationRate(0.999) + .setMinPlausibleActivePowerThreshold(0.02) .setLowImpedanceThreshold(1e-5) - .setMinNominalVoltageIgnoredBus(2.) - .setMinNominalVoltageIgnoredVoltageBounds(0.75) - .setPQMax(3987.76) - .setLowActivePowerDefaultLimit(12.32) - .setHighActivePowerDefaultLimit(1452.66) - .setDefaultQmaxPmaxRatio(0.24) + .setMinNominalVoltageIgnoredBus(0.75) + .setMinNominalVoltageIgnoredVoltageBounds(0.85) + .setPQMax(4001) + .setLowActivePowerDefaultLimit(0.1) + .setHighActivePowerDefaultLimit(1001) + .setDefaultQmaxPmaxRatio(0.2) .setDefaultMinimalQPRange(2.) - .setDefaultVariableScalingFactor(1.1222) - .setDefaultConstraintScalingFactor(0.7889) - .setReactiveSlackVariableScalingFactor(0.2) - .setTwoWindingTransformerRatioVariableScalingFactor(0.0045) - .setShuntVariableScalingFactor(0.101); + .setDefaultVariableScalingFactor(1.001) + .setDefaultConstraintScalingFactor(0.999) + .setReactiveSlackVariableScalingFactor(1e-2) + .setTwoWindingTransformerRatioVariableScalingFactor(2e-3) + .setShuntVariableScalingFactor(0.11); OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); // verify buses outside main SC have been excluded - assertEquals("INFO", result.getIndicators().get("log_level_ampl")); - assertEquals("2", result.getIndicators().get("log_level_knitro")); - assertEquals("2", result.getIndicators().get("objective_choice")); - assertEquals("0.69", result.getIndicators().get("ratio_voltage_target")); - assertEquals("2", result.getIndicators().get("coeff_alpha")); - assertEquals("2", result.getIndicators().get("Pnull")); - assertEquals("2", result.getIndicators().get("Znull")); - assertEquals("2", result.getIndicators().get("epsilon_nominal_voltage")); - assertEquals("2", result.getIndicators().get("min_plausible_low_voltage_limit")); - assertEquals("2", result.getIndicators().get("max_plausible_high_voltage_limit")); - assertEquals("2", result.getIndicators().get("ignore_voltage_bounds")); - assertEquals("16", result.getIndicators().get("buses_with_reactive_slacks")); - assertEquals("12", result.getIndicators().get("PQmax")); - assertEquals("4", result.getIndicators().get("defaultPmax")); - assertEquals("1", result.getIndicators().get("defaultPmin")); - assertEquals("1", result.getIndicators().get("defaultQmaxPmaxRatio")); - assertEquals("1", result.getIndicators().get("defaultQmin")); - assertEquals("1", result.getIndicators().get("defaultQmax")); - assertEquals("1", result.getIndicators().get("minimalQPrange")); - assertEquals("1", result.getIndicators().get("default_variable_scaling_factor")); - assertEquals("1", result.getIndicators().get("default_constraint_scaling_factor")); - assertEquals("1", result.getIndicators().get("reactive_slack_variable_scaling_factor")); - assertEquals("1", result.getIndicators().get("transformer_ratio_variable_scaling_factor")); - assertEquals("1", result.getIndicators().get("shunt_variable_scaling_factor")); + assertEquals("WARNING", result.getIndicators().get("log_level_ampl")); + assertEquals(1, Integer.parseInt(result.getIndicators().get("log_level_knitro"))); + assertEquals(2, Integer.parseInt(result.getIndicators().get("objective_choice"))); + assertEquals(0.7, Double.parseDouble(result.getIndicators().get("ratio_voltage_target"))); + assertEquals(0.999, Double.parseDouble(result.getIndicators().get("coeff_alpha"))); + assertEquals(0.02, Double.parseDouble(result.getIndicators().get("Pnull"))); + assertEquals(1e-5, Double.parseDouble(result.getIndicators().get("Znull"))); + assertEquals(0.75, Double.parseDouble(result.getIndicators().get("epsilon_nominal_voltage"))); + assertEquals(0.655, Double.parseDouble(result.getIndicators().get("min_plausible_low_voltage_limit"))); + assertEquals(1.425, Double.parseDouble(result.getIndicators().get("max_plausible_high_voltage_limit"))); + assertEquals(0.85, Double.parseDouble(result.getIndicators().get("ignore_voltage_bounds"))); + assertEquals("NO_GENERATION", result.getIndicators().get("buses_with_reactive_slacks")); + assertEquals(4001, Double.parseDouble(result.getIndicators().get("PQmax"))); + assertEquals(1001, Double.parseDouble(result.getIndicators().get("defaultPmax"))); + assertEquals(0.1, Double.parseDouble(result.getIndicators().get("defaultPmin"))); + assertEquals(0.2, Double.parseDouble(result.getIndicators().get("defaultQmaxPmaxRatio"))); + assertEquals(-200.2, Double.parseDouble(result.getIndicators().get("defaultQmin"))); + assertEquals(200.2, Double.parseDouble(result.getIndicators().get("defaultQmax"))); + assertEquals(2.0, Double.parseDouble(result.getIndicators().get("minimalQPrange"))); + assertEquals(1.001, Double.parseDouble(result.getIndicators().get("default_variable_scaling_factor"))); + assertEquals(0.999, Double.parseDouble(result.getIndicators().get("default_constraint_scaling_factor"))); + assertEquals(0.01, Double.parseDouble(result.getIndicators().get("reactive_slack_variable_scaling_factor"))); + assertEquals(0.002, Double.parseDouble(result.getIndicators().get("transformer_ratio_variable_scaling_factor"))); + assertEquals(0.11, Double.parseDouble(result.getIndicators().get("shunt_variable_scaling_factor"))); } @Test @@ -93,14 +97,14 @@ void testBusIndicators() throws IOException { network.getBusBreakerView().getBus("b1").setV(400); OpenReacResult result = runOpenReac(network, ""); - // verify buses outside main SC have been excluded assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals("16", result.getIndicators().get("nb_substations")); - assertEquals("16", result.getIndicators().get("nb_bus_in_data_file")); - assertEquals("16", result.getIndicators().get("nb_bus_in_ACDC_CC")); - assertEquals("12", result.getIndicators().get("nb_bus_in_AC_CC")); - assertEquals("4", result.getIndicators().get("nb_bus_in_ACDC_but_out_AC_CC")); - assertEquals("1", result.getIndicators().get("nb_bus_with_voltage_value")); + assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_substations"))); + assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_bus_in_data_file"))); + assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_bus_in_ACDC_CC"))); + // verify buses outside main SC have been excluded + assertEquals(12, Integer.parseInt(result.getIndicators().get("nb_bus_in_AC_CC"))); + assertEquals(4, Integer.parseInt(result.getIndicators().get("nb_bus_in_ACDC_but_out_AC_CC"))); + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_bus_with_voltage_value"))); } @Test @@ -108,17 +112,36 @@ void testBranchesIndicators() throws IOException { Network network = VoltageControlNetworkFactory.createWithSimpleRemoteControl(); network.getLine("l12").getTerminal2().disconnect(); network.getLine("l24").getTerminal1().disconnect(); + // due to disconnected lines, increase max P of generators in main CC + network.getGenerator("g3").setMaxP(3); + network.getGenerator("g4").setMaxP(3); OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); - // verify opened branches have been excluded assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals("4", result.getIndicators().get("nb_branch_in_data_file")); - assertEquals("2", result.getIndicators().get("nb_branch_in_AC_CC")); - assertEquals("1", result.getIndicators().get("nb_branch_with_nonsmall_impedance")); - assertEquals("1", result.getIndicators().get("nb_branch_with_zero_or_small_impedance")); + assertEquals(4, Integer.parseInt(result.getIndicators().get("nb_branch_in_data_file"))); + // verify opened branches have been excluded + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC"))); + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_nonsmall_impedance"))); + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_zero_or_small_impedance"))); } - // TODO : unit excluded from opti and fixed + @Test + void testGeneratorIndicators() throws IOException { + Network network = VoltageControlNetworkFactory.createWithGeneratorRemoteControl(); + network.getGenerator("g1").setTargetQ(50); + OpenReacParameters parameters = new OpenReacParameters(); + parameters.addConstantQGenerators(List.of("g1", "g3")); + OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_in_data_file"))); + assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_in_AC_CC"))); + assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_up_and_running"))); + // verify that only the generators indicated as constant and with defined target Q are fixed in optimization + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_unit_with_fixed_reactive_power"))); + // verify other generators are optimized + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_unit_with_variable_reactive_power"))); + } @Test void testTransformersIndicators() throws IOException { @@ -129,14 +152,38 @@ void testTransformersIndicators() throws IOException { // verify only one rtc has been optimized assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals("1", result.getIndicators().get("nb_transformers_with_variable_ratio")); - assertEquals("1", result.getIndicators().get("nb_transformers_with_fixed_ratio")); + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_variable_ratio"))); + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_fixed_ratio"))); } - // TODO : VSC and LCC converter stations + @Test + void testVscIndicators() throws IOException { + Network network = HvdcNetworkFactory.createVsc(); + // FIXME : should not depend on P/Q values on terminal + network.getVscConverterStation("cs2").getTerminal().setP(2).setQ(1); + OpenReacResult result = runOpenReac(network, ""); + + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file"))); + // verify only vsc in main cc is optimized + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_up_and_running"))); + } @Test - void testShunts() throws IOException { + void testLccIndicators() throws IOException { + Network network = HvdcNetworkFactory.createLcc(); + // FIXME : should not depend on P/Q values on terminal + network.getLccConverterStation("cs2").getTerminal().setP(2).setQ(1); + OpenReacResult result = runOpenReac(network, ""); + + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_in_data_file"))); + // verify only lcc in main cc is considered in optimization + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_up_and_running"))); + } + + @Test + void testShuntsIndicators() throws IOException { Network network = OpenReacOptimizationAndLoadFlowTest.create(); // add one shunt that will be fixed in optimization network.getVoltageLevel("vl3").newShuntCompensator() @@ -168,25 +215,68 @@ void testShunts() throws IOException { .add(); OpenReacParameters parameters = new OpenReacParameters(); parameters.addVariableShuntCompensators(List.of("SHUNT")); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "", parameters); - // verify only one shunt has been optimized assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals("3", result.getIndicators().get("nb_shunt_in_data_file")); - assertEquals("3", result.getIndicators().get("nb_shunt_connectable_or_in_AC_CC")); - assertEquals("1", result.getIndicators().get("nb_shunt_with_fixed_value")); - assertEquals("1", result.getIndicators().get("nb_shunt_with_variable_value")); // FIXME + assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_shunt_in_data_file"))); + assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_shunt_connectable_or_in_AC_CC"))); + // verify disconnected shunt, and not optimized, is not considered in shunts with fixed values + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_shunt_with_fixed_value"))); + // verify only one shunt has been optimized (even if it was disconnected) + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_shunt_with_variable_value"))); } @Test void testSvcIndicators() throws IOException { Network network = VoltageControlNetworkFactory.createWithStaticVarCompensator(); + network.getVoltageLevel("vl2").newStaticVarCompensator() + .setId("svc2") + .setConnectableBus("b2") + .setBus("b2") + .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) + .setVoltageSetpoint(400) + .setBmin(-0.008) + .setBmax(0.008) + .add(); + OpenReacResult result = runOpenReac(network, ""); + + assertEquals(OpenReacStatus.OK, result.getStatus()); + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_svc_in_data_file"))); + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_svc_in_AC_CC"))); + // verify only one svc is regulating + assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_svc_up_and_operating"))); + } + + @Test + void testBatteryIndicators() throws IOException { + Network network = VoltageControlNetworkFactory.createWithGeneratorRemoteControl(); + network.getVoltageLevel("vl4") + .newBattery() + .setId("bat1") + .setMinP(-10) + .setMaxP(10) + .setTargetP(2) + .setBus("b4") + .setConnectableBus("b4") + .setTargetQ(0) + .add(); + network.getVoltageLevel("vl1") + .newBattery() + .setId("bat2") + .setMinP(-9) + .setMaxP(11) + .setTargetP(1) + .setBus("b1") + .setConnectableBus("b1") + .setTargetQ(0.2) + .add(); OpenReacResult result = runOpenReac(network, ""); assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals("1", result.getIndicators().get("nb_svc_in_data_file")); - assertEquals("1", result.getIndicators().get("nb_svc_in_AC_CC")); - assertEquals("0", result.getIndicators().get("nb_svc_up_and_operating")); + assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_batteries"))); + // verify the sum of max and min active power of the batteries + assertEquals(21, Double.parseDouble(result.getIndicators().get("sum_batteries_pmax"))); + assertEquals(-19, Double.parseDouble(result.getIndicators().get("sum_batteries_pmin"))); } } From 81908d8a03d2b69fe237c7c5688c0cf495207742 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 4 Dec 2024 17:12:27 +0100 Subject: [PATCH 5/9] Clean Signed-off-by: p-arvy --- .../optimization/AbstractOpenReacRunnerTest.java | 10 ++++++++-- .../openreac/optimization/OpenReacAmplIOTest.java | 2 +- .../OpenReacOptimizationAndLoadFlowTest.java | 2 +- .../optimization/OpenReacParametrizationTest.java | 2 +- .../test/resources/com/powsybl/config/test/config.yml | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index 0ef48f70..7f6f920b 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -31,7 +31,6 @@ import java.nio.file.Path; import java.util.List; import java.util.Objects; -import java.util.concurrent.ForkJoinPool; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -95,7 +94,14 @@ protected void runAndApplyAllModifications(Network network, String subFolder, Op * Runs OpenReac and returns associated result. */ protected OpenReacResult runOpenReac(Network network, String subFolder) throws IOException { - return runOpenReac(network, subFolder, new OpenReacParameters(), ReportNode.NO_OP); + return runOpenReac(network, subFolder, new OpenReacParameters()); + } + + /** + * Runs OpenReac and returns associated result. + */ + protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters) throws IOException { + return runOpenReac(network, subFolder, parameters, ReportNode.NO_OP); } /** diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java index d8b31d34..20f6e00b 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacAmplIOTest.java @@ -34,7 +34,7 @@ * @author Geoffroy Jamgotchian {@literal } * @author Nicolas PIERRE {@literal } */ -public class OpenReacAmplIOTest extends AbstractOpenReacRunnerTest { +class OpenReacAmplIOTest extends AbstractOpenReacRunnerTest { @Test void testInputFile() throws IOException { diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java index fa431d9e..54260bd6 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java @@ -38,7 +38,7 @@ * @author Geoffroy Jamgotchian {@literal } * @author Nicolas PIERRE {@literal } */ -public class OpenReacOptimizationAndLoadFlowTest extends AbstractOpenReacRunnerTest { +class OpenReacOptimizationAndLoadFlowTest extends AbstractOpenReacRunnerTest { @Test void testRunAsync() throws IOException { diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java index c850c96a..02809d2f 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacParametrizationTest.java @@ -30,7 +30,7 @@ * @author Geoffroy Jamgotchian {@literal } * @author Nicolas PIERRE {@literal } */ -public class OpenReacParametrizationTest extends AbstractOpenReacRunnerTest { +class OpenReacParametrizationTest extends AbstractOpenReacRunnerTest { @Test void testDefaultParamAlgoExport() throws IOException { diff --git a/open-reac/src/test/resources/com/powsybl/config/test/config.yml b/open-reac/src/test/resources/com/powsybl/config/test/config.yml index 1acd4f0d..9d797384 100644 --- a/open-reac/src/test/resources/com/powsybl/config/test/config.yml +++ b/open-reac/src/test/resources/com/powsybl/config/test/config.yml @@ -1,2 +1,2 @@ ampl: - homeDir: ??? + homeDir: D:\AMPL-13.1.20220703-Win-64 From f6746be7f8b8294702aa9ab46df0b55531e86fc3 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Wed, 4 Dec 2024 18:44:58 +0100 Subject: [PATCH 6/9] Add resources Signed-off-by: p-arvy --- .../AbstractOpenReacRunnerTest.java | 58 ++++++++---- .../OpecReacOptimizationBoundsTest.java | 10 +- .../OpenReacOptimizationAndLoadFlowTest.java | 18 ++-- .../OpenReacOptimizationIndicatorsTest.java | 21 ++--- .../com/powsybl/config/test/config.yml | 2 +- .../reactiveopf_results_indic.txt | 94 +++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 94 +++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 94 +++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../bus-test/reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../lcc-test/reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../shunt-test/reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../svc-test/reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../vsc-test/reactiveopf_results_indic.txt | 93 ++++++++++++++++++ .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 .../reactiveopf_results_generators.csv | 0 .../reactiveopf_results_indic.txt | 0 .../reactiveopf_results_rtc.csv | 0 .../reactiveopf_results_shunts.csv | 0 ...iveopf_results_static_var_compensators.csv | 0 .../reactiveopf_results_voltages.csv | 0 ...tiveopf_results_vsc_converter_stations.csv | 0 69 files changed, 1463 insertions(+), 44 deletions(-) create mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt create mode 100644 open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-ieee14/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-real-network/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-shunt/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-svc/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-transfo/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-vsc/reactiveopf_results_vsc_converter_stations.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_generators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_indic.txt (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_rtc.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_shunts.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_static_var_compensators.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_voltages.csv (100%) rename open-reac/src/test/resources/{ => optimization/loadflow}/openreac-output-warm-start/reactiveopf_results_vsc_converter_stations.csv (100%) diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index 7f6f920b..f2dfd0ad 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -12,6 +12,7 @@ import com.powsybl.commons.test.ComparisonUtils; import com.powsybl.computation.ComputationManager; import com.powsybl.computation.local.LocalCommandExecutor; +import com.powsybl.computation.local.LocalComputationConfig; import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.iidm.network.*; import com.powsybl.loadflow.LoadFlow; @@ -27,13 +28,15 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.FileSystem; -import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.concurrent.ForkJoinPool; import java.util.stream.Collectors; import java.util.stream.Stream; +import static java.nio.file.Files.*; import static org.junit.jupiter.api.Assertions.*; /** @@ -47,7 +50,7 @@ abstract class AbstractOpenReacRunnerTest { @BeforeEach public void setUp() throws IOException { fileSystem = Jimfs.newFileSystem(Configuration.unix()); - tmpDir = Files.createDirectory(fileSystem.getPath("tmp")); + tmpDir = createDirectory(fileSystem.getPath("tmp")); } @AfterEach @@ -56,14 +59,14 @@ void tearDown() throws IOException { } protected void assertEqualsToRef(Path p, String refFileName) throws IOException { - try (InputStream actual = Files.newInputStream(p)) { + try (InputStream actual = newInputStream(p)) { ComparisonUtils.assertTxtEquals(Objects.requireNonNull(getClass().getResourceAsStream(refFileName)), actual); } } protected Path getAmplExecPath() throws IOException { Path execFolder; - try (Stream walk = Files.walk(tmpDir)) { + try (Stream walk = walk(tmpDir)) { execFolder = walk.limit(2).collect(Collectors.toList()).get(1); } return execFolder; @@ -90,40 +93,59 @@ protected void runAndApplyAllModifications(Network network, String subFolder, Op openReacResult.applyAllModifications(network); } + // TODO : remove useless methods here /** * Runs OpenReac and returns associated result. */ protected OpenReacResult runOpenReac(Network network, String subFolder) throws IOException { - return runOpenReac(network, subFolder, new OpenReacParameters()); + return runOpenReac(network, subFolder, false); } /** * Runs OpenReac and returns associated result. */ - protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters) throws IOException { + protected OpenReacResult runOpenReac(Network network, String subFolder, boolean onlyIndicators) throws IOException { + return runOpenReac(network, subFolder, new OpenReacParameters(), onlyIndicators); + } + + /** + * Runs OpenReac and returns associated result. + */ + protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, boolean onlyIndicators) throws IOException { return runOpenReac(network, subFolder, parameters, ReportNode.NO_OP); } + /** + * Runs OpenReac and returns associated result. + */ + protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { + return runOpenReac(network, subFolder, parameters, false, reportNode); + } + /** * Runs OpenReac and returns associated result. * Note that OpenReac is not really executed by default. If the execution line is not uncommented, * the results are retrieved and stored in an {@link OpenReacResult} object. */ - protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { + protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, + boolean onlyIndicators, ReportNode reportNode) throws IOException { // set default voltage limits to every voltage levels of the network setDefaultVoltageLimits(network); - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( - List.of(subFolder + "/reactiveopf_results_generators.csv", - subFolder + "/reactiveopf_results_indic.txt", - subFolder + "/reactiveopf_results_rtc.csv", - subFolder + "/reactiveopf_results_shunts.csv", - subFolder + "/reactiveopf_results_static_var_compensators.csv", - subFolder + "/reactiveopf_results_vsc_converter_stations.csv", - subFolder + "/reactiveopf_results_voltages.csv")); + List outputFileNames = new ArrayList<>(List.of(subFolder + "/reactiveopf_results_indic.txt")); + if (!onlyIndicators) { + outputFileNames.addAll(List.of( + subFolder + "/reactiveopf_results_rtc.csv", + subFolder + "/reactiveopf_results_shunts.csv", + subFolder + "/reactiveopf_results_static_var_compensators.csv", + subFolder + "/reactiveopf_results_vsc_converter_stations.csv", + subFolder + "/reactiveopf_results_voltages.csv" + )); + } + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor(outputFileNames); // To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path - try (ComputationManager computationManager = new LocalComputationManager()) { -// try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), -// localCommandExecutor, ForkJoinPool.commonPool())) { +// try (ComputationManager computationManager = new LocalComputationManager()) { + try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), + localCommandExecutor, ForkJoinPool.commonPool())) { return OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true), computationManager, reportNode, null); } diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java index c95bc0cf..a362a790 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java @@ -30,13 +30,13 @@ void testGeneratorsMaxPBounds() throws IOException { // due to the disconnection, the network is now imbalanced // and max p of generators is not enough to provide balance network.getLine("l45").getTerminal2().disconnect(); - OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + OpenReacResult result = runOpenReac(network, "optimization/bounds/generators-pmax-too-small", true); assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); // increase max p of generators to allow power balance network.getGenerator("g2").setMaxP(2.5); network.getGenerator("g3").setMaxP(2.5); - result = runOpenReac(network, "openreac-output-branches-opened"); + result = runOpenReac(network, "optimization/bounds/generators-pmax", true); assertEquals(OpenReacStatus.OK, result.getStatus()); } @@ -49,20 +49,20 @@ void testGeneratorsMinPBounds() throws IOException { network.getLoad("l4").setP0(3); network.getGenerator("g2").setMinP(2); network.getGenerator("g3").setMinP(2); - OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + OpenReacResult result = runOpenReac(network, "optimization/bounds/generators-pmin-too-high", true); assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); // decrease min p of generators to allow power balance // but targetP will be fixed in optimization, because it is too close of maxP network.getGenerator("g2").setMinP(1); network.getGenerator("g3").setMinP(1); - result = runOpenReac(network, "openreac-output-branches-opened"); + result = runOpenReac(network, "optimization/bounds/generators-target-p-too-close-pmax", true); assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); // increase max p of generators to allow modification of targetP in optimization network.getGenerator("g2").setMaxP(2.5); network.getGenerator("g3").setMaxP(2.5); - result = runOpenReac(network, "openreac-output-branches-opened"); + result = runOpenReac(network, "optimization/bounds/generators-pmin", true); assertEquals(OpenReacStatus.OK, result.getStatus()); } diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java index 54260bd6..89eba645 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java @@ -43,7 +43,7 @@ class OpenReacOptimizationAndLoadFlowTest extends AbstractOpenReacRunnerTest { @Test void testRunAsync() throws IOException { Network network = IeeeCdfNetworkFactory.create14(); - String subFolder = "openreac-output-ieee14"; + String subFolder = "optimization/loadflow/openreac-output-ieee14"; OpenReacParameters parameters = new OpenReacParameters(); setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( @@ -69,7 +69,7 @@ void testRunAsync() throws IOException { @Test void testOnlyGenerator() throws IOException { Network network = IeeeCdfNetworkFactory.create14(); - testAllModifAndLoadFlow(network, "openreac-output-ieee14", new OpenReacParameters(), ReportNode.NO_OP); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-ieee14", new OpenReacParameters(), ReportNode.NO_OP); } @Test @@ -79,7 +79,7 @@ void testHvdc() throws IOException { network.getVscConverterStation("cs4").getTerminal().setP(0.0); OpenReacParameters parameters = new OpenReacParameters(); parameters.addConstantQGenerators(List.of("g1", "g2", "g5", "g6")); - testAllModifAndLoadFlow(network, "openreac-output-vsc", parameters, ReportNode.NO_OP); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-vsc", parameters, ReportNode.NO_OP); } @Test @@ -89,7 +89,7 @@ void testSvc() throws IOException { network.getStaticVarCompensator("svc1").setVoltageSetpoint(390).setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE); OpenReacParameters parameters = new OpenReacParameters(); parameters.addConstantQGenerators(List.of("g1")); - testAllModifAndLoadFlow(network, "openreac-output-svc", parameters, ReportNode.NO_OP); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-svc", parameters, ReportNode.NO_OP); } @Test @@ -102,7 +102,7 @@ void testShunt() throws IOException { OpenReacParameters parameters = new OpenReacParameters(); parameters.addVariableShuntCompensators(List.of(shunt.getId())); ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); - testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-shunt", parameters, reportNode); assertEquals(3, reportNode.getChildren().size()); ReportNode reportShunts = reportNode.getChildren().get(2); @@ -135,7 +135,7 @@ void testShuntWithDeltaBetweenDiscretizedAndOptimalReactiveValueUnderThreshold() parameters.setShuntCompensatorActivationAlertThreshold(100.); parameters.addVariableShuntCompensators(List.of(shunt.getId())); ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("openReac", "openReac").build(); - testAllModifAndLoadFlow(network, "openreac-output-shunt", parameters, reportNode); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-shunt", parameters, reportNode); assertEquals(2, reportNode.getChildren().size()); @@ -156,7 +156,7 @@ void testTransformer() throws IOException { OpenReacParameters parameters = new OpenReacParameters(); parameters.addConstantQGenerators(List.of("GEN_1")); parameters.addVariableTwoWindingsTransformers(List.of("T2wT")); - testAllModifAndLoadFlow(network, "openreac-output-transfo", parameters, ReportNode.NO_OP); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-transfo", parameters, ReportNode.NO_OP); assertEquals(0, rtc.getTapPosition()); assertEquals(22.935, rtc.getTargetV()); } @@ -165,13 +165,13 @@ void testTransformer() throws IOException { void testRealNetwork() throws IOException { Network network = IeeeCdfNetworkFactory.create57(); OpenReacParameters parameters = new OpenReacParameters(); - testAllModifAndLoadFlow(network, "openreac-output-real-network", parameters, ReportNode.NO_OP); + testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-real-network", parameters, ReportNode.NO_OP); } @Test void testWarmStart() throws IOException { Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); - String subFolder = "openreac-output-warm-start"; + String subFolder = "optimization/loadflow/openreac-output-warm-start"; OpenReacParameters parameters = new OpenReacParameters(); runAndApplyAllModifications(network, subFolder, parameters, false, ReportNode.NO_OP); // without warm start, no update diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java index 6a059afd..74c3d32b 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java @@ -7,7 +7,6 @@ */ package com.powsybl.openreac.optimization; -import com.powsybl.commons.report.ReportNode; import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; @@ -62,7 +61,7 @@ void testParametrizationIndicators() throws IOException { .setReactiveSlackVariableScalingFactor(1e-2) .setTwoWindingTransformerRatioVariableScalingFactor(2e-3) .setShuntVariableScalingFactor(0.11); - OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + OpenReacResult result = runOpenReac(network, "optimization/indicators/input-parameters-test", parameters, true); // verify buses outside main SC have been excluded assertEquals("WARNING", result.getIndicators().get("log_level_ampl")); @@ -95,7 +94,7 @@ void testParametrizationIndicators() throws IOException { void testBusIndicators() throws IOException { Network network = HvdcNetworkFactory.createLccWithBiggerComponents(); network.getBusBreakerView().getBus("b1").setV(400); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "optimization/indicators/bus-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_substations"))); @@ -115,7 +114,7 @@ void testBranchesIndicators() throws IOException { // due to disconnected lines, increase max P of generators in main CC network.getGenerator("g3").setMaxP(3); network.getGenerator("g4").setMaxP(3); - OpenReacResult result = runOpenReac(network, "openreac-output-branches-opened"); + OpenReacResult result = runOpenReac(network, "optimization/indicators/branches-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(4, Integer.parseInt(result.getIndicators().get("nb_branch_in_data_file"))); @@ -131,7 +130,7 @@ void testGeneratorIndicators() throws IOException { network.getGenerator("g1").setTargetQ(50); OpenReacParameters parameters = new OpenReacParameters(); parameters.addConstantQGenerators(List.of("g1", "g3")); - OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + OpenReacResult result = runOpenReac(network, "optimization/indicators/generators-test", parameters, true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_in_data_file"))); @@ -148,7 +147,7 @@ void testTransformersIndicators() throws IOException { Network network = VoltageControlNetworkFactory.createNetworkWith2T2wt(); OpenReacParameters parameters = new OpenReacParameters(); parameters.addVariableTwoWindingsTransformers(List.of("T2wT1")); - OpenReacResult result = runOpenReac(network, "", parameters, ReportNode.NO_OP); + OpenReacResult result = runOpenReac(network, "optimization/indicators/transfo-test", parameters, true); // verify only one rtc has been optimized assertEquals(OpenReacStatus.OK, result.getStatus()); @@ -161,7 +160,7 @@ void testVscIndicators() throws IOException { Network network = HvdcNetworkFactory.createVsc(); // FIXME : should not depend on P/Q values on terminal network.getVscConverterStation("cs2").getTerminal().setP(2).setQ(1); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "optimization/indicators/vsc-test"); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file"))); @@ -174,7 +173,7 @@ void testLccIndicators() throws IOException { Network network = HvdcNetworkFactory.createLcc(); // FIXME : should not depend on P/Q values on terminal network.getLccConverterStation("cs2").getTerminal().setP(2).setQ(1); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "optimization/indicators/lcc-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_in_data_file"))); @@ -215,7 +214,7 @@ void testShuntsIndicators() throws IOException { .add(); OpenReacParameters parameters = new OpenReacParameters(); parameters.addVariableShuntCompensators(List.of("SHUNT")); - OpenReacResult result = runOpenReac(network, "", parameters); + OpenReacResult result = runOpenReac(network, "optimization/indicators/shunt-test", parameters, true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_shunt_in_data_file"))); @@ -238,7 +237,7 @@ void testSvcIndicators() throws IOException { .setBmin(-0.008) .setBmax(0.008) .add(); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "optimization/indicators/svc-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_svc_in_data_file"))); @@ -270,7 +269,7 @@ void testBatteryIndicators() throws IOException { .setConnectableBus("b1") .setTargetQ(0.2) .add(); - OpenReacResult result = runOpenReac(network, ""); + OpenReacResult result = runOpenReac(network, "optimization/indicators/battery-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_batteries"))); diff --git a/open-reac/src/test/resources/com/powsybl/config/test/config.yml b/open-reac/src/test/resources/com/powsybl/config/test/config.yml index 9d797384..1acd4f0d 100644 --- a/open-reac/src/test/resources/com/powsybl/config/test/config.yml +++ b/open-reac/src/test/resources/com/powsybl/config/test/config.yml @@ -1,2 +1,2 @@ ampl: - homeDir: D:\AMPL-13.1.20220703-Win-64 + homeDir: ??? diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt new file mode 100644 index 00000000..edad4c5b --- /dev/null +++ b/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt @@ -0,0 +1,94 @@ +final_status NOK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:39:06 2024' +last_solve_result_num 200 +nb_iter_last 67 +nb_iter_total 67 +_ampl_elapsed_time 0.140000 +_total_solve_time 0.046875 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_16806244976153640704' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 5 +nb_bus_in_data_file 5 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.02 +max_teta_ac 0.01 +teta_max 3.02 +min_teta_dc -0.05 +min_teta_ac -0.03 +teta_min -3.05 +max_delta_teta_dc 0.050000 +max_delta_teta_ac 0.030638 +min_delta_teta_dc -0.025000 +min_delta_teta_ac -0.014361 + +nb_reactive_slacks 4 +nb_slacks_condensator 4 +sum_slacks_condensator 2.6 +nb_slacks_self 4 +sum_slacks_self 2.5 +messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt new file mode 100644 index 00000000..aefdeae1 --- /dev/null +++ b/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:39:06 2024' +last_solve_result_num 0 +nb_iter_last 7 +nb_iter_total 7 +_ampl_elapsed_time 0.139000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_7246203715336309657' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 5 +nb_bus_in_data_file 5 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.02 +max_teta_ac 0.03 +teta_max 3.02 +min_teta_dc -0.05 +min_teta_ac -0.05 +teta_min -3.05 +max_delta_teta_dc 0.050000 +max_delta_teta_ac 0.051670 +min_delta_teta_dc -0.025000 +min_delta_teta_ac -0.025352 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt new file mode 100644 index 00000000..b213826c --- /dev/null +++ b/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt @@ -0,0 +1,94 @@ +final_status NOK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:39:05 2024' +last_solve_result_num 200 +nb_iter_last 60 +nb_iter_total 60 +_ampl_elapsed_time 0.155000 +_total_solve_time 0.046875 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_14708682651458660614' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 5 +nb_bus_in_data_file 5 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.01 +max_teta_ac 0.02 +teta_max 3.01 +min_teta_dc -0.03 +min_teta_ac -0.04 +teta_min -3.03 +max_delta_teta_dc 0.030000 +max_delta_teta_ac 0.035331 +min_delta_teta_dc -0.015000 +min_delta_teta_ac -0.018693 + +nb_reactive_slacks 4 +nb_slacks_condensator 4 +sum_slacks_condensator 1.3 +nb_slacks_self 4 +sum_slacks_self 1.2 +messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt new file mode 100644 index 00000000..b3a69be6 --- /dev/null +++ b/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:39:05 2024' +last_solve_result_num 0 +nb_iter_last 7 +nb_iter_total 7 +_ampl_elapsed_time 0.078000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_5930746422974926450' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 5 +nb_bus_in_data_file 5 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.01 +max_teta_ac 0.03 +teta_max 3.01 +min_teta_dc -0.03 +min_teta_ac -0.05 +teta_min -3.03 +max_delta_teta_dc 0.030000 +max_delta_teta_ac 0.054735 +min_delta_teta_dc -0.015000 +min_delta_teta_ac -0.026527 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt new file mode 100644 index 00000000..edce49c4 --- /dev/null +++ b/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt @@ -0,0 +1,94 @@ +final_status NOK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:39:05 2024' +last_solve_result_num 200 +nb_iter_last 60 +nb_iter_total 60 +_ampl_elapsed_time 0.109000 +_total_solve_time 0.046875 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_3318717096223947573' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 5 +nb_bus_in_data_file 5 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.01 +max_teta_ac 0.02 +teta_max 3.01 +min_teta_dc -0.03 +min_teta_ac -0.04 +teta_min -3.03 +max_delta_teta_dc 0.030000 +max_delta_teta_ac 0.035331 +min_delta_teta_dc -0.015000 +min_delta_teta_ac -0.018693 + +nb_reactive_slacks 4 +nb_slacks_condensator 4 +sum_slacks_condensator 1.3 +nb_slacks_self 4 +sum_slacks_self 1.2 +messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..2f49c9cc --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:29 2024' +last_solve_result_num 0 +nb_iter_last 10 +nb_iter_total 10 +_ampl_elapsed_time 0.109000 +_total_solve_time 0.046875 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_8792994315745054563' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 4 +nb_bus_in_data_file 4 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 3 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 3 +nb_unit_up_and_running 3 +nb_unit_with_variable_reactive_power 3 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 1 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 2 +sum_batteries_pmax 21.0 +sum_batteries_pmin -19.0 + +max_teta_dc 0.03 +max_teta_ac 0.02 +teta_max 3.03 +min_teta_dc 0.00 +min_teta_ac 0.00 +teta_min -3.00 +max_delta_teta_dc 0.030896 +max_delta_teta_ac 0.015495 +min_delta_teta_dc 0.018725 +min_delta_teta_ac 0.009609 + +nb_reactive_slacks 1 +nb_slacks_condensator 1 +sum_slacks_condensator 25.4 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..93f59eb1 --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:29 2024' +last_solve_result_num 0 +nb_iter_last 8 +nb_iter_total 8 +_ampl_elapsed_time 0.141000 +_total_solve_time 0.015625 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_16228844043131338938' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 4 +nb_bus_in_data_file 4 +nb_bus_in_ACDC_CC 3 +nb_bus_in_AC_CC 3 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 3 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 4 +nb_branch_in_AC_CC 2 +nb_branch_with_nonsmall_impedance 1 +nb_branch_with_zero_or_small_impedance 1 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 2 +nb_unit_up_and_running 2 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 2 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.03 +max_teta_ac 0.01 +teta_max 3.03 +min_teta_dc -0.00 +min_teta_ac -0.00 +teta_min -3.00 +max_delta_teta_dc 0.030000 +max_delta_teta_ac 0.013386 +min_delta_teta_dc 0.000001 +min_delta_teta_ac 0.000000 + +nb_reactive_slacks 2 +nb_slacks_condensator 2 +sum_slacks_condensator 0.2 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..4fc11e98 --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:30 2024' +last_solve_result_num 0 +nb_iter_last 17 +nb_iter_total 17 +_ampl_elapsed_time 0.124000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_4215184811660139075' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 16 +nb_bus_in_data_file 16 +nb_bus_in_ACDC_CC 16 +nb_bus_in_AC_CC 12 +nb_bus_in_ACDC_but_out_AC_CC 4 +nb_bus_with_voltage_value 1 +nb_bus_with_reactive_slacks 12 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 14 +nb_branch_in_AC_CC 11 +nb_branch_with_nonsmall_impedance 1 +nb_branch_with_zero_or_small_impedance 10 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 2 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.00 +max_teta_ac 0.00 +teta_max 3.00 +min_teta_dc -0.00 +min_teta_ac -0.00 +teta_min -3.00 +max_delta_teta_dc 0.000937 +max_delta_teta_ac 0.003363 +min_delta_teta_dc 0.000000 +min_delta_teta_ac -0.000000 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..c9c996ee --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:29 2024' +last_solve_result_num 0 +nb_iter_last 9 +nb_iter_total 9 +_ampl_elapsed_time 0.109000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_4963164058041255301' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 4 +nb_bus_in_data_file 4 +nb_bus_in_ACDC_CC 4 +nb_bus_in_AC_CC 4 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 4 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 3 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 3 +nb_unit_in_AC_CC 3 +nb_unit_up_and_running 3 +nb_unit_with_variable_reactive_power 2 +nb_unit_with_fixed_reactive_power 1 +nb_load_in_data_file 1 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.03 +max_teta_ac 0.02 +teta_max 3.03 +min_teta_dc 0.00 +min_teta_ac 0.00 +teta_min -3.00 +max_delta_teta_dc 0.031208 +max_delta_teta_ac 0.015617 +min_delta_teta_dc 0.018725 +min_delta_teta_ac 0.009685 + +nb_reactive_slacks 1 +nb_slacks_condensator 1 +sum_slacks_condensator 35.9 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..e7bb228a --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:28 2024' +last_solve_result_num 0 +nb_iter_last 7 +nb_iter_total 7 +_ampl_elapsed_time 0.140000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_10158983132520924590' + +log_level_ampl WARNING +log_level_knitro 1 +objective_choice 2 +ratio_voltage_target 0.700000 +coeff_alpha 0.999000 +Pnull 0.020000 +Znull 0.000010 +epsilon_nominal_voltage 0.750000 +min_plausible_low_voltage_limit 0.655000 +max_plausible_high_voltage_limit 1.425000 +ignore_voltage_bounds 0.850000 +buses_with_reactive_slacks NO_GENERATION +PQmax 4001.000000 +defaultPmax 1001.000000 +defaultPmin 0.100000 +defaultQmaxPmaxRatio 0.200000 +defaultQmin -200.200000 +defaultQmax 200.200000 +minimalQPrange 2.000000 +default_variable_scaling_factor 1.001000 +default_constraint_scaling_factor 0.999000 +reactive_slack_variable_scaling_factor 0.010000 +transformer_ratio_variable_scaling_factor 0.002000 +shunt_variable_scaling_factor 0.110000 + +nb_substations 42 +nb_bus_in_data_file 57 +nb_bus_in_ACDC_CC 57 +nb_bus_in_AC_CC 57 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 57 +nb_bus_with_reactive_slacks 53 +nb_bus_without_reactive_slacks 4 +nb_branch_in_data_file 80 +nb_branch_in_AC_CC 80 +nb_branch_with_nonsmall_impedance 80 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 7 +nb_unit_in_AC_CC 7 +nb_unit_up_and_running 4 +nb_unit_with_variable_reactive_power 4 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 42 +nb_load_in_AC_CC 42 +nb_shunt_in_data_file 3 +nb_shunt_connectable_or_in_AC_CC 3 +nb_shunt_with_fixed_value 3 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.21 +max_teta_ac 0.13 +teta_max 3.21 +min_teta_dc -0.17 +min_teta_ac -0.17 +teta_min -3.17 +max_delta_teta_dc 0.146072 +max_delta_teta_ac 0.105543 +min_delta_teta_dc -0.144911 +min_delta_teta_ac -0.088988 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..04782c22 --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:27 2024' +last_solve_result_num 0 +nb_iter_last 6 +nb_iter_total 6 +_ampl_elapsed_time 0.173000 +_total_solve_time 0.078125 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_1900278357647775261' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 3 +nb_bus_in_data_file 3 +nb_bus_in_ACDC_CC 3 +nb_bus_in_AC_CC 2 +nb_bus_in_ACDC_but_out_AC_CC 1 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 2 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 1 +nb_branch_in_AC_CC 1 +nb_branch_with_nonsmall_impedance 1 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 2 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 2 +nb_lcc_converter_up_and_running 1 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.00 +max_teta_ac 0.00 +teta_max 3.00 +min_teta_dc 0.00 +min_teta_ac 0.00 +teta_min -3.00 +max_delta_teta_dc 0.000975 +max_delta_teta_ac 0.001211 +min_delta_teta_dc 0.000975 +min_delta_teta_ac 0.001211 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..611ec18f --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 18:32:41 2024' +last_solve_result_num 0 +nb_iter_last 35 +nb_iter_total 35 +_ampl_elapsed_time 0.108000 +_total_solve_time 0.031250 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_15990639329670156176' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 3 +nb_bus_in_data_file 3 +nb_bus_in_ACDC_CC 3 +nb_bus_in_AC_CC 3 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 3 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 2 +nb_branch_in_AC_CC 2 +nb_branch_with_nonsmall_impedance 2 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 1 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 1 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 3 +nb_shunt_connectable_or_in_AC_CC 3 +nb_shunt_with_fixed_value 1 +nb_shunt_with_variable_value 1 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.00 +max_teta_ac 0.00 +teta_max 3.00 +min_teta_dc 0.00 +min_teta_ac -0.00 +teta_min -3.00 +max_delta_teta_dc 0.001894 +max_delta_teta_ac 0.001642 +min_delta_teta_dc 0.000000 +min_delta_teta_ac -0.000773 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..6c681c4e --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:28 2024' +last_solve_result_num 0 +nb_iter_last 4 +nb_iter_total 4 +_ampl_elapsed_time 0.125000 +_total_solve_time 0.062500 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_2452729350162475477' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 2 +nb_bus_in_data_file 2 +nb_bus_in_ACDC_CC 2 +nb_bus_in_AC_CC 2 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 2 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 1 +nb_branch_in_AC_CC 1 +nb_branch_with_nonsmall_impedance 1 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 1 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 1 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 2 +nb_svc_in_AC_CC 2 +nb_svc_up_and_operating 1 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.00 +max_teta_ac 0.00 +teta_max 3.00 +min_teta_dc 0.00 +min_teta_ac 0.00 +teta_min -3.00 +max_delta_teta_dc 0.001894 +max_delta_teta_ac 0.001258 +min_delta_teta_dc 0.001894 +min_delta_teta_ac 0.001258 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..9fb65985 --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:57:26 2024' +last_solve_result_num 0 +nb_iter_last 4 +nb_iter_total 4 +_ampl_elapsed_time 0.142000 +_total_solve_time 0.046875 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_3953804062991735571' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 3 +nb_bus_in_data_file 3 +nb_bus_in_ACDC_CC 3 +nb_bus_in_AC_CC 3 +nb_bus_in_ACDC_but_out_AC_CC 0 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 3 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 3 +nb_branch_in_AC_CC 3 +nb_branch_with_nonsmall_impedance 3 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 1 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 2 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 1 +nb_transformers_with_fixed_ratio 1 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 0 +nb_vsc_converter_up_and_running 0 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.01 +max_teta_ac 0.02 +teta_max 3.01 +min_teta_dc -0.02 +min_teta_ac -0.04 +teta_min -3.02 +max_delta_teta_dc 0.022957 +max_delta_teta_ac 0.037399 +min_delta_teta_dc 0.009298 +min_delta_teta_ac 0.016902 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt new file mode 100644 index 00000000..882281eb --- /dev/null +++ b/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt @@ -0,0 +1,93 @@ +final_status OK +dcopf_status OK + +ctime_start 'Wed Dec 04 17:15:42 2024' +last_solve_result_num 0 +nb_iter_last 5 +nb_iter_total 5 +_ampl_elapsed_time 0.093000 +_total_solve_time 0.062500 +total_time 0 + +operatingSystem windows +OS 'Windows_NT' +COMPUTERNAME 'ARTELYS-PC253' +directory 'C:\Users\parvy\AppData\Local\Temp\ampl_995048131625005748' + +log_level_ampl INFO +log_level_knitro 2 +objective_choice 0 +ratio_voltage_target 0.500000 +coeff_alpha 1.000000 +Pnull 0.010000 +Znull 0.000100 +epsilon_nominal_voltage 1.000000 +min_plausible_low_voltage_limit 0.500000 +max_plausible_high_voltage_limit 1.500000 +ignore_voltage_bounds 0.000000 +buses_with_reactive_slacks ALL +PQmax 9000.000000 +defaultPmax 1000.000000 +defaultPmin 0.000000 +defaultQmaxPmaxRatio 0.300000 +defaultQmin -300.000000 +defaultQmax 300.000000 +minimalQPrange 1.000000 +default_variable_scaling_factor 1.000000 +default_constraint_scaling_factor 1.000000 +reactive_slack_variable_scaling_factor 0.100000 +transformer_ratio_variable_scaling_factor 0.001000 +shunt_variable_scaling_factor 0.100000 + +nb_substations 3 +nb_bus_in_data_file 3 +nb_bus_in_ACDC_CC 3 +nb_bus_in_AC_CC 2 +nb_bus_in_ACDC_but_out_AC_CC 1 +nb_bus_with_voltage_value 0 +nb_bus_with_reactive_slacks 2 +nb_bus_without_reactive_slacks 0 +nb_branch_in_data_file 1 +nb_branch_in_AC_CC 1 +nb_branch_with_nonsmall_impedance 1 +nb_branch_with_zero_or_small_impedance 0 +nb_unit_in_data_file 1 +nb_unit_in_AC_CC 1 +nb_unit_up_and_running 1 +nb_unit_with_variable_reactive_power 1 +nb_unit_with_fixed_reactive_power 0 +nb_load_in_data_file 2 +nb_load_in_AC_CC 1 +nb_shunt_in_data_file 0 +nb_shunt_connectable_or_in_AC_CC 0 +nb_shunt_with_fixed_value 0 +nb_shunt_with_variable_value 0 +nb_transformers_with_variable_ratio 0 +nb_transformers_with_fixed_ratio 0 +nb_svc_in_data_file 0 +nb_svc_in_AC_CC 0 +nb_svc_up_and_operating 0 +nb_vsc_converter_in_data_file 2 +nb_vsc_converter_up_and_running 1 +nb_lcc_converter_in_data_file 0 +nb_lcc_converter_up_and_running 0 +nb_batteries 0 +sum_batteries_pmax 0.0 +sum_batteries_pmin 0.0 + +max_teta_dc 0.00 +max_teta_ac 0.00 +teta_max 3.00 +min_teta_dc 0.00 +min_teta_ac 0.00 +teta_min -3.00 +max_delta_teta_dc 0.000975 +max_delta_teta_ac 0.001335 +min_delta_teta_dc 0.000975 +min_delta_teta_ac 0.001335 + +nb_reactive_slacks 0 +nb_slacks_condensator 0 +sum_slacks_condensator 0.0 +nb_slacks_self 0 +sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-ieee14/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-ieee14/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-real-network/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-real-network/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-shunt/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-shunt/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-svc/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-svc/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-transfo/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-transfo/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-vsc/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-vsc/reactiveopf_results_vsc_converter_stations.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_generators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_generators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_generators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_generators.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_indic.txt similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_indic.txt rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_rtc.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_rtc.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_rtc.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_rtc.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_shunts.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_shunts.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_shunts.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_shunts.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_static_var_compensators.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_static_var_compensators.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_static_var_compensators.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_static_var_compensators.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_voltages.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_voltages.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_voltages.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_voltages.csv diff --git a/open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_vsc_converter_stations.csv b/open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_vsc_converter_stations.csv similarity index 100% rename from open-reac/src/test/resources/openreac-output-warm-start/reactiveopf_results_vsc_converter_stations.csv rename to open-reac/src/test/resources/optimization/loadflow/openreac-output-warm-start/reactiveopf_results_vsc_converter_stations.csv From 84e5da65d9b53f82d3a1991da79b19cc8eeda845 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Thu, 12 Dec 2024 15:53:53 +0100 Subject: [PATCH 7/9] Clean Signed-off-by: p-arvy --- .../AbstractOpenReacRunnerTest.java | 19 ++----------------- .../OpenReacOptimizationIndicatorsTest.java | 2 +- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index f2dfd0ad..965a9eff 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -87,20 +87,12 @@ protected void testAllModifAndLoadFlow(Network network, String subFolder, OpenRe */ protected void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { - OpenReacResult openReacResult = runOpenReac(network, subFolder, parameters, reportNode); + OpenReacResult openReacResult = runOpenReac(network, subFolder, parameters, false, reportNode); assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); openReacResult.setUpdateNetworkWithVoltages(updateNetworkWithVoltages); openReacResult.applyAllModifications(network); } - // TODO : remove useless methods here - /** - * Runs OpenReac and returns associated result. - */ - protected OpenReacResult runOpenReac(Network network, String subFolder) throws IOException { - return runOpenReac(network, subFolder, false); - } - /** * Runs OpenReac and returns associated result. */ @@ -112,14 +104,7 @@ protected OpenReacResult runOpenReac(Network network, String subFolder, boolean * Runs OpenReac and returns associated result. */ protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, boolean onlyIndicators) throws IOException { - return runOpenReac(network, subFolder, parameters, ReportNode.NO_OP); - } - - /** - * Runs OpenReac and returns associated result. - */ - protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { - return runOpenReac(network, subFolder, parameters, false, reportNode); + return runOpenReac(network, subFolder, parameters, onlyIndicators, ReportNode.NO_OP); } /** diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java index 74c3d32b..d98304e4 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java @@ -160,7 +160,7 @@ void testVscIndicators() throws IOException { Network network = HvdcNetworkFactory.createVsc(); // FIXME : should not depend on P/Q values on terminal network.getVscConverterStation("cs2").getTerminal().setP(2).setQ(1); - OpenReacResult result = runOpenReac(network, "optimization/indicators/vsc-test"); + OpenReacResult result = runOpenReac(network, "optimization/indicators/vsc-test", true); assertEquals(OpenReacStatus.OK, result.getStatus()); assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file"))); From a54206bbc407bcfe594573e20a8f57dbdb0ba261 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Thu, 12 Dec 2024 16:03:46 +0100 Subject: [PATCH 8/9] Clean code adding new TUs Signed-off-by: p-arvy --- .../AbstractOpenReacRunnerTest.java | 61 +--- .../OpecReacOptimizationBoundsTest.java | 69 ----- .../OpenReacOptimizationIndicatorsTest.java | 281 ------------------ .../reactiveopf_results_indic.txt | 94 ------ .../reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 94 ------ .../reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 94 ------ .../reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 93 ------ .../bus-test/reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 93 ------ .../lcc-test/reactiveopf_results_indic.txt | 93 ------ .../shunt-test/reactiveopf_results_indic.txt | 93 ------ .../svc-test/reactiveopf_results_indic.txt | 93 ------ .../reactiveopf_results_indic.txt | 93 ------ .../vsc-test/reactiveopf_results_indic.txt | 93 ------ 18 files changed, 16 insertions(+), 1793 deletions(-) delete mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java delete mode 100644 open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java delete mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt delete mode 100644 open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index 965a9eff..a53d9720 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -73,7 +73,7 @@ protected Path getAmplExecPath() throws IOException { } /** - * Runs OpenReac, apply the results and run a load flow. + * Runs OpenReac, apply the results and verify that a load flow converges on these results. */ protected void testAllModifAndLoadFlow(Network network, String subFolder, OpenReacParameters parameters, ReportNode reportNode) throws IOException { runAndApplyAllModifications(network, subFolder, parameters, true, reportNode); @@ -83,56 +83,27 @@ protected void testAllModifAndLoadFlow(Network network, String subFolder, OpenRe /** * Runs OpenReac and apply the results on the network. - * The application of the voltage plan calculated by optimization is optional. */ - protected void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, - boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { - OpenReacResult openReacResult = runOpenReac(network, subFolder, parameters, false, reportNode); - assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); - openReacResult.setUpdateNetworkWithVoltages(updateNetworkWithVoltages); - openReacResult.applyAllModifications(network); - } - - /** - * Runs OpenReac and returns associated result. - */ - protected OpenReacResult runOpenReac(Network network, String subFolder, boolean onlyIndicators) throws IOException { - return runOpenReac(network, subFolder, new OpenReacParameters(), onlyIndicators); - } - - /** - * Runs OpenReac and returns associated result. - */ - protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, boolean onlyIndicators) throws IOException { - return runOpenReac(network, subFolder, parameters, onlyIndicators, ReportNode.NO_OP); - } - - /** - * Runs OpenReac and returns associated result. - * Note that OpenReac is not really executed by default. If the execution line is not uncommented, - * the results are retrieved and stored in an {@link OpenReacResult} object. - */ - protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReacParameters parameters, - boolean onlyIndicators, ReportNode reportNode) throws IOException { - // set default voltage limits to every voltage levels of the network - setDefaultVoltageLimits(network); - List outputFileNames = new ArrayList<>(List.of(subFolder + "/reactiveopf_results_indic.txt")); - if (!onlyIndicators) { - outputFileNames.addAll(List.of( - subFolder + "/reactiveopf_results_rtc.csv", - subFolder + "/reactiveopf_results_shunts.csv", - subFolder + "/reactiveopf_results_static_var_compensators.csv", - subFolder + "/reactiveopf_results_vsc_converter_stations.csv", - subFolder + "/reactiveopf_results_voltages.csv" - )); - } - LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor(outputFileNames); + void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, + boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { + LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( + List.of(subFolder + "/reactiveopf_results_generators.csv", + subFolder + "/reactiveopf_results_indic.txt", + subFolder + "/reactiveopf_results_rtc.csv", + subFolder + "/reactiveopf_results_shunts.csv", + subFolder + "/reactiveopf_results_static_var_compensators.csv", + subFolder + "/reactiveopf_results_vsc_converter_stations.csv", + subFolder + "/reactiveopf_results_voltages.csv")); // To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path // try (ComputationManager computationManager = new LocalComputationManager()) { try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir), localCommandExecutor, ForkJoinPool.commonPool())) { - return OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters, + OpenReacResult openReacResult = OpenReacRunner.run(network, + network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true), computationManager, reportNode, null); + assertEquals(OpenReacStatus.OK, openReacResult.getStatus()); + openReacResult.setUpdateNetworkWithVoltages(updateNetworkWithVoltages); + openReacResult.applyAllModifications(network); } } diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java deleted file mode 100644 index a362a790..00000000 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpecReacOptimizationBoundsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * SPDX-License-Identifier: MPL-2.0 - */ -package com.powsybl.openreac.optimization; - -import com.powsybl.iidm.network.Network; -import com.powsybl.openreac.network.VoltageControlNetworkFactory; -import com.powsybl.openreac.parameters.output.OpenReacResult; -import com.powsybl.openreac.parameters.output.OpenReacStatus; -import org.junit.jupiter.api.Test; - -import java.io.IOException; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Test the equipment bounds in OpenReac optimization. - * - * @author Pierre ARVY {@literal } - */ -class OpecReacOptimizationBoundsTest extends AbstractOpenReacRunnerTest { - - @Test - void testGeneratorsMaxPBounds() throws IOException { - Network network = VoltageControlNetworkFactory.createWithTwoVoltageControls(); - // due to the disconnection, the network is now imbalanced - // and max p of generators is not enough to provide balance - network.getLine("l45").getTerminal2().disconnect(); - OpenReacResult result = runOpenReac(network, "optimization/bounds/generators-pmax-too-small", true); - assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); - - // increase max p of generators to allow power balance - network.getGenerator("g2").setMaxP(2.5); - network.getGenerator("g3").setMaxP(2.5); - result = runOpenReac(network, "optimization/bounds/generators-pmax", true); - assertEquals(OpenReacStatus.OK, result.getStatus()); - } - - @Test - void testGeneratorsMinPBounds() throws IOException { - Network network = VoltageControlNetworkFactory.createWithTwoVoltageControls(); - // due to the modifications, the network is now imbalanced - // and min p of generators is not small enough to provide balance - network.getLine("l45").getTerminal2().disconnect(); - network.getLoad("l4").setP0(3); - network.getGenerator("g2").setMinP(2); - network.getGenerator("g3").setMinP(2); - OpenReacResult result = runOpenReac(network, "optimization/bounds/generators-pmin-too-high", true); - assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); - - // decrease min p of generators to allow power balance - // but targetP will be fixed in optimization, because it is too close of maxP - network.getGenerator("g2").setMinP(1); - network.getGenerator("g3").setMinP(1); - result = runOpenReac(network, "optimization/bounds/generators-target-p-too-close-pmax", true); - assertEquals(OpenReacStatus.NOT_OK, result.getStatus()); - - // increase max p of generators to allow modification of targetP in optimization - network.getGenerator("g2").setMaxP(2.5); - network.getGenerator("g3").setMaxP(2.5); - result = runOpenReac(network, "optimization/bounds/generators-pmin", true); - assertEquals(OpenReacStatus.OK, result.getStatus()); - } - -} diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java deleted file mode 100644 index d98304e4..00000000 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationIndicatorsTest.java +++ /dev/null @@ -1,281 +0,0 @@ -/** - * Copyright (c) 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * SPDX-License-Identifier: MPL-2.0 - */ -package com.powsybl.openreac.optimization; - -import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; -import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.StaticVarCompensator; -import com.powsybl.openreac.network.HvdcNetworkFactory; -import com.powsybl.openreac.network.VoltageControlNetworkFactory; -import com.powsybl.openreac.parameters.input.OpenReacParameters; -import com.powsybl.openreac.parameters.input.algo.OpenReacAmplLogLevel; -import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective; -import com.powsybl.openreac.parameters.input.algo.OpenReacSolverLogLevel; -import com.powsybl.openreac.parameters.input.algo.ReactiveSlackBusesMode; -import com.powsybl.openreac.parameters.output.OpenReacResult; -import com.powsybl.openreac.parameters.output.OpenReacStatus; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Test the indicators returned by OpenReac optimization. - * Note that some indicators might depend on optimization process, - * and can not be tested in unit tests. - * - * @author Pierre ARVY {@literal } - */ -class OpenReacOptimizationIndicatorsTest extends AbstractOpenReacRunnerTest { - - @Test - void testParametrizationIndicators() throws IOException { - Network network = IeeeCdfNetworkFactory.create57(); - OpenReacParameters parameters = new OpenReacParameters() - .setObjective(OpenReacOptimisationObjective.SPECIFIC_VOLTAGE_PROFILE) - .setObjectiveDistance(70) - .setLogLevelAmpl(OpenReacAmplLogLevel.WARNING) - .setLogLevelSolver(OpenReacSolverLogLevel.ONLY_RESULTS) - .setMinPlausibleLowVoltageLimit(0.655) - .setMaxPlausibleHighVoltageLimit(1.425) - .setReactiveSlackBusesMode(ReactiveSlackBusesMode.NO_GENERATION) - .setActivePowerVariationRate(0.999) - .setMinPlausibleActivePowerThreshold(0.02) - .setLowImpedanceThreshold(1e-5) - .setMinNominalVoltageIgnoredBus(0.75) - .setMinNominalVoltageIgnoredVoltageBounds(0.85) - .setPQMax(4001) - .setLowActivePowerDefaultLimit(0.1) - .setHighActivePowerDefaultLimit(1001) - .setDefaultQmaxPmaxRatio(0.2) - .setDefaultMinimalQPRange(2.) - .setDefaultVariableScalingFactor(1.001) - .setDefaultConstraintScalingFactor(0.999) - .setReactiveSlackVariableScalingFactor(1e-2) - .setTwoWindingTransformerRatioVariableScalingFactor(2e-3) - .setShuntVariableScalingFactor(0.11); - OpenReacResult result = runOpenReac(network, "optimization/indicators/input-parameters-test", parameters, true); - - // verify buses outside main SC have been excluded - assertEquals("WARNING", result.getIndicators().get("log_level_ampl")); - assertEquals(1, Integer.parseInt(result.getIndicators().get("log_level_knitro"))); - assertEquals(2, Integer.parseInt(result.getIndicators().get("objective_choice"))); - assertEquals(0.7, Double.parseDouble(result.getIndicators().get("ratio_voltage_target"))); - assertEquals(0.999, Double.parseDouble(result.getIndicators().get("coeff_alpha"))); - assertEquals(0.02, Double.parseDouble(result.getIndicators().get("Pnull"))); - assertEquals(1e-5, Double.parseDouble(result.getIndicators().get("Znull"))); - assertEquals(0.75, Double.parseDouble(result.getIndicators().get("epsilon_nominal_voltage"))); - assertEquals(0.655, Double.parseDouble(result.getIndicators().get("min_plausible_low_voltage_limit"))); - assertEquals(1.425, Double.parseDouble(result.getIndicators().get("max_plausible_high_voltage_limit"))); - assertEquals(0.85, Double.parseDouble(result.getIndicators().get("ignore_voltage_bounds"))); - assertEquals("NO_GENERATION", result.getIndicators().get("buses_with_reactive_slacks")); - assertEquals(4001, Double.parseDouble(result.getIndicators().get("PQmax"))); - assertEquals(1001, Double.parseDouble(result.getIndicators().get("defaultPmax"))); - assertEquals(0.1, Double.parseDouble(result.getIndicators().get("defaultPmin"))); - assertEquals(0.2, Double.parseDouble(result.getIndicators().get("defaultQmaxPmaxRatio"))); - assertEquals(-200.2, Double.parseDouble(result.getIndicators().get("defaultQmin"))); - assertEquals(200.2, Double.parseDouble(result.getIndicators().get("defaultQmax"))); - assertEquals(2.0, Double.parseDouble(result.getIndicators().get("minimalQPrange"))); - assertEquals(1.001, Double.parseDouble(result.getIndicators().get("default_variable_scaling_factor"))); - assertEquals(0.999, Double.parseDouble(result.getIndicators().get("default_constraint_scaling_factor"))); - assertEquals(0.01, Double.parseDouble(result.getIndicators().get("reactive_slack_variable_scaling_factor"))); - assertEquals(0.002, Double.parseDouble(result.getIndicators().get("transformer_ratio_variable_scaling_factor"))); - assertEquals(0.11, Double.parseDouble(result.getIndicators().get("shunt_variable_scaling_factor"))); - } - - @Test - void testBusIndicators() throws IOException { - Network network = HvdcNetworkFactory.createLccWithBiggerComponents(); - network.getBusBreakerView().getBus("b1").setV(400); - OpenReacResult result = runOpenReac(network, "optimization/indicators/bus-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_substations"))); - assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_bus_in_data_file"))); - assertEquals(16, Integer.parseInt(result.getIndicators().get("nb_bus_in_ACDC_CC"))); - // verify buses outside main SC have been excluded - assertEquals(12, Integer.parseInt(result.getIndicators().get("nb_bus_in_AC_CC"))); - assertEquals(4, Integer.parseInt(result.getIndicators().get("nb_bus_in_ACDC_but_out_AC_CC"))); - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_bus_with_voltage_value"))); - } - - @Test - void testBranchesIndicators() throws IOException { - Network network = VoltageControlNetworkFactory.createWithSimpleRemoteControl(); - network.getLine("l12").getTerminal2().disconnect(); - network.getLine("l24").getTerminal1().disconnect(); - // due to disconnected lines, increase max P of generators in main CC - network.getGenerator("g3").setMaxP(3); - network.getGenerator("g4").setMaxP(3); - OpenReacResult result = runOpenReac(network, "optimization/indicators/branches-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(4, Integer.parseInt(result.getIndicators().get("nb_branch_in_data_file"))); - // verify opened branches have been excluded - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC"))); - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_nonsmall_impedance"))); - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_zero_or_small_impedance"))); - } - - @Test - void testGeneratorIndicators() throws IOException { - Network network = VoltageControlNetworkFactory.createWithGeneratorRemoteControl(); - network.getGenerator("g1").setTargetQ(50); - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addConstantQGenerators(List.of("g1", "g3")); - OpenReacResult result = runOpenReac(network, "optimization/indicators/generators-test", parameters, true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_in_data_file"))); - assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_in_AC_CC"))); - assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_unit_up_and_running"))); - // verify that only the generators indicated as constant and with defined target Q are fixed in optimization - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_unit_with_fixed_reactive_power"))); - // verify other generators are optimized - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_unit_with_variable_reactive_power"))); - } - - @Test - void testTransformersIndicators() throws IOException { - Network network = VoltageControlNetworkFactory.createNetworkWith2T2wt(); - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addVariableTwoWindingsTransformers(List.of("T2wT1")); - OpenReacResult result = runOpenReac(network, "optimization/indicators/transfo-test", parameters, true); - - // verify only one rtc has been optimized - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_variable_ratio"))); - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_fixed_ratio"))); - } - - @Test - void testVscIndicators() throws IOException { - Network network = HvdcNetworkFactory.createVsc(); - // FIXME : should not depend on P/Q values on terminal - network.getVscConverterStation("cs2").getTerminal().setP(2).setQ(1); - OpenReacResult result = runOpenReac(network, "optimization/indicators/vsc-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file"))); - // verify only vsc in main cc is optimized - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_up_and_running"))); - } - - @Test - void testLccIndicators() throws IOException { - Network network = HvdcNetworkFactory.createLcc(); - // FIXME : should not depend on P/Q values on terminal - network.getLccConverterStation("cs2").getTerminal().setP(2).setQ(1); - OpenReacResult result = runOpenReac(network, "optimization/indicators/lcc-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_in_data_file"))); - // verify only lcc in main cc is considered in optimization - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_up_and_running"))); - } - - @Test - void testShuntsIndicators() throws IOException { - Network network = OpenReacOptimizationAndLoadFlowTest.create(); - // add one shunt that will be fixed in optimization - network.getVoltageLevel("vl3").newShuntCompensator() - .setId("SHUNT2") - .setBus("b3") - .setConnectableBus("b3") - .setSectionCount(0) - .setVoltageRegulatorOn(true) - .setTargetV(393) - .setTargetDeadband(5.0) - .newLinearModel() - .setMaximumSectionCount(25) - .setBPerSection(1e-3) - .add() - .add(); - // add one shunt that will not be considered in optimization, as it is neither optimized nor connected - network.getVoltageLevel("vl3").newShuntCompensator() - .setId("SHUNT3") - // .setBus("b3") - .setConnectableBus("b3") - .setSectionCount(0) - .setVoltageRegulatorOn(true) - .setTargetV(393) - .setTargetDeadband(5.0) - .newLinearModel() - .setMaximumSectionCount(25) - .setBPerSection(1e-3) - .add() - .add(); - OpenReacParameters parameters = new OpenReacParameters(); - parameters.addVariableShuntCompensators(List.of("SHUNT")); - OpenReacResult result = runOpenReac(network, "optimization/indicators/shunt-test", parameters, true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_shunt_in_data_file"))); - assertEquals(3, Integer.parseInt(result.getIndicators().get("nb_shunt_connectable_or_in_AC_CC"))); - // verify disconnected shunt, and not optimized, is not considered in shunts with fixed values - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_shunt_with_fixed_value"))); - // verify only one shunt has been optimized (even if it was disconnected) - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_shunt_with_variable_value"))); - } - - @Test - void testSvcIndicators() throws IOException { - Network network = VoltageControlNetworkFactory.createWithStaticVarCompensator(); - network.getVoltageLevel("vl2").newStaticVarCompensator() - .setId("svc2") - .setConnectableBus("b2") - .setBus("b2") - .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) - .setVoltageSetpoint(400) - .setBmin(-0.008) - .setBmax(0.008) - .add(); - OpenReacResult result = runOpenReac(network, "optimization/indicators/svc-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_svc_in_data_file"))); - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_svc_in_AC_CC"))); - // verify only one svc is regulating - assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_svc_up_and_operating"))); - } - - @Test - void testBatteryIndicators() throws IOException { - Network network = VoltageControlNetworkFactory.createWithGeneratorRemoteControl(); - network.getVoltageLevel("vl4") - .newBattery() - .setId("bat1") - .setMinP(-10) - .setMaxP(10) - .setTargetP(2) - .setBus("b4") - .setConnectableBus("b4") - .setTargetQ(0) - .add(); - network.getVoltageLevel("vl1") - .newBattery() - .setId("bat2") - .setMinP(-9) - .setMaxP(11) - .setTargetP(1) - .setBus("b1") - .setConnectableBus("b1") - .setTargetQ(0.2) - .add(); - OpenReacResult result = runOpenReac(network, "optimization/indicators/battery-test", true); - - assertEquals(OpenReacStatus.OK, result.getStatus()); - assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_batteries"))); - // verify the sum of max and min active power of the batteries - assertEquals(21, Double.parseDouble(result.getIndicators().get("sum_batteries_pmax"))); - assertEquals(-19, Double.parseDouble(result.getIndicators().get("sum_batteries_pmin"))); - } - -} diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt deleted file mode 100644 index edad4c5b..00000000 --- a/open-reac/src/test/resources/optimization/bounds/generators-pmax-too-small/reactiveopf_results_indic.txt +++ /dev/null @@ -1,94 +0,0 @@ -final_status NOK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:39:06 2024' -last_solve_result_num 200 -nb_iter_last 67 -nb_iter_total 67 -_ampl_elapsed_time 0.140000 -_total_solve_time 0.046875 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_16806244976153640704' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 5 -nb_bus_in_data_file 5 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.02 -max_teta_ac 0.01 -teta_max 3.02 -min_teta_dc -0.05 -min_teta_ac -0.03 -teta_min -3.05 -max_delta_teta_dc 0.050000 -max_delta_teta_ac 0.030638 -min_delta_teta_dc -0.025000 -min_delta_teta_ac -0.014361 - -nb_reactive_slacks 4 -nb_slacks_condensator 4 -sum_slacks_condensator 2.6 -nb_slacks_self 4 -sum_slacks_self 2.5 -messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt deleted file mode 100644 index aefdeae1..00000000 --- a/open-reac/src/test/resources/optimization/bounds/generators-pmax/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:39:06 2024' -last_solve_result_num 0 -nb_iter_last 7 -nb_iter_total 7 -_ampl_elapsed_time 0.139000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_7246203715336309657' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 5 -nb_bus_in_data_file 5 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.02 -max_teta_ac 0.03 -teta_max 3.02 -min_teta_dc -0.05 -min_teta_ac -0.05 -teta_min -3.05 -max_delta_teta_dc 0.050000 -max_delta_teta_ac 0.051670 -min_delta_teta_dc -0.025000 -min_delta_teta_ac -0.025352 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt deleted file mode 100644 index b213826c..00000000 --- a/open-reac/src/test/resources/optimization/bounds/generators-pmin-too-high/reactiveopf_results_indic.txt +++ /dev/null @@ -1,94 +0,0 @@ -final_status NOK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:39:05 2024' -last_solve_result_num 200 -nb_iter_last 60 -nb_iter_total 60 -_ampl_elapsed_time 0.155000 -_total_solve_time 0.046875 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_14708682651458660614' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 5 -nb_bus_in_data_file 5 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.01 -max_teta_ac 0.02 -teta_max 3.01 -min_teta_dc -0.03 -min_teta_ac -0.04 -teta_min -3.03 -max_delta_teta_dc 0.030000 -max_delta_teta_ac 0.035331 -min_delta_teta_dc -0.015000 -min_delta_teta_ac -0.018693 - -nb_reactive_slacks 4 -nb_slacks_condensator 4 -sum_slacks_condensator 1.3 -nb_slacks_self 4 -sum_slacks_self 1.2 -messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt deleted file mode 100644 index b3a69be6..00000000 --- a/open-reac/src/test/resources/optimization/bounds/generators-pmin/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:39:05 2024' -last_solve_result_num 0 -nb_iter_last 7 -nb_iter_total 7 -_ampl_elapsed_time 0.078000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_5930746422974926450' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 5 -nb_bus_in_data_file 5 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.01 -max_teta_ac 0.03 -teta_max 3.01 -min_teta_dc -0.03 -min_teta_ac -0.05 -teta_min -3.03 -max_delta_teta_dc 0.030000 -max_delta_teta_ac 0.054735 -min_delta_teta_dc -0.015000 -min_delta_teta_ac -0.026527 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt deleted file mode 100644 index edce49c4..00000000 --- a/open-reac/src/test/resources/optimization/bounds/generators-target-p-too-close-pmax/reactiveopf_results_indic.txt +++ /dev/null @@ -1,94 +0,0 @@ -final_status NOK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:39:05 2024' -last_solve_result_num 200 -nb_iter_last 60 -nb_iter_total 60 -_ampl_elapsed_time 0.109000 -_total_solve_time 0.046875 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_3318717096223947573' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 5 -nb_bus_in_data_file 5 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.01 -max_teta_ac 0.02 -teta_max 3.01 -min_teta_dc -0.03 -min_teta_ac -0.04 -teta_min -3.03 -max_delta_teta_dc 0.030000 -max_delta_teta_ac 0.035331 -min_delta_teta_dc -0.015000 -min_delta_teta_ac -0.018693 - -nb_reactive_slacks 4 -nb_slacks_condensator 4 -sum_slacks_condensator 1.3 -nb_slacks_self 4 -sum_slacks_self 1.2 -messageInfo1 'Acopf optimization was ***not*** successfull - Convergence to an infeasible solution' diff --git a/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt deleted file mode 100644 index 2f49c9cc..00000000 --- a/open-reac/src/test/resources/optimization/indicators/battery-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:29 2024' -last_solve_result_num 0 -nb_iter_last 10 -nb_iter_total 10 -_ampl_elapsed_time 0.109000 -_total_solve_time 0.046875 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_8792994315745054563' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 4 -nb_bus_in_data_file 4 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 3 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 3 -nb_unit_up_and_running 3 -nb_unit_with_variable_reactive_power 3 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 1 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 2 -sum_batteries_pmax 21.0 -sum_batteries_pmin -19.0 - -max_teta_dc 0.03 -max_teta_ac 0.02 -teta_max 3.03 -min_teta_dc 0.00 -min_teta_ac 0.00 -teta_min -3.00 -max_delta_teta_dc 0.030896 -max_delta_teta_ac 0.015495 -min_delta_teta_dc 0.018725 -min_delta_teta_ac 0.009609 - -nb_reactive_slacks 1 -nb_slacks_condensator 1 -sum_slacks_condensator 25.4 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt deleted file mode 100644 index 93f59eb1..00000000 --- a/open-reac/src/test/resources/optimization/indicators/branches-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:29 2024' -last_solve_result_num 0 -nb_iter_last 8 -nb_iter_total 8 -_ampl_elapsed_time 0.141000 -_total_solve_time 0.015625 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_16228844043131338938' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 4 -nb_bus_in_data_file 4 -nb_bus_in_ACDC_CC 3 -nb_bus_in_AC_CC 3 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 3 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 4 -nb_branch_in_AC_CC 2 -nb_branch_with_nonsmall_impedance 1 -nb_branch_with_zero_or_small_impedance 1 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 2 -nb_unit_up_and_running 2 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 2 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.03 -max_teta_ac 0.01 -teta_max 3.03 -min_teta_dc -0.00 -min_teta_ac -0.00 -teta_min -3.00 -max_delta_teta_dc 0.030000 -max_delta_teta_ac 0.013386 -min_delta_teta_dc 0.000001 -min_delta_teta_ac 0.000000 - -nb_reactive_slacks 2 -nb_slacks_condensator 2 -sum_slacks_condensator 0.2 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt deleted file mode 100644 index 4fc11e98..00000000 --- a/open-reac/src/test/resources/optimization/indicators/bus-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:30 2024' -last_solve_result_num 0 -nb_iter_last 17 -nb_iter_total 17 -_ampl_elapsed_time 0.124000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_4215184811660139075' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 16 -nb_bus_in_data_file 16 -nb_bus_in_ACDC_CC 16 -nb_bus_in_AC_CC 12 -nb_bus_in_ACDC_but_out_AC_CC 4 -nb_bus_with_voltage_value 1 -nb_bus_with_reactive_slacks 12 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 14 -nb_branch_in_AC_CC 11 -nb_branch_with_nonsmall_impedance 1 -nb_branch_with_zero_or_small_impedance 10 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 2 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.00 -max_teta_ac 0.00 -teta_max 3.00 -min_teta_dc -0.00 -min_teta_ac -0.00 -teta_min -3.00 -max_delta_teta_dc 0.000937 -max_delta_teta_ac 0.003363 -min_delta_teta_dc 0.000000 -min_delta_teta_ac -0.000000 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt deleted file mode 100644 index c9c996ee..00000000 --- a/open-reac/src/test/resources/optimization/indicators/generators-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:29 2024' -last_solve_result_num 0 -nb_iter_last 9 -nb_iter_total 9 -_ampl_elapsed_time 0.109000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_4963164058041255301' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 4 -nb_bus_in_data_file 4 -nb_bus_in_ACDC_CC 4 -nb_bus_in_AC_CC 4 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 4 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 3 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 3 -nb_unit_in_AC_CC 3 -nb_unit_up_and_running 3 -nb_unit_with_variable_reactive_power 2 -nb_unit_with_fixed_reactive_power 1 -nb_load_in_data_file 1 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.03 -max_teta_ac 0.02 -teta_max 3.03 -min_teta_dc 0.00 -min_teta_ac 0.00 -teta_min -3.00 -max_delta_teta_dc 0.031208 -max_delta_teta_ac 0.015617 -min_delta_teta_dc 0.018725 -min_delta_teta_ac 0.009685 - -nb_reactive_slacks 1 -nb_slacks_condensator 1 -sum_slacks_condensator 35.9 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt deleted file mode 100644 index e7bb228a..00000000 --- a/open-reac/src/test/resources/optimization/indicators/input-parameters-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:28 2024' -last_solve_result_num 0 -nb_iter_last 7 -nb_iter_total 7 -_ampl_elapsed_time 0.140000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_10158983132520924590' - -log_level_ampl WARNING -log_level_knitro 1 -objective_choice 2 -ratio_voltage_target 0.700000 -coeff_alpha 0.999000 -Pnull 0.020000 -Znull 0.000010 -epsilon_nominal_voltage 0.750000 -min_plausible_low_voltage_limit 0.655000 -max_plausible_high_voltage_limit 1.425000 -ignore_voltage_bounds 0.850000 -buses_with_reactive_slacks NO_GENERATION -PQmax 4001.000000 -defaultPmax 1001.000000 -defaultPmin 0.100000 -defaultQmaxPmaxRatio 0.200000 -defaultQmin -200.200000 -defaultQmax 200.200000 -minimalQPrange 2.000000 -default_variable_scaling_factor 1.001000 -default_constraint_scaling_factor 0.999000 -reactive_slack_variable_scaling_factor 0.010000 -transformer_ratio_variable_scaling_factor 0.002000 -shunt_variable_scaling_factor 0.110000 - -nb_substations 42 -nb_bus_in_data_file 57 -nb_bus_in_ACDC_CC 57 -nb_bus_in_AC_CC 57 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 57 -nb_bus_with_reactive_slacks 53 -nb_bus_without_reactive_slacks 4 -nb_branch_in_data_file 80 -nb_branch_in_AC_CC 80 -nb_branch_with_nonsmall_impedance 80 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 7 -nb_unit_in_AC_CC 7 -nb_unit_up_and_running 4 -nb_unit_with_variable_reactive_power 4 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 42 -nb_load_in_AC_CC 42 -nb_shunt_in_data_file 3 -nb_shunt_connectable_or_in_AC_CC 3 -nb_shunt_with_fixed_value 3 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.21 -max_teta_ac 0.13 -teta_max 3.21 -min_teta_dc -0.17 -min_teta_ac -0.17 -teta_min -3.17 -max_delta_teta_dc 0.146072 -max_delta_teta_ac 0.105543 -min_delta_teta_dc -0.144911 -min_delta_teta_ac -0.088988 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt deleted file mode 100644 index 04782c22..00000000 --- a/open-reac/src/test/resources/optimization/indicators/lcc-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:27 2024' -last_solve_result_num 0 -nb_iter_last 6 -nb_iter_total 6 -_ampl_elapsed_time 0.173000 -_total_solve_time 0.078125 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_1900278357647775261' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 3 -nb_bus_in_data_file 3 -nb_bus_in_ACDC_CC 3 -nb_bus_in_AC_CC 2 -nb_bus_in_ACDC_but_out_AC_CC 1 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 2 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 1 -nb_branch_in_AC_CC 1 -nb_branch_with_nonsmall_impedance 1 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 2 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 2 -nb_lcc_converter_up_and_running 1 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.00 -max_teta_ac 0.00 -teta_max 3.00 -min_teta_dc 0.00 -min_teta_ac 0.00 -teta_min -3.00 -max_delta_teta_dc 0.000975 -max_delta_teta_ac 0.001211 -min_delta_teta_dc 0.000975 -min_delta_teta_ac 0.001211 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt deleted file mode 100644 index 611ec18f..00000000 --- a/open-reac/src/test/resources/optimization/indicators/shunt-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 18:32:41 2024' -last_solve_result_num 0 -nb_iter_last 35 -nb_iter_total 35 -_ampl_elapsed_time 0.108000 -_total_solve_time 0.031250 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_15990639329670156176' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 3 -nb_bus_in_data_file 3 -nb_bus_in_ACDC_CC 3 -nb_bus_in_AC_CC 3 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 3 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 2 -nb_branch_in_AC_CC 2 -nb_branch_with_nonsmall_impedance 2 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 1 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 1 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 3 -nb_shunt_connectable_or_in_AC_CC 3 -nb_shunt_with_fixed_value 1 -nb_shunt_with_variable_value 1 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.00 -max_teta_ac 0.00 -teta_max 3.00 -min_teta_dc 0.00 -min_teta_ac -0.00 -teta_min -3.00 -max_delta_teta_dc 0.001894 -max_delta_teta_ac 0.001642 -min_delta_teta_dc 0.000000 -min_delta_teta_ac -0.000773 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt deleted file mode 100644 index 6c681c4e..00000000 --- a/open-reac/src/test/resources/optimization/indicators/svc-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:28 2024' -last_solve_result_num 0 -nb_iter_last 4 -nb_iter_total 4 -_ampl_elapsed_time 0.125000 -_total_solve_time 0.062500 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_2452729350162475477' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 2 -nb_bus_in_data_file 2 -nb_bus_in_ACDC_CC 2 -nb_bus_in_AC_CC 2 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 2 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 1 -nb_branch_in_AC_CC 1 -nb_branch_with_nonsmall_impedance 1 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 1 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 1 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 2 -nb_svc_in_AC_CC 2 -nb_svc_up_and_operating 1 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.00 -max_teta_ac 0.00 -teta_max 3.00 -min_teta_dc 0.00 -min_teta_ac 0.00 -teta_min -3.00 -max_delta_teta_dc 0.001894 -max_delta_teta_ac 0.001258 -min_delta_teta_dc 0.001894 -min_delta_teta_ac 0.001258 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt deleted file mode 100644 index 9fb65985..00000000 --- a/open-reac/src/test/resources/optimization/indicators/transfo-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:57:26 2024' -last_solve_result_num 0 -nb_iter_last 4 -nb_iter_total 4 -_ampl_elapsed_time 0.142000 -_total_solve_time 0.046875 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_3953804062991735571' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 3 -nb_bus_in_data_file 3 -nb_bus_in_ACDC_CC 3 -nb_bus_in_AC_CC 3 -nb_bus_in_ACDC_but_out_AC_CC 0 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 3 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 3 -nb_branch_in_AC_CC 3 -nb_branch_with_nonsmall_impedance 3 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 1 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 2 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 1 -nb_transformers_with_fixed_ratio 1 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 0 -nb_vsc_converter_up_and_running 0 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.01 -max_teta_ac 0.02 -teta_max 3.01 -min_teta_dc -0.02 -min_teta_ac -0.04 -teta_min -3.02 -max_delta_teta_dc 0.022957 -max_delta_teta_ac 0.037399 -min_delta_teta_dc 0.009298 -min_delta_teta_ac 0.016902 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 diff --git a/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt b/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt deleted file mode 100644 index 882281eb..00000000 --- a/open-reac/src/test/resources/optimization/indicators/vsc-test/reactiveopf_results_indic.txt +++ /dev/null @@ -1,93 +0,0 @@ -final_status OK -dcopf_status OK - -ctime_start 'Wed Dec 04 17:15:42 2024' -last_solve_result_num 0 -nb_iter_last 5 -nb_iter_total 5 -_ampl_elapsed_time 0.093000 -_total_solve_time 0.062500 -total_time 0 - -operatingSystem windows -OS 'Windows_NT' -COMPUTERNAME 'ARTELYS-PC253' -directory 'C:\Users\parvy\AppData\Local\Temp\ampl_995048131625005748' - -log_level_ampl INFO -log_level_knitro 2 -objective_choice 0 -ratio_voltage_target 0.500000 -coeff_alpha 1.000000 -Pnull 0.010000 -Znull 0.000100 -epsilon_nominal_voltage 1.000000 -min_plausible_low_voltage_limit 0.500000 -max_plausible_high_voltage_limit 1.500000 -ignore_voltage_bounds 0.000000 -buses_with_reactive_slacks ALL -PQmax 9000.000000 -defaultPmax 1000.000000 -defaultPmin 0.000000 -defaultQmaxPmaxRatio 0.300000 -defaultQmin -300.000000 -defaultQmax 300.000000 -minimalQPrange 1.000000 -default_variable_scaling_factor 1.000000 -default_constraint_scaling_factor 1.000000 -reactive_slack_variable_scaling_factor 0.100000 -transformer_ratio_variable_scaling_factor 0.001000 -shunt_variable_scaling_factor 0.100000 - -nb_substations 3 -nb_bus_in_data_file 3 -nb_bus_in_ACDC_CC 3 -nb_bus_in_AC_CC 2 -nb_bus_in_ACDC_but_out_AC_CC 1 -nb_bus_with_voltage_value 0 -nb_bus_with_reactive_slacks 2 -nb_bus_without_reactive_slacks 0 -nb_branch_in_data_file 1 -nb_branch_in_AC_CC 1 -nb_branch_with_nonsmall_impedance 1 -nb_branch_with_zero_or_small_impedance 0 -nb_unit_in_data_file 1 -nb_unit_in_AC_CC 1 -nb_unit_up_and_running 1 -nb_unit_with_variable_reactive_power 1 -nb_unit_with_fixed_reactive_power 0 -nb_load_in_data_file 2 -nb_load_in_AC_CC 1 -nb_shunt_in_data_file 0 -nb_shunt_connectable_or_in_AC_CC 0 -nb_shunt_with_fixed_value 0 -nb_shunt_with_variable_value 0 -nb_transformers_with_variable_ratio 0 -nb_transformers_with_fixed_ratio 0 -nb_svc_in_data_file 0 -nb_svc_in_AC_CC 0 -nb_svc_up_and_operating 0 -nb_vsc_converter_in_data_file 2 -nb_vsc_converter_up_and_running 1 -nb_lcc_converter_in_data_file 0 -nb_lcc_converter_up_and_running 0 -nb_batteries 0 -sum_batteries_pmax 0.0 -sum_batteries_pmin 0.0 - -max_teta_dc 0.00 -max_teta_ac 0.00 -teta_max 3.00 -min_teta_dc 0.00 -min_teta_ac 0.00 -teta_min -3.00 -max_delta_teta_dc 0.000975 -max_delta_teta_ac 0.001335 -min_delta_teta_dc 0.000975 -min_delta_teta_ac 0.001335 - -nb_reactive_slacks 0 -nb_slacks_condensator 0 -sum_slacks_condensator 0.0 -nb_slacks_self 0 -sum_slacks_self 0.0 From cd043e818f1488daedfed4ef5ce82bc025cf4ad0 Mon Sep 17 00:00:00 2001 From: p-arvy Date: Thu, 12 Dec 2024 16:15:33 +0100 Subject: [PATCH 9/9] Clean Signed-off-by: p-arvy --- .../openreac/optimization/AbstractOpenReacRunnerTest.java | 3 ++- .../optimization/OpenReacOptimizationAndLoadFlowTest.java | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index a53d9720..c539f9b6 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -29,7 +29,6 @@ import java.io.InputStream; import java.nio.file.FileSystem; import java.nio.file.Path; -import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.ForkJoinPool; @@ -86,6 +85,8 @@ protected void testAllModifAndLoadFlow(Network network, String subFolder, OpenRe */ void runAndApplyAllModifications(Network network, String subFolder, OpenReacParameters parameters, boolean updateNetworkWithVoltages, ReportNode reportNode) throws IOException { + // set default voltage limits to every voltage levels of the network + setDefaultVoltageLimits(network); LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor( List.of(subFolder + "/reactiveopf_results_generators.csv", subFolder + "/reactiveopf_results_indic.txt", diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java index 89eba645..25632d0d 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/OpenReacOptimizationAndLoadFlowTest.java @@ -14,8 +14,6 @@ import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.*; -import com.powsybl.loadflow.LoadFlow; -import com.powsybl.loadflow.LoadFlowResult; import com.powsybl.openreac.OpenReacConfig; import com.powsybl.openreac.OpenReacRunner; import com.powsybl.openreac.network.HvdcNetworkFactory; @@ -189,9 +187,6 @@ void testWarmStart() throws IOException { assertEquals(0, network.getBusBreakerView().getBus("BUS_2").getAngle()); assertEquals(22.935, network.getBusBreakerView().getBus("BUS_3").getV()); assertEquals(-4.698, network.getBusBreakerView().getBus("BUS_3").getAngle(), 0.001); - - LoadFlowResult loadFlowResult = LoadFlow.run(network); - assertTrue(loadFlowResult.isFullyConverged()); } public static Network create() {