From ad6c79baaf97d0e55cfd5dea106ac3abda645aa6 Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 9 Mar 2023 18:00:17 +0100 Subject: [PATCH] replace names Signed-off-by: Coline PILOQUET --- .../shortcircuit/AbstractFaultResult.java | 2 +- .../powsybl/shortcircuit/FortescueValue.java | 102 +++++++++--------- ...bleShortCircuitAnalysisResultExporter.java | 2 +- .../json/FortescueValuesSerializer.java | 8 +- .../ShortCircuitAnalysisTest.java | 8 +- ...ortCircuitAnalysisResultExportersTest.java | 2 +- 6 files changed, 62 insertions(+), 62 deletions(-) diff --git a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/AbstractFaultResult.java b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/AbstractFaultResult.java index 7db64a41f6a..54da57aefcb 100644 --- a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/AbstractFaultResult.java +++ b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/AbstractFaultResult.java @@ -93,7 +93,7 @@ public double getFeederCurrent(String feederId) { for (FeederResult feederResult : feederResults) { if (feederResult.getConnectableId().equals(feederId)) { if (feederResult instanceof FortescueFeederResult) { - return ((FortescueFeederResult) feederResult).getCurrent().getDirectMagnitude(); + return ((FortescueFeederResult) feederResult).getCurrent().getPositiveMagnitude(); } else { return ((MagnitudeFaultResult) feederResult).getCurrent(); } diff --git a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/FortescueValue.java b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/FortescueValue.java index d7934a14517..de4ce4d1a09 100644 --- a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/FortescueValue.java +++ b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/FortescueValue.java @@ -13,8 +13,8 @@ import org.apache.commons.math3.util.Pair; /** - * The aim of this class is to store the magnitude and angle of current or voltage on the three phases, and the - * the magnitude and angle of current or voltage for the Fortescue direct, zero and inverse components. + * The aim of this class is to store the magnitude and angle of current or voltage on the three phases, and + * the magnitude and angle of current or voltage for the Fortescue positive, zero and negative components. * * @author Coline Piloquet * @author Jean-Baptiste Heyberger @@ -23,94 +23,94 @@ public class FortescueValue { public class ThreePhaseValue { // Value on the three phases. - private final double magnitude1; - private final double magnitude2; - private final double magnitude3; - private final double angle1; - private final double angle2; - private final double angle3; - - public ThreePhaseValue(double magnitude1, double magnitude2, double magnitude3, double angle1, double angle2, double angle3) { - this.magnitude1 = magnitude1; - this.magnitude2 = magnitude2; - this.magnitude3 = magnitude3; - this.angle1 = angle1; - this.angle2 = angle2; - this.angle3 = angle3; + private final double magnitudeA; + private final double magnitudeB; + private final double magnitudeC; + private final double angleA; + private final double angleB; + private final double angleC; + + public ThreePhaseValue(double magnitudeA, double magnitudeB, double magnitudeC, double angleA, double angleB, double angleC) { + this.magnitudeA = magnitudeA; + this.magnitudeB = magnitudeB; + this.magnitudeC = magnitudeC; + this.angleA = angleA; + this.angleB = angleB; + this.angleC = angleC; } - public double getMagnitude1() { - return magnitude1; + public double getMagnitudeA() { + return magnitudeA; } - public double getMagnitude2() { - return magnitude2; + public double getMagnitudeB() { + return magnitudeB; } - public double getMagnitude3() { - return magnitude3; + public double getMagnitudeC() { + return magnitudeC; } - public double getAngle1() { - return angle1; + public double getAngleA() { + return angleA; } - public double getAngle2() { - return angle2; + public double getAngleB() { + return angleB; } - public double getAngle3() { - return angle3; + public double getAngleC() { + return angleC; } } - private final double directMagnitude; + private final double positiveMagnitude; private final double zeroMagnitude; - private final double inverseMagnitude; - private final double directAngle; + private final double negativeMagnitude; + private final double positiveAngle; private final double zeroAngle; - private final double inverseAngle; + private final double negativeAngle; - public FortescueValue(double directMagnitude, double zeroMagnitude, double inverseMagnitude, double directAngle, double zeroAngle, double inverseAngle) { - this.directMagnitude = directMagnitude; - this.directAngle = directAngle; + public FortescueValue(double positiveMagnitude, double zeroMagnitude, double negativeMagnitude, double positiveAngle, double zeroAngle, double negativeAngle) { + this.positiveMagnitude = positiveMagnitude; + this.positiveAngle = positiveAngle; this.zeroMagnitude = zeroMagnitude; - this.inverseMagnitude = inverseMagnitude; + this.negativeMagnitude = negativeMagnitude; this.zeroAngle = zeroAngle; - this.inverseAngle = inverseAngle; + this.negativeAngle = negativeAngle; } - public FortescueValue(double directMagnitude, double directAngle) { - this(directMagnitude, Double.NaN, Double.NaN, directAngle, Double.NaN, Double.NaN); + public FortescueValue(double positiveMagnitude, double positiveAngle) { + this(positiveMagnitude, Double.NaN, Double.NaN, positiveAngle, Double.NaN, Double.NaN); } - public FortescueValue(double directMagnitude) { - this(directMagnitude, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN); + public FortescueValue(double positiveMagnitude) { + this(positiveMagnitude, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN); } - public double getDirectMagnitude() { - return directMagnitude; + public double getPositiveMagnitude() { + return positiveMagnitude; } public double getZeroMagnitude() { return zeroMagnitude; } - public double getInverseMagnitude() { - return inverseMagnitude; + public double getNegativeMagnitude() { + return negativeMagnitude; } - public double getDirectAngle() { - return directAngle; + public double getPositiveAngle() { + return positiveAngle; } public double getZeroAngle() { return zeroAngle; } - public double getInverseAngle() { - return inverseAngle; + public double getNegativeAngle() { + return negativeAngle; } public Pair getCartesianFromPolar(double magnitude, double angle) { @@ -132,9 +132,9 @@ ThreePhaseValue toThreePhaseValue() { // [G3] [ 1 a a²] [Gi] MatrixFactory matrixFactory = new DenseMatrixFactory(); - Pair directComponent = getCartesianFromPolar(directMagnitude, directAngle); + Pair directComponent = getCartesianFromPolar(positiveMagnitude, positiveAngle); Pair homopolarComponent = getCartesianFromPolar(zeroMagnitude, zeroAngle); - Pair inversComponent = getCartesianFromPolar(inverseMagnitude, inverseAngle); + Pair inversComponent = getCartesianFromPolar(negativeMagnitude, negativeAngle); Matrix mGfortescue = matrixFactory.create(6, 1, 6); mGfortescue.add(0, 0, homopolarComponent.getKey()); diff --git a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/converter/AbstractTableShortCircuitAnalysisResultExporter.java b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/converter/AbstractTableShortCircuitAnalysisResultExporter.java index 4b35e3e67ee..cf341ab3919 100644 --- a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/converter/AbstractTableShortCircuitAnalysisResultExporter.java +++ b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/converter/AbstractTableShortCircuitAnalysisResultExporter.java @@ -55,7 +55,7 @@ private static void printShortCircuitResults(ShortCircuitAnalysisResult result, for (FaultResult action : result.getFaultResults()) { if (action instanceof FortescueFaultResult) { formatter.writeCell(action.getFault().getElementId()) - .writeCell(((FortescueFaultResult) action).getCurrent().getDirectMagnitude()); + .writeCell(((FortescueFaultResult) action).getCurrent().getPositiveMagnitude()); } else { formatter.writeCell(action.getFault().getElementId()) .writeCell(((MagnitudeFaultResult) action).getCurrent()); diff --git a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/json/FortescueValuesSerializer.java b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/json/FortescueValuesSerializer.java index 5c0ab8267c3..ddec02a4157 100644 --- a/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/json/FortescueValuesSerializer.java +++ b/shortcircuit-api/src/main/java/com/powsybl/shortcircuit/json/FortescueValuesSerializer.java @@ -27,12 +27,12 @@ public void serialize(FortescueValue value, JsonGenerator jsonGenerator, Seriali jsonGenerator.writeStartObject(); // Fortescue components. - JsonUtil.writeOptionalDoubleField(jsonGenerator, "directMagnitude", value.getDirectMagnitude()); + JsonUtil.writeOptionalDoubleField(jsonGenerator, "directMagnitude", value.getPositiveMagnitude()); JsonUtil.writeOptionalDoubleField(jsonGenerator, "zeroMagnitude", value.getZeroMagnitude()); - JsonUtil.writeOptionalDoubleField(jsonGenerator, "inverseMagnitude", value.getInverseMagnitude()); - JsonUtil.writeOptionalDoubleField(jsonGenerator, "directAngle", value.getDirectAngle()); + JsonUtil.writeOptionalDoubleField(jsonGenerator, "inverseMagnitude", value.getNegativeMagnitude()); + JsonUtil.writeOptionalDoubleField(jsonGenerator, "directAngle", value.getPositiveAngle()); JsonUtil.writeOptionalDoubleField(jsonGenerator, "zeroAngle", value.getZeroAngle()); - JsonUtil.writeOptionalDoubleField(jsonGenerator, "inverseAngle", value.getInverseAngle()); + JsonUtil.writeOptionalDoubleField(jsonGenerator, "inverseAngle", value.getNegativeAngle()); jsonGenerator.writeEndObject(); } diff --git a/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/ShortCircuitAnalysisTest.java b/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/ShortCircuitAnalysisTest.java index da266228b15..bd5c493b7b6 100644 --- a/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/ShortCircuitAnalysisTest.java +++ b/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/ShortCircuitAnalysisTest.java @@ -134,9 +134,9 @@ void testFortescueTransformation() { double pi = Math.PI; FortescueValue fortescueValue = new FortescueValue(86.8086319, 0., 0., 1.83823431 * pi / 180, 0., 0.); FortescueValue.ThreePhaseValue threePhaseValue = fortescueValue.toThreePhaseValue(); - assertEquals(50.118988, threePhaseValue.getMagnitude1(), 0.00001); - assertEquals(1.83823431 * pi / 180, threePhaseValue.getAngle1(), 0.00001); - assertEquals(-118.161751 * pi / 180, threePhaseValue.getAngle2(), 0.00001); - assertEquals(121.838219 * pi / 180, threePhaseValue.getAngle3(), 0.00001); + assertEquals(50.118988, threePhaseValue.getMagnitudeA(), 0.00001); + assertEquals(1.83823431 * pi / 180, threePhaseValue.getAngleA(), 0.00001); + assertEquals(-118.161751 * pi / 180, threePhaseValue.getAngleB(), 0.00001); + assertEquals(121.838219 * pi / 180, threePhaseValue.getAngleC(), 0.00001); } } diff --git a/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/converter/ShortCircuitAnalysisResultExportersTest.java b/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/converter/ShortCircuitAnalysisResultExportersTest.java index d9b0206a0e5..ddba0f46188 100644 --- a/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/converter/ShortCircuitAnalysisResultExportersTest.java +++ b/shortcircuit-api/src/test/java/com/powsybl/shortcircuit/converter/ShortCircuitAnalysisResultExportersTest.java @@ -78,7 +78,7 @@ void readJsonFaultResultVersion10() { .read(getClass().getResourceAsStream("/shortcircuit-results-version10.json")); assertEquals(1, result.getFaultResults().size()); FortescueFaultResult faultResult = (FortescueFaultResult) result.getFaultResult("id"); - assertEquals(1.0, faultResult.getCurrent().getDirectMagnitude(), 0); + assertEquals(1.0, faultResult.getCurrent().getPositiveMagnitude(), 0); assertEquals(1, faultResult.getLimitViolations().size()); assertEquals(1, faultResult.getFeederResults().size()); }