feat: anchor charge continuity on the running session - #157
Merged
Merged
Conversation
The continuity stage assumed every device enters the horizon switched off, so keeping a running session on scored the same as stopping it and restarting one slot later. A device reporting c_initial above zero now enters the horizon on: continuing costs no start, interrupting costs one, and a plan that only moves the start earlier is worth polishing.
Only the on/off state decides a charge start, so c_active says that directly instead of making the model derive it from a power value it never uses.
1 task
andig
added a commit
that referenced
this pull request
Sep 17, 2026
# Conflicts: # src/optimizer/optimizer.py
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.
stacked on #151, pairs with evcc-io/evcc#33802
The continuity stage counts charge starts inside a plan, but it assumes every device enters the horizon switched off. A car that is charging right now therefore scores one start whether the plan keeps it running or stops it and restarts one slot later, so the interruption stays a free choice. Snapshots from a real session show that tie being resolved both ways between consecutive solves, with the charger commanded off and on again inside the same flat price window.
c_activereports whether a device is charging at the start of the horizon. It then enters the horizon switched on, so continuing costs no start and interrupting costs one.🤖 Generated with Claude Code