EV-18: no floor alarm at a quarter's start while the car explains the excess #264

Merged
ems-agent merged 4 commits from EV-18 into release/1.0 2026-11-19 15:13:34 +01:00
Collaborator

Fixes the floor alarm that fired at a quarter's start and stayed red for the quarter while the car explained the excess (EV-15 rig F-A).

There were two causes, both held by the latch _car_need_excl for the quarter:

  • "Without the car" assumed the batteries give 0 W, so the battery power still given below the reserve counted as house.
  • A single untrusted car cycle latched the alarm for the quarter.

Rule now (owner 2026-11-19):

  • Without the car, the batteries keep giving what they give now, re-checked every cycle.
  • A house need seen with a trusted car figure stays latched to the quarter's end.
  • An unknown value keeps the alarm only while it is unknown.
  • The guard's commands are unchanged.

Tests:

  • test_ev18.py: 69/69 green, 21 red on base 9fdce02.
  • ev10, ev10b and ev15: unchanged and green.
  • Mutants M1-M9: all killed.

Details: reports/EV-18-dev-report.md. Do not merge from the dev side.

🤖 Generated with Claude Code

Fixes the floor alarm that fired at a quarter's start and stayed red for the quarter while the car explained the excess (EV-15 rig F-A). There were two causes, both held by the latch `_car_need_excl` for the quarter: - "Without the car" assumed the batteries give 0 W, so the battery power still given below the reserve counted as house. - A single untrusted car cycle latched the alarm for the quarter. Rule now (owner 2026-11-19): - Without the car, the batteries keep giving what they give now, re-checked every cycle. - A house need seen with a trusted car figure stays latched to the quarter's end. - An unknown value keeps the alarm only while it is unknown. - The guard's commands are unchanged. Tests: - test_ev18.py: 69/69 green, 21 red on base 9fdce02. - ev10, ev10b and ev15: unchanged and green. - Mutants M1-M9: all killed. Details: reports/EV-18-dev-report.md. Do not merge from the dev side. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ems-agent added 1 commit 2026-11-19 10:36:30 +01:00
EV-18: no floor alarm at a quarter's start while the car explains the excess
checks / unit (pull_request) Successful in 23m6s
infra-pin / fresh (pull_request) Successful in 2s
12c97b56f4
EV-15 rig F-A: with both batteries at the peak reserve and the car charging,
PEAK_GUARD_FLOOR_LIMITED and goodwe_peak_soc_floor fired at a quarter's start
and stayed red for the quarter, the excess smaller than the car. Two causes,
both held by the per-quarter latch `_car_need_excl`:
- C2: "without the car" assumed the batteries give 0 W from now on, so what
  the loop still gives below the reserve counted as house (T2 red on base);
- C1: one cycle with no trusted car figure latched it for the quarter (T1).

Owner 2026-11-19 (Q1-Q3): without the car the batteries keep giving what they
give now (lower of two readings, every cycle); a house need seen with a
trusted car figure stays latched to the quarter's end (`_car_need_house`); an
unknown car figure keeps the alarm only while it is unknown. A car known to
draw nothing (fresh reading, not charging) still grades the house's own need.
After a restart or a gap only the rest of the quarter is graded without the
car. A 0 W figure explains nothing outside our own pause (EV-15). The guard's
claim, floor, setpoints and charger writes are unchanged (N4: 41 runs, same
command digests as base).

test_ev18.py: the test plan's T1-T18, T2b, T2c, N2-N5 (tools/ev18_peak.py:
the real Controller across one quarter edge, N=2 at the reserve).

Co-Authored-By: Claude <noreply@anthropic.com>
ems-agent added 1 commit 2026-11-19 11:28:08 +01:00
EV-18 review round 1: restart keeps the house's done part; contradicted figure untrusted to the quarter's end
checks / unit (pull_request) Successful in 29m3s
infra-pin / fresh (pull_request) Successful in 2s
5db56b5f28
- [Critical] After a restart or a gap only the rest of the quarter was graded
  without the car (`_carq["whole"]`), which dropped the house's own energy
  from before it and hid an honest alarm (review repro: house 18 kW then
  12 kW, restart at E+310). The rest-only grading is gone: the car is
  credited only with energy counted since the start, the rest of what is
  done counts as house (base's side). T17b covers it; T17 T2 at E+300 now
  alarms from the restart (the conservative side).
- [Major] Owner 2026-11-19: a figure the energy meter contradicted (fresh,
  charging, not corroborated) stays untrusted to the quarter's end, also as
  the EV-15 stand-in. T9(c): one alarm edge, red to the end; T9(c) is back
  in the N5 check.
- [Major] T2c lagging-meter variant (readings 389 W then 800 W, the meter at
  800 W): the house latch grades on the lower reading.
- Unit stub: a run that starts mid-quarter has the car counted since the
  quarter's start (no restart).

Co-Authored-By: Claude <noreply@anthropic.com>
ems-agent added 1 commit 2026-11-19 12:18:10 +01:00
EV-18 review round 2: the contradiction latch touches only the alarm; an unknown energy reading is not a contradiction
checks / unit (pull_request) Successful in 27m50s
infra-pin / fresh (pull_request) Successful in 2s
93c6628eca
- [Critical] The latch set `w = None` before `_car_quarter`, so with cover
  off the guard's input (`car_exclude`) counted the car as house and the
  batteries discharged. The latch now changes only the figure graded for the
  alarm; the car's energy count, the guard's input and the car-over row keep
  the unlatched `car_alarm_w()`. Cover-off N4 twins (energy gap, T9(c) liar,
  SoC 60 % and at the reserve) give the same commands as without the latch.
- [Major] `corroborated()` is False for an unknown energy reading, so one
  missing reading latched a correct figure for the quarter. New
  `CarTracker.contradicted()`: only a meter that answered over a whole window
  and fell short. R1 (energy entity unknown 1 s at E+200, T2 and T3 shapes):
  red for that cycle only, explained from the next.
- Minors: unit checks that a contradiction in our own pause latches nothing
  (MF) and that the latch ends with the quarter (MG).

Co-Authored-By: Claude <noreply@anthropic.com>
ems-agent added 1 commit 2026-11-19 13:02:05 +01:00
EV-18 review round 3: the DECISIONS line and a comment say what the contradiction latch does
checks / unit (pull_request) Successful in 23m10s
infra-pin / fresh (pull_request) Successful in 1s
ef8c5dcf62
Wording only. DECISIONS/EV-04: a contradiction is a meter that answered and
fell short (an unknown reading is none), and it grades no alarm while the
guard's input keeps the figure. ctl_car.car_cycle: the car-over row keeps the
figure only with the cover off.

Co-Authored-By: Claude <noreply@anthropic.com>
ems-agent merged commit 43b0db73d2 into release/1.0 2026-11-19 15:13:34 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/goodwe-addon#264