EV-21: Solar cuts the car first for the quarter peak
In Solar, when the 15-minute period heads over the aim and the batteries would have to give more, the car is lowered first: floor((car - excess) / (230 x phases)) A, 0 under 6 A. At once without real headroom (saturated, floor-limited, excess beyond what the batteries can add, no battery figure, cover off, last 120 s), else after at most 15 s. One cut per episode from its start, deeper only on a growing excess; restart with the start power under the aim for the start time; none after a 2nd cut in the period. Grading (formal C2): a Solar car Solar cannot cut is graded, banked and left in the guard as in Off. A Solar car is never banked. Grey note and Why "Solar lowered the car for the peak." Manual and Off unchanged. Tests: test_ev21.py, test_ev21_paths.py, test_ev21_same.py; T49 in tools/ev20_day.py; T50 in test_ev20_fuzz.py; test_ev20_guard section 8 moved from "as Manual" to "as Off" where Solar cannot cut (T51). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,10 @@ What is checked, per priority and cycle order:
|
||||
- the car's grid energy outside its holds: SETTLED (not within 20 s of a step
|
||||
of the sun, the house or the car's own current) at most 10 Wh; the zero-grid
|
||||
loop's slew after such a step (500 W per cycle) is reported apart;
|
||||
- house-caused alarms at the same seconds as the car-Off twin, +2 s.
|
||||
- house-caused alarms at the same seconds as the car-Off twin, +2 s;
|
||||
- EV-21 (T49): no peak cut on this day (the batteries catch every cloud edge
|
||||
and house step), no period over the aim that the car's energy alone takes
|
||||
over (N4), and no period banked as the car's.
|
||||
"""
|
||||
|
||||
import math
|
||||
@@ -25,6 +28,7 @@ import random
|
||||
import ev20_sun as S
|
||||
|
||||
DAY = 36000 # 08:00 to 18:00, 1 s cycles
|
||||
AIM = 3400.0 # the harness's cap 3500 less its margin 100
|
||||
PAUSE_S = 300.0
|
||||
MARGIN = 100.0
|
||||
_rnd = random.Random(53)
|
||||
@@ -113,11 +117,36 @@ def run_day(first, check):
|
||||
long_c = [(a, b) for a, b in CLOUDS if b - a > PAUSE_S]
|
||||
short_c = [(a, b) for a, b in CLOUDS if b - a <= PAUSE_S]
|
||||
print(f" clouds (start, length): {[(a, b - a) for a, b in CLOUDS]}")
|
||||
cutlog = {"step": [], "race": []}
|
||||
|
||||
def cut_rec(tag):
|
||||
def f(p, c, t):
|
||||
st = getattr(c, "_cut", None) or {}
|
||||
if st.get("cap") is not None and st.get("at") == t:
|
||||
cutlog[tag].append((t, st["cap"]))
|
||||
return f
|
||||
runs = {"step": S.drive(house, sun, dur=DAY, first=first, socs=dict(SOCS),
|
||||
race=False),
|
||||
race=False, on_cycle=cut_rec("step")),
|
||||
"race": S.drive(house, sun, dur=RACE[1] - RACE[0], t0=RACE[0],
|
||||
first=first, socs=dict(SOCS), race=True)}
|
||||
first=first, socs=dict(SOCS), race=True,
|
||||
on_cycle=cut_rec("race"))}
|
||||
for tag, r in runs.items():
|
||||
# EV-21, T49: N4 per period, and no cut on this day.
|
||||
per = {}
|
||||
for x in r["trace"]:
|
||||
q = int(x["t"]) // 900
|
||||
per.setdefault(q, [0.0, 0.0, 0])
|
||||
per[q][0] += x["grid"]
|
||||
per[q][1] += x["grid"] - x["car"]
|
||||
per[q][2] += 1
|
||||
n4 = [(q * 900, round(a / n), round(b / n))
|
||||
for q, (a, b, n) in per.items() if n == 900
|
||||
and a / n > AIM and b / n <= AIM]
|
||||
check(f"T49 (EV-21) [{first} first, {tag}]: no period over the aim "
|
||||
f"that the car alone takes over (N4: {n4[:3]}), none banked as "
|
||||
f"the car's ({r['c'].car_peak_q}), no peak cut on this day "
|
||||
f"({cutlog[tag][:3]})",
|
||||
not n4 and not r["c"].car_peak_q and not cutlog[tag])
|
||||
w = cur_writes(r)
|
||||
# A pause: a 0 A that is not a phase change's (no select within
|
||||
# 30 s); a start: the first current after a pause or at the start.
|
||||
|
||||
Reference in New Issue
Block a user