Main Content

When to Use PID Autotuning

The PID autotuner blocks in Simulink® Control Design™ let you tune a PID controller without a parametric plant model or an initial controller design. If you have a code-generation product such as Simulink Coder™, you can generate code that implements the tuning algorithm on hardware. Deploying the algorithm to hardware lets you tune a controller for a physical plant, with or without using Simulink to manage the tuning process.

To achieve model-free tuning, use the Closed-Loop PID Autotuner or Open-Loop PID Autotuner blocks. These blocks perform a frequency-response estimation experiment that injects signals into the plant and measures the plant output with the feedback loop closed or open, respectively. The blocks use the resulting estimated frequency response to tune PID gains for the plant.

PID autotuning works with any asymptotically stable or integrating SISO plant, whether low-order or high-order, with or without time delay, and with or without direct feedthrough. It can tune any type of PID controller. You trigger the tuning process via an input to the block, so you can tune your controller at any time.

PID Autotuning for a Physical Plant

Embedded PID autotuning is a useful option when you have a PID-controlled system and a test bed or control environment to operate in. In this case, you can deploy an autotuner block to your hardware and automatically tune the gains of the PID controller in your system.

In practice, you can manage the PID autotuning process in several ways, including:

PID Autotuning for a Plant Model in Simulink

If you have a plant model in Simulink, you can use PID autotuning to:

  • Obtain an initial PID design for your plant, which you can refine by tuning against the physical plant.

  • Preview plant response and adjust the settings for PID autotuning before tuning the controller in real time. Doing so helps ensure that real-time tuning does not drive your system out of the desirable operating range.

For more information, see PID Autotuning for a Plant Modeled in Simulink.

Closed-Loop vs. Open-Loop PID Autotuning

The PID autotuning tools let you tune:

  • In a closed-loop configuration, with your plant under control of an existing PID controller (Closed-Loop PID Autotuner block).

  • In an open-loop configuration (Open-Loop PID Autotuner block). With open-loop autotuning, if the plant is in a feedback loop, the autotuner opens the loop for the duration of the tuning process.

In general, if you do not have an initial PID design, start with open-loop autotuning, and switch to closed-loop autotuning for retuning or refinement. If you have an initial PID design for your plant, use closed-loop tuning, which is safer for your plant. With closed-loop autotuning, the controller remains in the loop to:

  • Reject unexpected plant disturbances to maintain safe operation of the plant during the estimation experiment.

  • Reduce the risk that the perturbations used for the experiment drive the plant away from the desired operating point.

Additional advantages of the closed-loop autotuning approach include:

  • Closed-loop tuning works with multiple-integrator plants. In contrast, you cannot use open-loop autotuning for multiple-integrator plants. Even single-integrator plants risk drifting away from the desired operating point during open-loop tuning.

  • Because the feedback loop remains closed, there is no concern about controller saturation during the tuning process. In contrast, with open-loop autotuning, a controller with integral action can saturate while the loop is open. Such saturation can create a jump at the plant input when the tuning process ends. With open-loop tuning, you must take additional steps to ensure that the controller continues to track autotuner block output during tuning. (See, for instance, PID Autotuning for a Plant Modeled in Simulink.)

If safe operation of your plant is not a practical concern (such as when tuning against a plant model in Simulink), open-loop autotuning has these advantages:

  • Open-loop tuning can result in more accurate frequency-response estimation and tuning. In closed-loop tuning, the controller suppresses injected perturbations, which can result in less accurate frequency-response estimation and poorer tuning results.

  • Open-loop tuning is faster. Closed-loop tuning uses a lower-frequency perturbation signal, which makes the process about three times longer.

  • The memory footprint of the deployed algorithm is slightly smaller.


  • Do not use either closed-loop or open-loop PID autotuning with an unstable plant.

  • Do not use open-loop PID autotuning with a plant that has more than one integrator. You can use closed-loop PID autotuning with a multiple-integrator plant.

To get started with either type of PID autotuner, see How PID Autotuning Works.

When Not to Use PID Autotuning

PID Autotuning is not suitable for unstable plants. The perturbations applied in open-loop tuning can drive an unstable plant to operating conditions that are unsafe for the plant. Although closed-loop autotuning does not have that risk, it does not yield meaningful tuning results for unstable plants.

PID autotuning does not work well when there are large disturbances in the plant during the estimation experiment. Disturbances distort the plant response to the perturbation signals, yielding poor estimation results.

See Also


Related Topics