Require TempController(Smith)'s model params/ambient via setters; add comprehensive process() checks

TempController(Smith).__init__ no longer takes model_params/theta_amb -
set_model_plant_params() and the existing set_ambient_temperature() must be
called instead (mirrors components/plant/pot.py's own Pot constructor
refactor). temp_controller.py's now-pointless model_params/theta_amb
constructor placeholders (kept only for "compatibility" with Smith) are
dropped too.

Both TempController variants now raise a clear RuntimeError from process()
itself if set_params() wasn't called, instead of letting it surface deep
inside Pid.process() as an opaque "'NoneType' object is not subscriptable".
Smith additionally checks its internal models via Pot.is_configured() (new)
and raises if set_model_plant_params()/set_ambient_temperature() weren't
called either.

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 18:31:58 +02:00
co-authored by Claude Sonnet 4.6
parent 0a6d3e6462
commit 96fe7ce90c
8 changed files with 50 additions and 13 deletions
@@ -43,8 +43,10 @@ if __name__ == '__main__':
temp_ist = 0
temp_soll = 20
heatrate_soll = 1.25
ctrl = TempController(dt, plant_params, theta_amb)
ctrl = TempController(dt)
ctrl.set_params(ctrl_params)
ctrl.set_model_plant_params(plant_params)
ctrl.set_ambient_temperature(theta_amb)
ctrl.set_enabled(True)
plant = Pot(dt)
plant.set_plant_params(plant_params)
+3 -1
View File
@@ -48,8 +48,10 @@ if __name__ == '__main__':
"Td" : 60
}
ctrl = TempController(dt, plant_params, theta_amb)
ctrl = TempController(dt)
ctrl.set_params(ctrl_params)
ctrl.set_model_plant_params(plant_params)
ctrl.set_ambient_temperature(theta_amb)
plant = Pot(dt)
plant.set_plant_params(plant_params)
plant.set_ambient_temperature(theta_amb)