diff --git a/components/sud_forecast.py b/components/sud_forecast.py index a213080..ae7eab4 100644 --- a/components/sud_forecast.py +++ b/components/sud_forecast.py @@ -51,6 +51,17 @@ class SudForecastEstimator: tc = PidFactory.create(self.pid_type, self.dt, self.tempctrl_params, self.plant_params, theta_amb=self.theta_amb) tc.set_enabled(True) tc.set_theta_ist(pot.get_temperature()) + # Seed the target at start_theta - this tc is a fresh, throwaway + # instance (unlike the real run's persistent one), so without this + # its theta_soll_set defaults to 0 until a step pushes its own. + # Steps without their own 'temperature' (common now that ramping + # isn't gated by a 'ramp' key - see components/sud.py) rely on + # inheriting whatever target was already running, which for a + # schedule starting mid-brew (the dynamic remaining forecast) is + # start_theta, not 0 - without this, such a schedule's first step + # would have the simulated controller chase 0 degrees indefinitely, + # hitting MAX_TICKS and producing a needlessly huge result. + tc.set_theta_soll(start_theta) def on_step_changed(step): if step is None: