-
-
Notifications
You must be signed in to change notification settings - Fork 91
Fix: Enforce battery stop threshold during full solar passthrough mode #2289
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
base: development
Are you sure you want to change the base?
Conversation
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Move battery discharge limit check before full solar passthrough logic to ensure stop threshold is always respected. When battery discharge is disabled due to stop threshold, limit full solar passthrough to requested power only, preventing battery discharge below threshold. Fixes issue where full solar passthrough had higher priority than stop threshold, causing battery to discharge below configured limit. Co-authored-by: AndreasBoehm <1270749+AndreasBoehm@users.noreply.github.com>
…is explicitly disabled Corrected the condition to check if battery discharge limit exists AND is zero, rather than treating nullopt (no BMS data) the same as disabled. When no BMS data is available (nullopt), full solar passthrough behaves normally. Co-authored-by: AndreasBoehm <1270749+AndreasBoehm@users.noreply.github.com>
@SW-Niko i did not look into this but do you think that this will fix the issue that you reported? |
@AndreasBoehm I thought I understood how the stop-threshold, solar-passthrough, and full-solar-passthrough work together. Now I'm not sure if I didn't understand the principle or if I didn't understand the code. The amplifiers are only switched to standby when the function calcPowerBusUsage() delivers 0W.
I thought we definitely wanted to shut down the inverter when the voltage fell below the stop-threshold, right? |
No, I was wrong ... 😞
We do not switch off if the solar-passthrough is enabled and we have sufficient solar power. Got it. Okay, I think I've found a very simple solution. I'll do some testing. Stay tuned. |
Use #2299 and delete this PR |
Problem
When the Full-Solar-Passthrough start threshold is configured to be lower than the Battery stop threshold, the inverter continues to draw energy from the battery even after the stop threshold has been reached. This can lead to battery over-discharge and potential damage.
Example misconfiguration:
In this scenario, once full solar passthrough activates at 45V, it continues even when the battery voltage drops below 48V (the configured stop threshold), draining the battery beyond safe limits.
Root Cause
In the
calcPowerBusUsage()
function (src/PowerLimiter.cpp
), the full solar passthrough check had higher priority than the battery discharge limit check. The function would return early when full solar passthrough was active, before reaching the code that checks whether battery discharge should be disabled due to the stop threshold:Solution
This PR reorders the logic to check the battery discharge limit before making the full solar passthrough decision. When the stop threshold is reached (battery discharge disabled), the system now limits output to only available solar power, preventing battery discharge below the configured threshold:
Changes
PowerLimiterClass::calcPowerBusUsage()
insrc/PowerLimiter.cpp
Behavior
Before this fix:
After this fix:
Impact
Additional Benefits
This fix also improves safety in other scenarios:
Testing
To verify this fix:
Fixes issue where battery continues discharging during full solar passthrough despite stop threshold being reached.
Original prompt
Fixes #2288
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.