Skip to content
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

Merged
merged 7 commits into from
Dec 1, 2023

Conversation

gcoan
Copy link
Collaborator

@gcoan gcoan commented Nov 29, 2023

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

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
@gcoan gcoan mentioned this pull request Nov 29, 2023
@@ -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)))
Copy link
Owner

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 :)

@@ -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 ]
Copy link
Owner

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

@gcoan
Copy link
Collaborator Author

gcoan commented Nov 30, 2023 via email

@@ -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 ]
Copy link
Owner

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?

@springfall2008 springfall2008 merged commit 0c04624 into springfall2008:main Dec 1, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants