SudForecastEstimator no longer needs plant_params - the doc supplies it

sud.start() synchronously fires the first step's on_step_changed callback
before it even returns (assigning Sud.step triggers callbacks immediately),
which sets M/C/L/Td from this doc's own derive_plant_params() before any
pot.process()/tc.process() tick ever runs - so the constructor's
plant_params was being set, then immediately discarded, unused. theta_amb
stays, since it's not part of the Sud doc at all.

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 19:01:28 +02:00
co-authored by Claude Sonnet 4.6
parent f1688d3c71
commit 868c35f4e8
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -22,10 +22,9 @@ class SudForecastEstimator:
spin-up/settling lag, which is exactly why its estimate drifted so far
from reality (see README.md's "Forecast vs. actual duration")."""
def __init__(self, dt, theta_amb, plant_params, pid_type, tempctrl_params, heater_max_power):
def __init__(self, dt, theta_amb, pid_type, tempctrl_params, heater_max_power):
self.dt = dt
self.theta_amb = theta_amb
self.plant_params = plant_params
self.pid_type = pid_type
self.tempctrl_params = tempctrl_params
self.heater_max_power = heater_max_power
@@ -61,14 +60,17 @@ class SudForecastEstimator:
if not sud.load(doc) or not sud.schedule:
return [0.0], [start_theta], SudState.DONE, []
# Plant params (M/C/L/Td) are deliberately *not* seeded here from
# any default - sud.start() below synchronously fires the first
# step's on_step_changed callback (assigning Sud.step triggers
# its callbacks immediately, before sud.start() even returns),
# which sets them from this doc's own derive_plant_params() - see
# there - before any pot.process()/tc.process() tick ever runs.
pot = Pot(self.dt)
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)
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)