Pot: require plant params and ambient temperature via setters, not the constructor
Pot.__init__ now only takes dt; set_plant_params() and set_ambient_temperature() must be called before process(), which now raises RuntimeError if either is missing instead of silently computing on whatever the constructor happened to default to. set_ambient_temperature() only seeds the plant's starting temperature the first time it's called, so changing ambient mid-run still can't clobber an in-progress simulated temperature. Updates all callers (server/brewpi.py, TempController(Smith)'s two internal models, SudForecastEstimator, and the plant/pid/sud demo scripts) to call the setters right after construction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DkkuG48uHFCGKe6dPSERFk
This commit is contained in:
+3
-1
@@ -76,7 +76,9 @@ if __name__ == '__main__':
|
||||
taskmgr.add(sensor_task)
|
||||
|
||||
# Plant
|
||||
pot = Pot(DT, DEFAULT_PLANT_PARAMS, theta_amb)
|
||||
pot = Pot(DT)
|
||||
pot.set_plant_params(DEFAULT_PLANT_PARAMS)
|
||||
pot.set_ambient_temperature(theta_amb)
|
||||
taskmgr.add(PotTask(pot, DT_TASK, dispatcher.msgio_get("Pot")))
|
||||
|
||||
# Heater
|
||||
|
||||
Reference in New Issue
Block a user