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
-2
@@ -29,6 +29,7 @@ if __name__ == '__main__':
|
||||
DT = config['Controller']['dt']
|
||||
DT_TASK = 1.0 / config['Controller']['sim_warp_factor']
|
||||
DT_TASK_TRACER = DT_TASK / DT
|
||||
theta_amb = config['ambient_temperature']
|
||||
|
||||
# Sensor
|
||||
sensor = TempSensorFactory.create(config['Controller']['sensor_name'], temp_offset=-0.15, variance=0.01)
|
||||
@@ -37,7 +38,7 @@ if __name__ == '__main__':
|
||||
|
||||
# Plant
|
||||
pot_params = config['Plant']
|
||||
pot = Pot(DT, pot_params, 20)
|
||||
pot = Pot(DT, pot_params, theta_amb)
|
||||
taskmgr.add(PotTask(pot, DT_TASK, dispatcher.msgio_get("Pot")))
|
||||
|
||||
# Heater
|
||||
@@ -47,7 +48,7 @@ if __name__ == '__main__':
|
||||
taskmgr.add(heater_task)
|
||||
|
||||
# Temperature Controller
|
||||
tc = PidFactory.create(config['Controller']['pid_type'], DT, config['TempCtrl'], config['Model'])
|
||||
tc = PidFactory.create(config['Controller']['pid_type'], DT, config['TempCtrl'], config['Model'], theta_amb=theta_amb)
|
||||
tc_task = TcTask(tc, DT_TASK, dispatcher.msgio_get("TempCtrl"))
|
||||
taskmgr.add(tc_task)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user