Skip to content

Commit

Permalink
Removed randomised start time
Browse files Browse the repository at this point in the history
A better approach is to encourage users to set a friendly start time in palm_settings.
  • Loading branch information
salewis38 authored Sep 7, 2023
1 parent bc1d91c commit 619cba6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions palm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import Tuple, List
import logging
## import matplotlib.pyplot as plt
import random
import requests
import palm_settings as stgs

Expand Down Expand Up @@ -49,7 +48,7 @@
# ...
# 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)
# 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)

PALM_VERSION = "v1.1.0"
# -*- coding: utf-8 -*-
Expand Down Expand Up @@ -324,18 +323,18 @@ def set_inverter_register(register: str, value: str):
logger.error("Readback failed on GivEnergy API... Expected " +
str(value) + ", Read: "+ str(returned_cmd))

if cmd == "set_soc": # Sets target SoC to value, randomises start time to be grid friendly
if cmd == "set_soc": # Sets target SoC to value
set_inverter_register("77", str(self.tgt_soc))
if stgs.GE.start_time != "":
start_time = t_to_hrs(t_to_mins(stgs.GE.start_time) + random.randint(1,14))
start_time = t_to_hrs(t_to_mins(stgs.GE.start_time))
set_inverter_register("64", start_time)
if stgs.GE.end_time != "":
set_inverter_register("65", stgs.GE.end_time)

elif cmd == "set_soc_winter": # Restore default overnight charge params
set_inverter_register("77", "100")
if stgs.GE.start_time != "":
start_time = t_to_hrs(t_to_mins(stgs.GE.start_time) + random.randint(1,14))
start_time = t_to_hrs(t_to_mins(stgs.GE.start_time))
set_inverter_register("64", stgs.GE.start_time)
if stgs.GE.end_time_winter != "":
set_inverter_register("65", stgs.GE.end_time_winter)
Expand Down

0 comments on commit 619cba6

Please sign in to comment.