Skip to content

Commit

Permalink
Tidy up some debug output (#436)
Browse files Browse the repository at this point in the history
* Tidy up some debug output

* [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 7, 2023
1 parent d6297c6 commit 547ce9d
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6516,11 +6516,24 @@ def optimise_charge_limit(
# Add margin last
best_soc = min(best_soc + self.best_soc_margin, self.soc_max)

self.log(
"Try optimising charge window(s) {} price {} results {} selected {} was {}".format(
all_n if all_n else window_n, charge_window[window_n]["average"], window_results, best_soc, charge_limit[window_n]
if not all_n:
self.log(
"Try optimising charge window(s) {}: {} - {} price {} selected {} was {} results {}".format(
window_n,
self.time_abs_str(window["start"]),
self.time_abs_str(window["end"]),
charge_window[window_n]["average"],
best_soc,
charge_limit[window_n],
window_results,
)
)
else:
self.log(
"Try optimising charge window(s) {}: price {} selected {} was {} results {}".format(
all_n, charge_window[window_n]["average"], best_soc, charge_limit[window_n], window_results
)
)
)
return best_soc, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep

def optimise_discharge(
Expand Down Expand Up @@ -6679,10 +6692,22 @@ def optimise_discharge(
best_size = window_size
best_keep = metric_keep

optimized = all_n
if not optimized:
optimized = window_n
self.log("Try optimising discharge window(s) {} price {} gives {} => selected {}% size {}".format(optimized, window["average"], window_results, best_discharge, best_size))
if not all_n:
self.log(
"Try optimising discharge window(s) {}: {} - {} price {} selected {}% size {} was {}% results {}".format(
window_n,
self.time_abs_str(window["start"]),
self.time_abs_str(window["end"]),
window["average"],
best_discharge,
best_size,
discharge_limit[window_n],
window_results,
)
)
else:
self.log("Try optimising discharge window(s) {} price {} selected {}% size {} results {}".format(all_n, window["average"], best_discharge, best_size, window_results))

return best_discharge, best_start, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep

def window_sort_func(self, window):
Expand Down

0 comments on commit 547ce9d

Please sign in to comment.