From c575619a97d1393862eb482a82e6593a5350a6c5 Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Tue, 24 Dec 2024 09:53:05 +0000 Subject: [PATCH] Bug related to freeze only mode calcs --- apps/predbat/plan.py | 13 +++++++++---- apps/predbat/predbat.py | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/predbat/plan.py b/apps/predbat/plan.py index 1e7ffabe..4104aca9 100644 --- a/apps/predbat/plan.py +++ b/apps/predbat/plan.py @@ -106,7 +106,9 @@ def optimise_charge_limit_price_threads( for loop_price in all_prices: pred_table = [] - if self.set_export_freeze: + if self.set_export_freeze and self.set_export_freeze_only: + freeze_options = [True] + elif self.set_export_freeze: freeze_options = [True, False] else: freeze_options = [False] @@ -1272,7 +1274,7 @@ def optimise_export(self, window_n, record_charge_windows, try_charge_limit, cha export_step = 5 # loop on each export option - if self.set_export_freeze and freeze_only: + if self.set_export_freeze and (freeze_only or self.set_export_freeze_only): loop_options = [100, 99] elif self.set_export_freeze and not self.set_export_freeze_only: # If we support freeze, try a 99% option which will freeze at any SoC level below this @@ -1991,7 +1993,10 @@ def optimise_all_windows(self, best_metric, metric_keep, debug_mode=False): record_charge_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.charge_window_best), 1) record_export_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.export_window_best), 1) window_sorted, window_index, price_set, price_links = self.sort_window_by_price_combined( - self.charge_window_best[:record_charge_windows], self.export_window_best[:record_export_windows], calculate_import_low_export=self.calculate_import_low_export, calculate_export_high_import=self.calculate_export_high_import + self.charge_window_best[:record_charge_windows], + self.export_window_best[:record_export_windows], + calculate_import_low_export=self.calculate_import_low_export, + calculate_export_high_import=self.calculate_export_high_import ) self.rate_best_cost_threshold_charge = best_price @@ -3173,7 +3178,7 @@ def plan_iboost_smart(self): # Avoid duplicate slots if minute in used_slots: - rate_okay = False + rate_okay = False # Boost on import/export rate if price > self.iboost_rate_threshold: diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py index 03a2a077..c99d5c09 100644 --- a/apps/predbat/predbat.py +++ b/apps/predbat/predbat.py @@ -292,7 +292,6 @@ def reset(self): self.current_status = None self.previous_status = None self.had_errors = False - self.expert_mode = False self.plan_valid = False self.plan_last_updated = None self.plan_last_updated_minutes = 0