Site: don't apply battery priority to loadpoints with battery boost active#31790
Site: don't apply battery priority to loadpoints with battery boost active#31790webalexeu wants to merge 1 commit into
Conversation
|
This looks nearly identical to my prototype, see master...mfuchs1984:evcc:fix/boost_below_prioritysoc The only difference is that your add |
…ctive Below prioritySoc, sitePower hides the power charging the battery (batteryPower, excessDCPower) and forces a 100W residual so loadpoints leave the surplus to the battery. This also starved loadpoints with battery boost active, which deliberately take priority over the home battery (boost has its own soc floor via batteryBoostLimit). sitePower now additionally returns the priority adjustment it applied; site.update adds it back for a boost-active loadpoint, restoring the unadjusted site power. Fixes evcc-io#30541 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
481552c to
e4b4912
Compare
Indeed, I've added a test yo cover it @andig Can you have a look to see what you think ? |
Fixes #30541
Desired behavior
Battery boost deliberately drains the home battery into the vehicle and has its own soc floor via
batteryBoostLimit(boost auto-disables when the battery soc drops below it). Therefore battery priority (prioritySoc) does not apply to a loadpoint with boost active: it may claim the power currently charging the battery. All other loadpoints keep respecting battery priority unchanged.Problem
Below
prioritySoc,sitePower()hides the power flowing into the battery (batteryPower,excessDCPowerzeroed) and forces a 100W residual so loadpoints leave the surplus to the battery. This also starved boost-active loadpoints: with the battery charging at 2000W, the boosting loadpoint ramped at ~0.4A per cycle instead of ~9A and could stay stuck on 1 phase (see issue for the full calculation).Solution (contained, per #30541 (comment))
sitePower()additionally returns the priority adjustment it applied (zeroedbatteryPower + excessDCPowerplus the residual override delta). Adding it back exactly reconstructs the unadjusted site power; theexcessDCPowerterm self-corrects, so DC-only excess that no loadpoint can claim stays reserved for the battery.site.updateadds the adjustment back only for the loadpoint being updated when its boost is active. Loadpoints are updated one per cycle, so there is no double-counting with multiple boost loadpoints.Covered by the new table-driven
TestSitePowerPriorityAdjustment(charging above/belowprioritySoc, discharging below), exercising the fullsitePowerpath with mocked battery meters.Known edge case: on the cycle where boost auto-disables (soc fell below
batteryBoostLimit), the loadpoint may see one interval of unadjusted surplus before reverting — keeping the boost check out ofsitePoweris what keeps the change contained.🤖 Generated with Claude Code