Skip to content

Commit 7917816

Browse files
Plan prices
1 parent 28279bf commit 7917816

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

apps/predbat/output.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,27 @@ def short_textual_plan(self, soc_min, soc_min_minute, pv_forecast_minute_step, p
823823
rate_export_str = rate_bucket_export[0]["rate"]
824824
rate_export_duration = rate_bucket_export[0]["end"] - rate_bucket_export[0]["start"]
825825

826+
midnight_today_minute = 24*60 - self.minutes_now
827+
midnight_tomorrow_minute = 24*60 + midnight_today_minute
828+
829+
metric_midnight_today = self.predict_metric_best.get(midnight_today_minute, 0.0)
830+
metric_midnight_tomorrow = self.predict_metric_best.get(midnight_tomorrow_minute, None)
831+
832+
if metric_midnight_tomorrow is not None:
833+
metric_midnight_tomorrow -= metric_midnight_today
834+
835+
if metric_midnight_tomorrow is None:
836+
sentence += "- Your estimated bill for today is {}{}\n".format(
837+
self.currency_symbols[0], dp2(metric_midnight_today/100)
838+
)
839+
else:
840+
sentence += "- Your estimated bill for today is {}{} and tomorrow is {}{}\n".format(
841+
self.currency_symbols[0], dp2(metric_midnight_today/100),
842+
self.currency_symbols[0], dp2(metric_midnight_tomorrow/100),
843+
)
844+
826845
if rate_import_str != "fixed":
827-
sentence = "- Import rates are {} {} for the next {}".format(rate_import_str, rate_bucket_import[0]["range"], self.duration_string(rate_import_duration))
846+
sentence += "- Import rates are {} {} for the next {}".format(rate_import_str, rate_bucket_import[0]["range"], self.duration_string(rate_import_duration))
828847
if len(rate_bucket_import) > 1:
829848
sentence += " and then {} {} for the next {}".format(rate_bucket_import[1]["rate"], rate_bucket_import[1]["range"], self.duration_string(rate_bucket_import[1]["end"] - rate_bucket_import[1]["start"]))
830849
sentence += ".\n"

apps/predbat/plan.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def optimise_charge_limit_price_threads(
164164
self.log("All prices {}".format(all_prices))
165165
if region_start:
166166
self.log("Region {} - {}".format(self.time_abs_str(region_start), self.time_abs_str(region_end)))
167-
self.log("Current best metric {} cost {} best level score {} all level score {}".format(best_metric, best_cost, best_level_score, levels_score))
168167

169168
# Start loop of trials
170169
for loop_price in all_prices:
@@ -2694,11 +2693,12 @@ def optimise_detailed_pass(
26942693
)
26952694
printed_set = True
26962695

2697-
self.log(
2698-
"Optimise export window {} end_record {} best_price_charge {} best_price_export {} lowest_price_charge {} with charge limits {} export limits {}".format(
2699-
window_n, self.time_abs_str(self.end_record + self.minutes_now), best_price_charge, best_price_export, lowest_price_charge, self.charge_limit_best, self.export_limits_best
2696+
if self.debug_enable:
2697+
self.log(
2698+
"Optimise export window {} end_record {} best_price_charge {} best_price_export {} lowest_price_charge {} with charge limits {} export limits {}".format(
2699+
window_n, self.time_abs_str(self.end_record + self.minutes_now), best_price_charge, best_price_export, lowest_price_charge, self.charge_limit_best, self.export_limits_best
2700+
)
27002701
)
2701-
)
27022702

27032703
self.export_window_best[window_n]["start"] = self.export_window_best[window_n].get("start_orig", self.export_window_best[window_n]["start"])
27042704
n_best_soc, n_best_start, n_best_metric, n_best_cost, n_soc_min, n_soc_min_minute, n_best_keep, n_best_cycle, n_best_carbon, n_best_import = self.optimise_export(
@@ -2727,12 +2727,6 @@ def optimise_detailed_pass(
27272727
self.export_window_best[window_n]["start_orig"] = self.export_window_best[window_n].get("start_orig", self.export_window_best[window_n]["start"])
27282728
self.export_window_best[window_n]["start"] = best_start
27292729

2730-
self.log(
2731-
"Optimised export window {} end_record {} best_price_charge {} best_price_export {} lowest_price_charge {} with charge limits {} export limits {}".format(
2732-
window_n, self.time_abs_str(self.end_record + self.minutes_now), best_price_charge, best_price_export, lowest_price_charge, self.charge_limit_best, self.export_limits_best
2733-
)
2734-
)
2735-
27362730
self.plan_write_debug(debug_mode, "plan_{}_export_{}.html".format(pass_type, window_n))
27372731

27382732
if self.debug_enable:

0 commit comments

Comments
 (0)