From e360394ab25a1a2f6f837103b0169bd706293be7 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 7 Feb 2023 13:56:38 +0100 Subject: [PATCH] Fix i2 derivative to a1 (#724) Signed-off-by: Geoffroy Jamgotchian --- .../ClosedBranchSide2CurrentMagnitudeEquationTerm.java | 2 +- src/test/java/com/powsybl/openloadflow/ac/AcEquationsTest.java | 2 +- .../openloadflow/sensi/ac/AcSensitivityAnalysisTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/powsybl/openloadflow/ac/equations/ClosedBranchSide2CurrentMagnitudeEquationTerm.java b/src/main/java/com/powsybl/openloadflow/ac/equations/ClosedBranchSide2CurrentMagnitudeEquationTerm.java index 0b2b3c3ab3..5af354cf0d 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/equations/ClosedBranchSide2CurrentMagnitudeEquationTerm.java +++ b/src/main/java/com/powsybl/openloadflow/ac/equations/ClosedBranchSide2CurrentMagnitudeEquationTerm.java @@ -124,7 +124,7 @@ private static double di2dph1(double y, double ksi, double g2, double b2, double } private static double di2da1(double y, double ksi, double g2, double b2, double v1, double ph1, double r1, double a1, double v2, double ph2) { - return -di2dph1(y, ksi, g2, b2, v1, ph1, r1, a1, v2, ph2); + return di2dph1(y, ksi, g2, b2, v1, ph1, r1, a1, v2, ph2); } @Override diff --git a/src/test/java/com/powsybl/openloadflow/ac/AcEquationsTest.java b/src/test/java/com/powsybl/openloadflow/ac/AcEquationsTest.java index 662792bc8c..dd7e1d1739 100644 --- a/src/test/java/com/powsybl/openloadflow/ac/AcEquationsTest.java +++ b/src/test/java/com/powsybl/openloadflow/ac/AcEquationsTest.java @@ -144,7 +144,7 @@ void branchTest() { eval(new ClosedBranchSide2ActiveFlowEquationTerm(branch, bus1, bus2, variableSet, true, true), variables, sv)); assertArrayEquals(new double[] {16.04980301110306, -123.06939783256767, 51.99045110393844, 152.96594042215764, -51.99045110393844, -138.1398958886022, 51.99045110393844, 29.89654258958997}, eval(new ClosedBranchSide2ReactiveFlowEquationTerm(branch, bus1, bus2, variableSet, true, true), variables, sv)); - assertArrayEquals(new double[] {40.7613721648136, -0.07246503940372644, 132.23571821183896, 38.10038077658943, -132.23571821183896, Double.NaN, -132.23571821183896, 38.02791573718571}, + assertArrayEquals(new double[] {40.7613721648136, -0.07246503940372644, 132.23571821183896, 38.10038077658943, -132.23571821183896, Double.NaN, 132.23571821183896, 38.02791573718571}, eval(new ClosedBranchSide2CurrentMagnitudeEquationTerm(branch, bus1, bus2, variableSet, true, true), variables, sv)); // open branch equations diff --git a/src/test/java/com/powsybl/openloadflow/sensi/ac/AcSensitivityAnalysisTest.java b/src/test/java/com/powsybl/openloadflow/sensi/ac/AcSensitivityAnalysisTest.java index 9fa1dec1a6..55a82ca515 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/ac/AcSensitivityAnalysisTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/ac/AcSensitivityAnalysisTest.java @@ -353,7 +353,7 @@ void test4busesPhaseShiftIntensity() { assertEquals(-25.0905d, result.getBranchCurrent1SensitivityValue("l23", "l13", SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I); //Check values for side 2 using generic and function type specific api - assertEquals(-161.8233d, result.getSensitivityValue("l23", "l23", SensitivityFunctionType.BRANCH_CURRENT_2, SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I); + assertEquals(37.6816d, result.getSensitivityValue("l23", "l23", SensitivityFunctionType.BRANCH_CURRENT_2, SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I); assertEquals(-12.5509d, result.getBranchCurrent2SensitivityValue("l23", "l14", SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I); assertEquals(37.3727d, result.getBranchCurrent2SensitivityValue("l23", "l12", SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I); assertEquals(-12.6567d, result.getBranchCurrent2SensitivityValue("l23", "l34", SensitivityVariableType.TRANSFORMER_PHASE), LoadFlowAssert.DELTA_I);