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

Inhibit solar passthrough while battery below stop threshold #354

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

schlimmchen
Copy link
Member

This PR mangles two changes. The commits are separated. They do, however, build on one another.

  1. "Improve" the DPL verbose logging. Please see the commit message for a list of changes. Some are purely cosmetic, some are arguably improvements.
  2. Inhibit solar passthrough if the battery SoC or voltage is below the respective stop threshold.

Reasons for 2:

  • If solar passthrough is active for a couple of hours or days and the battery is slightly discharged the whole time because the inverter is using a little too much power, maybe because the losses are bigger than anticipated, then this becomes a problem.
  • The battery self-discharges over time, which might become an issue on prolonged periods with little sunshine.
  • The inverter uses power at night. Very little, but this inevitable drains power and if solar passthrough prevents the battery from charging for a longer time, it depletes. The same is true for the BMS.

For those circumstances I propose this new piece of the DPL puzzle: Solar passthrough is inhibited while the battery is below the stop threshold.

A new method isBelowStopThreshold in introduced. However, the code in isStopThresholdReached and isStartThresholdReached was not copied another time. Instead, a new generic implementation is used by all three methods.

* shorten DPL log prefix
* canUseDirectSolarPower() was printed two times
* _batteryDischargeEnabled was printed two times
* convert boolean values to human-readable strings
* add units where possible
* split messages into block "before calculating new limit" and "after
  calculating new limit", as the latter cannot rely on _inverter being
  available.
* order messages such that variables whose value is derived from other
  variables are printed later than their dependencies.
* merge output into blocks (one instance near "Printout some stats")
* remove more redundant info (produced in functions outside loop())
* print target grid consumption
we only want to inhibit solar passthrough if the SoC is *below* the stop
threshold, not if it is equal to the stop threshold. otherwise, when
discharging, we would discharge until the battery reached the stop
threshold, then we would also inhibit solar passthrough, until the
battery is charged to the SoC stop threshold plus one percent.
@helgeerbe
Copy link
Collaborator

Checking my initial state diagram this was the initial behavior of the DPL. This must be removed in various refactorings. Thanks for finding this.

I haven't seen this in my log. Because, when you stop draining the battery, voltage climbs above stropThreshold.

@helgeerbe helgeerbe merged commit aff7924 into hoylabs:development Aug 4, 2023
7 of 8 checks passed
@schlimmchen schlimmchen deleted the solar-pt-stop-threshold branch August 4, 2023 17:59
Copy link

github-actions bot commented Apr 5, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants