From 398785c5f4b6464e2a39102bcda12d35a525ce71 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, 11 Jan 2025 15:51:47 +0000 Subject: [PATCH] [pre-commit.ci lite] apply automatic fixes --- apps/predbat/execute.py | 40 +++++++++++++++++++++------------------- apps/predbat/inverter.py | 1 - 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/predbat/execute.py b/apps/predbat/execute.py index 6a42d0f6..73a5bd6f 100644 --- a/apps/predbat/execute.py +++ b/apps/predbat/execute.py @@ -101,31 +101,34 @@ def execute_plan(self): self.log("Inverter {} Charge window will be: {} - {} - current soc {} target {}".format(inverter.id, charge_start_time, charge_end_time, inverter.soc_percent, self.charge_limit_percent_best[0])) # Are we actually charging? if self.minutes_now >= minutes_start and self.minutes_now < minutes_end: - target_soc = self.charge_limit_percent_best[0] if self.charge_limit_best != self.reserve else self.soc_kw inv_target_soc = self.adjust_battery_target_multi(inverter, target_soc, True, False, check=True) new_charge_rate, new_charge_rate_real = find_charge_rate( - self.minutes_now, - inverter.soc_kw, - window, - inv_target_soc * inverter.soc_max / 100.0, - inverter.battery_rate_max_charge, - inverter.soc_max, - self.battery_charge_power_curve, - self.set_charge_low_power, - self.charge_low_power_margin, - self.battery_rate_min, - self.battery_rate_max_scaling, - self.battery_loss, - self.log, - inverter.battery_temperature, - self.battery_temperature_discharge_curve - ) + self.minutes_now, + inverter.soc_kw, + window, + inv_target_soc * inverter.soc_max / 100.0, + inverter.battery_rate_max_charge, + inverter.soc_max, + self.battery_charge_power_curve, + self.set_charge_low_power, + self.charge_low_power_margin, + self.battery_rate_min, + self.battery_rate_max_scaling, + self.battery_loss, + self.log, + inverter.battery_temperature, + self.battery_temperature_discharge_curve, + ) new_charge_rate = int(new_charge_rate * MINUTE_WATT) current_charge_rate = inverter.get_current_charge_rate() - self.log("Inverter {} Target SOC {} (this inverter {}) Battery temperature {} Select charge rate {}w (real {}w) current charge rate {}".format(inverter.id, target_soc, inv_target_soc, inverter.battery_temperature, new_charge_rate, new_charge_rate_real * MINUTE_WATT, current_charge_rate)) + self.log( + "Inverter {} Target SOC {} (this inverter {}) Battery temperature {} Select charge rate {}w (real {}w) current charge rate {}".format( + inverter.id, target_soc, inv_target_soc, inverter.battery_temperature, new_charge_rate, new_charge_rate_real * MINUTE_WATT, current_charge_rate + ) + ) # Adjust charge rate if we are more than 10% out or we are going back to Max charge rate max_rate = inverter.battery_rate_max_charge * MINUTE_WATT @@ -681,7 +684,6 @@ def fetch_inverter_data(self, create=True): self.current_charge_limit = calc_percent_limit(self.current_charge_limit_kwh, self.soc_max) self.battery_temperature += inverter.battery_temperature - # Work out battery temperature self.battery_temperature = int(dp0(self.battery_temperature / self.num_inverters)) diff --git a/apps/predbat/inverter.py b/apps/predbat/inverter.py index 530f3b03..c97bad87 100644 --- a/apps/predbat/inverter.py +++ b/apps/predbat/inverter.py @@ -327,7 +327,6 @@ def __init__(self, base, id=0, quiet=False, rest_postCommand=None, rest_getData= ivtime = self.base.get_arg("inverter_time", index=self.id, default=None) - # Battery cannot be zero size if self.soc_max <= 0: self.base.log("Error: Reported battery size from REST is {}, but it must be >0".format(self.soc_max))