From d60b63aa572cc865922b89228ba8018dcd789e17 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Tue, 10 Mar 2026 13:46:10 +0100 Subject: [PATCH] bidi charging: fix calculation of medium current --- packages/control/algorithm/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/control/algorithm/utils.py b/packages/control/algorithm/utils.py index 24f422bb60..562662b17d 100644 --- a/packages/control/algorithm/utils.py +++ b/packages/control/algorithm/utils.py @@ -4,7 +4,7 @@ def get_medium_charging_current(currents: List[float]) -> float: """Ermittelt den mittleren Ladestrom der Phasen, auf denen geladen wird. """ - if any(x >= 0.5 for x in currents): - return sum(x for x in currents if x >= 0.5) / len([x for x in currents if x >= 0.5]) + if any(abs(x) >= 0.5 for x in currents): + return sum(x for x in currents if abs(x) >= 0.5) / len([x for x in currents if abs(x) >= 0.5]) else: return 0.0