This example shows how to tune a PID controller to reduce overshoot in reference tracking or to improve rejection of a disturbance at the plant input. Using the PID Tuner app, the example illustrates the tradeoff between reference tracking and disturbance-rejection performance in PI and PID control systems.
Load a Simulink® model that contains a PID Controller block.
The plant in this example is:
The model also includes a reference signal and a step disturbance
at the plant input. Reference tracking is the response at
the reference signal,
r. Disturbance rejection
is a measure of the suppression at
y of the injected
d. When you use PID Tuner to
tune the controller, you can adjust the design to favor reference
tracking or disturbance rejection as your application requires.
Design an initial controller for the plant. To do so, double-click the PID Controller block to open the Block Parameters dialog box, and click Tune. PID Tuner opens and automatically computes an initial controller design.
The PID Controller in the Simulink model is configured as a PI-type controller. Therefore, the initial controller designed by PID Tuner is also of PI-type.
Add a step response plot of the input disturbance rejection. Select Add Plot > Input Disturbance Rejection.
PID Tuner tiles the disturbance-rejection plot side by side with the reference-tracking plot.
Tip Use the options in the View tab to change how PID Tuner displays multiple plots.
By default, for a given bandwidth and phase margin, PID Tuner tunes the controller to achieve a balance between reference tracking and disturbance rejection. In this case, the controller yields some overshoot in the reference-tracking response. The controller also suppresses the input disturbance with a longer settling time than the reference tracking, after an initial peak.
Click to update the Simulink model with this initial controller design. Doing so also updates the Block Response plots in PID Tuner, so that as you change the controller design, you can compare the results with the initial design.
Depending on your application, you might want to alter the balance
between reference tracking and disturbance rejection to favor one
or the other. For a PI controller, you can alter this balance using
the Transient Behavior slider. Move the Transient
behavior slider to the left to improve the disturbance
rejection. The responses with the initial controller design are now
displayed as the
Block response (dotted line).
Lowering the transient-behavior coefficient to 0.45 speeds up disturbance rejection, but also increases overshoot in the reference-tracking response.
Tip Right-click on the reference-tracking plot and select Characteristics > Peak Response to obtain a numerical value for the overshoot.
Move the Transient behavior to the right until the overshoot in the reference-tracking response is minimized.
Increasing the transient-behavior coefficient to 0.70 nearly eliminates the overshoot, but results in extremely sluggish disturbance rejection. You can try moving the Transient behavior slider until you find a suitable balance between reference tracking and disturbance rejection for your application. How much the slider affects the balance depends on the plant model. For some plant models, the effect is not as large as shown in this example.
So far, the response time of the control system has remained fixed while you have changed the transient-behavior coefficient. These operations are equivalent to fixing the bandwidth and varying the target minimum phase margin of the system. If you want to fix both the bandwidth and target phase margin, you can still change the balance between reference tracking and disturbance rejection. To tune a controller that favors either disturbance rejection or reference tracking, you change the design focus of the PID tuning algorithm.
Changing the PID Tuner design focus is more
effective the more tunable parameters there are in the control system.
Therefore, it does not have much effect when used with a PI controller.
To see its effect, change the controller type to PID. In the Simulink model,
double-click the PID controller block. In the block
parameters dialog box, in the Controller drop-down
Click Apply. Then, click Tune. This action updates PID Tuner with a new controller design, this time for a PID controller. Click to the Simulink model with this initial PID controller design, so that you can compare the results when you change design focus.
As in the PI case, the initial PID design balances reference tracking and disturbance rejection. In this case as well, the controller yields some overshoot in the reference-tracking response, and suppresses the input disturbance with a longer settling time.
Change the PID Tuner design focus to favor
reference tracking without changing the response time or the transient-behavior
coefficient. To do so, click
and in the Focus menu, select
PID Tuner automatically retunes the controller coefficients with a focus on reference-tracking performance.
The responses with the balanced controller are now displayed
Block response, and the controller tuned
with a focus reference-tracking is the
The plots show that the resulting controller tracks the reference
input with considerably less overshoot and a faster settling time
than the balanced controller design. However, the design yields much
poorer disturbance rejection.
Finally, change the design focus to favor disturbance
rejection. In the
box, in the Focus menu, select
This controller design yields improved disturbance rejection, but results in some increased overshoot in the reference-tracking response.
When you use design focus option, you can still adjust the Transient Behavior slider for further fine-tuning of the balance between these two measures of performance. Use the design focus and the sliders together to achieve the performance balance that best meets your design requirements. The effect of this fine-tuning on system performance depends strongly on the properties of your plant. For some plants, moving the Transient Behavior slider or changing the Focus option has little or no effect.
To obtain independent control over reference tracking and disturbance rejection, you can use a two-degree-of-freedom controller block, PID Controller (2DOF), instead of a single degree-of-freedom controller.