The writer step took the meter age from the snapshot of the previous cycle
(silent / unknown_s / hold), so in production order the silent-meter pause
came one cycle late (C21) and a start or raise could still be written at an own
age of 31-39 s (C22, N8). The step now judges its own age: the pause timing and
held_pause, the non-zero write block (nz_block), and the late-readings hold with
its stale rule. Meter values stay from the snapshot; car.held / car.reading and
the arrival sources' spare-unknown check are unchanged.
Also: one DEBUG line per Solar writer step (time, meter age, decision, write);
tools/ev20_sun.drive takes cyc / phase / jitter / cset (default unchanged);
test_ev51.py (T1-T43, N1-N12); DECISIONS states the rule once.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
On a held charger read no writer steps and the Solar plan does nothing: no
phase change or switching start begins, no _set or end_switch, ok_since,
up_since, down_since, low_since and set_at stay, and the hold pause does not
fire; a decision due then runs on the next real reading. The one exception
is the pause by the meter's age (C18, SolarWriter.held_pause). Rows: the
reviewer's three shapes with 1- and 2-read gaps on and before the decision
cycle, and the hold pause on a held cycle. DECISIONS wording fixed.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
The C17 branch (end a phase change at its 0 A and pause) ran on a held read
too, so one failed read just after a select stopped the car for the 600 s
phase gap. A held read now leaves the change alone; it goes on at the next
real reading. The silent meter still ends it at its 0 A. Rows: test_ev20_rig
section 9.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
A retry on a held cycle went to a charger that was not answering and changed
the try count (test_ev20_fuzz T54 N14, seed 1). Held cycles now allow only a
new 0 A decision, such as the age pause.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
While the meter's age is past meter_max_age_s, or on a held charger read,
Solar sends no non-zero current: no retry, no raise, no phase change begun,
and a phase change under way ends at its 0 A. 0 A is always allowed. On a
held read Solar still steps (Manual does not), so a pause due then is not
slipped. Rows in test_ev20_rig.py section 8.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
A failed read or every required entity unavailable is a gap and keeps the
last reading; one entity missing, a wrong power unit or login off stay the
reading they are (EV-03 round 4 rows green again).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
A charger reading missing for less than stale_input_s keeps the last trusted
reading in CarTracker (shared by Solar, Manual and the peak guard): no
decision or write in that cycle, no stuck arm or clear. At stale_input_s the
safe path is unchanged. This also stops the false PEAK_GUARD_FLOOR_LIMITED
after one gap (EV-18 T10(b) updated). On ha_signed Solar's unknown-sun pause
comes at meter age meter_max_age_s + ev_pause_min, checked every cycle.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
Under one stuck verdict Solar still makes at most MAX_TRIES starts and gives
one CHARGER_REFUSED; then one more start after 15 min and one every 30 min
(each by the start rule and the write clock), so a fault that clears is
found again. The episode ends when the reading follows a start, on a press
of Solar, Off, Manual, shadow or a stop. Rows: cap, backoff times,
recovery, press, episode end; T28 (b) no flapping. DOCS and DECISIONS.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
The exemption now applies whenever Solar is not live (also just after Solar
is chosen under a verdict Manual's refusals left), so Solar writes its 0 A
over the other current first and then the start rule runs. EV-13
T14 [8 A], T17 and T18 now assert that the energy meter does not flag the
frozen figure (PM accepted the trade-off); T14 [6 A] that it flags at +57 s.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
SPIKE-06 option 2 (PM decision). The stuck check's baseline is the reading
before the send, for accepted and refused writes; it clears on any change
from it (3a17012's power rules removed), so the race cannot arm it (C10,
C11, C13). Frozen power under an accepted write is left to the energy meter
and the read-back cap (EV-13 T14/T17/T18 changed). Once Solar's own 0 A
stands, a stuck verdict no longer blocks the start rule (C12), at most
MAX_TRIES starts per verdict, then CHARGER_REFUSED until Solar is pressed.
Rows in test_ev20_rig.py section 6.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
An accepted write keeps the car's power from the reading before the send
(begin_write); a later reading whose power differs from it, or that shows a
paused car (not charging, under PAUSED_W), clears the armed check. A refused
write's first sample after the send is not life by itself (EV-36). EV-13 T7/T8
and the refusal-window row get two-change variants so mutant M3 stays killed.
DECISIONS records the arming rule.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
The stuck check's baseline is the signature of the latest reading taken
before the send (kept at begin_write), never one that arrived while the write
waited; a refused write's first post-send sample is its baseline (EV-36).
After a step down, a step back up needs UP_HYST_W past the boundary. Solar's
15 s meter-age gate applies only where the age measures arrival; on
ha_signed it is the source's meter_max_age_s. Rows in test_ev20_rig.py;
harness modes for the rig's interleave and an on-change meter.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ManualWriter._write, the one write_current call, stamps every non-zero
current either writer sends; Solar's 30 s gate reads that stamp (its own and
Manual's), so the step back up after a phase change's closing write waits 30
s on every path. The closing current is fixed once per sequence, retries too.
Rows: every select shape (refused, ignored, late; settle refused three times;
T7 1 -> 3 and T22 3 -> 1) with nevers().
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
After its own phase select (taken, or with a late read-back), Solar ends the
sequence with the lower of the currents for the new phases and the phases the
charger reports, and keeps the plan on them; the old phases' current comes
back only when no select went out (EV-28's cap). Rows: T19/T33 settle write
refused or ignored once and select confirmed late; an exit after a given-up
write; shutdown in Off with the 0 A owed; Stop with a refused 0 A and another
writer. NoCharger.write_current takes took_s; ev_mode_start text names C1;
NL solar_hold wording.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
C1: an own 0 A not yet read back is kept with the mode; a start in Off with
it writes the 0 A (retried), without it nothing; a start that will not write
warns once when the charger still has the add-on's current. C6: Solar's 30 s
gate also counts from Manual's latest write. C9: an exit also owes its 0 A
when the read-back shows Solar's own value. Rows for C5 and C8 too.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
T4: battery A's power missing, NaN or unavailable, for one cycle (no
write) and for 400 s (no spare, the current held, 0 A at 300 s).
T21 (a): car_cycle on the same projection, guard and reading gives the
same car figure, explains and over in Solar and Manual.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
Solar as a second writer next to Manual (carmode.SolarPlan, SolarWriter on
ManualWriter's one write site, safe phase sequence and other-writer watch):
signed spare, Batteries first on the batteries' ratings, the margin, whole
amps rounded down, the 30 s / 1 A rule, start and pause dwells, auto phases,
a one-phase car. Every way out ends at 0 A, retried by EV-04's rule; at
shutdown before the inverters, three tries inside 15 s (D3); start-up and a
returning charger or HA write 0 A first (D2); never over another writer's
hold. The peak guard treats a Solar car as a Manual car (D1 wording). Solar
kWh sensor and card line; select.goodwe_car_sun_first; ev_margin_w,
ev_start_min, ev_pause_min with config, validator, translations, DOCS,
DECISIONS and CHANGELOG.
Checks: test_ev20.py, test_ev20_exits.py, test_ev20_writers.py,
test_ev20_guard.py, test_ev20_long.py, test_ev20_long_car.py,
test_ev20_fuzz.py (harness tools/ev20_sun.py, ev20_kit.py, ev20_day.py);
test_ev03/test_ev04 no longer use Solar as the refused example.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
Display only: shadow mode over-limit Why speaks in would-terms; read phases that
differ from the setting say the charger stays; a writer hold says something
else set the charger. EN and NL texts, test_ev14.py.
Co-Authored-By: Claude <noreply@anthropic.com>
A phase that drops out or comes back shifted the compressed current_a tuple and
read as life, so a frozen charger never armed. ChargerReading.phase_a keeps
L1/L2/L3 with None for a missing phase and the life test uses it.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
A refused write on a live charger no longer reads as a stuck reading 60 s
later, so a refused write shows one amber row (charger_refused). A frozen
charger still arms and is still caught.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
Review fixes, no logic change:
- T17a now asserts the restore is the first write once the charger is back
(it was only checked to happen at some point); mutant M3 (restore after
SETTLE_S) now turns T17a red.
- T15 now asserts the refused restore is counted once (`fails == 1`);
a mutant without `_failed` there now turns T15 red.
- DECISIONS "The phase sequence" and the carmode docstring reflowed to 79
columns; DECISIONS says D counts as drawing too, as the code does.
Co-Authored-By: Claude <noreply@anthropic.com>
Stage zero counted mode3 B as quiet whatever the power and selected at the
20 s timeout under load. A power reading now decides (under 100 W); mode3
(not C, not D) only without one. Still drawing at 20 s: no select, the
current comes back at once, one failed try, next try PHASE_GAP_S later.
Co-Authored-By: Claude <noreply@anthropic.com>
The fallback (no record yet, or a record of an ended episode) had no check;
reading floor_limited alone there survived test_ev16. Test only.
Co-Authored-By: Claude <noreply@anthropic.com>
car_cycle ends with _car_why_tick (display only: control writes, never reads);
the Why reads the record. Adds read-gap tests (A, B, cover off/on), a long
guard-None test and a lower bound for the hold.
Co-Authored-By: Claude <noreply@anthropic.com>
Control bumps _car_over_ep at each start and end of car_over; the display
ignores a hold of another episode, so a read overlapping the end cannot bring
a stale text back.
Co-Authored-By: Claude <noreply@anthropic.com>
Display only: the 'are at' / 'give all they can' text changes only when the
other state has stood for 180 s (the car_over off hold); SoC unread is never
'are at'. Cleared when car_over drops, on unplug and with cover off.
Co-Authored-By: Claude <noreply@anthropic.com>
Test-only. Two unit checks in test_ev19.py: an honest step with a burst
that moves the meter's house side +/-60 W alarms in base's cycle, and
inside the band (0 W) the car explains at most the step's own cycle;
a car step offset by a burst at the meter is not discounted. They kill
RISE_STILL_W = 500 W and a stillness test without the car term.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w