Skip to content

Commit

Permalink
Bug related to freeze only mode calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
springfall2008 authored Dec 24, 2024
1 parent 8b066e8 commit c575619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions apps/predbat/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c575619

Please sign in to comment.