From ef496c1906911b3b12cfd6641a3cdfc60ff70dbc Mon Sep 17 00:00:00 2001 From: salewis38 <46199139+salewis38@users.noreply.github.com> Date: Mon, 28 Aug 2023 18:23:37 +0100 Subject: [PATCH] Added second SoC calculataion for fine tuning Run a second SoC calculation 1 hour before the end of the off-peak period as all forecasts are better when nearer to the time, including Solcast. To benefit fully from downward corrections, a sufficiently large load is needed for the final hour to discharge the battery to the new target. --- palm.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/palm.py b/palm.py index 82c0424..00b2c13 100644 --- a/palm.py +++ b/palm.py @@ -537,17 +537,20 @@ def balance_loads(): else: # Schedule activities at specific intervals - # 5 minutes before off-peak start for next day's forecast + # 5 minutes before off-peak start for next day's forecast and 1hr before off-peak ends if ((stgs.pg.test_mode or stgs.pg.once_mode) and stgs.pg.loop_counter == 1) or \ - stgs.pg.t_now_mins == (t_to_mins(stgs.GE.start_time) + 1435) % 1440: + stgs.pg.t_now_mins == (t_to_mins(stgs.GE.start_time) + 1435) % 1440 or \ + stgs.pg.t_now_mins == (t_to_mins(stgs.GE.end_time) + 1375) % 1440: try: pv_forecast.update() except Exception: logger.warning("Warning; Solcast download failure") # 2 minutes before off-peak start for setting overnight battery charging target + # Repeat 60 mins before end of off-peak in case of Solcast fine-tuning if ((stgs.pg.test_mode or stgs.pg.once_mode) and stgs.pg.loop_counter == 2) or \ - stgs.pg.t_now_mins == (t_to_mins(stgs.GE.start_time) + 1438) % 1440: + stgs.pg.t_now_mins == (t_to_mins(stgs.GE.start_time) + 1438) % 1440 or \ + stgs.pg.t_now_mins == (t_to_mins(stgs.GE.end_time) + 1380) % 1440: # compute & set SoC target try: inverter.get_load_hist() @@ -572,7 +575,7 @@ def balance_loads(): # Reset sunrise and sunset for next day env_obj.reset_sr_ss() - # Pause/resume battery once charged to compensate for AC3 inverter bug + # Pause/resume battery once charged to compensate for AC3 inverter oscillation bug # Covers charge period both in early-morning and spanning midnight if MANUAL_HOLD_VAR is False and \ (t_to_mins(stgs.GE.start_time) < stgs.pg.t_now_mins < t_to_mins(stgs.GE.end_time) or \ @@ -582,7 +585,8 @@ def balance_loads(): inverter.set_mode("pause") MANUAL_HOLD_VAR = True if stgs.pg.month not in stgs.GE.winter and stgs.pg.t_now_mins == t_to_mins(stgs.GE.end_time) or \ - stgs.pg.month in stgs.GE.winter and stgs.pg.t_now_mins == t_to_mins(stgs.GE.end_time_winter): + stgs.pg.month in stgs.GE.winter and stgs.pg.t_now_mins == t_to_mins(stgs.GE.end_time_winter) or \ + stgs.pg.t_now_mins + 60 == t_to_mins(stgs.GE.end_time): inverter.set_mode("resume") MANUAL_HOLD_VAR = False