Replace Pid.scale()'s mutable gain factor with a stateless process() arg
Pid.scale(k) set self.k as persistent state, mutated from outside the class and never reset in reset(), so a stale scale factor could survive a state-transition reset. Replace it with a plain scale=1.0 argument on Pid.process(), and have temp_controller.py/temp_controller_smith.py compute the heat-rate-overshoot compensation factor themselves and pass it through process_pid() each tick instead of mutating pid_hold's state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,8 +106,8 @@ class TempControllerBase(APid):
|
||||
print("New state = {}".format(state_next))
|
||||
self.on_state_entered(state_next)
|
||||
|
||||
def process_pid(self, theta_err, heatrate_err):
|
||||
self.pid_hold.process(theta_err, -self.theta_ist)
|
||||
def process_pid(self, theta_err, heatrate_err, hold_scale=1.0):
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user