Skip to content

Commit

Permalink
Added second SoC calculataion for fine tuning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
salewis38 authored Aug 28, 2023
1 parent fb24cc8 commit ef496c1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions palm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 \
Expand All @@ -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

Expand Down

0 comments on commit ef496c1

Please sign in to comment.