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:
@@ -65,8 +65,12 @@ class SudForecastEstimator:
|
||||
pot.set_plant_params(self.plant_params)
|
||||
pot.set_ambient_temperature(self.theta_amb)
|
||||
pot.initial(start_theta)
|
||||
tc = PidFactory.create(self.pid_type, self.dt, self.plant_params, theta_amb=self.theta_amb)
|
||||
tc = PidFactory.create(self.pid_type, self.dt)
|
||||
tc.set_params(self.tempctrl_params)
|
||||
if hasattr(tc, 'set_model_plant_params'):
|
||||
tc.set_model_plant_params(self.plant_params)
|
||||
if hasattr(tc, 'set_ambient_temperature'):
|
||||
tc.set_ambient_temperature(self.theta_amb)
|
||||
tc.set_enabled(True)
|
||||
tc.set_theta_ist(pot.get_temperature())
|
||||
# Seed the target at start_theta - this tc is a fresh, throwaway
|
||||
|
||||
Reference in New Issue
Block a user