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:
2026-06-22 18:15:08 +02:00
co-authored by Claude Sonnet 4.6
parent e0bd3acc26
commit 296d3a333d
8 changed files with 67 additions and 31 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ if __name__ == '__main__':
"gain" : 1.0
}
pot = Pot(dt, pot_params, theta_amb)
pot = Pot(dt)
pot.set_plant_params(pot_params)
pot.set_ambient_temperature(theta_amb)
_t = np.empty(0)
_temp = np.empty(0)