Tunable two-degree-of-freedom PID controller
blk = tunablePID2(name,type)
blk = tunablePID2(name,type,Ts)
blk = tunablePID2(name,sys)
Model object for creating tunable two-degree-of-freedom PID
controllers. tunablePID2
lets you parametrize
a tunable SISO two-degree-of-freedom PID controller. You can use this
parametrized controller for parameter studies or for automatic tuning
with tuning commands such as systune
, looptune
,
or the Robust Control Toolbox™ command hinfstruct
.
tunablePID2
is part of the family of parametric Control
Design Blocks. Other parametric Control Design Blocks include tunableGain
, tunableSS
,
and tunableTF
.
creates
the two-degree-of-freedom continuous-time PID controller described
by the equation:blk
= tunablePID2(name
,type
)
r is the setpoint command, y is the measured response to that setpoint, and u is the control signal, as shown in the following illustration.
The tunable parameters of the block are:
Scalar gains Kp
, Ki
,
and Kd
Filter time constant Tf
Scalar weights b
and c
The type
argument sets the controller type
by fixing some of these values to zero (see Input Arguments).
creates
a discrete-time PID controller with sample time blk
= tunablePID2(name
,type
,Ts
)Ts
.
The equation describing this controller is:
IF(z) and DF(z)
are the discrete integrator formulas for the integral and derivative
terms, respectively. The values of the IFormula
and DFormula
properties
set the discrete integrator formulas (see Properties).
uses
the dynamic system model, blk
= tunablePID2(name
,sys
)sys
, to set the sample
time, Ts
, and the initial values of all the tunable
parameters. The model sys
must be compatible
with the equation of a two-degree-of-freedom PID controller.
|
PID controller | |||||||||||||||
|
Controller type, specified as one of the values in the following table. Specifying a controller type fixes up to three of the PID controller parameters.
| |||||||||||||||
|
Sample time, specified as a scalar. | |||||||||||||||
|
Dynamic system model representing a two-degree-of-freedom PID controller. |
|
Parametrization of the PID gains The following fields of
| ||||||||||
|
Discrete integrator formulas IF(z) and DF(z) for the integral and derivative terms, respectively, specified as one of the values in the following table.
Default: | ||||||||||
|
Sample time. For continuous-time models, Changing this property does not discretize or resample the model. 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: |
Tunable Two-Degree-of-Freedom Controller with a Fixed Parameter
Create a tunable two-degree-of-freedom PD controller. Then, initialize the parameter values, and fix the filter time constant.
blk = tunablePID2('pdblock','PD'); blk.b.Value = 1; blk.c.Value = 0.5; blk.Tf.Value = 0.01; blk.Tf.Free = false; blk
blk = Parametric continuous-time 2-DOF PID controller "pdblock" with equation: s u = Kp (b*r-y) + Kd -------- (c*r-y) Tf*s+1 where r,y are the controller inputs and Kp, Kd, b, c are tunable gains. Type "showBlockValue(blk)" to see the current value and "get(blk)" to see all properties.
Controller Initialized by Dynamic System Model
Create a tunable two-degree-of-freedom PI controller. Use a
two-input, one-output tf
model
to initialize the parameters and other properties.
s = tf('s'); Kp = 10; Ki = 0.1; b = 0.7; sys = [(b*Kp + Ki/s), (-Kp - Ki/s)]; blk = tunablePID2('PI2dof',sys)
blk = Parametric continuous-time 2-DOF PID controller "PI2dof" with equation: 1 u = Kp (b*r-y) + Ki --- (r-y) s where r,y are the controller inputs and Kp, Ki, b are tunable gains. Type "showBlockValue(blk)" to see the current value and "get(blk)" to see all properties.
blk
takes initial parameter values from sys
.
If sys
is a discrete-time system, blk
takes
the value of properties, such as Ts
and IFormula
,
from sys
.
Controller with Named Inputs and Output
Create a tunable PID controller, and assign names to the inputs and output.
blk = tunablePID2('pidblock','pid'); blk.InputName = {'reference','measurement'}; blk.OutputName = {'control'};
blk.InputName
is a cell array containing
two names, because a two-degree-of-freedom PID controller has two
inputs.
You can modify the PID structure by fixing or freeing
any of the parameters. For example, blk.Tf.Free = false
fixes Tf
to
its current value.
To convert a tunablePID2
parametric
model to a numeric (nontunable) model object, use model commands such
as tf
or ss
. You can also use getValue
to
obtain the current value of a tunable model.
genss
| looptune
| systune
| tunableGain
| tunablePID
| tunableSS
| tunableTF
| hinfstruct
(Robust Control Toolbox)