Skip to content

Commit

Permalink
Bug related to freeze only mode calcs (#1785)
Browse files Browse the repository at this point in the history
* Bug related to freeze only mode calcs

* [pre-commit.ci lite] apply automatic fixes

* Test update

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored Dec 24, 2024
1 parent 8b066e8 commit d9ed507
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 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
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
3 changes: 2 additions & 1 deletion apps/predbat/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,10 +1678,11 @@ def run_single_debug(my_predbat, debug_file):
my_predbat.read_debug_yaml(debug_file)
my_predbat.config_root = "./"
my_predbat.save_restore_dir = "./"
print("Fetch config options")
my_predbat.fetch_config_options()

# Force off combine export XXX:
print("Combined export slots {} min_improvement_export {}".format(my_predbat.combine_export_slots, my_predbat.metric_min_improvement_export))
print("Combined export slots {} min_improvement_export {} set_export_freeze_only {}".format(my_predbat.combine_export_slots, my_predbat.metric_min_improvement_export, my_predbat.set_export_freeze_only))
my_predbat.combine_export_slots = False
# my_predbat.best_soc_keep = 1.0
my_predbat.metric_min_improvement_export = 5
Expand Down

0 comments on commit d9ed507

Please sign in to comment.