MAINT-28: during a real peak the maintenance charge stays paused until the house is clear of the aim
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
1b5f7c9ccb
commit
8cd10ee6aa
@@ -28,6 +28,10 @@ FLOOR_AT_SOC_FLOOR = "the battery level is at or below the peak reserve"
|
||||
|
||||
SOURCE = "peak"
|
||||
|
||||
# MAINT-28. Watts the house must sit under the aim before a paused maintenance
|
||||
# charge resumes. DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md.
|
||||
MAINT_RESUME_UNDER_W = 300.0
|
||||
|
||||
# Mirror of config.yaml's peak options, pinned to the file by
|
||||
# test_peakguard.py. Not a read: `decide()` takes them as arguments.
|
||||
PEAK_OPTION_DEFAULTS = {
|
||||
@@ -446,6 +450,20 @@ def shaping_suspended(decision, peak_forecast_w, cap_w) -> bool:
|
||||
return decision is not None and decision.engaged
|
||||
|
||||
|
||||
def shaping_held(held, decision, peak_forecast_w, aim_w, house_w) -> bool:
|
||||
"""MAINT-28. `shaping_suspended()`, kept on until the house is
|
||||
`MAINT_RESUME_UNDER_W` under `aim_w` (`peak_forecast_w` stands in for an
|
||||
unread house; neither read: not held, as SAFETY-63). Only ever pauses the
|
||||
maintenance charge, never a cut-back.
|
||||
DECISIONS/MAINT-28-hold-the-pause-in-a-peak.md."""
|
||||
if shaping_suspended(decision, peak_forecast_w, aim_w):
|
||||
return True
|
||||
if not held:
|
||||
return False
|
||||
level = house_w if house_w is not None else peak_forecast_w
|
||||
return level is not None and level > float(aim_w) - MAINT_RESUME_UNDER_W
|
||||
|
||||
|
||||
def cap_floor(decision, cap_w):
|
||||
"""SAFETY-128: the floor no higher than `cap_w` (the command standing while
|
||||
the readings have not answered it), or `decision` unchanged when None.
|
||||
|
||||
Reference in New Issue
Block a user