pidstd2
Create 2-DOF PID controller in standard form, convert to standard-form 2-DOF PID controller
Syntax
C2 = pidstd2(Kp,Ti,Td,N,b,c)
C2 = pidstd2(Kp,Ti,Td,N,b,c,Ts)
C2 = pidstd2(sys)
C2 = pid2(___,Name,Value)
Description
pid2
controller objects represent
two-degree-of-freedom (2-DOF) PID controllers in parallel form. Use pid2
either
to create a pid2
controller object from known
coefficients or to convert a dynamic system model to a pid2
object.
Two-degree-of-freedom (2-DOF) PID controllers include setpoint weighting on the proportional and derivative terms. A 2-DOF PID controller is capable of 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.
creates
a continuous-time 2-DOF PID controller with proportional gain C2
= pidstd2(Kp
,Ti
,Td
,N
,b
,c
)Kp
,
integrator and derivative time constants Ti
,
and Td
, and derivative filter divisor N
.
The controller also has setpoint weighting b
on
the proportional term, and setpoint weighting c
on
the derivative term. The relationship between the 2-DOF controller’s
output (u) and its two inputs (r and y)
is given by:
This representation is in standard form.
If all of the coefficients are real-valued, then the resulting C2
is
a pidstd2
controller object. If one or more of
these coefficients is tunable (realp
or genmat
),
then C2
is a tunable generalized state-space
(genss
) model object.
creates
a discrete-time 2-DOF PID controller with sample time C2
= pidstd2(Kp
,Ti
,Td
,N
,b
,c
,Ts
)Ts
.
The relationship between the controller’s output and inputs
is given by:
IF(z) and DF(z) are the discrete integrator formulas for the integrator and derivative filter. By default,
To choose different discrete integrator formulas, use the IFormula
and DFormula
properties.
(See Properties for more information).
If DFormula
= 'ForwardEuler'
(the
default value) and N
≠ Inf
, then Ts
, Td
,
and N
must satisfy Td/N > Ts/2
. This requirement ensures a stable derivative
filter pole.
converts
the dynamic system C2
= pidstd2(sys
)sys
to a standard form pidstd2
controller
object.
specifies
additional properties as comma-separated pairs of C2
= pid2(___,Name,Value
)Name,Value
arguments.
Input Arguments
|
Proportional gain.
Default: 1 |
|
Integrator time.
When Default: |
|
Derivative time.
When Default: 0 |
|
Derivative filter divisor.
When Default: |
|
Setpoint weighting on proportional term.
When Default: 1 |
|
Setpoint weighting on derivative term.
When Default: 1 |
|
Sample time. To create a discrete-time
Default: 0 (continuous time) |
|
SISO dynamic system to convert to standard
|
Name-Value Arguments
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
Use Name,Value
syntax to set the numerical
integration formulas IFormula
and DFormula
of
a discrete-time pidstd2
controller, or to set
other object properties such as InputName
and OutputName
.
For information about available properties of pidstd2
controller
objects, see Properties.
Output Arguments
|
2-DOF PID controller, returned as a
|
Properties
|
Setpoint weights on the proportional and derivative terms, respectively. |
|
Proportional gain. The value of |
|
Integrator time. |
|
Derivative time. |
|
Derivative filter divisor. |
|
Discrete integrator formula IF(z)
for the integrator of the discrete-time
When Default: |
|
Discrete integrator formula DF(z)
for the derivative filter of the discrete-time
When Default: |
|
Time delay on the system input. |
|
Time delay on the system Output. |
|
Sample time. For continuous-time models, Changing this property does not discretize or resample the model.
Use Default: |
|
Units for the time variable, the sample time
Changing this property has no effect on other properties, and
therefore changes the overall system behavior. Use Default: |
|
Input channel name, specified as a character vector or a 2-by-1
cell array of character vectors. Use this property to name the input
channels of the controller model. For example, assign the names C.InputName = {'setpoint';'measurement'}; Alternatively, use automatic vector expansion to assign both input names. For example: C.InputName = 'C-input'; The input names automatically expand to You can use the shorthand notation Input channel names have several uses, including:
Default: |
|
Input channel units, specified as a 2-by-1 cell array of character
vectors. Use this property to track input signal units. For example,
assign the units C.InputUnit = {'Volts';'mol/m^3'};
Default: |
|
Input channel groups. This property is not needed for PID controller models. Default: |
|
Output channel name, specified as a character vector. Use this
property to name the output channel of the controller model. For example,
assign the name C.OutputName = 'control'; You can use the shorthand notation Input channel names have several uses, including:
Default: Empty character vector, |
|
Output channel units, specified as a character vector. Use this
property to track output signal units. For example, assign the unit C.OutputUnit = 'Volts';
Default: Empty character vector, |
|
Output channel groups. This property is not needed for PID controller models. Default: |
|
System name, specified as a character vector. For example, Default: |
|
Any text that you want to associate with the system, stored as a string or a cell array of
character vectors. The property stores whichever data type you
provide. For instance, if sys1.Notes = "sys1 has a string."; sys2.Notes = 'sys2 has a character vector.'; sys1.Notes sys2.Notes ans = "sys1 has a string." ans = 'sys2 has a character vector.' Default: |
|
Any type of data you want to associate with system, specified as any MATLAB® data type. Default: |
|
Sampling grid for model arrays, specified as a data structure. For model arrays that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model in the array. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables. Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array. For example, suppose you create a 11-by-1
array of linear models, sysarr.SamplingGrid = struct('time',0:10) Similarly, suppose you create a 6-by-9
model array, [zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>) M.SamplingGrid = struct('zeta',zeta,'w',w) When you display M M(:,:,1,1) [zeta=0.3, w=5] = 25 -------------- s^2 + 3 s + 25 M(:,:,2,1) [zeta=0.35, w=5] = 25 ---------------- s^2 + 3.5 s + 25 ... For model arrays generated by linearizing a Simulink® model
at multiple parameter values or operating points, the software populates Default: |
Examples
Tips
To design a PID controller for a particular plant, use
pidtune
orpidTuner
. To create a tunable 2-DOF PID controller as a control design block, usetunablePID2
.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: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