Anchor the forecast to the real current temperature, not a cold start
send_forecast() was defaulting to a cold start at ambient (SudForecastEstimator. estimate()'s default when start_theta isn't passed), so the forecast's t=0 never matched whatever temperature the pot actually was at - understating how long the first ramp would really take whenever it wasn't already cold. Anchoring at tc.get_theta_ist() seemed like the obvious fix but isn't reliable right after Load: that's only ever updated inside process(), which a model-based controller (Smith) doesn't run until its plant params are configured - which now only happens once a Sud is loaded (see the "inert until loaded" change) - so theta_ist can still be sitting at its never-updated __init__ default of 0 the instant send_forecast() reads it. Added TempControllerBase.get_theta_ist_set() (mirroring the existing get_theta_soll_set()) - the raw sensor reading, updated the instant a reading comes in regardless of whether process() has ever run - and used that instead. That still leaves a gap between Load and Start: the real temperature can drift (time passing, manual heating via the Manual tab) between loading a schedule and actually starting it, leaving the forecast anchored to a now-stale temperature. recv()'s 'Start' handler now re-sends the forecast, freshly anchored to the real temperature at that moment, on every fresh start (not a Pause->resume, which keeps the already-established forecast rather than discarding it mid-run). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DkkuG48uHFCGKe6dPSERFk
This commit is contained in:
@@ -97,6 +97,17 @@ class TempControllerBase(APid):
|
||||
def get_theta_ist(self):
|
||||
return self.theta_ist
|
||||
|
||||
def get_theta_ist_set(self):
|
||||
"""The raw sensor reading, as last pushed via set_theta_ist() -
|
||||
unlike get_theta_ist() (self.theta_ist), this is updated the
|
||||
instant a reading comes in, regardless of whether process() has
|
||||
ever actually run (e.g. before set_params()/a model-based
|
||||
controller's plant params have been configured - see SudTask.
|
||||
send_forecast(), which needs a real "current temperature" at the
|
||||
moment a Sud is loaded, before this controller may have ticked
|
||||
even once)."""
|
||||
return self.theta_ist_set
|
||||
|
||||
def set_heatrate_ist(self, value):
|
||||
self.heatrate_ist_set = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user