App 2.19.7: meter AC charging too, while the app runs
A session runs whenever power flows into the pack, AC or DC; gaps the head unit slept through are dropped as before. Dashboard and server texts no longer say DC only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -73,14 +73,30 @@ public class ChargingStateTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyDcSpeedChargingIsMetered() {
|
||||
// The session meter runs on DC alone: 7 kW is a home charge the head unit sleeps
|
||||
// through, so its curve and duration would be fiction.
|
||||
public void dcIsTenKilowattsOrMore() {
|
||||
// The label and ABRP's is_dcfc: 7 kW is AC, 10 kW and up can only be DC.
|
||||
assertFalse(ChargingState.isDcCharging(1, Boolean.TRUE, -7f, 0f));
|
||||
assertTrue(ChargingState.isDcCharging(10, Boolean.TRUE, -50f, 0f));
|
||||
assertTrue(ChargingState.isDcCharging(null, null, -10f, 0f));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void acAndDcAreBothMetered() {
|
||||
assertTrue(ChargingState.isMeteredCharging(1, Boolean.TRUE, -7f, 0f));
|
||||
assertTrue(ChargingState.isMeteredCharging(null, null, -2.3f, 0f)); // granny lead
|
||||
assertTrue(ChargingState.isMeteredCharging(10, Boolean.TRUE, -50f, 0f));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void meteringNeedsPowerFlowingIn() {
|
||||
// A status code still saying "charging" at the end, with nothing flowing, is no session.
|
||||
assertFalse(ChargingState.isMeteredCharging(1, Boolean.TRUE, 0f, 0f));
|
||||
assertFalse(ChargingState.isMeteredCharging(1, Boolean.TRUE, -0.2f, 0f));
|
||||
assertFalse(ChargingState.isMeteredCharging(1, Boolean.TRUE, null, 0f));
|
||||
// Regeneration while driving is not a charge.
|
||||
assertFalse(ChargingState.isMeteredCharging(null, null, -15f, 50f));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dcMeteringNeedsARealPowerReading() {
|
||||
// Unlike isCharging, which stays permissive so the consumption counters do not
|
||||
|
||||
Reference in New Issue
Block a user