Fix incorrect SoC when battery_scaling_auto is enabled#3974
Open
nickgee31 wants to merge 1 commit into
Open
Conversation
Preserve manual DoD/usable config when battery_scaling_auto is enabled by introducing battery_scaling_config and clamping auto-scaling to [config*0.8, config]. Update Inverter to set battery_scaling from the computed value and to default battery_scaling to 1.0 when no nominal capacity is configured. Add/adjust unit tests: helper _clamped_auto_scaling, assert battery_scaling is updated in existing auto-scaling tests, add test_battery_scaling_auto_preserves_configured_scaling to ensure measured degradation below configured DoD is applied, and wire the new test into the test runner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed battery degradation auto-scaling so it respects the configured battery_scaling baseline.
Previously, battery_scaling_auto could update soc_max without keeping the effective runtime battery scale consistent. This could make Predbat’s displayed SoC diverge from the real inverter SoC, especially on systems using battery_scaling for DoD correction, such as 0.8.
The change now treats the configured per-inverter battery_scaling value as the upper bound, and only allows auto degradation to reduce from that baseline. For example, battery_scaling: 0.9 can auto-adjust within 0.72-0.9, while battery_scaling: 0.8 can adjust within 0.64-0.8. This preserves manual DoD/SOH correction while still allowing measured battery degradation to be applied consistently to both soc_max and shown SoC.
#3940 - fixes this issue.