From 39f023593556bcff33f8fe6e67880b329137f18f Mon Sep 17 00:00:00 2001 From: belthlemar Date: Thu, 19 Jan 2023 11:15:07 +0100 Subject: [PATCH 1/2] Only one line fix --- .../search_tree_rao/search_tree/algorithms/SearchTree.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java b/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java index 711837374a..6edbdf5b2e 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java @@ -566,7 +566,7 @@ List getVirtualCostlyElementsLogs(Leaf leaf, String virtualCostName, Str for (FlowCnec flowCnec : leaf.getCostlyElements(virtualCostName, NUMBER_LOGGED_VIRTUAL_COSTLY_ELEMENTS)) { Side limitingSide = leaf.getMargin(flowCnec, Side.LEFT, unit) < leaf.getMargin(flowCnec, Side.RIGHT, unit) ? Side.LEFT : Side.RIGHT; double flow = leaf.getFlow(flowCnec, limitingSide, unit); - Double limitingThreshold = flow >= 0 ? flowCnec.getUpperBound(limitingSide, unit).orElse(Double.NaN) : flowCnec.getLowerBound(limitingSide, unit).orElse(Double.NaN); + Double limitingThreshold = flowCnec.getUpperBound(limitingSide, unit).orElse(flowCnec.getLowerBound(limitingSide, unit).orElse(Double.NaN)); logs.add(String.format(Locale.ENGLISH, "%s%s, limiting \"%s\" constraint #%02d: flow = %.2f %s, threshold = %.2f %s, margin = %.2f %s, element %s at state %s, CNEC ID = \"%s\", CNEC name = \"%s\"", prefix, From 80368fb23fce836129a59dc525cda585fb7703fb Mon Sep 17 00:00:00 2001 From: belthlemar Date: Thu, 19 Jan 2023 14:51:29 +0100 Subject: [PATCH 2/2] Modified according to review --- .../search_tree_rao/search_tree/algorithms/SearchTree.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java b/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java index 6edbdf5b2e..d96b8a50ce 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/farao_community/farao/search_tree_rao/search_tree/algorithms/SearchTree.java @@ -566,7 +566,8 @@ List getVirtualCostlyElementsLogs(Leaf leaf, String virtualCostName, Str for (FlowCnec flowCnec : leaf.getCostlyElements(virtualCostName, NUMBER_LOGGED_VIRTUAL_COSTLY_ELEMENTS)) { Side limitingSide = leaf.getMargin(flowCnec, Side.LEFT, unit) < leaf.getMargin(flowCnec, Side.RIGHT, unit) ? Side.LEFT : Side.RIGHT; double flow = leaf.getFlow(flowCnec, limitingSide, unit); - Double limitingThreshold = flowCnec.getUpperBound(limitingSide, unit).orElse(flowCnec.getLowerBound(limitingSide, unit).orElse(Double.NaN)); + Double limitingThreshold = flow >= 0 ? flowCnec.getUpperBound(limitingSide, unit).orElse(flowCnec.getLowerBound(limitingSide, unit).orElse(Double.NaN)) + : flowCnec.getLowerBound(limitingSide, unit).orElse(flowCnec.getUpperBound(limitingSide, unit).orElse(Double.NaN)); logs.add(String.format(Locale.ENGLISH, "%s%s, limiting \"%s\" constraint #%02d: flow = %.2f %s, threshold = %.2f %s, margin = %.2f %s, element %s at state %s, CNEC ID = \"%s\", CNEC name = \"%s\"", prefix,