From 0c195fcb598a6075dbb4f31f88e25cc785f53fb0 Mon Sep 17 00:00:00 2001 From: KAHYA Amira Date: Tue, 17 Oct 2023 10:28:19 +0200 Subject: [PATCH] add a check to avoid a nan when we calculating the leaving flow from danglingline Signed-off-by: KAHYA Amira --- .../java/com/powsybl/balances_adjustment/util/CountryArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/balances-adjustment/src/main/java/com/powsybl/balances_adjustment/util/CountryArea.java b/balances-adjustment/src/main/java/com/powsybl/balances_adjustment/util/CountryArea.java index d6630a43..e5f7e2a9 100644 --- a/balances-adjustment/src/main/java/com/powsybl/balances_adjustment/util/CountryArea.java +++ b/balances-adjustment/src/main/java/com/powsybl/balances_adjustment/util/CountryArea.java @@ -121,7 +121,7 @@ private boolean isAreaBorder(HvdcLine hvdcLine) { } private double getLeavingFlow(DanglingLine danglingLine) { - return danglingLine.getTerminal().isConnected() ? -danglingLine.getBoundary().getP() : 0; + return danglingLine.getTerminal().isConnected() && !Double.isNaN(danglingLine.getBoundary().getP()) ? -danglingLine.getBoundary().getP() : 0; } private double getLeavingFlow(Line line) {