Designing PID Controllers with PID Tuner
In Control System Toolbox™, PID Tuner lets you perform automatic, interactive tuning of PID controllers for plants represented by LTI models.
For information about using PID Tuner to tune a PID Controller block in a Simulink® model, see Introduction to Model-Based PID Tuning in Simulink (Simulink Control Design).
PID Tuner Overview
Use PID Tuner to interactively design a SISO PID controller in a single-loop, negative-feedback control configuration.
PID Tuner automatically designs a controller for your plant. You specify the controller type (P, I, PI, PD, PDF, PID, PIDF) and form (parallel or standard).
You can also use PID Tuner to design a 2-DOF PID controller for the feedback configuration of the following illustration:
PID Tuner can design 2-DOF PID controllers in which the setpoint weights can be free and tunable parameters. PID Tuner can also design controllers in which the setpoint weights are fixed in common control configurations, such as I-PD and PI-D.
You can analyze the design using a variety of response plots, and interactively adjust the design to meet your performance requirements.
To launch PID Tuner, use the pidTuner
command:
pidTuner(sys,type)
where sys
is a linear model of the plant you want to control, and
type
is indicates the controller
type to design.
Alternatively, enter
pidTuner(sys,Cbase)
where Cbase
is a baseline controller, allowing you to compare the
performance of the designed controller to the performance of
Cbase
.
For more information about sys
and Cbase
, see the
pidTuner
reference page.
Note
You can also open PID Tuner from the MATLAB® desktop, in the Apps tab. When you do so, use the Plant menu in PID Tuner to specify your plant model.
PID Controller Type
To select the controller type, use one of these methods:
Specify type when opening the app — Provide the
type
argument to thepidTuner
command when you open PID Tuner. For example,pidTuner(G,'PIDF2')
opens PID Tuner with an initial design that is a 2-DOF PID controller with a filter on the derivative term.Specify type with an existing controller object — Provide the baseline-controller
Cbase
argument to thepidTuner
command when you open PID Tuner. PID Tuner designs a controller of the same type asCbase
. For example, supposeC0
is apid
controller object that has proportional and derivative action only (PD controller). Then,pidTuner(G,C0)
opens PID Tuner with an initial design that is a PD controller.Specify controller type within the app — In PID Tuner, use the Type menu to change controller types.
The following tables summarize the available PID controller types. For more information about these controller types, see PID Controller Types for Tuning.
1-DOF Controllers
type input to
pidTuner | Entry in Type menu | Controller Actions |
---|---|---|
'P' | P | Proportional only |
'I' | I | Integral only |
'PI' | PI | Proportional and integral |
'PD' | PD | Proportional and derivative |
'PDF' | PDF | Proportional and derivative with first-order filter on derivative term |
'PID' | PID | Proportional, integral, and derivative |
'PIDF' | PIDF | Proportional, integral, and derivative with first-order filter on derivative term |
2-DOF Controllers
PID Tuner can automatically design 2-DOF PID controller types with free setpoint weights. The following table summarizes the 2-DOF controller types in PID Tuner. For more information about 2-DOF PID controllers generally, see Two-Degree-of-Freedom PID Controllers.
type input to
pidTuner | Entry in Type menu | Controller Actions |
---|---|---|
'PI2' | PI2 | 2-DOF proportional and integral |
'PD2' | PD2 | 2-DOF proportional and derivative |
'PDF2' | PDF2 | 2-DOF proportional and derivative with first-order filter on derivative term |
'PID2' | PID2 | 2-DOF proportional, integral, and derivative |
'PIDF2' | PIDF2 | 2-DOF proportional, integral, and derivative with first-order filter on derivative term |
2-DOF Controllers with Fixed Setpoint Weights
Use PID Tuner to design the fixed-setpoint-weight controller types summarized in the following table. For more information about these controller types, see PID Controller Types for Tuning.
type input to
pidTuner | Entry in Type menu | Controller Actions |
---|---|---|
'I-PD' | I-PD | 2-DOF PID with b = 0, c = 0 |
'I-PDF' | I-PDF | 2-DOF PIDF with b = 0, c = 0 |
'ID-P' | ID-P | 2-DOF PID with b = 0, c = 1 |
'IDF-P' | IDF-P | 2-DOF PIDF with b = 0, c = 1 |
'PI-D' | PI-D | 2-DOF PID with b = 1, c = 0 |
'PI-DF' | PI-DF | 2-DOF PIDF with b = 1, c = 0 |
Discrete-Time Controller Types
If sys
is a discrete-time model with sample time
Ts
, PID Tuner designs a discrete-time
pid
controller using the ForwardEuler
discrete
integrator formula. To design a controller that has different discrete integrator
formulas, use one of the following methods:
Provide a discrete-time baseline controller
Cbase
to the launch commandpidTuner
. PID Tuner designs a controller that has the same discrete integrator formulas asCbase
.After launching PID Tuner, click Options to open the Controller Options dialog box. Select discrete integrator formulas from the Integral Formula and Derivative Formula menus.
For more information about discrete integrator formulas, see the pid
, pid2
, pidstd
, and pidstd2
reference pages.
PID Controller Form
When you use the type
input to pidTuner
,
PID Tuner designs a controller in parallel form. To design a controller in
standard form, use one of the following methods:
Provide a standard-form baseline controller
Cbase
to the launch commandpidTuner
. PID Tuner designs a controller of the same form asCbase
.Use the Form menu to change controller form after launching PID Tuner.
For more information about parallel and standard controller forms, see the pid
, pid2
, pidstd
, and pidstd2
reference pages.