How can I tune my PID controller using Ziegler Nichols?

103 views (last 30 days)
I am modeling a linearized inverted pendulum using a transfer function, and using a PID controller to control it. I am adding a pulse disturbance after 1 second. As I am new to control theory, I am struggling with how to choose PID gains (I am trying to find good gains myself, rather than using the auto tune functionality).
I read that the Ziegler-Nichols method suggests keeping integral and derivative action at 0, and increasing the proportional gain until constant oscillations occur. For me, that is at a gain of 5. However, the scope shows a pendulum angle of above 60 (radians?) - which is not possible because it no longer works with the small angle approximation. And, if I use P = 5, I = 0, D = 0 on a simscape model that I created, the pendulum goes wild. For the simscape, a P-gain of 23 first results in stable oscillations. Using the autotune gives gains of approx. P = 105, I = 472, D = 5.7. How am I supposed to find the right gains?

Answers (1)

Delprat Sebastien
Delprat Sebastien on 24 Sep 2020
Edited: Delprat Sebastien on 22 Apr 2022
Please stop using ziegler nichols. This method has been created a whole ago when computers were not available. It is only intended for process that are integrator with a delay. IT WILL NOT WORK ON OTHER SYSTEMS, except if your lucky. Generally, the closed loop will have overshoots, etc. So how to tune pid. Either by hand, purely by trial and errors. Alternatively if you have a linear model, use linear control system theory for the controler synthesis (compute gain to have a given phase margin for instance or to get the closed loop poles at a specified location).
  3 Comments
Delprat Sebastien
Delprat Sebastien on 19 Feb 2024
Edited: Delprat Sebastien on 19 Feb 2024
Ziegler Nichols is poorly understood. Take a second order system. Fix the natural frequency, fix arbitrary gain, damping and natural freq. Compute a ZN PID and simulate. Iterate over different damping value. This should convice you that there is no reason that ZN Work.
Then you can argue that you do not want to make a modle and stick to it. But in the and, you will have to modify the PI coef because they simply doesn't work for most of the system. If you have a counter argument, I would be very pleased to have a proof that the ZN allows to control (with descent perf) any linear system.
However, if your system is simple and there is no perf requirement, a simple hand tuned PI will do the job 95% of the time.
For the reamining 5%, you need to switch the brain on...
My opinion is that you cannot synthetize a controler without any a prori knowledge on the system dynamics. For unstable systems, this is a real problem. For most of the stable systems, fitting a simple dynamics in the viscinity of an operating point is usually not a big deal. It is easy to fit an under damped second order system. All the mechanical systems are affine in their coefficients and can thus be identified straightforwardly off line (take the output, use a zero lag filter to remove noise, estimate the first and second order derivative numerically, and coefs are obtained as a linear fit).
In the same way damped systems (like thoses with two real poles or one pole+integrator) can be easily identified using a proportionnal closed loop tuned such that it is underdamped (identify natural freq+damping coef of second order closed loop and this alows to derive the coef of the open loop).
For all the others, you have the identification toolbox...
Final word: Control is not magical. If you do not have a model tune a PI by hand, your brain can tune the closed loop very easily. You need something more serious, then yes, it will require some work. Most of the time if you have a model, you can do better than a PI.
Sam Chak
Sam Chak on 19 Feb 2024
Considering that the mathematical model or transfer function of the system is currently unavailable, I would like to inquire whether the system is open-loop stable or unstable. Additionally, I would like to know if you have modeled the system in Simulink to gain further insights.

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!