pid2
2-DOF PID controller in parallel form
Description
Use pid2
to create parallel-form, two-degree-of-freedom (2-DOF)
proportional-integral-derivative (PID) controller model objects, or to convert dynamic system models to parallel 2-DOF PID controller
form.
2-DOF PID controllers include setpoint weighting on the proportional and derivative terms. A 2-DOF PID controller can achieve fast disturbance rejection without significant increase of overshoot in setpoint tracking. 2-DOF PID controllers are also useful to mitigate the influence of changes in the reference signal on the control signal. The following illustration shows a typical control architecture using a 2-DOF PID controller.
The pid2
controller model object can represent parallel-form PID
controllers in continuous time or discrete time.
Continuous time —
Discrete time —
Here:
b is the setpoint weighting on the proportional term.
c is the setpoint weighting on the derivative term.
Kp is the proportional gain.
Ki is the integral gain.
Kd is the derivative gain.
Tf is the first-order derivative filter time constant.
IF(z) is the integrator method for computing the integral in the discrete-time controller.
DF(z) is the integrator method for computing the derivative filter in the discrete-time controller.
You can then combine this object with other components of a control architecture, such as the plant, actuators, and sensors to represent your control system. For more information, see Control System Modeling with Model Objects.
You can create a PID controller model object by either specifying the controller
parameters directly, or by converting a model of another type (such as a transfer function
model tf
) to PID controller form.
You can also use pid2
to create generalized state-space (genss
) models or uncertain state-space (uss
(Robust Control Toolbox)) models.
Creation
You can obtain pid2
controller models in one of the following
ways.
Create a model using the
pid2
function.Use the
pidtune
function to tune PID controllers for a plant model. Specify a 2-DOF PID controller type in thetype
argument of thepidtune
function to obtain a parallel-form 2-DOF PID controller. For example:sys = zpk([],[-1 -1 -1],1); C2 = pidtune(sys,'PID2');
Interactively tune the PID controller for a plant model using:
The Tune PID Controller Live Editor task.
The PID Tuner app.
Syntax
Description
Input Arguments
Output Arguments
Properties
Object Functions
The following lists contain a representative subset of the functions you can use with pid2
models. In general, any function applicable to Dynamic System Models is applicable to a pid2
object.
Examples
Tips
To break a 2-DOF controller into two SISO control components, such as a feedback controller and a feedforward controller, use
getComponents
.Create arrays of
pid2
controller objects by:Specifying array values for one or more of the coefficients
Kp
,Ki
,Kd
,Tf
,b
, andc
.Specifying an array of dynamic systems
sys
to convert topid2
controller objects.Using
stack
to build arrays from individual controllers or smaller arrays.Passing an array of plant models to
pidtune
.
In an array of
pid2
controllers, each controller must have the same sample timeTs
and discrete integrator formulasIFormula
andDFormula
.To create or convert to a standard-form controller, use
pidstd2
. Standard form expresses the controller actions in terms of an overall proportional gain Kp, integral and derivative times Ti and Td, and filter divisor N. For example, the relationship between the inputs and output of a continuous-time standard-form 2-DOF PID controller is given by:There are two ways to discretize a continuous-time
pid2
controller:Use the
c2d
command.c2d
computes new parameter values for the discretized controller. The discrete integrator formulas of the discretized controller depend upon thec2d
discretization method you use, as shown in the following table.c2d
Discretization MethodIFormula
DFormula
'zoh'
ForwardEuler
ForwardEuler
'foh'
Trapezoidal
Trapezoidal
'tustin'
Trapezoidal
Trapezoidal
'impulse'
ForwardEuler
ForwardEuler
'matched'
ForwardEuler
ForwardEuler
For more information about
c2d
discretization methods, See thec2d
reference page. For more information aboutIFormula
andDFormula
, see Properties.If you require different discrete integrator formulas, you can discretize the controller by directly setting
Ts
,IFormula
, andDFormula
to the desired values. (See Discretize a Continuous-Time 2-DOF PID Controller.) However, this method does not compute new gain and filter-constant values for the discretized controller. Therefore, this method might yield a poorer match between the continuous- and discrete-timepid2
controllers than usingc2d
.
Version History
Introduced in R2015b