Repository navigation
fix(plan): show the held part of a charge window as HoldChrg, not Chrg (#5990) - #6006
chalfontchubby wants to merge 8 commits into
Conversation
…5990) A charge window that charged up to its target and then held there was drawn as one merged Chrg cell, because the label was taken from the lowest SoC over the whole window. The span now ends where the predicted SoC reaches the target, so the rest starts its own HoldChrg span. The SoC scan behind the label also stops at the span drawn rather than the window's end, so an export that cuts the window no longer turns a held span into Chrg. Display only: what is planned and executed is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) The SoC scan behind an export span's label ran to the window's end measured from the aligned slot, overshooting by however far into the slot "now" is. A charge straight after an export that never reaches its target then lifted the scanned maximum and showed Exp instead of HoldExp. Scan to the window's end measured from now, as the charge span now does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d stop label scans at the plan's end (#5990) Review follow-ups. A window that touched its target and then dipped below it was split into two adjacent Chrg cells; the split now comes at the earliest boundary from which SoC stays at the target to the end of the span, the same test the HoldChrg label applies. The label scans for charge and export spans also stop where the table stops drawing, so a span cut by the end of the plan is not labelled from SoC past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Second review pass. The split now also covers a window that starts at its target, dips below it and recovers: it is held from the recovery, where before it stayed Chrg throughout. Both the split and the span labels are judged on the whole rows the span draws, so a window ending part way through a row, or past the end of the plan, is not labelled from the part drawn on its own. The split is skipped where an export shares the row, as no span is drawn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…een the split and the label (#5990) The span split and the HoldChrg label each resolved a charge window's target and applied the held-at-target test on their own. Both now go through charge_window_target_percent() and charge_window_held(), and get_charge_export_text() uses the same target lookup, so they cannot drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
springfall2008
left a comment
There was a problem hiding this comment.
Automated comment from the triage bot.
Reviewed at 7ef344e. Display-only change in publish_html_plan: a charge span now ends at the last boundary from which SoC stays at the target, and both charge and export labels are judged on the span drawn instead of the whole window. I traced the split loop and the label scans against the span-drawing invariants (rowspan bookkeeping across the split, the export cut, mid-slot rows, the periods_left/plan-end cap, freeze windows, and the rowspan/skip handling on both the server HTML and the client renderer in web_helper.py), and re-derived each of the ten new test cases against both this code and main's window end - minute_now_align scan - they are consistent with the code, and the ones I could check by hand do fail on main via the mid-slot overshoot. The committed debug-case goldens compare plan windows only (test_single_debug.py), so they are not affected. 2 low findings inline, 1 note in the body.
Does this fully fix #5990? The PR fixes the plan-table labelling half. The 5 Nov triage comment on #5990 (comment 6668165463) attributed the all-day charge windows to auto-mode widening at fetch.py (rate_export_max > rate_max makes rate_import_cost_threshold = rate_max + 0.1, so every slot is a charge candidate - still present on this branch, confirmed at fetch.py:3561-3565). With this PR the same plan now reads Chrg then HoldChrg instead of one mislabelled block; if the reporter's complaint was the windows themselves (they expected Demand in the peak period), that part remains open and #5990 should not be closed on the label fix alone - worth checking against the reporter's rate_low_threshold setting when it merges.
…hold spans Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Posted by Claude on Rik's behalf.
Fixes #5990.
What users see
A charge window that charges up to its target and then holds there was drawn as one
Chrg ↗ 100cell for the whole window. In #5990 that was 05:30 to 16:00, with the battery sitting at 100% the whole time. The plan now showsChrgfor the part that charges andHoldChrg →for the part that holds.This is display only. What Predbat plans and what it sends to the inverter are unchanged; execution already reports "Hold charging" once SoC reaches the target.
Why it happened
The plan table merges a window into one rowspan cell and labels it once, from the lowest predicted SoC across the span. Two things went wrong:
Chrg.window end - minute_now_align, which goes past an export that cuts the span. Mid-slot, it also goes up to 25 minutes past the window. This is what the reporter's own plan hit: SoC was 100% for every row from 05:30 to 16:00, but an export at 16:30 pulled the scanned minimum down. Export spans had the same overshoot, which could showExpwhereHoldExpwas right.The change (
Output.publish_html_plan)HoldChrglabel applies, now shared throughcharge_window_held()andcharge_window_target_percent().Evidence
predbat_debug.yamlagainst this branch, the 22-rowChrgspan becomes a 22-rowHoldChrgspan. The recomputed plan splits intoChrgthenHoldChrgspans.test_plan_why_reasonadds 11 cases. 8 fail on main: charge-then-hold, held until an export, mid-slot charge, mid-slot export, a dip after reaching target, start-dip-recover, a window ending mid-row, and a span cut by the end of the plan. The other 3 (held throughout, never reaching target, and a freeze window whose SoC rises above the reserve staying oneFrzChrgspan) guard existing behaviour; the freeze case fails if the freeze exclusion incharge_window_held()is removed.Not changed
Expspan. There is no label for "exported to target, now idle", becauseHoldExpmeans the target can't be reached. That needs a decision on a label, so it is left for a follow-up.Side effect
Chrgspan's rate tooltip now covers only the rows that charge when a window is split, because the split also movescharge_end_minuteto the split point. TheHoldChrgreason text has no rate in it, so the held part's rates are only in the rate column. You only see this when the rate changes inside the window, for example at an Agile slot boundary.🤖 Generated with Claude Code