You can use PID Tuner to interactively tune PID gains in a Simulink® model containing a PID Controller, Discrete PID Controller, PID Controller (2DOF), or Discrete PID Controller (2DOF) block. For more information, see Introduction to Model-Based PID Tuning in Simulink.
Before you can use PID Tuner, you must:
Create a Simulink model containing a PID Controller, Discrete PID Controller, PID Controller (2DOF), or Discrete PID Controller (2DOF) block. Your model can have one or more PID blocks, but you can only tune one PID block at a time.
If you are tuning a multi-loop control system with coupling between the loops, consider using other Simulink Control Design™ tools instead of PID Tuner. For more information, see Choose a Control Design Approach.
The PID Controller blocks support vector signals. However, using PID Tuner requires scalar signals at the block inputs. That is, the PID block must represent a single PID controller.
Your plant (all blocks in the control loop other than the controller) can be linear or nonlinear. The plant can also be of any order, and have any time delays.
Configure the PID block settings, such as controller type, controller form, time domain, sample time. For more information on these block settings, see the individual block reference pages:
To open PID Tuner and view the initial compensator design:
Open the Simulink model by typing the model name at the MATLAB® command prompt.
To open the block dialog box, double-click the PID controller block.
In the block dialog box, in the Select Tuning Method
drop-down list, select
Transfer Function Based (PID Tuner
App). To open PID Tuner, click
When you open PID Tuner, the following actions occur:
PID Tuner automatically linearizes the plant at the operating point specified by the model initial conditions, as described in What Plant Does PID Tuner See?. If you want to design a controller for a different operating point, see Tune at a Different Operating Point.
If the plant model in the PID loop linearizes to zero, PID Tuner provides the Obtain plant model dialog box. This dialog box allows you to obtain a new plant model by either:
Linearizing at a different operating point (see Tune at a Different Operating Point).
Importing an LTI model object representing the plant. For example, you can
import frequency response data (
frd model) obtained by frequency
response estimation. For more information, see Design PID Controller Using Estimated Frequency Response.
Identifying a linear plant model from simulated or measured response data (requires System Identification Toolbox™ software). PID Tuner uses system identification to estimate a linear plant model from the time-domain response of your plant to an applied input. For an example, see Interactively Estimate Plant from Measured or Simulated Response Data.
As an alternative, you can exit PID Tuner and use the Frequency Response Based PID Tuner, which runs simulations to perturb the plant and estimate frequency responses at frequencies near the control bandwidth. See Frequency-Response Based Tuning.
PID Tuner computes an initial compensator design for the linearized plant model using the algorithm described in PID Tuning Algorithm.
PID Tuner displays the closed-loop step reference tracking response for the initial compensator design. For comparison, the display also includes the closed-loop response for the gains specified in the PID controller block, if that closed loop is stable, as shown in the following figure.
After the tuner opens, you can close the controller block dialog box.