From 439434aeb654239ae5075c67ddda9384c58330a8 Mon Sep 17 00:00:00 2001 From: salewis38 <46199139+salewis38@users.noreply.github.com> Date: Sat, 11 Nov 2023 17:38:44 +0000 Subject: [PATCH] Bugfix: exit with SoC = 100% Indexing error causes PALM to exit with SoC = 100% under certain circumstances. --- palm_utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/palm_utils.py b/palm_utils.py index cc9decb..897cb8d 100644 --- a/palm_utils.py +++ b/palm_utils.py @@ -48,9 +48,10 @@ # ... # v0.10.0 21/Jun/23 Added multi-day averaging for usage calcs # v1.0.0 15/Jul/23 Random start time, Solcast data correction, IO compatibility, 48-hour fcast -# v1.1.0 06/Aug/23 Split out generic functions as palm_utils.py (this file), remove random start time (add comment in settings instead) +# v1.1.0 06/Aug/23 Split out generic functions as palm_utils.py, remove randomised start time +# v1.1.0a 11/Nov/23 Fixed resume operation after daytime charging, bugfix for chart generation -PALM_VERSION = "v1.1.0" +PALM_VERSION = "v1.1.0a" # -*- coding: utf-8 -*- # pylint: disable=logging-not-lazy # pylint: disable=consider-using-f-string @@ -504,7 +505,7 @@ def compute_tgt_soc(self, gen_fcast, weight: int, commit: bool) -> str: if day == 1 and i == 0: diff = plot_y2[48] - plot_y1[49] if plot_y1[day*48 + i + 1] + diff > 100: # Correct for SoC > 100% - diff = 100 - plot_y1[day*48 + i] + diff = 100 - plot_y1[day*48 + i + 1] # Bugfix v1.1.0a plot_y2.append(plot_y1[day*48 + i + 1] + diff) i += 1 day += 1 @@ -597,11 +598,13 @@ def get_solcast(url) -> Tuple[bool, str]: pv_est90 = [0] * 10080 if stgs.Solcast.url_sw != "": # Two arrays are specified - forecast_lines = min(len(solcast_data_1['forecasts']), len(solcast_data_2['forecasts'])) - 1 + forecast_lines = min(len(solcast_data_1['forecasts']), \ + len(solcast_data_2['forecasts'])) - 1 else: forecast_lines = len(solcast_data_1['forecasts']) - 1 interval = int(solcast_data_1['forecasts'][0]['period'][2:4]) - solcast_offset = t_to_mins(solcast_data_1['forecasts'][0]['period_end'][11:16]) - interval - 60 + solcast_offset = t_to_mins(solcast_data_1['forecasts'][0]['period_end'][11:16]) \ + - interval - 60 # Check for BST and convert to local time to align with GivEnergy data if time.strftime("%z", time.localtime()) == "+0100":