Skip to content

Commit

Permalink
Fixes Louisvdw#100
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Nov 6, 2024
1 parent 9c65396 commit 81d743b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def soc_calculation(self) -> None:
# limit soc_calc_capacity_remain to capacity and zero
# in case 100% is reached and the battery is not fully charged
# in case 0% is reached and the battery is not fully discharged
self.soc_calc_capacity_remain = round(max(min(self.soc_calc_capacity_remain, self.capacity), 0), 3)
self.soc_calc_capacity_remain = max(min(self.soc_calc_capacity_remain, self.capacity), 0)
self.soc_calc_capacity_remain_lasttime = current_time

# execute checks only if one cell reaches max voltage
Expand Down Expand Up @@ -524,7 +524,7 @@ def soc_calculation(self) -> None:
self.soc_calc_capacity_remain_lasttime = current_time

# calculate the SOC based on remaining capacity
self.soc_calc = round(max(min((self.soc_calc_capacity_remain / self.capacity) * 100, 100), 0), 2)
self.soc_calc = round(max(min((self.soc_calc_capacity_remain / self.capacity) * 100, 100), 0), 3)

def soc_reset_voltage_management(self) -> None:
"""
Expand Down

0 comments on commit 81d743b

Please sign in to comment.