ControlDesign - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim Toolboxes : MapleSim Control Design Toolbox : ControlDesign Package : PID Tuning : ControlDesign/GainPhaseMargin

ControlDesign

  

GainPhaseMargin

  

PID tuning based on gain-phase margin specifications

 

Calling Sequence

Parameters

Options

Description

Examples

References

Calling Sequence

GainPhaseMargin(sys, GM, PM, opts)

Parameters

sys

-

System; system object

GM

-

realcons; desired gain margin

PM

-

realcons; desired phase margin

opts

-

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

Options

• 

controller = PI or PID

  

Specifies the controller type. The default value is PID.

• 

decibels = true or false

  

Specifies whether the desired gain margin is given in decibels, i.e. 20log10GM. The default is the value of decibels in SystemOptions'decibels'.

• 

radians = true or false

  

Specifies whether the desired phase margin is given in radians. The default is the value of radians in SystemOptions'radians'.

• 

alpha = realcons and positive

  

Specifies the ratio between the derivative time and the integral time of the PID controller as Td=αTi, in the numerical solution, where Td=KdKp and Ti=KpKi. The default value is 14.

• 

factored  = true or false

  

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

• 

returntype =  list or record or system

  

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

Description

• 

The GainPhaseMargin calculates the controller parameters to meet the specified gain and phase margins. The gain-phase margin specifications correspond to a set of nonlinear equations based on the controller structure. The algorithm first tries to find a numerical solution to the original problem. If no such solution exists, an approximate analytical solution is used.

• 

The numerical solution is found by solving the set of nonlinear equations associated to the selected controller type. For the PI controller, there are four equations (two magnitude equations and two phase equations) and four unknowns (two controller parameters and two crossover frequencies for gain and phase margins) to be solved for. For the PID controller, there are four equations as in the PI case but five unknowns (three controller parameters and the two crossover frequencies). In this case, one extra equation is provided by establishing a ratio between the PID integral and derivative times as Td=αTi. The ratio α is a design parameter whose value can be specified by the user. The default value of this parameter is 14 as suggested in Astrom et al. (1984), Hang et al. (1991) and Ho et al. (1999).

• 

If a numerical solution to the original problem does not exist for the selected controller type and the specified gain-phase margins, then the approximate analytical solutions for the PI and PID controller designs are used as described in Ho et al. (1995). Since the analytical method is based on lower order approximations of the system, the performance of the designed controller must be verified and fine tuned if necessary.

• 

Note: The numerical solution is applied to both stable and unstable systems, but the approximate analytical solution is only applicable to stable systems.

• 

The system sys is a continuous-time linear system object created using the DynamicSystems package. The system object must single-input single-output (SISO) and one of the following types: TransferFunction (tf), ZeroPoleGain(zpk), Coefficients(coeff), StateSpace(ss), DiffEquations (de).

• 

The GainPhaseMargin command returns a list of the form [Kp, Ki] for a PI controller or [Kp, Ki, Kd] for a PID controller, where Kp is the proportional gain, Ki is the integral gain, and Kd is the derivative gain.

• 

The controller transfer function is then obtained as:

– 

PI: Cs=Kp+Kis

– 

PID: Cs=Kp+Kis+Kds

Examples

withControlDesign:

withDynamicSystems:

Build a transfer function for a SISO system sys1

sys1NewSystem2s+15s4+8s3+20s2+21s+6:

GainMarginsys1,'decibels'=false

1.500000001,1.732050808

(1)

PhaseMarginsys1

19.84519766,1.395724232

(2)

Design a PI controller (desired gain margin equal to 25 decibels and desired phase margin equal to 60 degrees)

PIparsGainPhaseMarginsys1,25,60,'controller'=Π,'decibels'=true,'radians'=false

PIpars:=0.03833922655,0.01796181549

(3)

PI controller transfer function

GcGainPhaseMarginsys1,25,60,'controller'=Π,'decibels'=true,'radians'=false,'returntype'=system:

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.03833922654s+0.01796181549s

(4)

sys_loopNewSystemsys1:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

28.13997620,1.420339299

(5)

PhaseMarginsys_loop,'radians'=false

83.37149660,0.08945084113

(6)

Design a PID controller with the same gain-phase margin specifications

pidGainPhaseMarginsys1,25,60,'controller'=PID,decibels='true','radians'=false,'returntype'=record

pid:=RecordpackedKp=0.05930671873,Ki=0.04693334343,Kd=0.08729712630

(7)

PID controller transfer function

