Skip to content

Commit

Permalink
Put cloud enable back in expert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
springfall2008 authored Dec 7, 2023
1 parent 547ce9d commit be171bc
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import appdaemon.plugins.hass.hassapi as hass
import adbase as ad

THIS_VERSION = "v7.14.4"
THIS_VERSION = "v7.14.5"
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
TIME_FORMAT_SECONDS = "%Y-%m-%dT%H:%M:%S.%f%z"
TIME_FORMAT_OCTOPUS = "%Y-%m-%d %H:%M:%S%z"
Expand Down Expand Up @@ -305,6 +305,13 @@
"enable": "expert_mode",
"default": 0.95,
},
{
"name": "metric_cloud_enable",
"friendly_name": "Enable Cloud Model",
"type": "switch",
"default": True,
"enable": "expert_mode",
},
{"name": "set_reserve_min", "friendly_name": "Set Reserve Min", "type": "input_number", "min": 4, "max": 100, "step": 1, "unit": "%", "icon": "mdi:percent", "default": 4.0},
{
"name": "rate_low_threshold",
Expand Down Expand Up @@ -6517,22 +6524,22 @@ def optimise_charge_limit(
best_soc = min(best_soc + self.best_soc_margin, self.soc_max)

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,
)
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
)
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

Expand Down Expand Up @@ -6693,21 +6700,25 @@ def optimise_discharge(
best_keep = metric_keep

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,
)
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))

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 Expand Up @@ -7907,7 +7918,7 @@ def calculate_plan(self, recompute=True):
# Full plan
if recompute:
self.optimise_all_windows(self.end_record, load_minutes_step, pv_forecast_minute_step, pv_forecast_minute10_step, metric, metric_keep)

# Tweak plan
self.tweak_plan(self.end_record, load_minutes_step, pv_forecast_minute_step, pv_forecast_minute10_step, metric, metric_keep)

Expand Down Expand Up @@ -8904,7 +8915,7 @@ def fetch_config_options(self):
self.battery_rate_max_scaling = self.get_arg("battery_rate_max_scaling")

self.best_soc_step = 0.25
self.metric_cloud_enable = True
self.metric_cloud_enable = self.get_arg("metric_cloud_enable")

# Battery charging options
self.battery_capacity_nominal = self.get_arg("battery_capacity_nominal")
Expand Down

0 comments on commit be171bc

Please sign in to comment.