-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update predbat.py, added rounding to self.log messages #393
Conversation
Added rounding to logging of status messages where figures were being displayed with lots of unnecessary decimal places: - cache retrieval aging - PV forecast figures - soc charging and discharging limits - plan last updated time
apps/predbat/predbat.py
Outdated
@@ -2146,7 +2146,7 @@ def download_predbat_releases_url(self, url): | |||
pdata = self.github_url_cache[url]["data"] | |||
age = now - stamp | |||
if age.seconds < (120 * 60): | |||
self.log("Using cached GITHub data for {} age {} minutes".format(url, age.seconds / 60)) | |||
self.log("Using cached GITHub data for {} age {} minutes".format(url, round(age.seconds / 60,1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the same as self.dp1(x) - we should probably pick one of them :)
apps/predbat/predbat.py
Outdated
@@ -7712,6 +7712,10 @@ def calculate_plan(self, recompute=True): | |||
save="best", | |||
end_record=self.end_record, | |||
) | |||
# round charge_limit_best and discharge_limits_best to nearest whole number as soc's are integer values | |||
self.charge_limit_best = [ int(round(elem,0)) for elem in self.charge_limit_best ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is correct, for legacy reasons the charge limit is in kWh while the discharge limit is in percent
Ok I’ll change both of them in line with your comments
… On 30 Nov 2023, at 09:25, Trefor Southwell ***@***.***> wrote:
@springfall2008 commented on this pull request.
In apps/predbat/predbat.py:
> @@ -2146,7 +2146,7 @@ def download_predbat_releases_url(self, url):
pdata = self.github_url_cache[url]["data"]
age = now - stamp
if age.seconds < (120 * 60):
- self.log("Using cached GITHub data for {} age {} minutes".format(url, age.seconds / 60))
+ self.log("Using cached GITHub data for {} age {} minutes".format(url, round(age.seconds / 60,1)))
I think this is the same as self.dp1(x) - we should probably pick one of them :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
apps/predbat/predbat.py
Outdated
@@ -7712,6 +7718,10 @@ def calculate_plan(self, recompute=True): | |||
save="best", | |||
end_record=self.end_record, | |||
) | |||
# round charge_limit_best (kWh) to 1 decimal place and discharge_limits_best (percentage) to nearest whole number gc | |||
self.charge_limit_best = [ self.dp1(elem) for elem in self.charge_limit_best ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure 1 decimal place is enough here as it needs to be converted back into the right percentage later. I wonder if you are trying to fix the formatting of the text rather than really wanting to modified the save values that will be used to program the inverter?
Added rounding to logging of status messages where figures were being displayed with lots of unnecessary decimal places: