Create PID controller in parallel form, convert to parallel-form PID controller
C = pid(Kp,Ki,Kd,Tf)
C = pid(Kp,Ki,Kd,Tf,Ts)
C = pid(sys)
C = pid(Kp)
C = pid(Kp,Ki)
C = pid(Kp,Ki,Kd)
C = pid(...,Name,Value)
C = pid
creates
a continuous-time PID controller with proportional, integral, and
derivative gains C
= pid(Kp
,Ki
,Kd
,Tf
)Kp
, Ki
,
and Kd
and first-order derivative filter time
constant Tf
:
This representation is in parallel form.
If all of Kp
, Ki
, Kd
,
and Tf
are real, then the resulting C
is
a pid
controller object. If one or more of these
coefficients is tunable (realp
or genmat
),
then C
is a tunable generalized state-space (genss
)
model object.
creates
a discrete-time PID controller with sample time C
= pid(Kp
,Ki
,Kd
,Tf
,Ts
)Ts
.
The controller is:
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
about IFormula
and DFormula
).
If DFormula
= 'ForwardEuler'
(the
default value) and Tf
≠ 0, then Ts
and Tf
must
satisfy Tf > Ts/2
.
This requirement ensures a stable derivative filter pole.
converts
the dynamic system C
= pid(sys
)sys
to a parallel form pid
controller
object.
creates
a continuous-time proportional (P) controller with C
= pid(Kp
)Ki
= 0, Kd
= 0, and Tf
= 0.
creates
a proportional and integral (PI) controller with C
= pid(Kp
,Ki
)Kd
= 0 and Tf
= 0.
creates
a proportional, integral, and derivative (PID) controller with C
= pid(Kp
,Ki
,Kd
)Tf
= 0.
creates
a controller or converts a dynamic system to a C
= pid(...,Name,Value
)pid
controller
object with additional options specified by one or more Name,Value
pair
arguments.
|
Proportional gain.
When Default: 1 |
|
Integral gain.
When Default: 0 |
|
Derivative gain.
When Default: 0 |
|
Time constant of the first-order derivative filter.
When Default: 0 |
|
Sample time. To create a discrete-time
Default: 0 (continuous time) |
|
SISO dynamic system to convert to parallel
|
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 pid
controller, or to set other
object properties such as InputName
and OutputName
.
For information about available properties of pid
controller
objects, see Properties.
|
PID controller, represented as a
|
|
PID controller gains. The |
|
Derivative filter time constant. The |
|
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. Use this
property to name the input channel of the controller model. For example,
assign the name C.InputName = 'error'; You can use the shorthand notation Input channel names have several uses, including:
Default: Empty character vector, |
|
Input channel units, specified as a character vector. Use this
property to track input signal units. For example, assign the concentration
units C.InputUnit = 'mol/m^3';
Default: Empty character vector, |
|
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: |
Use pid
to:
Create a pid
controller object
from known PID gains and filter time constant.
Convert a pidstd
controller object
to a standard-form pid
controller object.
Convert other types of dynamic system models to a pid
controller
object.
To design a PID controller for a particular plant, use pidtune
or pidTuner
. To create a tunable PID
controller as a control design block, use tunablePID
.
Create arrays of pid
controller
objects by:
In an array of pid
controllers, each controller
must have the same sample time Ts
and discrete
integrator formulas IFormula
and DFormula
.
To create or convert to a standard-form controller,
use pidstd
. 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:
There are two ways to discretize a continuous-time pid
controller:
Use the c2d
command. c2d
computes
new parameter values for the discretized controller. The discrete
integrator formulas of the discretized controller depend upon the c2d
discretization
method you use, as shown in the following table.
c2d Discretization
Method | IFormula | DFormula |
---|---|---|
'zoh' | ForwardEuler | ForwardEuler |
'foh' | Trapezoidal | Trapezoidal |
'tustin' | Trapezoidal | Trapezoidal |
'impulse' | ForwardEuler | ForwardEuler |
'matched' | ForwardEuler | ForwardEuler |
For more information about c2d
discretization methods, see the c2d
reference page. For more information about IFormula
and
DFormula
, see Properties .
If you require different discrete integrator formulas,
you can discretize the controller by directly setting Ts
, IFormula
,
and DFormula
to the desired values. (See Discretize a Continuous-Time 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-time pid
controllers
than using c2d
.