From 29191e202332e8a8c3d5ee221c2e9ac0a19f9f76 Mon Sep 17 00:00:00 2001 From: Anne Tilloy Date: Tue, 13 Jun 2023 14:45:55 +0200 Subject: [PATCH 1/6] WIP. Signed-off-by: Anne Tilloy --- .../java/com/powsybl/iidm/network/Bus.java | 36 -------------- .../powsybl/iidm/network/Identifiable.java | 20 -------- .../iidm/network/StaticVarCompensator.java | 48 ++----------------- .../network/StaticVarCompensatorAdder.java | 24 +--------- .../powsybl/iidm/network/ValidationUtil.java | 15 ------ .../powsybl/iidm/network/VoltageLevel.java | 10 ---- .../network/util/LimitViolationUtils.java | 16 ------- .../powsybl/iidm/network/util/Networks.java | 14 ------ .../network/impl/NodeBreakerVoltageLevel.java | 9 ---- 9 files changed, 6 insertions(+), 186 deletions(-) diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Bus.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Bus.java index 030829882fc..f7ab9c41f45 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Bus.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Bus.java @@ -114,57 +114,21 @@ default Bus setFictitiousQ0(double q0) { */ Iterable getTwoWindingsTransformers(); - /** - * Get 2 windings transformer connected to the bus. - * @deprecated Use {@link #getTwoWindingsTransformers()} instead. - */ - @Deprecated - default Iterable getTwoWindingTransformers() { - return getTwoWindingsTransformers(); - } - /** * Get 2 windings transformer connected to the bus. */ Stream getTwoWindingsTransformerStream(); - /** - * Get 2 windings transformer connected to the bus. - * @deprecated Use {@link #getTwoWindingsTransformerStream()} instead. - */ - @Deprecated - default Stream getTwoWindingTransformerStream() { - return getTwoWindingsTransformerStream(); - } - /** * Get 3 windings transformers connected to the bus. */ Iterable getThreeWindingsTransformers(); - /** - * Get 3 windings transformers connected to the bus. - * @deprecated Use {@link #getThreeWindingsTransformers()} instead. - */ - @Deprecated - default Iterable getThreeWindingTransformers() { - return getThreeWindingsTransformers(); - } - /** * Get 3 windings transformers connected to the bus. */ Stream getThreeWindingsTransformerStream(); - /** - * Get 3 windings transformers connected to the bus. - * @deprecated Use {@link #getThreeWindingsTransformerStream()} instead. - */ - @Deprecated - default Stream getThreeWindingTransformerStream() { - return getThreeWindingsTransformerStream(); - } - /** * Get generators connected to the bus. */ diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Identifiable.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Identifiable.java index 53817fa9902..c09f0de9ea8 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Identifiable.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Identifiable.java @@ -28,16 +28,6 @@ public interface Identifiable> extends Extendable { */ String getId(); - /** - * Get the name of the object if it exists. If not, get the unique identifier of the object. - * - * @deprecated Use {@link #getNameOrId()} or {@link #getOptionalName()} instead. - */ - @Deprecated - default String getName() { - return getNameOrId(); - } - /** * Get the aliases of the object. */ @@ -135,16 +125,6 @@ default I setName(String name) { */ boolean hasProperty(); - /** - * Get properties associated to the object. - * - * @deprecated Use {@link #getProperty(String)} & {@link #setProperty(String, String)} instead. - */ - @Deprecated - default Properties getProperties() { - throw new UnsupportedOperationException("Deprecated"); - } - /** * Check that this object has property with specified name. */ diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensator.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensator.java index 13e49cd600d..f489db134d8 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensator.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensator.java @@ -134,17 +134,7 @@ enum RegulationMode { *

Depends on the working variant.

* @return the voltage setpoint */ - default double getVoltageSetpoint() { - return getVoltageSetPoint(); - } - - /** - * @deprecated use {@link #getVoltageSetpoint()} instead. - */ - @Deprecated - default double getVoltageSetPoint() { - return getVoltageSetpoint(); - } + double getVoltageSetpoint(); /** *

Set the voltage setpoint in Kv.

@@ -153,17 +143,7 @@ default double getVoltageSetPoint() { * @param voltageSetpoint the voltage setpoint * @return this to allow method chaining */ - default StaticVarCompensator setVoltageSetpoint(double voltageSetpoint) { - return setVoltageSetPoint(voltageSetpoint); - } - - /** - * @deprecated use {@link #setVoltageSetpoint(double voltageSetpoint)} instead. - */ - @Deprecated - default StaticVarCompensator setVoltageSetPoint(double voltageSetPoint) { - return setVoltageSetpoint(voltageSetPoint); - } + StaticVarCompensator setVoltageSetpoint(double voltageSetpoint); /** *

Get the reactive power setpoint in MVAR.

@@ -171,17 +151,7 @@ default StaticVarCompensator setVoltageSetPoint(double voltageSetPoint) { *

Depends on the working variant.

* @return the reactive power setpoint */ - default double getReactivePowerSetpoint() { - return getReactivePowerSetPoint(); - } - - /** - * @deprecated use {@link #getReactivePowerSetpoint()} instead. - */ - @Deprecated - default double getReactivePowerSetPoint() { - return getReactivePowerSetpoint(); - } + double getReactivePowerSetpoint(); /** *

Set the reactive power setpoint in MVAR.

@@ -190,17 +160,7 @@ default double getReactivePowerSetPoint() { * @param reactivePowerSetpoint the reactive power setpoint * @return this to allow method chaining */ - default StaticVarCompensator setReactivePowerSetpoint(double reactivePowerSetpoint) { - return setReactivePowerSetPoint(reactivePowerSetpoint); - } - - /** - * @deprecated use {@link #setReactivePowerSetpoint(double reactivePowerSetpoint)} instead. - */ - @Deprecated - default StaticVarCompensator setReactivePowerSetPoint(double reactivePowerSetPoint) { - return setReactivePowerSetpoint(reactivePowerSetPoint); - } + StaticVarCompensator setReactivePowerSetpoint(double reactivePowerSetpoint); /** *

Get the regulating mode.

diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensatorAdder.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensatorAdder.java index 3aaa9125a1d..487a574dfca 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensatorAdder.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/StaticVarCompensatorAdder.java @@ -15,29 +15,9 @@ public interface StaticVarCompensatorAdder extends InjectionAdder maxP) { - throw new ValidationException(validable, "invalid active power p > maxP: " + p + " > " + maxP); - } - if (p < minP) { - throw new ValidationException(validable, "invalid active power p < minP: " + p + " < " + minP); - } - } - public static ValidationLevel checkTargetDeadband(Validable validable, String validableType, boolean regulating, double targetDeadband, ValidationLevel validationLevel) { return checkTargetDeadband(validable, validableType, regulating, targetDeadband, validationLevel, Reporter.NO_OP); } diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageLevel.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageLevel.java index a614e230c53..9f84cb39ddf 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageLevel.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageLevel.java @@ -445,16 +445,6 @@ interface InternalConnection { int getNode2(); } - /** - * Get the count of used nodes (nodes attached to an equipment, a switch or an internal connection). - * - * @deprecated Use {@link #getMaximumNodeIndex()} instead. - */ - @Deprecated - default int getNodeCount() { - throw new UnsupportedOperationException(); - } - /** * Get the highest index of used nodes (i.e. attached to an equipment, a switch or an internal connection) in the voltage level. */ diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/LimitViolationUtils.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/LimitViolationUtils.java index 328c04a64bc..09b55b67624 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/LimitViolationUtils.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/LimitViolationUtils.java @@ -26,14 +26,6 @@ public final class LimitViolationUtils { private LimitViolationUtils() { } - /** - * @deprecated Since 4.3.0, use {@link #checkTemporaryLimits(Branch, Branch.Side, float, double, LimitType)} instead. - */ - @Deprecated(since = "4.3.0") - public static Branch.Overload checkTemporaryLimits(Branch branch, Branch.Side side, float limitReduction, double i) { - return checkTemporaryLimits(branch, side, limitReduction, i, LimitType.CURRENT); - } - public static Branch.Overload checkTemporaryLimits(Branch branch, Branch.Side side, float limitReduction, double i, LimitType type) { Objects.requireNonNull(branch); Objects.requireNonNull(side); @@ -62,14 +54,6 @@ private static OverloadImpl getOverload(LoadingLimits limits, double i, float li return null; } - /** - * @deprecated Since 4.3.0, use {@link #checkPermanentLimit(Branch, Branch.Side, float, double, LimitType)} instead. - */ - @Deprecated(since = "4.3.0") - public static boolean checkPermanentLimit(Branch branch, Branch.Side side, float limitReduction, double i) { - return checkPermanentLimit(branch, side, limitReduction, i, LimitType.CURRENT); - } - public static boolean checkPermanentLimit(Branch branch, Branch.Side side, float limitReduction, double i, LimitType type) { return branch.getLimits(type, side) .map(l -> !Double.isNaN(l.getPermanentLimit()) && diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/Networks.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/Networks.java index b40ca2999dc..ed031d581b4 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/Networks.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/Networks.java @@ -90,20 +90,6 @@ static class ConnectedPower { private double disconnectedShuntNegativeVolume = 0.0; } - /** - * @deprecated Use {@link #printBalanceSummary(String, Network, Writer)} instead. - */ - @Deprecated - public static void printBalanceSummary(String title, Network network, Logger logger) throws IOException { - Objects.requireNonNull(logger); - if (logger.isDebugEnabled()) { - try (Writer writer = new StringWriter()) { - printBalanceSummary(title, network, writer); - logger.debug(writer.toString()); - } - } - } - public static void printBalanceSummary(String title, Network network, Writer writer) throws IOException { Objects.requireNonNull(title); Objects.requireNonNull(network); diff --git a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NodeBreakerVoltageLevel.java b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NodeBreakerVoltageLevel.java index 6794e62083b..4c4d047997c 100644 --- a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NodeBreakerVoltageLevel.java +++ b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NodeBreakerVoltageLevel.java @@ -707,15 +707,6 @@ public NodeBreakerView setFictitiousQ0(int node, double q0) { return this; } - /** - * @deprecated Use {@link #getMaximumNodeIndex()} instead. - */ - @Override - @Deprecated - public int getNodeCount() { - return graph.getVertexCount(); - } - @Override public int getMaximumNodeIndex() { return graph.getVertexCapacity() - 1; From a97e9758c7d369e841aa5fa4953edf850719d61a Mon Sep 17 00:00:00 2001 From: Anne Tilloy Date: Tue, 13 Jun 2023 14:56:22 +0200 Subject: [PATCH 2/6] Clean scalable. Signed-off-by: Anne Tilloy --- .../scalable/AbstractScalable.java | 43 ------------------- .../iidm/modification/scalable/Scalable.java | 19 -------- .../scalable/GeneratorScalableTest.java | 9 ---- .../modification/scalable/ScalableTest.java | 42 ------------------ 4 files changed, 113 deletions(-) diff --git a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/AbstractScalable.java b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/AbstractScalable.java index 78f3e37b3af..a25967c44b4 100644 --- a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/AbstractScalable.java +++ b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/AbstractScalable.java @@ -6,13 +6,11 @@ */ package com.powsybl.iidm.modification.scalable; -import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Injection; import com.powsybl.iidm.network.Network; import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** * @author Geoffroy Jamgotchian @@ -34,47 +32,6 @@ public List filterInjections(Network network) { return filterInjections(network, null); } - - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - public List listGenerators(Network n, List notFoundGenerators) { - List generators = new ArrayList<>(); - listGenerators(n, generators, notFoundGenerators); - return generators; - } - - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - public List listGenerators(Network n) { - return listGenerators(n, null); - } - - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - public void listGenerators(Network network, List generators, List notFoundGenerators) { - Objects.requireNonNull(network); - Objects.requireNonNull(generators); - - List injections = filterInjections(network, notFoundGenerators); - - for (Injection injection : injections) { - - if (injection instanceof Generator) { - generators.add((Generator) injection); - } else { - if (notFoundGenerators != null) { - notFoundGenerators.add(injection.getId()); - } - } - } - } - @Override public double maximumValue(Network n) { return maximumValue(n, ScalingConvention.GENERATOR); diff --git a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java index b13921e1121..2ecd7bf917d 100644 --- a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java +++ b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java @@ -6,7 +6,6 @@ */ package com.powsybl.iidm.modification.scalable; -import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Injection; import com.powsybl.iidm.network.Network; @@ -74,24 +73,6 @@ enum ScalingConvention { */ double minimumValue(Network n, ScalingConvention scalingConvention); - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - void listGenerators(Network n, List generators, List notFoundGenerators); - - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - List listGenerators(Network n, List notFoundGenerators); - - /** - * @deprecated listGenerators should be replaced by filterInjections - */ - @Deprecated - List listGenerators(Network n); - /** * Scans all the expected injections of the scalable. * If the injection can be found in given network, it is added the the injections list. diff --git a/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/GeneratorScalableTest.java b/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/GeneratorScalableTest.java index 5cbccd18da1..870cd1466df 100644 --- a/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/GeneratorScalableTest.java +++ b/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/GeneratorScalableTest.java @@ -92,15 +92,6 @@ void testMinimumValue() { assertEquals(-100, g5.minimumValue(network, LOAD), 0); } - @Test - void testListGenerators() { - Generator generator1 = network.getGenerator("g1"); - - List generators = g1.listGenerators(network); - assertEquals(1, generators.size()); - assertSame(generator1, generators.get(0)); - } - @Test void testDisconnectedGenerator() { g3.scale(network, 100.0); diff --git a/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/ScalableTest.java b/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/ScalableTest.java index 7e38eb643f7..ed8a293216c 100644 --- a/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/ScalableTest.java +++ b/iidm/iidm-modification/src/test/java/com/powsybl/iidm/modification/scalable/ScalableTest.java @@ -401,48 +401,6 @@ void testStackScaleLoadConvention() { } - @Test - void testListGenerators() { - Generator generator1 = network.getGenerator("g1"); - Generator generator2 = network.getGenerator("g2"); - - List generators = g1.listGenerators(network); - assertEquals(1, generators.size()); - assertSame(generator1, generators.get(0)); - - generators = Scalable.stack(g1, g2).listGenerators(network); - assertEquals(2, generators.size()); - assertSame(generator1, generators.get(0)); - assertSame(generator2, generators.get(1)); - - Scalable unknownGenerator = Scalable.onGenerator("unknown"); - List notFoundGenerators = new ArrayList<>(); - generators = Scalable.stack(g1, g2, unknownGenerator).listGenerators(network, notFoundGenerators); - assertEquals(2, generators.size()); - assertSame(generator1, generators.get(0)); - assertSame(generator2, generators.get(1)); - assertEquals(1, notFoundGenerators.size()); - assertEquals("unknown", notFoundGenerators.get(0)); - - generators = new ArrayList<>(); - notFoundGenerators.clear(); - Scalable.stack(g1, g2, unknownGenerator).listGenerators(network, generators, notFoundGenerators); - assertEquals(2, generators.size()); - assertSame(generator1, generators.get(0)); - assertSame(generator2, generators.get(1)); - assertEquals(1, notFoundGenerators.size()); - assertEquals("unknown", notFoundGenerators.get(0)); - - generators = new ArrayList<>(); - notFoundGenerators.clear(); - Scalable.stack(g1, g2, l1, s).listGenerators(network, generators, notFoundGenerators); - assertEquals(2, generators.size()); - assertSame(generator1, generators.get(0)); - assertSame(generator2, generators.get(1)); - assertEquals(2, notFoundGenerators.size()); - - } - @Test void testFilterInjections() { Generator generator1 = network.getGenerator("g1"); From 580d49479cafddca1942b54ed5142ae315801bce Mon Sep 17 00:00:00 2001 From: Anne Tilloy Date: Tue, 13 Jun 2023 15:01:22 +0200 Subject: [PATCH 3/6] Clean LoadFlowParameters. Signed-off-by: Anne Tilloy --- .../powsybl/loadflow/LoadFlowParameters.java | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/loadflow/loadflow-api/src/main/java/com/powsybl/loadflow/LoadFlowParameters.java b/loadflow/loadflow-api/src/main/java/com/powsybl/loadflow/LoadFlowParameters.java index 9295d3bba2a..2f24167ec94 100644 --- a/loadflow/loadflow-api/src/main/java/com/powsybl/loadflow/LoadFlowParameters.java +++ b/loadflow/loadflow-api/src/main/java/com/powsybl/loadflow/LoadFlowParameters.java @@ -255,42 +255,10 @@ public LoadFlowParameters setPhaseShifterRegulationOn(boolean phaseShifterRegula return this; } - /** - * @deprecated Use {@link #isTwtSplitShuntAdmittance} instead. - */ - @Deprecated - public boolean isSpecificCompatibility() { - return isTwtSplitShuntAdmittance(); - } - - /** - * @deprecated Use {@link #isTwtSplitShuntAdmittance} instead. - */ - @Deprecated - public boolean isT2wtSplitShuntAdmittance() { - return isTwtSplitShuntAdmittance(); - } - public boolean isTwtSplitShuntAdmittance() { return twtSplitShuntAdmittance; } - /** - * @deprecated Use {@link #setTwtSplitShuntAdmittance} instead. - */ - @Deprecated - public LoadFlowParameters setSpecificCompatibility(boolean twtSplitShuntAdmittance) { - return setTwtSplitShuntAdmittance(twtSplitShuntAdmittance); - } - - /** - * @deprecated Use {@link #setTwtSplitShuntAdmittance} instead. - */ - @Deprecated - public LoadFlowParameters setT2wtSplitShuntAdmittance(boolean twtSplitShuntAdmittance) { - return setTwtSplitShuntAdmittance(twtSplitShuntAdmittance); - } - public LoadFlowParameters setTwtSplitShuntAdmittance(boolean twtSplitShuntAdmittance) { this.twtSplitShuntAdmittance = twtSplitShuntAdmittance; return this; From fc334064edfbd11e85317020d77f95ababaff634 Mon Sep 17 00:00:00 2001 From: Anne Tilloy Date: Tue, 13 Jun 2023 15:41:03 +0200 Subject: [PATCH 4/6] WIP Signed-off-by: Anne Tilloy --- .../conversion/CurrentLimitsMapping.java | 31 ------------------- .../iidm/modification/scalable/Scalable.java | 8 ----- .../modification/tripping/BranchTripping.java | 8 ----- 3 files changed, 47 deletions(-) delete mode 100644 cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CurrentLimitsMapping.java diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CurrentLimitsMapping.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CurrentLimitsMapping.java deleted file mode 100644 index 5df6bfa3c7b..00000000000 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CurrentLimitsMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2020, 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.cgmes.conversion; - -import com.powsybl.iidm.network.CurrentLimitsAdder; - -import java.util.function.Supplier; - -/** - * @deprecated Use {@link LoadingLimitsMapping} instead. - * - * @author Miora Ralambotiana - */ -@Deprecated -public class CurrentLimitsMapping extends LoadingLimitsMapping { - CurrentLimitsMapping(Context context) { - super(context); - } - - /** - * @deprecated Use {@link LoadingLimitsMapping#computeIfAbsentLoadingLimitsAdder(String, Supplier)} instead. - */ - @Deprecated - public CurrentLimitsAdder getCurrentLimitsAdder(String id, Supplier supplier) { - return (CurrentLimitsAdder) adders.computeIfAbsent(id, s -> supplier.get()); - } -} diff --git a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java index 2ecd7bf917d..b803f2107f2 100644 --- a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java +++ b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/scalable/Scalable.java @@ -123,14 +123,6 @@ default double scale(Network n, double asked) { return scale(n, asked, new ScalingParameters()); } - /** - * @deprecated gen should be replaced by onGenerator - */ - @Deprecated - static GeneratorScalable gen(String id) { - return new GeneratorScalable(id); - } - /** * create GeneratorScalable with id */ diff --git a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/tripping/BranchTripping.java b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/tripping/BranchTripping.java index fadd70ab996..b8eabf37be6 100644 --- a/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/tripping/BranchTripping.java +++ b/iidm/iidm-modification/src/main/java/com/powsybl/iidm/modification/tripping/BranchTripping.java @@ -41,14 +41,6 @@ protected BranchTripping(String branchId, String voltageLevelId, BiFunction Date: Tue, 13 Jun 2023 16:04:54 +0200 Subject: [PATCH 5/6] cgmes: clean deprecated methods and classes Signed-off-by: Luma --- .../cgmes/conversion/CgmesBoundary.java | 21 --------- .../com/powsybl/cgmes/model/CgmesModel.java | 37 ++-------------- .../cgmes/model/InMemoryCgmesModel.java | 44 +++++++------------ 3 files changed, 18 insertions(+), 84 deletions(-) diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesBoundary.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesBoundary.java index 42fe9b4755c..426a278b757 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesBoundary.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesBoundary.java @@ -85,18 +85,6 @@ public PowerFlow powerFlowAtNode(String node) { return nodesPowerFlow.get(node); } - /** - * @deprecated Not used anymore. To set an equipment at boundary node, use - * {@link CgmesBoundary#addAcLineSegmentAtNode(PropertyBag, String)} or - * {@link CgmesBoundary#addSwitchAtNode(PropertyBag, String)} or - * {@link CgmesBoundary#addTransformerAtNode(PropertyBags, String)} or - * {@link CgmesBoundary#addEquivalentBranchAtNode(PropertyBag, String)} instead. - */ - @Deprecated - public void addEquipmentAtNode(PropertyBag line, String node) { - throw new ConversionException("Deprecated. Not used anymore"); - } - public void addAcLineSegmentAtNode(PropertyBag line, String node) { List equipment; equipment = nodesEquipment.computeIfAbsent(node, ls -> new ArrayList<>(2)); @@ -148,15 +136,6 @@ public double angleAtBoundary(String node) { return nodesVoltage.containsKey(node) ? nodesVoltage.get(node).angle : Double.NaN; } - /** - * @deprecated Not used anymore. To get the equipment at boundary node, use - * {@link CgmesBoundary#boundaryEquipmentAtNode(String)} instead. - */ - @Deprecated - public List equipmentAtNode(String node) { - throw new ConversionException("Deprecated. Not used anymore"); - } - public List boundaryEquipmentAtNode(String node) { return nodesEquipment.getOrDefault(node, Collections.emptyList()); } diff --git a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesModel.java b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesModel.java index 94a4db5606a..fa13753ca03 100644 --- a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesModel.java +++ b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesModel.java @@ -24,7 +24,7 @@ */ public interface CgmesModel { - // FIXME generic cgmes models may not have an underlying triplestore + // Although generic cgmes models may not have an underlying triplestore TripleStore tripleStore(); Properties getProperties(); @@ -184,40 +184,9 @@ default void write(DataSource ds, CgmesSubset subset) { // Helper mappings - /** - * @deprecated Not used anymore. To get the CGMES Terminal ID of an equipment, use alias i.e. - * {@code equipement.getAlias("CGMES.Terminal1")} - */ - @Deprecated - default String terminalForEquipment(String conductingEquipmentId, int sequenceNumber) { - return null; - } - - /** - * @deprecated Use {@link #ratioTapChangerListForPowerTransformer(String)} instead. - */ - @Deprecated - default String ratioTapChangerForPowerTransformer(String powerTransformerId) { - return ratioTapChangerListForPowerTransformer(powerTransformerId).stream().filter(Objects::nonNull).findFirst().orElse(null); - } - - /** - * @deprecated Use {@link #phaseTapChangerListForPowerTransformer(String)} instead. - */ - @Deprecated - default String phaseTapChangerForPowerTransformer(String powerTransformerId) { - return phaseTapChangerListForPowerTransformer(powerTransformerId).stream().filter(Objects::nonNull).findFirst().orElse(null); - } - - default List ratioTapChangerListForPowerTransformer(String powerTransformerId) { - return Collections.singletonList(ratioTapChangerForPowerTransformer(powerTransformerId)); - } - - default List phaseTapChangerListForPowerTransformer(String powerTransformerId) { - return Collections.singletonList(phaseTapChangerForPowerTransformer(powerTransformerId)); - } + List ratioTapChangerListForPowerTransformer(String powerTransformerId); - // TODO(Luma) refactoring node-breaker conversion temporal + List phaseTapChangerListForPowerTransformer(String powerTransformerId); /** * Obtain the substation of a given terminal. diff --git a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/InMemoryCgmesModel.java b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/InMemoryCgmesModel.java index ca924aa8395..44e669e4f51 100644 --- a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/InMemoryCgmesModel.java +++ b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/InMemoryCgmesModel.java @@ -16,11 +16,7 @@ import java.io.InputStream; import java.io.PrintStream; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.function.Consumer; /** @@ -349,7 +345,6 @@ public PropertyBags terminals() { @Override public PropertyBags connectivityNodeContainers() { - // TODO(Luma) refactoring node-breaker conversion temporal return new PropertyBags(); } @@ -504,6 +499,16 @@ public PropertyBags phaseTapChangerTable(String tableId) { return new PropertyBags(); } + @Override + public List ratioTapChangerListForPowerTransformer(String powerTransformerId) { + return Collections.emptyList(); + } + + @Override + public List phaseTapChangerListForPowerTransformer(String powerTransformerId) { + return Collections.emptyList(); + } + @Override public PropertyBags acDcConverters() { return acDcConverters; @@ -592,24 +597,6 @@ public CgmesDcTerminal dcTerminal(String dcTerminalId) { return null; } - /** - * @deprecated Use {@link #ratioTapChangerListForPowerTransformer(String)} instead. - */ - @Override - @Deprecated - public String ratioTapChangerForPowerTransformer(String powerTransformerId) { - return null; - } - - /** - * @deprecated Use {@link #phaseTapChangerListForPowerTransformer(String)} instead. - */ - @Override - @Deprecated - public String phaseTapChangerForPowerTransformer(String powerTransformerId) { - return null; - } - @Override public String substation(CgmesTerminal t, boolean nodeBreaker) { return null; @@ -632,27 +619,26 @@ public double nominalVoltage(String baseVoltageId) { @Override public void setBasename(String baseName) { - // TODO Review if required by current tests + // Not required by current tests } @Override public String getBasename() { - // TODO Review if required by current tests return null; } @Override public void read(ReadOnlyDataSource ds, Reporter reporter) { - // TODO Review if required by current tests + // Not required by current tests } @Override public void read(ReadOnlyDataSource mainDataSource, ReadOnlyDataSource alternativeDataSourceForBoundary, Reporter reporter) { - // TODO Review if required by current tests + // Not required by current tests } @Override public void read(InputStream is, String baseName, String contextName, Reporter reporter) { - // TODO Review if required by current tests + // Not required by current tests } } From 5d34e2e63c4ed54c5238cd39433153fb9ce3cda5 Mon Sep 17 00:00:00 2001 From: Luma Date: Tue, 13 Jun 2023 17:42:17 +0200 Subject: [PATCH 6/6] complete coverage Signed-off-by: Luma --- .../test/FakeTapChangerConversionTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/FakeTapChangerConversionTest.java diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/FakeTapChangerConversionTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/FakeTapChangerConversionTest.java new file mode 100644 index 00000000000..d21d08c819f --- /dev/null +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/FakeTapChangerConversionTest.java @@ -0,0 +1,28 @@ +/** + * 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/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.cgmes.conversion.test; + +import com.powsybl.cgmes.model.CgmesModel; +import com.powsybl.cgmes.model.InMemoryCgmesModel; +import org.junit.jupiter.api.Test; + +import java.util.Collections; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author Luma ZamarreƱo + */ +class FakeTapChangerConversionTest { + @Test + void fakeTapChangersEmpty() { + CgmesModel cgmes = new InMemoryCgmesModel(); + assertEquals(Collections.emptyList(), cgmes.ratioTapChangerListForPowerTransformer("anyTransformer")); + assertEquals(Collections.emptyList(), cgmes.phaseTapChangerListForPowerTransformer("anyTransformer")); + } +}