Skip to content

Fix incorrect SoC when battery_scaling_auto is enabled#3974

Open
nickgee31 wants to merge 1 commit into
springfall2008:mainfrom
nickgee31:fix-battery-degradation-soc
Open

Fix incorrect SoC when battery_scaling_auto is enabled#3974
nickgee31 wants to merge 1 commit into
springfall2008:mainfrom
nickgee31:fix-battery-degradation-soc

Conversation

@nickgee31
Copy link
Copy Markdown

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.

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.
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.

1 participant