Force the heater off and show a "Cool down" indicator during a passive cooldown
A ramp step whose target is below the current actual temperature can only be reached by ambient cooling - the heater can't actively cool. SudTask now detects this once per ramp phase and calls the controller's new set_cooling() override (forces y=0, bypassing the FSM) instead of waiting for its hysteresis-based IDLE transition. The GUI shows a blinking blue "Cool down" label in the status bar while this is active. Progression already only advances once theta_ist matches theta_soll regardless of direction, so no change was needed there.
This commit is contained in:
@@ -37,6 +37,12 @@ class TempControllerBase(APid):
|
||||
self.pid_hold.set_params(params['Hold'])
|
||||
self.pid_rate.set_params(params['Heat'])
|
||||
self.is_startup = True
|
||||
# Explicit override for a ramp step whose target is below the
|
||||
# current temperature: the heater can't actively cool, so rather
|
||||
# than wait for the FSM's own (slower, hysteresis-based) IDLE
|
||||
# transition, force y to 0 as soon as the caller (SudTask) knows
|
||||
# the step needs to passively cool down.
|
||||
self.cooling = False
|
||||
|
||||
def on_state_entered(self, state):
|
||||
pass
|
||||
@@ -70,6 +76,9 @@ class TempControllerBase(APid):
|
||||
def set_heatrate_soll(self, value):
|
||||
self.heatrate_soll_set = value
|
||||
|
||||
def set_cooling(self, value):
|
||||
self.cooling = value
|
||||
|
||||
def get_heatrate_soll(self):
|
||||
return self.heatrate_soll
|
||||
|
||||
@@ -109,7 +118,7 @@ class TempControllerBase(APid):
|
||||
self.pid_hold.process(theta_err, -self.theta_ist, hold_scale)
|
||||
self.pid_rate.process(heatrate_err, -self.heatrate_ist)
|
||||
|
||||
if self.state == States.IDLE:
|
||||
if self.state == States.IDLE or self.cooling:
|
||||
self.y = 0
|
||||
else:
|
||||
self.y = self.pid_rate.get_y()
|
||||
|
||||
Reference in New Issue
Block a user