fix(plan): don't offer Freeze Export for inverters that always charge from PV surplus - #4538
fix(plan): don't offer Freeze Export for inverters that always charge from PV surplus#4538chalfontchubby wants to merge 2 commits into
Conversation
… from PV surplus (#4207) Alternative to the stale #4425 (which patched the prediction model instead - reworking it here per that PR's own follow-up discussion): on an inverter with inverter_can_charge_during_export=true (the default), PV surplus charges the battery regardless of what mode Predbat has commanded, so Freeze Export (hold SoC flat, export the rest) can never actually be achieved - it collapses to identical behaviour as Idle. Rather than teach the prediction model to simulate a distinction that doesn't exist in reality, stop the optimiser offering/selecting freeze for these inverters in the first place: - optimise_export(): allow_freeze is now also forced off when the inverter can charge during export, alongside the existing set_export_freeze check. - optimise_solar() ("Export more solar"): sets export limits to 99.0 (freeze) directly, bypassing optimise_export()'s search entirely, so it needs the same gate independently or it reintroduces the bug through the back door. No prediction.py or kernel changes needed - this is purely a search-space restriction, not a modelling change, so no parity bump or binary rebuild. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Does this mean that for inverters with |
|
I'm not sure this seems right, freeze export disables battery charging allowing all solar to be exported. Can charge during export just means can the battery charge if the solar exceeds the capability of the inverter to export, this is different. |
|
I wondered about a new switch - battery can’t not charge while exporting,Freeze_export_supported, something like that
Sent from Yahoo Mail for iPhone
On Sunday, August 16, 2026, 6:37 pm, Trefor Southwell ***@***.***> wrote:
springfall2008 left a comment (springfall2008/batpred#4538)
I'm not sure this seems right, freeze export disables battery charging allowing all solar to be exported.
Can charge during export just means can the battery charge if the solar exceeds the capability of the inverter to export, this is different.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
#4207/#4538) springfall2008 pointed out on #4538 that gating on inverter_can_charge_during_export was wrong: that flag is specifically about PV exceeding the inverter/export limit during *active* Force Export (see its own docstring), not about whether Freeze Export can hold the battery flat at all - two genuinely different questions this PR had conflated. Add inverter_can_freeze_export as its own setting (apps.yaml only, defaults to true) and gate optimise_export()/optimise_solar()'s freeze offering on it instead. Reusing inverter_can_charge_during_export's default of true would have been wrong here too - most inverters genuinely can freeze, so "assume it works, let affected users opt out" is the right default for this flag as well, it just needed to be a different flag with a different meaning, not a shared one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@springfall2008 You're right, thanks for catching that - Pushed a fix using a new, dedicated |
|
@daviessm To answer directly: no, this shouldn't take away "feed-in first"/pre-emptive export for you. The gate now checks a new |
Summary
Fixes #4207. Supersedes #4425 (closed separately - see comment there).
Some inverters (e.g. FoxESS "Feed-in First") can't be commanded into a state where battery charging is disabled at all - they keep charging from any available surplus PV regardless of the mode Predbat has requested. That means Freeze Export (hold the battery flat, export the rest) can never actually be achieved on that hardware. Predbat's plan previously assumed freeze always holds SoC flat, so on this class of inverter it predicted "no charging" while the inverter actually kept charging from the surplus - a plan/reality mismatch.
#4425 tried to fix this by teaching the prediction model to simulate PV-charging during freeze too. That correctly modelled the physical behaviour, but as raised there: once applied, freeze (99%) and idle (100%) run through identical code for these inverters, so "Freeze Export" becomes a pure relabelling with zero distinguishing effect from doing nothing - the plan would keep showing a
FrzExpslot that isn't actually achieving a freeze.This PR takes the alternative raised in that discussion instead: rather than patch the prediction model to simulate a distinction that doesn't exist in reality, stop the optimiser offering/selecting freeze for these inverters in the first place.
Revision history on this PR, for anyone following the thread: this was originally gated on the existing
inverter_can_charge_during_exportflag, reusing it rather than adding something new. @springfall2008 correctly pointed out that's wrong - that flag is specifically about PV exceeding the inverter/export limit during active Force Export (see its own docs entry), not about whether Freeze Export can hold the battery flat at all. Two genuinely different questions. This is now gated on a new, dedicatedinverter_can_freeze_exportsetting instead (apps.yaml only, defaults totrue- most inverters genuinely can freeze, so "assume it works, let affected users opt out" is still the right default, it just needed to be its own flag).optimise_export():allow_freezeis forced off wheninverter_can_freeze_exportisfalse, alongside the existingset_export_freezecheck.optimise_solar()("Export more solar"): sets export limits to 99.0 (freeze) directly, bypassingoptimise_export()'s search entirely, so it needs the same gate independently or it reintroduces the bug through the back door.prediction.pyor kernel changes - this is purely a search-space restriction, not a modelling change, so no parity bump or binary rebuild needed.Consequence worth being upfront about: this is opt-out, not opt-in - Freeze Export keeps working for everyone by default, and only stops being offered for someone who's explicitly set
inverter_can_freeze_export: falsebecause their specific inverter genuinely can't achieve it.Test plan
test_optimise_solar.pyconfirming freeze is not offered wheninverter_can_freeze_export=False, and unaffected (still offered) otherwisetest_optimise_solar.pyscenarios pass their original intent unchanged./run_all --quickpasses./run_pre_commitpasses🤖 Generated with Claude Code