GcGainPhaseMarginsys1,25,60,'controller'=PID,decibels='true','radians'=false,'returntype'=system:

Warning, improper transfer-function, degree(num) > degree(den)

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.08729712631s2+0.05930671873s+0.04693334343s

(8)

sys_loopNewSystemsys1:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

37.51046154,5.276553296

(9)

PhaseMarginsys_loop,'radians'=false

67.31441788,0.2025962852

(10)

Build a transfer function for a SISO system sys2

sys2NewSystem120s+25:

GainMarginsys2,'decibels'=false

0.7694501862,1.453085056

(11)

PhaseMarginsys2

19.25926810,1.669405996

(12)

Design a PI controller (desired gain margin equal to 25 decibels and desired phase margin equal to 60 degrees)

GcGainPhaseMarginsys2,25,60,'controller'=Π,decibels='true','radians'=false,'factored'=false,'returntype'=system:

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.01875874587s+0.01743451489s

(13)

sys_loopNewSystemsys2:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

25.82711900,1.049870847

(14)

PhaseMarginsys_loop,'radians'=false

84.66335908,0.06536623173

(15)

Design a PID controller with the same gain-phase margin specifications

GcGainPhaseMarginsys2,25,60,'controller'=PID,decibels='true','radians'=false,'factored'=true,'returntype'=system:

Warning, improper transfer-function, degree(num) > degree(den)

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.02389881218s2+0.02529072048s+0.02817486605s

(16)

sys_loopNewSystemsys2:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

32.12602018,2.176177693

(17)

PhaseMarginsys_loop,'radians'=false

80.45980564,0.1044325480

(18)

Build a transfer function for a SISO system sys3

sys3NewSystem120s1s+25:

GainMarginsys3,'decibels'=false

1.812938848,3.142987870

(19)

PhaseMarginsys3

38.06739594,2.454043910

(20)

Design a PI controller (desired gain margin equal to 25 decibels and desired phase margin equal to 60 degrees)

PIpars3GainPhaseMarginsys3,25,60,'controller'=Π,decibels='true','radians'=false,'factored'=true,'returntype'=record

PIpars3:=RecordpackedK=0.003864514182,Ti=0.4960037565

(21)

PI controller transfer function

GcGainPhaseMarginsys3,25,60,'controller'=Π,decibels='true','radians'=false,'factored'=true,'returntype'=system

Gc:=Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1s

(22)

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.003864514182s0.007791300230s

(23)

sys_loopNewSystemsys3:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

25.57023890,0.5471290232

(24)

PhaseMarginsys_loop,'radians'=false

84.97193810,0.02921732225

(25)

Design a PID controller with the same gain-phase margin specifications

paramsGainPhaseMarginsys3,25,60,'controller'=PID,decibels='true','radians'=false,'factored'=false

params:=0.005161515110,0.01070504302,0.002515442705

(26)

Kpparams1;Kiparams2;Kdparams3

Kp:=0.005161515110

Ki:=0.01070504302

Kd:=0.002515442705

(27)

PID controller transfer function

GcNewSystemKp+Kis+Kds:

Warning, improper transfer-function, degree(num) > degree(den)

PrintSystemGc

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=0.002515442705s20.005161515110s0.01070504302s

(28)

sys_loopNewSystemsys3:-tf1,1Gc:-tf1,1:

GainMarginsys_loop,'decibels'=true

23.50129588,0.5516567517

(29)

PhaseMarginsys_loop,'radians'=false

83.06374234,0.04012814203

(30)

References

  

[1] K. J. Astrom and T. Hagglund, Automatic Tuning of Simple Regulators with Specifications on Phase and Amplitude Margins, Automatica, Vol. 20, No. 5, pp. 645-651, 1984.

  

[2] C. C. Hang, K. J. Astrom, and W. K. Ho, Refinements of the Ziegler-Nichols Tuning Formula, IEE Proceedings D, Control Theory and Applications, Vol. 138, No. 2, pp. 111-118, 1991.

  

[3] W. K. Ho, K. W. Lim, C. C. Hang and L. Y. Ni, Getting more Phase Margin and Performance out of PID Controllers, Automatica, Vol. 35, No. 9, pp. 1579-1585, 1999.

  

[4] W. K. Ho, C. C. Hang, L. S. Cao, Tuning of PID Controllers Based on Gain and Phase Margin Specifications Automatica, Vol 31, No. 3, pp. 497-502, 1995.

See Also

ControlDesign

ControlDesign[CohenCoon]

ControlDesign[ZNFreq]

ControlDesign[ZNTimeModified]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam