Skip to content

Commit

Permalink
fix proposal for Louisvdw#733
Browse files Browse the repository at this point in the history
  • Loading branch information
ogurevich committed Jun 26, 2023
1 parent 18d5333 commit 81a2fc7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def manage_charge_voltage_linear(self) -> None:
voltageSum = 0
penaltySum = 0
tDiff = 0

# meassurment and variation tolerance in volts
measurementToleranceVariation = 0.0215
try:
# calculate battery sum
for i in range(self.cell_count):
Expand All @@ -269,7 +270,7 @@ def manage_charge_voltage_linear(self) -> None:
if self.max_voltage_start_time is None:
# start timer, if max voltage is reached and cells are balanced
if (
self.max_battery_voltage - utils.VOLTAGE_DROP <= voltageSum
self.max_battery_voltage - utils.VOLTAGE_DROP - measurementToleranceVariation <= voltageSum
and voltageDiff <= utils.CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL
and self.allow_max_voltage
):
Expand All @@ -290,7 +291,7 @@ def manage_charge_voltage_linear(self) -> None:
self.max_voltage_start_time = None
# we don't forget to reset max_voltage_start_time wenn we going to bulk(dynamic) mode
# regardless of whether we were in absorption mode or not
if voltageSum < self.max_battery_voltage - utils.VOLTAGE_DROP:
if voltageSum < self.max_battery_voltage - utils.VOLTAGE_DROP - measurementToleranceVariation:
self.max_voltage_start_time = None

# INFO: battery will only switch to Absorption, if all cells are balanced.
Expand Down

0 comments on commit 81a2fc7

Please sign in to comment.