tune 2-dof pid controller (pid tuner)
this example shows how to design a two-degree-of-freedom (2-dof) pid controller using pid tuner. the example also compares the 2-dof controller performance to the performance achieved with a 1-dof pid controller.
in this example, you represent the plant as an . for information about using pid tuner to tune a pid controller (2dof) block in a simulink® model, see (simulink control design).
2-dof pid controllers include setpoint weighting on the proportional and derivative terms. compared to a 1-dof pid controller, a 2-dof pid controller can achieve better disturbance rejection without significant increase of overshoot in setpoint tracking. a typical control architecture using a 2-dof pid controller is shown in the following diagram.
for this example, first design a 1-dof controller for the plant given by:
g = tf(1,[1 0.5 0.1]); pidtuner(g,'pid')
suppose for this example that your application requires a faster response than the pid tuner initial design. in the text box next to the response time slider, enter 2.
the resulting response is fast, but has a considerable amount of overshoot.
design a 2-dof controller to improve the overshoot. first, set the 1-dof
controller as the baseline controller for comparison. click the
export arrow and select save as
baseline
.
design the 2-dof controller. in the type menu, select
pid2
.
pid tuner generates a 2-dof controller with the same target
response time. the controller parameters displayed at the bottom right show that
pid tuner tunes all controller coefficients, including the
setpoint weights b
and c
, to balance
performance and robustness. compare the 2-dof controller performance (solid
line) with the performance of the 1-dof controller that you stored as the
baseline (dotted line).
adding the second degree of freedom eliminates the overshoot in the reference tracking response. next, add a step response plot to compare the disturbance rejection performance of the two controllers. select add plot > input disturbance rejection.
you can move the plots in the pid tuner such that the disturbance-rejection plot side by side with the reference-tracking plot.
the disturbance-rejection performance is identical with both controllers. thus, using a 2-dof controller eliminates reference-tracking overshoot without any cost to disturbance rejection.
you can improve disturbance rejection too by changing the pid tuner
design focus. first, click the export arrow
and select save as
baseline
again to set the 2-dof controller as the baseline for
comparison.
change the pid tuner design focus to favor reference tracking
without changing the response time or the transient-behavior coefficient. to do
so, click
options, and in the focus menu, select
input disturbance rejection
.
pid tuner automatically retunes the controller coefficients with a focus on disturbance-rejection performance.
with the default balanced design focus, pid tuner selects a
b
value between 0 and 1. for this plant, when you change
design focus to favor disturbance rejection, pid tuner sets
b
= 0 and c
= 0. thus, pid
tuner automatically generates an i-pd controller to optimize for
disturbance rejection. (explicitly specifying an i-pd controller without setting
the design focus yields a similar controller.)
the response plots show that with the change in design focus, the disturbance rejection is further improved compared to the balanced 2-dof controller. this improvement comes with some sacrifice of reference-tracking performance, which is slightly slower. however, the reference-tracking response still has no overshoot.
thus, using 2-dof control can improve disturbance rejection without sacrificing as much reference tracking performance as 1-dof control. these effects on system performance depend strongly on the properties of your plant and the speed of your controller. for some plants and some control bandwidths, using 2-dof control or changing the design focus has less or no impact on the tuned result.