Skip to content

feat(plan): show the actual planned charge/export rate in the hover text - #4608

Merged
springfall2008 merged 2 commits into
mainfrom
feat/plan-charge-export-rate-display
Aug 20, 2026
Merged

feat(plan): show the actual planned charge/export rate in the hover text#4608
springfall2008 merged 2 commits into
mainfrom
feat/plan-charge-export-rate-display

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

Closes #4596. Adds the planned charge/export rate (kW) to the plan's per-slot hover/click text, alongside the existing rate (p/kWh) info. gcoan agreed hover text over cluttering the state cell/snail symbol.

  • Export: reuses the existing fractional-limit encoding that already drives the snail symbol (limit's fractional part = tens-of-percent rate reduction) - battery_rate_max_export * (1 - (limit - int(limit))). No new computation, just surfacing a value the code already derives elsewhere (execute.py/prediction.py).
  • Charging: has no equivalent fixed encoding - low power charging (set_charge_low_power) throttles the rate dynamically per-minute rather than storing a reduced value per window. Added get_charge_rate_kw() in output.py, which recomputes the actual rate via find_charge_rate() (the same function the prediction engine itself uses) so the low-power case shows the real throttled rate rather than the nameplate max, which would otherwise be actively misleading during a slow-charge slot.

Test plan

  • ./run_all --test plan_why_reason - extended with two new scenarios: a fractional/slow export limit showing the reduced rate, and a low-power charge slot showing a throttled rate below the nameplate max (not just the simple full-rate case)
  • Existing Chrg/Exp reason-param assertions updated to include the new rate_kw param
  • ./run_all --quick passes
  • ./run_pre_commit passes

🤖 Generated with Claude Code

Adds {rate_kw} to the charge_low_rate and export_high_rate "why" reason
templates, so the plan tooltip shows what rate will actually be used,
not just the price. Requested in #4596, gcoan agreed hover text over
cluttering the state cell.

Export reuses the existing fractional-limit encoding (the same one
that drives the snail symbol) - battery_rate_max_export scaled by
1 - (limit - int(limit)).

Charging has no equivalent fixed encoding: low power charging
(set_charge_low_power) throttles the rate dynamically per-minute
rather than storing a reduced rate per window, so the non-low-power
case is a straight nameplate-rate lookup but the low-power case needs
recomputing via find_charge_rate() (added get_charge_rate_kw()) to
avoid showing a misleadingly-high number during a throttled slot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances Predbat’s HTML plan “why” (hover/click) text by including the planned charge/export power rate (kW) alongside the existing price-rate (p/kWh), improving visibility when slow/limited modes are active.

Changes:

  • Added rate_kw to the charge_low_rate and export_high_rate reason templates and per-slot reason params.
  • Introduced get_charge_rate_kw() to recompute the effective charge rate (including low-power throttling) via find_charge_rate().
  • Extended test_plan_why_reason to assert the new rate_kw param and to cover slow export + low-power charge scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/predbat/output.py Adds rate_kw into plan reason templates/params; introduces get_charge_rate_kw() and computes export rate_kw from fractional export limit encoding.
apps/predbat/tests/test_plan_why_reason.py Updates assertions to include rate_kw and adds scenarios for throttled charge and fractional-limit export.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/predbat/output.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@springfall2008
springfall2008 merged commit aa6d331 into main Aug 20, 2026
2 checks passed
@springfall2008
springfall2008 deleted the feat/plan-charge-export-rate-display branch August 20, 2026 16:36
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.

Show planned charge/discharge rate in plan when slow mode used

3 participants