From 0cce27f29f179298e97681e6271b00f5f7464bbb Mon Sep 17 00:00:00 2001 From: MartinBelthle <102529366+MartinBelthle@users.noreply.github.com> Date: Thu, 19 Jan 2023 15:08:26 +0100 Subject: [PATCH] NaN threshold values in virtual cost logs (#722) * Only one line fix * 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 711837374a..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 = flow >= 0 ? flowCnec.getUpperBound(limitingSide, unit).orElse(Double.NaN) : 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,