| Contents | Index |
blk = ltiblock.pid(name,type)
blk = ltiblock.pid(name,type,Ts)
blk = ltiblock.pid(name,sys)
Model object for creating tunable one-degree-of-freedom PID controllers. ltiblock.pid lets you parametrize a tunable SISO PID controller for for parameter studies or for automatic tuning with hinfstruct (requires Robust Control Toolbox).
ltiblock.pid is part of the Control Design Block family of parametric models. Other Control Design Blocks includeltiblock.gain, ltiblock.ss, and ltiblock.tf.
blk = ltiblock.pid(name,type) creates the one-degree-of-freedom continuous-time PID controller:
![]()
with tunable parameters Kp, Ki, Kd, and Tf. The string type sets the controller type by fixing some of these values to zero (see Input Arguments).
blk = ltiblock.pid(name,type,Ts) creates a discrete-time PID controller with sampling time Ts:
![]()
where 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).
blk = ltiblock.pid(name,sys) uses the dynamic system sys to set the sampling time Ts and the initial values of the parameters Kp, Ki, Kd, and Tf.
name |
String specifying the PID controller Name . (See Properties.) | |||||||||||||||
type |
String specifying controller type. Specifying a controller type fixes up to three of the PID controller parameters. type can take the following values:
| |||||||||||||||
Ts |
Scalar sampling time. | |||||||||||||||
sys |
Dynamic system model representing a PID controller. |
You can modify the PID structure by fixing or freeing any of the parameters Kp, Ki, Kd, and Tf. For example, blk.Tf.Free = false fixes Tf to its current value.
To convert an ltiblock.pid parametric model to a numeric (non-tunable) model object, use model commands such as pid, pidstdtf, or ss.
Kp, Ki, Kd, Tf |
Parametrization of the PID gains Kp, Ki, Kd, and filter time constant Tf of the tunable PID controller blk. blk.Kp, blk.Ki, blk.Kd, and blk.Tf are param.Continuous objects. For general information about the properties of these param.Continuous objects, see the param.Continuous object reference page. The following fields of blk.Kp, blk.Ki, blk.Kd, and blk.Tf are used when you tune blk using hinfstruct:
| ||||||||
IFormula, DFormula |
Strings setting the discrete integrator formulas IF(z) and DF(z) for the integral and derivative terms, respectively. IFormula and DFormula can have the following values:
Default: 'ForwardEuler' | ||||||||
Ts |
Sampling time. For continuous-time models, Ts = 0. For discrete-time models, Ts is a positive scalar representing the sampling period expressed in the unit specified by the TimeUnit property of the model. To denote a discrete-time model with unspecified sampling time, set Ts = -1. Changing this property does not discretize or resample the model. Use c2d and d2c to convert between continuous- and discrete-time representations. Use d2d to change the sampling time of a discrete-time system. Default: 0 (continuous time) | ||||||||
TimeUnit |
String representing the unit of the time variable, any time delays in the model (for continuous-time models), and the sampling time Ts (for discrete-time models). TimeUnit can take the following values:
Changing this property changes the overall system behavior. Use chgTimeUnit to convert between time units without modifying system behavior. Default: 'seconds' | ||||||||
InputName |
Input channel names. Set InputName to a string for single-input model. For a multi-input model, set InputName to a cell array of strings. Alternatively, use automatic vector expansion to assign input names for multi-input models. For example, if sys is a two-input model, enter: sys.InputName = 'controls'; The software automatically expands the input names to {'controls(1)';'controls(2)'}. You can use the shorthand notation u to refer to the InputName property. For example, sys.u is equivalent to sys.InputName. Input channel names have several uses, including:
Default: Empty string '' for all input channels | ||||||||
InputUnit |
Input channel units. Use InputUnit to keep track of input signal units. Set InputUnit to a string for single-input model, or to a cell array of strings for a multi-input model. InputUnit has no effect on system behavior. Default: Empty string '' for all input channels | ||||||||
InputGroup |
Input channel groups. The InputGroup property lets you assign the input channels of MIMO systems into groups and refer to each group by name. Specify input groups as a structure whose field names are the group names and whose field values are the input channels belong to each group. For example: sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5]; creates input groups named controls and noise that include input channels 1, 2 and 3, 5, respectively. You can then extract the subsystem from the controls inputs to all outputs using: sys(:,'controls') Default: Struct with no fields | ||||||||
OutputName |
Output channel names. Set OutputName to a string for single-output model. For a multi-output model, set OutputName to a cell array of strings. Alternatively, use automatic vector expansion to assign output names for multi-output models. For example, if sys is a two-output model, enter: sys.OutputName = 'measurements'; The software automatically expands the output names to {'measurements(1)';'measurements(2)'}. You can use the shorthand notation y to refer to the OutputName property. For example, sys.y is equivalent to sys.OutputName. Output channel names have several uses, including:
Default: Empty string '' for all input channels | ||||||||
OutputUnit |
Output channel units. Use OutputUnit to keep track of output signal units. Set OutputUnit to a string for single-input model, or to a cell array of strings for a multi-input model. OutputUnit has no effect on system behavior. Default: Empty string '' for all input channels | ||||||||
OutputGroup |
Output channel groups. The OutputGroup property lets you assign the output channels of MIMO systems into groups and refer to each group by name. Specify output groups as a structure whose field names are the group names and whose field values are the output channels belong to each group. For example: sys.OutputGroup.temperature = [1]; sys.InputGroup.measurement = [3 5]; creates output groups named temperature and measurement that include output channels 1, and 3, 5, respectively. You can then extract the subsystem from all inputs to the measurement outputs using: sys('measurement',:)
Default: Struct with no fields | ||||||||
Name | System name. Set Name to a string to label the system. Default: '' | ||||||||
Notes | Any text that you wish to associate with the system. Set Notes to a string or a cell array of strings. Default: {} | ||||||||
UserData | Any type of data you wish to associate with system. Set UserData to any MATLAB data type. Default: [] |
Create a tunable PD controller, initialize the parameters values, and fix the filter time constant.
blk = ltiblock.pid('pdblock','PD');
blk.Kp.Value = 4; % initialize Kp to 4
blk.Kd.Value = 0.7; % initialize Kd to 0.7
blk.Tf.Value = 0.01; % set parameter Tf to 0.01
blk.Tf.Free = false; % fix parameter Tf to this valueCreate a tunable discrete-time PI controller, using a pid object to initialize the parameters and other properties.
C = pid(5,2.2,'Ts',0.1,'IFormula','BackwardEuler');
blk = ltiblock.pid('piblock',C);blk takes properties such as Ts and IFormula from C.
Create a tunable PID controller, and assign names to the input and output.
blk = ltiblock.pid('pidblock','pid')
blk.InputName = {'error'} % assign input name
blk.OutputName = {'control'} % assign output namegenss | ltiblock.gain | ltiblock.ss | ltiblock.tf

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |