From 15aa22e3e549906c6dab26a94619173404682a32 Mon Sep 17 00:00:00 2001 From: cflenker Date: Mon, 18 Dec 2023 20:39:36 +0100 Subject: [PATCH] Restart MAX_VOLTAGE_TIME_SEC if cell diff > CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART --- etc/dbus-serialbattery/battery.py | 3 +++ etc/dbus-serialbattery/config.default.ini | 2 ++ etc/dbus-serialbattery/utils.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/etc/dbus-serialbattery/battery.py b/etc/dbus-serialbattery/battery.py index 8704f476..1f814798 100644 --- a/etc/dbus-serialbattery/battery.py +++ b/etc/dbus-serialbattery/battery.py @@ -338,6 +338,9 @@ def manage_charge_voltage_linear(self) -> None: pass else: + if voltageDiff > utils.CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART: + self.max_voltage_start_time = current_time + tDiff = current_time - self.max_voltage_start_time # keep max voltage for MAX_VOLTAGE_TIME_SEC more seconds if utils.MAX_VOLTAGE_TIME_SEC < tDiff: diff --git a/etc/dbus-serialbattery/config.default.ini b/etc/dbus-serialbattery/config.default.ini index 3e4b3d8d..6bd8eeab 100644 --- a/etc/dbus-serialbattery/config.default.ini +++ b/etc/dbus-serialbattery/config.default.ini @@ -123,6 +123,8 @@ CVCM_ENABLE = True ; -- CVL reset based on cell voltage diff (linear mode) ; Specify cell voltage diff where CVL limit is kept until diff is equal or lower CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL = 0.010 +; Specify cell voltage diff where MAX_VOLTAGE_TIME_SEC restarts if diff is bigger +CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART = 0.013 ; Specify cell voltage diff where CVL limit is reset to max voltage, if value get above ; the cells are considered as imbalanced, if the cell diff exceeds 5% of the nominal cell voltage ; e.g. 3.2 V * 5 / 100 = 0.160 V diff --git a/etc/dbus-serialbattery/utils.py b/etc/dbus-serialbattery/utils.py index 3c7b3704..8a6f41b1 100644 --- a/etc/dbus-serialbattery/utils.py +++ b/etc/dbus-serialbattery/utils.py @@ -102,6 +102,9 @@ def _get_list_from_config( CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL = float( config["DEFAULT"]["CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL"] ) +CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART = float( + config["DEFAULT"]["CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART"] +) CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT = float( config["DEFAULT"]["CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT"] )