Keep plant/temp control inert until a Sud is actually loaded

server/brewpi.py no longer pre-configures the real Pot's or Smith's model's
plant params at startup - there's no longer any generic baseline at all,
since the only source of truth is now a loaded Sud's own doc (applied via
tasks/sud.py's SudTask.apply_plant_params(), on Load and on every step).
Ambient temperature and PID gains stay configured at startup, since
they're independent of any Sud (global setting / hardware tuning, not
doc-derived).

Add Pot.is_configured() (already existed)/TempControllerBase.is_configured()/
TempController(Smith).is_configured(), and have tasks/pot.py's PotTask and
tasks/tempctrl.py's TcTask skip process() while not yet configured instead
of letting it raise - so plant and temp control are genuinely inert (not
crashing) until a Sud is loaded. "Normal" has no plant-model dependency,
so it stays active regardless.

Also refreshes README.md: removes stale tracer.py/.mat references (already
removed in an earlier commit), documents SudLogTask's JSON logs, the doc's
L/Td fields, and this inert-until-loaded behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DkkuG48uHFCGKe6dPSERFk
This commit is contained in:
2026-06-22 20:05:33 +02:00
co-authored by Claude Sonnet 4.6
parent 51add6fd56
commit 77e68afef1
6 changed files with 84 additions and 38 deletions
+8
View File
@@ -75,6 +75,14 @@ class TempControllerBase(APid):
raise RuntimeError(
"{}.process(): PID gains not set - call set_params() first".format(type(self).__name__))
def is_configured(self):
"""Whether set_params() has been called - lets a caller (e.g.
TcTask's own process loop) check upfront and skip processing
gracefully while not yet configured, rather than relying on
process() raising. Overridden by TempController(Smith) to also
require its internal model's plant params/ambient."""
return self.params is not None
def on_state_entered(self, state):
pass
+3
View File
@@ -32,6 +32,9 @@ class TempController(TempControllerBase):
self.model.set_ambient_temperature(theta_amb)
self.model_delay.set_ambient_temperature(theta_amb)
def is_configured(self):
return super().is_configured() and self.model.is_configured() and self.model_delay.is_configured()
def on_state_entered(self, state):
if state in (States.HEAT, States.COOL):
self.model.initial(self.theta_ist)