mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-13 09:13:30 +01:00
fix(battery): preserve energy below minimum state of charge (#1483)
This commit is contained in:
@@ -366,6 +366,9 @@ class Battery:
|
||||
|
||||
# Raw extractable energy above minimum SoC
|
||||
raw_available_wh = max(self.soc_wh - self.min_soc_wh, 0.0)
|
||||
if raw_available_wh == 0.0:
|
||||
# A measured SoC below the reserve must not be raised by discharging.
|
||||
return 0.0, 0.0
|
||||
|
||||
# Maximum raw discharge due to power limit, scaled to the slot duration.
|
||||
# max_charge_power_w is a power [W]; energy movable in one slot is
|
||||
|
||||
@@ -304,6 +304,9 @@ class Inverter:
|
||||
discharged_raw_wh = battery._discharged_raw_wh_per_slot
|
||||
discharging_efficiency = battery.discharging_efficiency
|
||||
raw_available_wh = max(soc_wh - min_soc_wh, 0.0)
|
||||
if raw_available_wh == 0.0:
|
||||
# Match Battery.discharge_energy(): preserve a SoC below the reserve.
|
||||
return 0.0, 0.0
|
||||
max_raw_wh = max(
|
||||
battery.max_charge_power_w * battery.slot_duration_h - discharged_raw_wh[hour], 0.0
|
||||
)
|
||||
|
||||
@@ -227,6 +227,9 @@ class Genetic0Battery:
|
||||
|
||||
# Raw extractable energy above minimum SoC
|
||||
raw_available_wh = max(self.soc_wh - self.min_soc_wh, 0.0)
|
||||
if raw_available_wh == 0.0:
|
||||
# A measured SoC below the reserve must not be raised by discharging.
|
||||
return 0.0, 0.0
|
||||
|
||||
# Maximum raw discharge due to power limit
|
||||
max_raw_wh = self.max_charge_power_w # TODO rename to max_discharge_power_w
|
||||
|
||||
Reference in New Issue
Block a user