Skip to content

fix: work the sustainable current from whichever ambient leaves less headroom - #33

Closed
zebraengine wants to merge 1 commit into
mainfrom
fix/sustainable-ambient-less-headroom
Closed

zebraengine wants to merge 1 commit into
mainfrom
fix/sustainable-ambient-less-headroom

Conversation

@zebraengine

Copy link
Copy Markdown
Owner

Problem

Two failures of the ambient behind sustainable_max_a, same evening, opposite directions:

  1. End of the 32 A probe (18:38): the trajectory-implied ambient named 47 A; the sensor's 30.25 °C named 44 A, which is what held. The current law extrapolated to 32 A over-reads the rise by ~2 °C, and the error comes back doubled when rescaled to 47 A. feat: fit how rise scales with current, and restore straight to the sustainable rate #31 fixed this by preferring the sensor.
  2. Restart at 20:38, 1.7 h after a 55-min charge: the sensor read 25.6 °C but the handle's trajectory implied 28.7 °C — the cable and wall were still heat-soaked. The sensor route named 48 A; the implied route (and suggested_max_a) named 46 A, which is right.

So "sensor first" is optimistic on a warm restart and "implied first" is optimistic after a low-current probe.

Code touched

  • wallmonitor/thermal.py predict(): sustainable_max_a is worked from whichever of the two ambients is warmer — i.e. leaves the handle less headroom. sustainable_ambient_source says which won ("measured" / "implied"). On model basis the implied ambient is the model's ambient, so nothing changes there. suggested_max_a untouched (implied, as before).
  • Docstring in sustainable_max_current, the amp-control module docstring, and docs/amp-control.md updated to describe the rule and both incidents.
  • tests/test_wallmonitor.py: sensor cooler than the trajectory implies → implied wins (42 A); sensor warmer → sensor wins (< 42 A). Existing trajectory test asserts sustainable_ambient_source == "implied" with no sensor.

Risk

Verification

  • uv run pytest: 153 passed (one new).
  • Both incidents replayed by hand against the rule: probe end → max(30.25, 27.3) = 30.25 → 44 A; warm restart → max(25.6, 28.7) = 28.7 → 46 A.

Deploy: pull + sudo systemctl restart wallmonitor.service. Server-only.

🤖 Generated with Claude Code

…headroom

Two failures of the sustainable-current ambient in one evening, in opposite
directions. At the end of the 32 A probe the trajectory-implied ambient
named 47 A where the sensor's 30.3 C named 44, which held: the current law
extrapolated to 32 A over-reads the rise, and the error comes back doubled
at 47. Preferring the sensor fixed that and was shipped in #31. Then the car
restarted 1.7 h after a 55 min charge: the sensor read 25.6 C, the handle
behaved like 28.7 C - the cable and wall were still warm - and the sensor
route named 48 A against a correct 46.

Neither source deserves to be first. The sensor reads the air, not the
hardware's thermal state; the trajectory reads the hardware, through a
model that is weakest far from the fits. So the sustainable current is
worked from whichever of the two leaves the handle less headroom. Both
incidents come out right: 44 A after the probe, 46 A on the warm restart.
On model basis the two coincide and nothing changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@zebraengine

Copy link
Copy Markdown
Owner Author

Superseded: the backtest in #34 shows every ambient-selection rule sits under a 3–5 °C model error that grows with ambient. The model gets an ambient term instead; the restore ambient gets re-evaluated with numbers after that.

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.

1 participant