From 746692bad718d60eb4c57def6223e2713d38277d Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 21 Jun 2026 13:59:00 +0200 Subject: [PATCH] Rename TempControllerBase.pid_rate to pid_heat, matching pid_hold/pid_cool naming --- components/pid/temp_controller_base.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/pid/temp_controller_base.py b/components/pid/temp_controller_base.py index 192848c..0be2f7f 100644 --- a/components/pid/temp_controller_base.py +++ b/components/pid/temp_controller_base.py @@ -23,7 +23,7 @@ class TempControllerBase(APid): def __init__(self, dt, params): APid.__init__(self) self.pid_hold = Pid(dt) - self.pid_rate = Pid(dt) + self.pid_heat = Pid(dt) # Separate gains for ramping down (negative diff) - the actuator # (e.g. a heat-only Pot/heater) is responsible for clamping the # resulting negative power to whatever it's actually capable of; @@ -42,7 +42,7 @@ class TempControllerBase(APid): self.y = -1 self.state = States.INIT self.pid_hold.set_params(params['Hold']) - self.pid_rate.set_params(params['Heat']) + self.pid_heat.set_params(params['Heat']) self.pid_cool.set_params(params['Cool']) self.is_startup = True # Master on/off switch: while disabled, the FSM is held in IDLE and @@ -105,16 +105,16 @@ class TempControllerBase(APid): elif self.state == States.IDLE: # Just (re-)enabled - land in HOLD; the very next tick's # threshold check (below) moves it on to HEAT/COOL if the gap - # actually warrants it. pid_rate was frozen (see process_pid()) + # actually warrants it. pid_heat was frozen (see process_pid()) # and possibly stale for as long as we were disabled - start it # clean rather than resuming wherever it last left off. state_next = States.HOLD self.pid_hold.reset() - self.pid_rate.reset() + self.pid_heat.reset() elif self.state == States.HOLD: if diff >= self.thresholds['HoldHeat']: state_next = States.HEAT - self.pid_rate.reset() + self.pid_heat.reset() elif diff <= -self.thresholds['HoldCool']: state_next = States.COOL self.pid_cool.reset() @@ -128,15 +128,15 @@ class TempControllerBase(APid): elif self.state == States.COOL: if diff >= self.thresholds['CoolHeat']: state_next = States.HEAT - self.pid_rate.reset() + self.pid_heat.reset() elif diff >= -self.thresholds['CoolHold']: state_next = States.HOLD self.pid_hold.reset() - # pid_rate was frozen during COOL (see process_pid()) - + # pid_heat was frozen during COOL (see process_pid()) - # resume it clean rather than from whatever it last held # before COOL took over, which by now may be a stale fit # for a completely different part of the curve. - self.pid_rate.reset() + self.pid_heat.reset() if state_next != self.state: self.state = state_next @@ -146,7 +146,7 @@ class TempControllerBase(APid): self.pid_hold.process(theta_err, -self.theta_ist, hold_scale) # Only the PID actually driving y is advanced - otherwise the - # inactive one (e.g. pid_rate while COOL has pid_cool driving) + # inactive one (e.g. pid_heat while COOL has pid_cool driving) # would keep silently integrating against a heatrate_err that # isn't actually under its control, building a stale windup that # causes a discontinuity in y the moment it takes back over. @@ -156,8 +156,8 @@ class TempControllerBase(APid): self.pid_cool.process(heatrate_err, -self.heatrate_ist) self.y = self.pid_cool.get_y() else: - self.pid_rate.process(heatrate_err, -self.heatrate_ist) - self.y = self.pid_rate.get_y() + self.pid_heat.process(heatrate_err, -self.heatrate_ist) + self.y = self.pid_heat.get_y() self.post_pid()