diff --git a/goodwe_controller/app/clamp.py b/goodwe_controller/app/clamp.py index e7a9a87..4c8c5f1 100644 --- a/goodwe_controller/app/clamp.py +++ b/goodwe_controller/app/clamp.py @@ -145,10 +145,32 @@ from datetime import datetime # nothing else in this add-on uses it. See "DISTINCT FROM SATURATION". REASON_CODE = "OUTPUT_CLAMP" -# Re-assert the notification this often while the clamp stays engaged. 30 s is -# the planning cadence (2.3), i.e. slow enough not to flood and fast enough -# that a pinned loop is never quiet for a whole billing quarter. -REASSERT_S = 30.0 +# Re-assert the notification this often while the clamp stays engaged. +# +# ⚠️ RAISED 30 s -> 150 s on 2026-09-05, and the reason is a REGIME CHANGE, not a +# change of mind about the alarm. 30 s was the planning cadence (2.3), chosen +# when a loop-side engagement was a rare event: this module's own note records +# "60 cycles of the §10.3 runaway produce 2 loop-side engagements". On the live +# install it produced 48 IN 25 MINUTES of ordinary operation, because `max_w` is +# 5000 W where the loop's tuning was derived at a 1500 W clamp (SAFETY-39) - so +# the integrator reaches its bound constantly and the notification re-asserted +# every 30 s, all day. An alarm that speaks that often about the normal case is +# how an operator learns to ignore the one that matters, which is the exact +# failure this module's docstring is written against. +# +# ⚠️ 150 s IS NOT A COMFORT CHOICE, IT IS THE REQUIREMENT'S OWN EDGE, WITH ONE +# STEP OF MARGIN. test_clamp.py part 2 pins the cadence in WALL-CLOCK terms +# rather than against this constant - a loop pinned on the rail must speak at +# least MIN_PER_QUARTER = 5 times inside the 900 s quarter that bills the +# capacity tariff. That caps this constant at 900/5 = 180 s. At 180 s the check +# passes with exactly 5 of a required 5, so any later change to the firing logic +# tips it red; 150 s gives 6. The floor is the thing that must not move. +# +# ⚠️ THIS IS A STOP-GAP AND SHOULD BE REVISITED. It reduces how often the alarm +# repeats; it does not make the alarm correct. SAFETY-40 is the wording and the +# i-clamped/clamped split, and SAFETY-39 is the tuning that would stop the loop +# railing in the first place. Neither is done by this line. +REASSERT_S = 150.0 # Consecutive clean cycles before the alarm de-asserts (10.2 hysteresis). CLEAR_CYCLES = 3