pidstd
创造a PID controller in standard form, convert to standard-form PID controller
Syntax
c = pidstd(kp,ti,td,n)
C = pidstd(Kp,Ti,Td,N,Ts)
C = pidstd(sys)
C = PIDSTD(KP)
c = pidstd(kp,ti)
C = PIDSTD(KP,TI,TD)
C = pidstd(...,Name,Value)
C = pidstd
Description
creates a continuous-time PIDF (PID with first-order derivative filter) controller object in standard form. The controller has proportional gainC
= pidstd(KP
,Ti
,Td
,N
)KP
、积分和微分时间sTi
和Td
, 和first-order derivative filter divisorN
:
creates a discrete-time controller with sample timeC
= pidstd(KP
,Ti
,Td
,N
,Ts
)Ts
。The discrete-time controller is:
如果(z) andDF(z)是discrete integrator formulasfor the integrator and derivative filter. By default,
To choose different discrete integrator formulas, use the如果或者mula
和DFormula
输入。(看Properties更多的information about如果或者mula
和DFormula
)。IfDFormula
='前锋'
(the default value) andN
≠Inf
, thenTs
,Td
, 和N
must satisfyTd/N > Ts/2
。This requirement ensures a stable derivative filter pole.
转换动态系统C
= pidstd(sys
)sys
to a standard formpidstd
控制器对象。
creates a continuous-time proportional (P) controller withC
= pidstd(KP
)Ti
=Inf
,Td
= 0, andN
=Inf
。
creates a proportional and integral (PI) controller withC
= pidstd(KP
,Ti
)Td
= 0 andN
=Inf
。
creates a proportional, integral, and derivative (PID) controller withC
= pidstd(KP
,Ti
,Td
)N
=Inf
。
creates a controller or converts a dynamic system to aC
= pidstd(...,,名称,价值
)pidstd
控制ler object with additional options specified by one or more名称,价值
pair arguments.
输入参数
|
比例收益。
Default:1 |
|
Integrator time.
Default: |
|
Derivative time.
When Default:0 |
|
导数滤波器分裂。
When Default: |
|
Sample time. To create a discrete-time
Default:0 (continuous time) |
|
SISO动态系统转换为标准
|
Name-Value Arguments
Specify optional comma-separated pairs of名称,价值
arguments.Name
是the argument name and价值
是相应的值。Name
必须出现在引号中。您可以按任何顺序指定几个名称和值对参数Name1,Value1,...,NameN,ValueN
。
利用名称,价值
syntax to set the numerical integration formulas如果或者mula
和DFormula
的a discrete-timepidstd
控制ler, or to set other object properties such asInputName
和输出名称
。有关可用属性的信息pidstd
控制ler objects, seeProperties。
Output Arguments
|
控制器类型(P,PI,PD,PDF,PID,PIDF)取决于 When the inputs |
Properties
|
比例收益。 |
|
Integral time. |
|
Derivative time. |
|
导数滤波器分裂。 |
|
Discrete integrator formula如果(z)用于离散时间的集成器
When Default: |
|
Discrete integrator formulaDF(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: |
|
输入通道名称,指定为字符向量。使用此属性命名控制器模型的输入通道。例如,分配名称 C.InputName ='error';
您可以使用速记符号 Input channel names have several uses, including:
Default:空字符向量, |
|
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:空字符向量, |
|
Input channel groups. This property is not needed for PID controller models. Default: |
|
输出通道名称,指定为字符向量。使用此属性命名控制器模型的输出通道。例如,分配名称 C.Outputname ='control';
您可以使用速记符号 Input channel names have several uses, including:
Default:空字符向量, |
|
输出通道单元,指定为字符向量。使用此属性跟踪输出信号单元。例如,分配单元 C.outputunit ='Volts';
Default:空字符向量, |
|
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®数据类型。 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. 例如,假设您创建一个11 x-1线性模型的数组, sysarr.SamplingGrid = struct('time',0:10)
Similarly, suppose you create a 6-by-9 model array, [zeta,w] = ndgrid(zeta>的<6值,<9值W>的值)m.samplinggrid = struct(struct(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
创造Continuous-Time Standard-Form PDF Controller
创造a continuous-time standard-form PDF controller with proportional gain 1, derivative time 3, and a filter divisor of 6.
C = pidstd(1,Inf,3,6);
c = s kp *(1 + td * -------------)(td/n) * s + 1 with kp = 1,td = 3,n = 6连续时间PDF控制器标准格式
The display shows the controller type, formula, and coefficient values.
创造Discrete-Time PI Controller with Trapezoidal Discretization Formula
要创建离散时间控制器,请设置Ts
using名称,价值
syntax.
C = pidstd(1,0.5,'Ts',0.1,'IFormula','Trapezoidal')% Ts = 0.1s
This command produces the result:
标准形式的离散时间PI控制器:1 ts *(z + 1)kp *(1 + ----- * ---------------)ti 2 *(z-1),kp = 1,ti= 0.5,ts = 0.1
另外,您可以通过提供相同的离散时间控制器Ts
作为所有四个PID参数之后的第五个参数KP
,Ti
,Td
, 和N
。
C = pidstd(5,2.4,0,Inf,0.1,'IFormula','Trapezoidal');
创造PID Controller and Set System Properties
创造a PID controller and set dynamic system propertiesInputName
和输出名称
。
C = pidstd(1,0.5,3,'InputName','e','OutputName','u');
创建标准形式PID控制器的网格
创造a 2-by-3 grid of PI controllers with proportional gain ranging from 1–2 and integral time ranging from 5–9.
创造a grid of PI controllers with proportional gain varying row to row and integral time varying column to column. To do so, start with arrays representing the gains.
KP= [1 1 1;2 2 2]; Ti = [5:2:9;5:2:9]; pi_array = pidstd(Kp,Ti,'Ts',0.1,'IFormula','BackwardEuler');
这些命令产生2 x-3的离散时间pidstd
对象。Allpidstd
objects in an array must have the same sample time, discrete integrator formulas, and dynamic system properties (such asInputName
和输出名称
)。
Alternatively, you can use thestack
command to build arrays ofpidstd
对象。
C = PIDSTD(1,5,0.1)%PID控制器CF = PIDSTD(1,5,0.1,0.5)%PID控制器with filterpid_array = stack(2,C,Cf);%沿第二个数组尺寸堆叠
These commands produce a 1-by-2 array of controllers. Enter the command:
size(pid_array)
to see the result
1x2 array of PID controller. Each PID has 1 output and 1 input.
转换并行形式pid
Controller to Standard Form
Parallel PID form expresses the controller actions in terms of an proportional, integral, and derivative gainsKp,Ki, 和Kd, 和a filter time constantTf。You can convert a parallel form controllerparsys
to standard form usingpidstd
, provided that:
parsys
是not a pure integrator (I) controller.收益
KP
,ki
, 和KD
的parsys
all have the same sign.
parsys = pid(2,3,4,5);% Standard-form controllerstdsys = pidstd(parsys)
这些命令产生一个并行形式的控制器:
Continuous-time PIDF controller in standard form: 1 1 s Kp * (1 + ---- * --- + Td * ------------) Ti s (Td/N)*s+1 with Kp = 2, Ti = 0.66667, Td = 2, N = 0.4
创造pidstd
Controller from Continuous-Time Dynamic System
动态系统
represents a PID controller. Usepidstd
to obtainH(s) to in terms of the standard-form PID parametersKp,Ti, 和Td。
H = zpk([-1,-2],0,3); C = pidstd(H)
These commands produce the result:
Continuous-time PID controller in standard form: 1 1 Kp * (1 + ---- * --- + Td * s) Ti s with Kp = 9, Ti = 1.5, Td = 0.33333
创造pidstd
离散时间动态系统的控制器
You can convert a discrete-time dynamic system that represents a PID controller with derivative filter to standardpidstd
form.
% PIDF controller expressed in zpk formsys = zpk([-0.5,-0.6],[1 -0.2],3,'Ts',0.1);
The resultingpidstd
object depends upon the discrete integrator formula you specify for如果或者mula
和DFormula
。
For example, if you use the defaultForwardEuler
for both formulas:
C = pidstd(sys)
您获得结果:
离散时间PIDF控制器标准形式:1Ts 1 Kp * (1 + ---- * ------ + Td * ---------------) Ti z-1 (Td/N)+Ts/(z-1) with Kp = 2.75, Ti = 0.045833, Td = 0.0075758, N = 0.090909, Ts = 0.1
对于这个特殊sys
, you cannot writesys
in standard PID form using the后卫
公式DFormula
。Doing so would result inN
<0,不允许。在这种情况下,pidstd
returns an error.
同样,你也不能写sys
以标准形式使用Trapezoidal
两个集成商的公式。这样做会导致负面Ti
和Td
, which also returns an error.
Discretize Continuous-Timepidstd
Controller
首先,使用'zoh'
method ofc2d
。
Cc = pidstd(1,2,3,4);% continuous-time pidf controllerCD1 = C2D(CC,0.1,'zoh')
离散时间PIDF控制器标准形式:1Ts 1 Kp * (1 + ---- * ------ + Td * ---------------) Ti z-1 (Td/N)+Ts/(z-1) with Kp = 1, Ti = 2, Td = 3.2044, N = 4, Ts = 0.1
The resulting discrete-time controller usesForwardEuler
(Ts/((z–1)) for both如果或者mula
和DFormula
。
The discrete integrator formulas of the discretized controller depend upon thec2d
离散方法,如Tips。To use a different如果或者mula
和DFormula
, directly setTs
,如果或者mula
, 和DFormula
to the desired values:
Cd2 = Cc; Cd2.Ts = 0.1; Cd2.IFormula ='BackwardEuler'; Cd2.DFormula ='BackwardEuler';
These commands do not compute new parameter values for the discretized controller. To see this, enter:
Cd2
获得结果:
离散时间PIDF控制器标准形式:1Ts*z 1 Kp * (1 + ---- * ------ + Td * -----------------) Ti z-1 (Td/N)+Ts*z/(z-1) with Kp = 1, Ti = 2, Td = 3, N = 4, Ts = 0.1
Tips
利用
pidstd
either to create apidstd
控制ler object from known PID gain, integral and derivative times, and filter divisor, or to convert a dynamic system model to apidstd
目的。To tune a PID controller for a particular plant, use
pidtune
或者pidTuner
。创造arrays of
pidstd
控制lers by:在一系列
pidstd
控制lers, each controller must have the same sample timeTs
和离散集成商公式如果或者mula
和DFormula
。To create or convert to a parallel-form controller, use
pid
。并行形式以比例,积分和衍生品的增长来表达控制器的作用Kp,Ki和Kd, 和a filter time constantTf:There are two ways to discretize a continuous-time
pidstd
控制器:利用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 Method如果或者mula
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 about如果或者mula
和DFormula
, seeProperties。If you require different discrete integrator formulas, you can discretize the controller by directly setting
Ts
,如果或者mula
, 和DFormula
到所需的值。(有关更多信息,请参阅Discretize Continuous-Time pidstd 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-time and discrete-timepidstd
控制lers than usingc2d
。