Troubleshooting Automatic PID Tuning

This section explains some procedures that can help you obtain better results from PID Tuner if the basic procedures yield unsatisfactory controller performance.

Plant Cannot Be Linearized or Linearizes to Zero

What This Means

When you open PID Tuner, it attempts to linearize the model at the operating point specified by the model initial conditions. Sometimes, PID Tuner cannot obtain a nonzero linear system for the plant as seen by the PID controller.

How to Fix It

If the plant model in the PID loop cannot be linearized, you have several options for obtaining a linear plant model for PID tuning.

Cannot Find a Good Design in PID Tuner

What This Means

You have adjusted the PID Tuner sliders, but you cannot find a design that meets your design requirements when you analyze the PID Tuner response plots.

How to Fix It

Try a different PID controller type. It is possible that your controller type is not the best choice for your plant or your requirements.

For example, the closed-loop step response of a P- or PD-controlled system can settle on a value that is offset from the setpoint. If you require a zero steady-state offset, adding an integrator (using a PI or PID controller) can give better results.

As another example, in some cases a PI controller does not provide adequate phase margin. You can instead try a PID controller to give the tuning algorithm extra degrees of freedom to satisfy both speed and robustness requirements simultaneously.

To switch controller types, in the PID Controller block dialog box:

  • Select a different controller type from the Controller drop-down menu.

  • Click Apply to save the change.

  • Click Tune to instruct PID Tuner to tune the parameters for the new controller type.

If you cannot find any satisfactory controller with PID Tuner, PID control possibly is not sufficient for your requirements. You can design more complex controllers using the Control System Designer app.

Simulated Response Does Not Match the PID Tuner Response

What This Means

When you run your Simulink® model using the PID gains computed by PID Tuner, the simulation output differs from the PID Tuner response plot.

There are several reasons why the simulated model can differ from the PID Tuner response plot. If the simulated result meets your design requirements (despite differing from the PID Tuner response), you do not need to refine the design further. If the simulated result does not meet your design requirements, see Cannot Find an Acceptable PID Design in the Simulated Model.

Some causes for a difference between the simulated and PID Tuner responses include:

  • The reference signals or disturbance signals in your Simulink model differ from the step signals that PID Tuner uses. If you need step signals to evaluate the performance of the PID controller in your model, change the reference signals in your model to step signals.

  • The structure of your model differs from the loop structure that PID Tuner designs for. PID Tuner assumes the loop configuration shown in the following figure.

    As the figure illustrates, PID Tuner designs for a PID controller in the feedforward path of a unity-gain feedback loop. If your Simulink model differs from this structure, or injects a disturbance signal in a different location, your simulated response differs from the PID Tuner response.

  • You have enabled nonlinear features in the PID Controller block in your model, such as saturation limits or anti-windup circuitry. PID Tuner ignores nonlinear settings in the PID Controller block, which can cause PID Tuner to give a different response from the simulation.

  • Your Simulink model has strong nonlinearities in the plant that make the linearization invalid over the full operating range of the simulation.

  • You selected an operating point using PID Tuner that is different from the operating point saved in the model. In this case, PID Tuner has designed a controller for a different operating point than the operating point that begins the simulation. Simulate your model using the PID Tuner operating point by initializing your Simulink model with this operating point. See Simulate Simulink Model at Specific Operating Point.

Cannot Find an Acceptable PID Design in the Simulated Model

What This Means

You tune the PID Controller using PID Tuner and run your Simulink model with the tuned PID gains. However, the simulated response of your model does not meet your design requirements.

How to Fix It

In some cases, PID control is not adequate to meet the control requirements for your plant. If you cannot find a design that meets your requirements when you simulate your model, consider using a more complex controller. See Control System Designer.

If you have enabled saturation limits in the PID Controller block without antiwindup circuitry, enable antiwindup circuitry. You can enable antiwindup circuitry in two ways:

  • Activate the PID Controller block antiwindup circuitry on the PID Advanced tab of the block dialog box.

  • Use the PID Controller block tracking mode to implement your own antiwindup circuitry external to the block. Activate the PID Controller block tracking mode on the PID Advanced tab of the block dialog box.

To learn more about both ways of implementing antiwindup circuitry, see Anti-Windup Control Using a PID Controller.

After enabling antiwindup circuitry, run the simulation again to see whether controller performance is acceptable.

If the loop response is still unacceptable, try slowing the response of the PID controller. To do so, reduce the response time or the bandwidth in PID Tuner. See Refine the Design.

You can also try implementing gain-scheduled PID control to help account for nonlinearities in your system. See Designing a Family of PID Controllers for Multiple Operating Points and Implement Gain-Scheduled PID Controllers.

If you still cannot get acceptable performance with PID control, consider using a more complex controller. See Control System Designer.

Controller Performance Deteriorates When Switching Time Domains

What This Means

You obtain a well-tuned continuous-time PID controller. Then, you convert the controller time domain using the Time Domain selector button in the PID Controller block dialog box. The controller performs poorly or even becomes unstable when you convert the controller to discrete time.

How To Fix It

In some cases, you can improve performance by adjusting the sample time by trial and error. However, this procedure can yield a poorly tuned controller, especially where your application imposes a limit on the sample time. Instead, if you change time domains and the response deteriorates, click Tune in the PID Controller block dialog to design a new controller.

    Note:   If the plant and controller time domains differ, PID Tuner discretizes the plant (or converts the plant to continuous time) to match the controller time domain. If the plant and controller both use discrete time, but have different sample times, PID Tuner resamples the plant to match the controller. All conversions use the tustin method (see Continuous-Discrete Conversion Methods.

When Tuning the PID Controller, the D Gain Has a Different Sign from the I Gain

What This Means

When you use PID Tuner to design a controller, the resulting derivative gain, D, can have a different sign from the integral gain I. PID Tuner always returns a stable controller, even if one or more gains are negative.

For example, the following expression gives the PID controller transfer function in Ideal form:


For a stable controller, all three numerator coefficients require positive values. Because N is positive, IN  >  0 requires that I is also positive. However, the only restriction on D is (1 + DN) > 0. Therefore, as long as DN > –1, a negative D still yields a stable PID controller.

Similar reasoning applies for any controller type and for the Parallel controller form. For more information about controller transfer functions, see the PID Controller block reference page.

Was this topic helpful?