Skip to content

feat: value the state of charge the device is expected to leave with - #184

Open
andig wants to merge 4 commits into
mainfrom
feat/departure-risk
Open

andig wants to merge 4 commits into
mainfrom
feat/departure-risk

Conversation

@andig

@andig andig commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

closes #163

One optional field per battery lets the schedule weigh that a vehicle may leave before the horizon ends. Absent, the model is unchanged and every stored case solves as before.

  • r_departure: probability of leaving in each time step, the remainder stays. p_a then values the state of charge the device is expected to leave with, the departure weighted sum of s[t], instead of s[-1]. A charge that may be cut short is worth less than one already in. One objective term, no new variables or rows.
  • Once the probabilities add up to one the device has certainly left, and its charge and discharge bounds are zero from there on. Without that the cost neutral tie break could put free surplus into a vehicle that is gone: with p_E = 0 and charge_before_export it did.
  • The cost of charging planned after an uncertain departure is still counted in full, so the schedule leans early rather than being exact in expectation.
  • A p_demand past a certain departure is a conflicting request. The demand penalty wins and the schedule fills the vehicle before it leaves, at real cost. The caller should cut the demand where it cuts the presence.
  • The reported objective value follows the same accounting.
  • tools/bench_departure.py runs the stored cases against main, then with a 30 % departure chance spread over hours 6 to 12 on every battery without discharge. Plain: 5.20 s against 5.18 s total. Departure: 4.19 s, rows and columns unchanged, 020 and 028 solve faster with it. A certain departure at hour 12 over the 13 cases that reach it: 3.47 s before the bounds, 2.45 s with them, since the bounded steps leave the model in presolve. 023 drops from 0.69 to 0.04 s, 028 from 0.69 to 0.38 s.
  • evcc has to send the field for this to take effect, from the session history or a default such as a 24 h half-life. Forecast uncertainty is the separate feat: price the grid at the mean over the forecast band #185.

🤖 Generated with Claude Code

andig added 2 commits October 4, 2026 18:41
…loses #163)

p_departure per battery gives the probability the device leaves during each step. p_a then weighs
s[t] by it instead of valuing s[-1] alone, so a charge that may be cut short is worth less than one
already in. Optional, absent it reproduces the previous model.
Once the departure probabilities add up to one, the charge and discharge bounds of the later steps
are zero. Without it the cost neutral tie break could put free surplus into a vehicle that is gone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefer early charging if economics are similar

1 participant