App 2.5.0: range estimates from current and 5-minute average power

The Vehicle tab gets two tiles next to the car's own range:

- Range at current power: remaining energy / (power / speed) right now.
- Range at 5-min average: remaining energy / (energy used / distance
  driven) over the last 5 minutes, integrated time-weighted from both
  the service tick (15 s) and the open screen (2 s), so it is ready as
  soon as the app opens.

Each shows the consumption it is based on (kWh/100 km). Remaining
energy is SOC x usable capacity, because the car publishes no pack
energy; the capacity is a new setting in the Consumption tab (default
50.8 kWh, the 51 kWh battery). Estimates read "—" with the reason when
they cannot mean anything: standing still, regenerating, too little
driving, or across a gap in the samples; over 999 km shows "> 999 km".

RangeEstimator is Android-free and has 7 tests. Also fixes the battery
card's note, which still said the SoH goes to MongoDB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
2026-10-17 22:33:10 +02:00
co-authored by Claude Opus 5.5
parent 5f6cf1e901
commit a53ea589b2
9 changed files with 296 additions and 4 deletions
+11
View File
@@ -31,6 +31,17 @@
<string name="vehicle_row_soc">Charge (SOC)</string>
<string name="vehicle_row_range">Range</string>
<string name="vehicle_row_power">Power</string>
<string name="vehicle_row_range_power">Range at current power</string>
<string name="vehicle_row_range_average">Range at 5-min average</string>
<string name="range_consumption">%1$.1f kWh/100 km</string>
<string name="range_over">&gt; %1$d km</string>
<string name="range_waiting">needs a few minutes of driving</string>
<string name="range_not_driving">only while driving</string>
<string name="hint_usable_capacity">Usable battery capacity</string>
<string name="btn_save_capacity">Save capacity</string>
<string name="helper_usable_capacity">Used for the range estimates on the Vehicle tab. The 51 kWh MG4 battery has 50.8 kWh usable, the 64 kWh one 61.7, the 77 kWh one 74.4.</string>
<string name="usable_capacity_saved">Usable capacity saved</string>
<string name="usable_capacity_invalid">Enter a value between 10 and 150 kWh</string>
<string name="vehicle_row_speed">Speed</string>
<string name="vehicle_row_odometer">Odometer</string>
<string name="vehicle_row_batt_temp">Battery Temperature</string>