# Good method for Retuning a PID After Detecting Oscillation

Given a PID controller with an anti-windup, what are some practical ways to retune the controller once oscillation has been caused and detected? I have access to the magnitude and period of the oscillation.

I don't want to use the Ziegler-Nichols method; rather I'd like a method that allows me to specify a phase/gain margin as I am returning the system.

Could someone recommend me towards a book/article or theory?

• PIDs are meant to be very static with respect to their gains -- "set it and forget it". Why does your system oscillate in some cases but not in others?
– Ian
Jul 11 '14 at 16:28
• The Wiki PID mentioned dozens of methods. I think it would hard to explain it any better then there. en.wikipedia.org/wiki/PID_controller Unless someone already knows right off what direction to go. Jan 7 '15 at 19:46

A controlled process might vary over time (due to e.g. slack, wear and tear ...), causing the need for refining the controller. If the aim is not to rely on heuristics (e.g. Zigler-Nichols) - and that is a good intention - then what one should do is first to come up with a model that is representative of the plant and second use such a model to tune the PID. The recipe is pretty much described here.

What makes the identification difficult in this context is the fact that we are dealing with a closed-loop system, meaning that the plant is under the control of our by now "weakly" tuned PID. In this scenario we have to be careful, since we cannot blindly adopt standard identification techniques as in the more usual open-loop framework.

In literature there exist direct, indirect and joint input-output methods for closed-loop identification. An enlightening reading is "Closed-loop Identication. Methods, Theory, and Applications". To any rate, the Prediction Error Estimation (PEM) turns to be a viable and simple solution to this end: we have just to record the output of our PID as the process input so as the output of the plant as the process output and then use some sort of ARX, ARMAX, Output-Error black box identification approaches and we will end up with an unbiased estimation of the plant dynamics. It can be demonstrated indeed that the estimation is valid and informative as it would have been carried out in open-loop fashion.

Once we have a good estimate of the plant, we can design the PID controller relying on diverse techniques, such as dominant pole placement, loop shaping, in order to meet some given performance and robustness requirements.

I'm am just going to mention the two first approaches that came to my mind when reading about your situation. You can change the behavior of a PID controller by adjusting the Kp, Ki and Kd parameters. For doing so, I suggest:

1. Evolutionary Programming
2. Another PID controller (or three, in fact)

In both scenarios you will need to be have some idea of what your ideal response would be, for instance using the gain/phase, the amount of overshoot, the number of oscillations - or similar characteristics - as measurements. I have previously experimented with both options, but never implemented either. Also, I do not know if these methods are actually used in practice for auto-tuning PIDs. Good luck. :)

• Thanks for your comment. My thought was that since the system does fall into oscillation (which is unfortunate), at that stage it is now persistently excited. So now I should have enough modes to determine and identify my plant and be able to retune my controller. That's in essence how ZN approach is. Jul 11 '14 at 21:34