Skip to content

feat: prefer fewer charging interruptions - #151

Open
andig wants to merge 7 commits into
mainfrom
feat/fewer-charging-interruptions
Open

andig wants to merge 7 commits into
mainfrom
feat/fewer-charging-interruptions

Conversation

@andig

@andig andig commented Sep 5, 2026

Copy link
Copy Markdown
Member

Refs #150

Prefer fewer charging interruptions when the achieved economics and existing strategy objectives can be preserved. This is a cost-neutral preference, not enforcement of evcc's Continuous setting or a guarantee of one session when interrupted charging is cheaper.

  • Add an automatic final tie-break for batteries with a positive minimum charge power.
  • Bound the achieved economic and preference objectives and each leveled grid peak instead of relying on a small objective coefficient.
  • Limit the additional solve to one second within the remaining request budget, retaining the previous schedule unless a valid improvement is found.

cc @ekkea

🤖 Generated with OpenCode

@andig
andig marked this pull request as ready for review September 5, 2026 13:34
The continuity stage validated its candidate with candidate.valid(1e-5), which
re-evaluates every model row from the values CBC wrote to its solution file. CBC
prints eight significant digits, so a 40 kWh SOC comes back rounded to 1e-3 and
the balance rows miss the tolerance by up to 8e-4. The candidate was discarded on
every request with a sizeable EV battery, silently, and the schedule kept its
interruptions. Measured on the request from #146: the candidate found one charge
start at identical cost and was thrown away because 79 rows were off.

CBC already held the model rows within its own tolerance. Check only what this
stage adds, the cost, preference and peak bounds, and the integrality of what
came back. A test with a 40 kWh battery pins it; the existing cases stay below
10 kWh, where eight digits are still enough.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Five solver runs share one clock and the constants that size them sit
across three modules. One table in the README names each stage, when it
runs, and the setting or constant that bounds it, next to the log fields
that report it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
andig added a commit that referenced this pull request Sep 10, 2026
The table already says when the pass runs and what bounds it. The one
sentence the section added, that this is a preference and not a
guarantee, moves into its row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
andig added a commit that referenced this pull request Sep 10, 2026
iseeberg79 added a commit to iseeberg79/optimizer that referenced this pull request Sep 11, 2026
…testing)

Squashed application of the upstream 'feat/fewer-charging-interruptions'
branch (as of e016fe7) on top of our dev, for local evaluation. Not our
own feature — revert this commit if it doesn't hold up or once the
upstream PR lands and we do a real merge instead.

Adds a fifth solve stage after the tie-break: for batteries with c_min > 0
and a fragmented schedule, minimize charge starts under strict bounds on
the achieved cost, preference objective, and each leveled grid peak, so
fewer interruptions never trade away money, existing preferences, or peak
shaping. Bounded to 1s of solver time within the remaining request budget.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HMJZPAoqmpKJEVnPNApipb
@iseeberg79

iseeberg79 commented Sep 14, 2026

Copy link
Copy Markdown

Like it. This reduces breaks and helps a lot. I even could imagine to have a small cost factor applied which would not be that wrong but is difficult to define. Happy with the current idea.

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.

2 participants