Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4944,12 +4944,12 @@ def plan_car_charging(self, car_n, low_rates):
kwh = self.car_charging_rate[car_n] * hours

kwh_add = kwh * self.car_charging_loss
kwh_left = self.car_charging_limit[car_n] - car_soc
kwh_left = max(self.car_charging_limit[car_n] - car_soc, 0)

# Clamp length to required amount (shorten the window)
if kwh_add > kwh_left:
percent = kwh_left / kwh_add
length = int((length * percent) / 5 + 2.5) * 5
length = min(int(((length * percent) / 5) + 2.5) * 5, end - start)
end = start + length
hours = length / 60
kwh = self.car_charging_rate[car_n] * hours
Expand Down