diff --git a/src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java b/src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java index 166974d4cc..de18401c6b 100644 --- a/src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java +++ b/src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java @@ -55,6 +55,7 @@ public class DcSensitivityAnalysis extends AbstractSensitivityAnalysis { private static final double CONNECTIVITY_LOSS_THRESHOLD = 10e-7; + private static final double FUNCTION_REFERENCE_ZER0_THRESHOLD = 1e-13; static final class ComputedContingencyElement { @@ -332,12 +333,25 @@ private void createBranchSensitivityValue(LfSensitivityFactor factors = List.of(new SensitivityFactor( + SensitivityFunctionType.BRANCH_ACTIVE_POWER_1, + "NHV1_NHV2_1_2", + SensitivityVariableType.INJECTION_ACTIVE_POWER, + "GEN", + false, + ContingencyContext.all()) + ); + + List contingencies = List.of(Contingency.line("NHV1_NHV2_1_1")); + + SensitivityAnalysisResult result = sensiRunner.run(network, factors, contingencies, Collections.emptyList(), sensiParameters); + + assertEquals(303.5d, result.getBranchFlow1FunctionReferenceValue("NHV1_NHV2_1_2"), LoadFlowAssert.DELTA_POWER); + assertEquals(0, result.getBranchFlow1FunctionReferenceValue("NHV1_NHV2_1_1", "NHV1_NHV2_1_2"), 0d); // strict zero and not anymore a small value + } }