Closed Steinarr134 closed 1 year ago
Hi!
I've now implemented a starting_output
argument when creating a PID object that sets the _integral
much like you said. If you're still interested in this, any feedback on if this works for you would be greatly appreciated!
The first output from the PID will always be zero, I don't know if this is by design or a just how the math turned out but it is a bit annoying to turn on the PID, system is at the setpoint yet the pid throws in a zero
I found a way around it by doing:
pid.set_auto_mode(False)
pid.set_auto_mode(True, last_output=last_output_guess)
it's a hacky way of getting what I want but since I can read the current settings from my equipment and from there calculate what the last output from the pid would have been, I don't want the pid to output a 0 and send the system into a frenzy for no reason.
All this to say, I propose allowing optional keyword
last_output
in thePID.__init__
method.edit: I've gotten the behavior I wanted by including optional keyword
last_output
and adding the following lines to the end of theinit
method: