PIDAuto - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ControlDesign

  

PIDAuto

  

automatic tuning of PID controller based on a desired closed-loop time constant

 

Calling Sequence

Parameters

Options

Description

Examples

References

Calling Sequence

PIDAuto(sys, Tc, opts)

Parameters

sys

-

System; system object

Tc

-

And(positive, numeric); desired closed-loop time constant (seconds)

opts

-

(optional) equation(s) of the form option = value; specify options for the PIDAuto command

Options

• 

factored = true or false

  

True means return the factored version of the controller gains (K=Kp, Ti=KpKi, Td=KdKp and Nd=Tf). False means return the controller gains (Kp, Ki, Kd and Tf). The default is false.

• 

returntype =  record or system

  

Specifies the returned type. If a record is specified, a record containing the PID controller parameters is returned. If system is specified, a System (DynamicSystems system object) containing the transfer function of the PID controller is returned. The default value is record.

  

True means return a System (DynamicSystems system object) containing the PID controller transfer function. False means return a record containing the controller gains. The default value is false.

• 

proper =  true or false

  

True means return PID controller gains to make its transfer function proper in case Tf=0 (Tf is set to a recommended value of Kd100 . The default is false.

• 

parameters = {list, set}(name = complexcons)

  

Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters).

Description

• 

The PIDAuto command automatically calculates the controller gains of a PID controller with filtered derivative, based on the desired closed-loop time constant, Tc (seconds).  

• 

The system sys is a continuous-time linear system object created using the DynamicSystems package. The system object must be in transfer function (TF) form. The system must be single-input single-output (SISO). The system must be proper and must have a nonzero static gain.

• 

The parameter Tc is a tuning parameter that generally has the same order of magnitude as the time constant of the closed-loop. Tune this parameter to adjust the time constant of the closed-loop precisely.

• 

The PIDAuto command returns a record containing the controller parameters Kp, Ki, Kd and Tf, where Kp is the proportional gain, Ki is the integral gain, Kd is the derivative gain and Tf is the time constant of the derivative filter. The controller transfer function is then obtained as:

  

Cs=Kp+Kis+KdsTfs+1.

• 

If the computed value of Tf is equal to zero, the resulting PID controller transfer function is improper. A recommended value to make the transfer function proper is Tf=Kd100. This value is used when the proper option is set to true and the computed value of Tf is equal to zero. The controller transfer function is then obtained as:

  

Cs=Kp+Kis+Kds1+Kds100.

  

If the resulting closed-loop is unstable, use RouthTable in order to calculate a value of Tf that keeps the closed-loop stable.

• 

If the order of sys is greater than two and sys is unstable or has complex poles, the gains are calculated using an optimization algorithm that may not be able to find a solution if Tc is too small. The error message is then could not compute a stabilizing PID. In this case, try increasing Tc until a solution can be found.

Examples

withDynamicSystems:

withControlDesign:

infolevelControlDesign3:

Differential equations of a DC motor model:

eq1Jdiffωt,t+bωtKit=0:

eq2Ldiffit,t+Rit=VtKωt:

eq3diffθt,t=ωt:

The numeric values of the model parameters are as follows:

paramsJ=0.01,K=0.01,L=0.5,R=1,b=0.1:

Transfer function

systfTransferFunctioneq1,eq2,eq3,Vt,it,ωt,θt:

PrintSystemsystf

Transfer Functioncontinuous3 output(s); 1 input(s)inputvariable=Vsoutputvariable=is,ωs,θstf1,1=Js+bJLs2+JR+Lbs+K2+Rbtf2,1=KJLs2+JR+Lbs+K2+Rbtf3,1=KJLs3+JR+Lbs2+K2+Rbs

(1)

Extract a subsystem with the desired output (position θ):

subsystfSubsystemsystf,all,3:

PrintSystemsubsystf

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=Vsoutputvariable=θstf1,1=KJLs3+JR+Lbs2+K2+Rbs

(2)

Design a position controller with a settling time of 4 seconds (time constant is 0.7 seconds approximately):

τ0.7

τ0.7

(3)

pidPIDAutosubsystf,τ,parameters=params

PIDAuto:   Using PIDOptimize

pidRecordpackedKp=10.2115133154945,Ki=0.000879895477927287,Kd=1.01771326328058,Tf=0

(4)

Get a proper transfer function for the PID controller

pidtfPIDAutosubsystf,τ,parameters=params,returntype=system,proper=true:

PIDAuto:   Using PIDOptimize
PIDAuto:   Computed 'Tf = 0' (improper PID transfer function); setting 'Tf = Kd/100' to make it proper

PrintSystempidtf

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=1.121637189s2+10.21152227s+0.00087989547790.01017713263s2+1.s

(5)

Calculate the closed-loop system and plot a step response:

clsysPIDClosedLoopsubsystf,pidtf,parameters=params:

PrintSystemclsys

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=theta_refsoutputvariable=θstf1,1=0.01121637189s2+0.1021152227s+8.798954779×10−60.00005088566315s5+0.005610627958s4+0.06101873098s3+0.1113163719s2+0.1021152227s+8.798954779×10−6

(6)

ResponsePlotclsys,Step,output=θ,duration=10,gridlines=true,parameters=params

References

  

[1] Philippe de Larminat, Automatique appliquee, Hermes, 2007.

  

[2] Sigurd Skogestad, Simple analytic rules for model reduction and PID controller design, Journal of Process Control, Vol. 13, 291-309, 2003.

  

[3] J. M. Maciejowski, Multivariable Feedback Design, Pearson Education, 1989.

  

[4] J. M. Edmunds, Control system design and analysis using closed-loop Nyquist and Bode arrays, International Journal of Control, 30: 5, 773-802, 1979.

See Also

ControlDesign

ControlDesign[CohenCoon]

ControlDesign[DominantPole]

ControlDesign[GainPhaseMargin]

ControlDesign[ZNFreq]

ControlDesign[ZNTimeModified]