pidstd2
2-DOF PID controller in standard form
Description
Use pidstd2
to create standard-form, two-degree-of-freedom
(2-DOF) proportional-integral-derivative (PID) controller model objects, or to convert dynamic system models to standard 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 pidstd2
controller model object can represent standard-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.
Ti is the integral time.
Td is the derivative time.
N is the first-order derivative filter divisor.
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 pidstd2
to create generalized state-space (genss
) models or uncertain state-space (uss
(Robust Control Toolbox)) models.
Creation
You can obtain pidstd2
controller models in one of the following
ways.
Create a model using the
pidstd2
function.Use the
pidtune
function to tune PID controllers for a plant model. Specify a baseline standard-form 2-DOF PID controller type using theC0
argument of thepidtune
function. For example:sys = zpk([],[-1 -1 -1],1); C0 = pidstd2(1,1,1); C2 = pidtune(sys,C0)
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 pidstd2
models. In general, any function applicable to Dynamic System Models is applicable to a pidstd2
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
pidstd2
controllers by:Specifying array values for one or more of the coefficients
Kp
,Ti
,Td
,N
,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
pidstd2
controllers, each controller must have the same sample timeTs
and discrete integrator formulasIFormula
andDFormula
.To create or convert to a parallel-form controller, use
pid2
. Parallel form expresses the controller actions in terms of proportional, integral, and derivative gains Kp, Ki and Kd, and a filter time constant Tf. For example, the relationship between the inputs and output of a continuous-time parallel-form 2-DOF PID controller is given by:There are two ways to discretize a continuous-time
pidstd2
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 Standard-Form 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-timepidstd2
controllers than usingc2d
.
Version History
Introduced in R2015b