Make ambient temperature configurable and wire it everywhere it was hardcoded
brewpi.py passed a literal 20 as theta_amb to Pot, and temp_controller_smith.py's two internal Pot models (and every demo's Pot/TempController instantiation) silently relied on Pot's default of 20 instead. Add a top-level ambient_temperature key to config.json(.templ/.sim), thread it through brewpi.py into both the real plant and the Smith predictor's models via a new theta_amb param on TempController, and make the demos pass it explicitly too. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ from components.pid.temp_controller_base import TempControllerBase, States
|
||||
|
||||
|
||||
class TempController(TempControllerBase):
|
||||
def __init__(self, dt, params, model_params):
|
||||
def __init__(self, dt, params, model_params, theta_amb=20):
|
||||
TempControllerBase.__init__(self, dt, params)
|
||||
self.dt = dt
|
||||
self.last_theta_ist = 20
|
||||
@@ -11,10 +11,10 @@ class TempController(TempControllerBase):
|
||||
|
||||
# Fast model: same plant model but with zero transport delay, used
|
||||
# to predict the current temperature without the dead time.
|
||||
self.model = Pot(dt, {**model_params, 'Td': 0})
|
||||
self.model = Pot(dt, {**model_params, 'Td': 0}, theta_amb)
|
||||
# Delayed model: keeps the plant's assumed transport delay, so it
|
||||
# can be compared like-for-like against the real (delayed) measurement.
|
||||
self.model_delay = Pot(dt, model_params)
|
||||
self.model_delay = Pot(dt, model_params, theta_amb)
|
||||
|
||||
self.theta_ist_plant = 0
|
||||
self.theta_ist_model = 0
|
||||
|
||||
Reference in New Issue
Block a user