Skip to content

Commit

Permalink
make CCL and DCL more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jul 25, 2023
1 parent 2ed2780 commit e09658c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Changed: Improved battery voltage handling in linear absorption mode by @ogurevich
* Changed: Improved driver reinstall when multiple Bluetooth BMS are enabled by @mr-manuel
* Changed: Improved Jkbms_Ble driver by @seidler2547 & @mr-manuel
* Changed: Make CCL and DCL limiting messages more clear by @mr-manuel
* Changed: Reduce the big inrush current if the CVL jumps from Bulk/Absorbtion to Float https://github.com/Louisvdw/dbus-serialbattery/issues/659 by @Rikkert-RS & @ogurevich
* Changed: Time-to-Go and Time-to-SoC use the current average of the last 5 minutes for calculation by @mr-manuel
* Changed: Time-to-SoC calculate only positive points by @mr-manuel
Expand Down
66 changes: 49 additions & 17 deletions etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,33 +564,48 @@ def manage_charge_voltage_step(self) -> None:

def manage_charge_current(self) -> None:
# Manage Charge Current Limitations
charge_limits = {utils.MAX_BATTERY_CHARGE_CURRENT: "Config Limit"}
charge_limits = {utils.MAX_BATTERY_CHARGE_CURRENT: "Max Battery Charge Current"}

# if values are not the same, then the limit was read also from the BMS
if utils.MAX_BATTERY_CHARGE_CURRENT != self.max_battery_charge_current:
charge_limits.update({self.max_battery_charge_current: "BMS Limit"})
# if BMS limit is lower then config limit and therefore the values are not the same,
# then the limit was also read from the BMS
if utils.MAX_BATTERY_CHARGE_CURRENT > self.max_battery_charge_current:
charge_limits.update({self.max_battery_charge_current: "BMS Settings"})

if utils.CCCM_CV_ENABLE:
tmp = self.calcMaxChargeCurrentReferringToCellVoltage()
if self.max_battery_charge_current != tmp:
if tmp in charge_limits:
charge_limits.update({tmp: charge_limits[tmp] + ", Cell Voltage"})
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
charge_limits.update(
{tmp: charge_limits[tmp] + ", Cell Voltage"}
)
else:
pass
else:
charge_limits.update({tmp: "Cell Voltage"})

if utils.CCCM_T_ENABLE:
tmp = self.calcMaxChargeCurrentReferringToTemperature()
if self.max_battery_charge_current != tmp:
if tmp in charge_limits:
charge_limits.update({tmp: charge_limits[tmp] + ", Temp"})
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
charge_limits.update({tmp: charge_limits[tmp] + ", Temp"})
else:
pass
else:
charge_limits.update({tmp: "Temp"})

if utils.CCCM_SOC_ENABLE:
tmp = self.calcMaxChargeCurrentReferringToSoc()
if self.max_battery_charge_current != tmp:
if tmp in charge_limits:
charge_limits.update({tmp: charge_limits[tmp] + ", SoC"})
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
charge_limits.update({tmp: charge_limits[tmp] + ", SoC"})
else:
pass
else:
charge_limits.update({tmp: "SoC"})

Expand Down Expand Up @@ -628,35 +643,52 @@ def manage_charge_current(self) -> None:
#####

# Manage Discharge Current Limitations
discharge_limits = {utils.MAX_BATTERY_DISCHARGE_CURRENT: "Config Limit"}

# if values are not the same, then the limit was read also from the BMS
if utils.MAX_BATTERY_DISCHARGE_CURRENT != self.max_battery_discharge_current:
discharge_limits.update({self.max_battery_discharge_current: "BMS Limit"})
discharge_limits = {
utils.MAX_BATTERY_DISCHARGE_CURRENT: "Max Battery Discharge Current"
}

# if BMS limit is lower then config limit and therefore the values are not the same,
# then the limit was also read from the BMS
if utils.MAX_BATTERY_DISCHARGE_CURRENT > self.max_battery_discharge_current:
discharge_limits.update(
{self.max_battery_discharge_current: "BMS Settings"}
)

if utils.DCCM_CV_ENABLE:
tmp = self.calcMaxDischargeCurrentReferringToCellVoltage()
if self.max_battery_discharge_current != tmp:
if tmp in discharge_limits:
discharge_limits.update(
{tmp: discharge_limits[tmp] + ", Cell Voltage"}
)
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
discharge_limits.update(
{tmp: discharge_limits[tmp] + ", Cell Voltage"}
)
else:
pass
else:
discharge_limits.update({tmp: "Cell Voltage"})

if utils.DCCM_T_ENABLE:
tmp = self.calcMaxDischargeCurrentReferringToTemperature()
if self.max_battery_discharge_current != tmp:
if tmp in discharge_limits:
discharge_limits.update({tmp: discharge_limits[tmp] + ", Temp"})
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
discharge_limits.update({tmp: discharge_limits[tmp] + ", Temp"})
else:
pass
else:
discharge_limits.update({tmp: "Temp"})

if utils.DCCM_SOC_ENABLE:
tmp = self.calcMaxDischargeCurrentReferringToSoc()
if self.max_battery_discharge_current != tmp:
if tmp in discharge_limits:
discharge_limits.update({tmp: discharge_limits[tmp] + ", SoC"})
# do not add string, if global limitation is applied
if charge_limits["tmp"] != "Max Battery Charge Current":
discharge_limits.update({tmp: discharge_limits[tmp] + ", SoC"})
else:
pass
else:
discharge_limits.update({tmp: "SoC"})

Expand Down

0 comments on commit e09658c

Please sign in to comment.