PID Autotune VI Gives Wrong Gain Values

Updated Oct 27, 2023

Reported In


  • LabVIEW PID Control Toolkit
  • LabVIEW PID and Fuzzy Logic Toolkit
  • LabVIEW

Issue Details

I'm working with LabVIEW's PID Autotuning VI, and the PID gains produced do not work for my system. How can I get better gains from the VI?


Before you begin autotuning, you must establish a stable open-loop system, even if you cannot tune the system on your own.

Once you have your system in a stable state, you will need to provide the VI with the autotuning parameters it will use to tune your system:
  • Controller Type — Select what type of controller you are trying to tune. Your options are P, PI, or PID. The default option is PI.
  • Relay Cycles — This tells the setpoint relay experiment how many cycles to use. Your results will be more precise with more cycles but will require more time to execute. This will be more pronounced in slower systems. The default value is three.
  • Relay Amplitude — Specifies the step change of the current setpoint up or down. This number will ideally be set so that the each oscillation period takes at least twenty control cycles. The default value is one.
  • Control Specification — This specifies how the systems will respond. Keep in mind that faster response will result in higher overshoot which may not be desirable. Your options are normal, fast and slow. The default option is slow.
  • PV Noise Level — Estimate the noise level that will be included in the process variable. The default value is 0.1.
You'll also need to provide starting PID values, output limits, a setpoint, and a process variable.

When the PID Autotuning VI runs, it will excite your controller and force it to adapt to the changes in your process variable.

Once the autotuning is complete, the function will output better PID values if the algorithm was able to find any. If the autotuning did not set any change in the PID gains, the PID gains out values will be the same as the PID gains input.


Additional Information

The PID Autotuning VI uses the Ziegler-Nichols tuning method. This is a heuristic method that will iterate the PID values until the system has reached a tuned state. The diagram below outlines the process used by the PID Autotuning VI:

The autotuning procedure is excited by the setpoint relay which steps the setpoint up or down. This will allow the controller to respond to changes and tune the system for an acceptable response. For more information about how this VI works, refer to the LabVIEW PID and Fuzzy Logic Toolkit API Reference and the PID Autotuning VI Help page.

If the system model is too complex or nonlinear the autotune may not work as expected. The algorithm assumes that the controlled system is first-order with a dead-time.

Another problem is control output saturation at the output high and output low limits during autotuning (specified by the output range input to the function). Control output saturation adds a nonlinear element to the system and causes incorrect results. To avoid this problem, reduce the relay amplitude parameter and/or reduce the proportional gain, Kc, of the PID controller before starting the autotuning procedure.