Repository navigation
fix(output): cap the plan tooltip charge rate at the inverter limit - #5643
Conversation
…5394) get_charge_rate_kw() re-ran find_charge_rate() but not the inverter-limit clamp the prediction applies afterwards, so a battery rated above its inverter showed battery_rate_max_charge in the Chrg hover text instead of the rate actually planned. 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 813af58: 1 finding inline, none in the body. The fix itself is correct.
I re-derived the clamp algebra against prediction.py rather than trusting the description: when the generic "Clamp at inverter limit" block (prediction.py:1264-1296) binds during a charge it leaves the DC-side battery power at exactly pv_dc + inverter_limit × inverter_loss — the over_limit × inverter_loss correction cancels the loss divider from get_total_inverted() — in both the hybrid and AC-coupled branches, and with pv_dc = min(rate, pv_now) its binding condition (rate > pv_dc + limit × loss) is the same condition the tooltip's new min() tests. So min(rate, limit × loss + pv) mirrors the prediction exactly on every path this PR models, PV included; the reporter's numbers (11 kW × 0.96 = 10.56 kW, matching their measured battery_power_best) come out exact. Units line up too: pv_forecast_minute_step holds kWh per 5-minute step in Predbat's per-minute units, so dividing by PREDICT_STEP matches find_charge_rate()'s units, and the existing Test 1 assertion is untouched because the fixture's 1 kW inverter limit equals its 1 kW battery rate.
The two scope gaps the PR body already discloses — hybrid battery_rate_max_charge_dc > battery_rate_max_charge with PV lifting the combined rate (tooltip then under-reports) and the export tooltip's equivalent clamp gap — are real but correctly deferred; the reporter's comment on #5394 about export is the pointer for that follow-up.
|
Automated reply from the triage bot (PR cleanup run). Nothing pushed: the local quality gate failed in a test this PR doesn't touch. What was addressed (locally, not pushed)
Why it was not pushed
Every other hook and test passed. This PR changes only The cleanup rules don't allow pushing past a failing gate. The CI |
|
Automated cleanup failed to complete for this PR. Reason: The run exited cleanly but left 1 file(s) with uncommitted changes, so its fixes were never pushed. They are stashed in the bot's clone before the next flow runs. Failed at: |
…ge-rate-inverter-limit-5394
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge-rate-inverter-limit-5394
|
This seems wrong, the description is about tool tips but it changes a live prediction of rates? |
|
Posted by Claude on behalf of @chalfontchubby. @springfall2008 it only changes the plan table's explanation text, not the prediction. The function recomputes the rate the way the prediction works it out, for display, and the new lines copy the inverter-limit clamp |
This is an automated draft PR generated from issue #5394 — a maintainer should review it before merging.
Fixes #5394
Summary
Output.get_charge_rate_kw()re-ranfind_charge_rate()for theChrghover text, but it did not apply the inverter-limit clamp that the prediction applies afterwards (prediction.py, "Clamp at inverter limit" for hybrids and the non-hybridtotal_invertedclamp). So when a battery is rated above its inverter, the tooltip showedbattery_rate_max_chargerather than the rate the plan actually uses. The reporter's case: 14.40 kW shown, 10.56 kW planned.The rate is now capped at
inverter_limit × inverter_loss, which is where both prediction clamps leave the grid side of a charge. On a hybrid inverter the slot's DC-coupled PV is added on top, because the hybrid clamp only measuresbattery_draw + pv_dc. For the reporter's zero-PV overnight window (11.0 kW limit, 0.96 inverter loss) this gives 10.56 kW, which is their measuredbattery_power_best.Testing
tools/triage_test.sh plan_why_reason: fails without the fix, passes with it. Withoutput.pystashed, all three new cases fail withgot 2.00. With the fix restored, the module passes.test_plan_why_reason.pyuses a 2 kW battery behind a 1 kW inverter with 0.96 inverter loss. It covers three cases:./run_pre_commit(fromcoverage/): all hooks passed, including the quick suite it runs.Notes
find_charge_rate().prediction.py(wherepv_dc = min(charge, pv)and the clamp acts on|draw + pv_dc| / inverter_loss), not from comparing with a prediction run. The zero-PV case matches the reporter's own numbers from their debug dump, as the triage comment verified.battery_rate_max_charge_dcpath. Whenbattery_rate_max_charge_dc > battery_rate_max_chargeon a hybrid, the prediction lets surplus PV raise the requested rate. The tooltip never modelled this, before or after this change, so it can under-report in that one case. I left it alone to keep this fix to the clamp.export_limit, so this PR does not change it.get_charge_rate_kw()to return a tuple, so whichever merges second will need a small rebase. The two changes do not conflict in what they mean: Show the snail icon on low power charge slots in the plan #5353's snail checks the requested rate, and this PR caps only the rate that is displayed.impact): LOW. There is one caller,publish_html_plan, so only the hover text changes. Plan, prediction and execution are untouched.🤖 Generated with Claude Code