From 7710d45393563ac191d9dbd01a2a933a3e8184a4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Dec 2026 15:12:19 +0100 Subject: [PATCH] EV-22 review r2: Solar row where R1 is seen (clamp falls between close tries); note on the masked Solar row Test only, no implementation change. Green on e0e51da, red under R1 (seq own dropped). Co-Authored-By: Claude --- goodwe_controller/test_ev22.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/goodwe_controller/test_ev22.py b/goodwe_controller/test_ev22.py index a4909c3..2c49847 100644 --- a/goodwe_controller/test_ev22.py +++ b/goodwe_controller/test_ev22.py @@ -1150,6 +1150,9 @@ check(f"T43 (R1, Manual): the close refused until 120, a press at 113 clears " f"({rec.first('mm', lo=100)}, {rec.first('mhold', lambda v: v)})", rec.first("mm", lo=100) is None and rec.first("mhold", lambda v: v) is None) +# R1 is masked in this row: _adopt takes a read-back equal to sent_a as own +# before the watch (red under R1 only with that take off); the clamp row +# below sees R1 for Solar (EV-22 review round 2). ls = LateSim(setpoint_a=0) ls.t0, ls.t1 = TS + 10.5, TS + 14.0 # the close at 592 (sim 593) ignored rec = Rec() @@ -1161,6 +1164,37 @@ check(f"T44 (R1, Solar): the close refused from 592, a press at {TS + 12}, " f"{rec.first('hold', lambda v: v)})", rec.first("ms", lo=TS) is None and rec.first("hold", lambda v: v) is None) +# R1 for Solar where _adopt does not cover it (review round 2): the clamp +# falls between two close tries, so the retry sends 8 A (sent_a 8); after a +# press the charger shows the FIRST close (12 A) late. Only seq["own"] has it. +w = swriter(0.0, ph=3) +w.plan.a, w.plan.n = 12.0, 1 +drv = Drv(0.0, take=lambda a, d: False, ph=1) +w.seq = {"stage": "settle", "t0": 119.0, "t1": 122.0, "n": 1, "tries": 0, + "prev": None, "from": 3, "own": [0.0], "sel": True} +w.last_done = 122.0 +w._own_n = 3 +w._select_try(1, True) +trk, msr = Trk(), {} +for t in range(123, 143): + drv.now = float(t) + if t == 138: + w.user_changed() + if t == 140 and drv.calls: + drv.cur = drv.calls[0][1] + rd = Rd(drv.cur, drv.ph, power=0.0 if drv.cur == 0 else 1840.0) + LOOP.run_until_complete(w.step( + drv, rd, mode=CM.SOLAR, sun=CM.SunInputs(target_w=2000.0), + clamp=16.0 if t < 135 else 8.0, now=float(t), tracker=trk, + writing=True, status="charging")) + msr[t] = (w.mismatch_since, w.hold, w.seq is not None) +check(f"T44 (R1, Solar, clamp): close 12 A refused, the retry at the new " + f"clamp 8 A refused, a press at 138, the 12 A shown late at 140: own " + f"inside the change, the retry goes on ({drv.calls}, " + f"{[msr[t] for t in (140, 141, 142)]})", + [a for _, a in drv.calls[:2]] == [12.0, 8.0] + and all(msr[t][0] is None and not msr[t][1] for t in (140, 141)) + and msr[141][2] and (142.0, 8.0) in drv.calls) # Finding 4: `last_done` a fraction of a second after the step's `now`: the