Skip to content

Commit

Permalink
Try to export everything left if allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
springfall2008 authored Dec 26, 2024
1 parent 88d8194 commit 27f074c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/predbat/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def execute_plan(self):
discharge_soc = max((self.export_limits_best[0] * self.soc_max) / 100.0, self.reserve, self.best_soc_min)
self.log("Next export window will be: {} - {} at reserve {}".format(discharge_start_time, discharge_end_time, self.export_limits_best[0]))
if (self.minutes_now >= minutes_start) and (self.minutes_now < minutes_end) and (self.export_limits_best[0] < 100.0):
if not self.set_export_freeze_only and self.export_limits_best[0] < 99.0 and ((self.soc_kw - PREDICT_STEP * inverter.battery_rate_max_discharge_scaled) >= discharge_soc):
if not self.set_export_freeze_only and self.export_limits_best[0] < 99.0 and (self.soc_kw > discharge_soc):
self.log("Exporting now - current SoC {} and target {}".format(self.soc_kw, dp2(discharge_soc)))
inverter.adjust_discharge_rate(inverter.battery_rate_max_discharge * MINUTE_WATT)
resetDischarge = False
Expand Down
7 changes: 2 additions & 5 deletions apps/predbat/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,7 @@ def run_prediction(self, charge_limit, charge_window, export_window, export_limi

# Once a force discharge is set the four hour rule is disabled
if four_hour_rule:
if minute < 4 * 60:
keep_minute_scaling = 0
else:
keep_minute_scaling = min(((minute - 4 * 60) / (2 * 60)), 1.0) * self.best_soc_keep_weight
keep_minute_scaling = min((minute / (4 * 60)), 1.0) * self.best_soc_keep_weight
else:
keep_minute_scaling = self.best_soc_keep_weight

Expand Down Expand Up @@ -587,7 +584,7 @@ def run_prediction(self, charge_limit, charge_window, export_window, export_limi
if export_window_n >= 0:
discharge_min = max(self.soc_max * export_limits[export_window_n] / 100.0, self.reserve, self.best_soc_min)

if not self.set_export_freeze_only and (export_window_n >= 0) and export_limits[export_window_n] < 99.0 and (soc - step * self.battery_rate_max_discharge_scaled) >= discharge_min:
if not self.set_export_freeze_only and (export_window_n >= 0) and export_limits[export_window_n] < 99.0 and (soc > discharge_min):
# Discharge enable
discharge_rate_now = self.battery_rate_max_discharge # Assume discharge becomes enabled here
discharge_rate_now_curve = get_discharge_rate_curve(soc, discharge_rate_now, self.soc_max, self.battery_rate_max_discharge, self.battery_discharge_power_curve, self.battery_rate_min) * self.battery_rate_max_scaling_discharge
Expand Down

0 comments on commit 27f074c

Please sign in to comment.