Main Content

PID Tuning Algorithm

Typical PID tuning objectives include:

  • Closed-loop stability — The closed-loop system output remains bounded for bounded input.

  • Adequate performance — The closed-loop system tracks reference changes and suppresses disturbances as rapidly as possible. The larger the loop bandwidth (the frequency of unity open-loop gain), the faster the controller responds to changes in the reference or disturbances in the loop.

  • Adequate robustness — The loop design has enough gain margin and phase margin to allow for modeling errors or variations in system dynamics.

MathWorks® algorithm for tuning PID controllers meets these objectives by tuning the PID gains to achieve a good balance between performance and robustness. By default, the algorithm chooses a crossover frequency (loop bandwidth) based on the plant dynamics, and designs for a target phase margin of 60°. When you interactively change the response time, bandwidth, transient response, or phase margin using the PID Tuner interface, the algorithm computes new PID gains.

For a given robustness (minimum phase margin), the tuning algorithm chooses a controller design that balances the two measures of performance, reference tracking and disturbance rejection. You can change the design focus to favor one of these performance measures. To do so, use the DesignFocus option of pidtune at the command line or the Options dialog box in PID Tuner.

When you change the design focus, the algorithm attempts to adjust the gains to favor either reference tracking or disturbance rejection, while achieving the same minimum phase margin. The more tunable parameters there are in the system, the more likely it is that the PID algorithm can achieve the desired design focus without sacrificing robustness. For example, setting the design focus is more likely to be effective for PID controllers than for P or PI controllers. In all cases, fine-tuning the performance of the system depends strongly on the properties of your plant. For some plants, changing the design focus has little or no effect.