MAINT-28: keep the single shaping_suspended(.., maint_aim) call site (test_peak_margin pin); shaping_held takes its answer
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
23359a047d
commit
edf30f345a
@@ -572,11 +572,12 @@ class CycleMixin:
|
||||
# (SAFETY-87 / SAFETY-119 pins).
|
||||
house = (None if self.grid is None or self.site_batt_w is None
|
||||
else float(self.grid) + float(self.site_batt_w))
|
||||
_susp = peakguard.shaping_suspended(
|
||||
self.peak_guard, self.peak_fc, maint_aim)
|
||||
self._maint_peak_hold = peakguard.shaping_held(
|
||||
_peak_held and len(self.inverters) > 1
|
||||
_susp, _peak_held and len(self.inverters) > 1
|
||||
and maint_aim > self.peak_aim_w(),
|
||||
self.peak_guard, self.peak_fc,
|
||||
maint_aim, house)
|
||||
self.peak_fc, maint_aim, house)
|
||||
if self._maint_peak_hold:
|
||||
# Edge-logged: level-logging here would write one line per
|
||||
# cycle for as long as the event lasts and flush the 40-line
|
||||
|
||||
@@ -450,13 +450,13 @@ 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.
|
||||
def shaping_held(suspended, held, peak_forecast_w, aim_w, house_w) -> bool:
|
||||
"""MAINT-28. `suspended` (`shaping_suspended()`'s answer), kept on while
|
||||
`held` 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):
|
||||
if suspended:
|
||||
return True
|
||||
if not held:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user