From c964c28de57d6aab7366e8f9e0f4c826334c6c3d Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:17:23 +0000 Subject: [PATCH 1/2] Fix bug in car charging smart calculation https://github.com/springfall2008/batpred/issues/621 --- apps/predbat/predbat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py index 10547bad5..a89655bb3 100644 --- a/apps/predbat/predbat.py +++ b/apps/predbat/predbat.py @@ -5024,7 +5024,7 @@ def plan_car_charging(self, car_n, low_rates): # Clamp length to required amount (shorten the window) if kwh_add > kwh_left: percent = kwh_left / kwh_add - length = min(int(((length * percent) / 5) + 2.5) * 5, end - start) + length = min(int(((length * percent) / 5) + 0.5) * 5, end - start) end = start + length hours = length / 60 kwh = self.car_charging_rate[car_n] * hours @@ -10895,4 +10895,4 @@ def run_time_loop_balance(self, cb_args): except Exception as e: self.log("ERROR: Exception raised {}".format(e)) self.record_status("ERROR: Exception raised {}".format(e)) - raise + raise \ No newline at end of file From d6e86beaf7341f5b0af443073c98d7d403770f2d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:18:46 +0000 Subject: [PATCH 2/2] [pre-commit.ci lite] apply automatic fixes --- apps/predbat/predbat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py index a89655bb3..b6cf6f762 100644 --- a/apps/predbat/predbat.py +++ b/apps/predbat/predbat.py @@ -10895,4 +10895,4 @@ def run_time_loop_balance(self, cb_args): except Exception as e: self.log("ERROR: Exception raised {}".format(e)) self.record_status("ERROR: Exception raised {}".format(e)) - raise \ No newline at end of file + raise