From bc5be4964e9ecc078439a164c9e74c1ccb321245 Mon Sep 17 00:00:00 2001 From: glenn schrooyen Date: Fri, 13 Nov 2026 00:20:21 +0100 Subject: [PATCH] MAINT-28: N=1 digest test with a banked peak (so the N=1 gate is tested) Co-Authored-By: Claude --- .../DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md | 2 +- goodwe_controller/test_maint28.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/goodwe_controller/DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md b/goodwe_controller/DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md index fba51c6..d10406c 100644 --- a/goodwe_controller/DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md +++ b/goodwe_controller/DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md @@ -30,7 +30,7 @@ House 3000 -> 6500 W for 45 min -> 3000 W, +-50 W every 5 s, banked month peak 6 Rig (MAINT-24 test report, F-1): 468 reversals in 45 min on 1b5f7c9, 11 on 02eac3b. Live shape (house 3000 W): no pause, A 1475 W, as MAINT-24. ## Tests and mutants -`test_maint28.py`: part 1 the real peak, 1b the stale hold, 2 `shaping_held()` edges, 3 the unchanged cases (digests equal 1b5f7c9). On 1b5f7c9 itself (hold stubbed out) part 1 and 1b fail. Mutants, each red: M1 hold state not kept (`shaping_held(False, ...)`: the 1b5f7c9 behaviour); M2 resume line `-` to `+`; M3 house not passed; M4 the per-cycle reset removed; M5 the N=1 gate removed (digest `n1_peak`); M6 the aim gate removed (digest `n2_nobank`). +`test_maint28.py`: part 1 the real peak, 1b the stale hold, 2 `shaping_held()` edges, 3 the unchanged cases (digests equal 1b5f7c9). On 1b5f7c9 itself (hold stubbed out) part 1 and 1b fail. Mutants, each red: M1 hold state not kept (`held` always False: the 1b5f7c9 behaviour); M2 resume line `-` to `+`; M3 house not passed; M4 the per-cycle reset removed; M5 the N=1 gate removed (digest `n1_peak`: N=1, banked peak, house 6500 W); M6 the aim gate removed (digest `n2_nobank`). ## Not changed MAINT-24's rate and its tests, N=1, the drain, modes off (digests of 02eac3b). The pause for a late or missing forecast. diff --git a/goodwe_controller/test_maint28.py b/goodwe_controller/test_maint28.py index f4a8c4f..4ed5072 100644 --- a/goodwe_controller/test_maint28.py +++ b/goodwe_controller/test_maint28.py @@ -253,10 +253,10 @@ d1 = sc.digest(scen(a=CH, n=1, fc=None, peak=None)[0]) dd = sc.digest(scen(a=DRAIN_R, soc=(60.0, 30.0), peak=None, fc=None)[0]) dm = sc.digest(scen(a=CH, variant="modes_off", peak=None, fc=None)[0]) d2n = sc.digest(scen(a=CH, house_w=5000.0, peak=None, fc="grid")[0]) -d1p = sc.digest(scen(a=CH, n=1, fc=None, peak=None, house_w=5000.0)[0]) +d1p = sc.digest(scen(a=CH, n=1, fc=None, house_w=6500.0)[0]) AT_BASE = { "n2_nobank": "c164c9d4f221f7d685a0aa904a7878d4b287cf295d2e22281132140ba4a047db", - "n1_peak": "8d266f39eb880f80fad8d236b2fb5100934cb92efd8ed2082e85eb3b71cd6c45", + "n1_peak": "ba8eddb78265ecc0db1d3bc0e06f48478e69047f7eb124dc523ae19ef930b631", "n1": "44816d132984ecd64d5a2510223debe102f29decd1d5127ae2b255b45dbf8bd4", "drain": "8fd86d0816626ee5ae86bc973cb0121b1b5108e56c3b0fdd4b4be6c1f403f748", "off": "a007f962793611bce15b11f576a76aa52063adcfde82b2a2dc0b0c075b60e60b", @@ -267,7 +267,7 @@ for k in AT_BASE: f"{got[k][:16]}") check("N=1 with A in maintenance charge and no forecast entity: equal to " "release/1.0 1b5f7c9", got["n1"] == AT_BASE["n1"]) -check("N=1 in a real peak (house 5000 W, a guard that steps in): equal " +check("N=1 in a real peak above a banked month peak (house 6500 W, the guard steps in): equal " "to 1b5f7c9, the hold is for N=2 and up", got["n1_peak"] == AT_BASE["n1_peak"]) check("N=2 in a real peak with no banked peak (house 5000 W over the aim " "3450 W): equal to 1b5f7c9, the hold is for a month aim above the cap",