PIDClosedLoop - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

ControlDesign

  

PIDClosedLoop

  

determine the closed-loop equations of a system with PID controller

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

PIDClosedLoop(sys, pid, opts)

Parameters

sys

-

System; system object

pid

-

System; controller system object

opts

-

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

Options

• 

outputtype = tf, coeff, zpk, ss, or de

  

Determines the subtype of the returned system object.  The default return type is based on the type of the system object specified in the sys parameter.

• 

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).

• 

controlled_input = posint

  

Specifies the controlled input (uc) index for sys, for the MIMO case. The default is 1.  

• 

controlled_output = posint

  

Specifies the controlled output (yc) index for sysfor the MIMO case. The  default is 1.

• 

augment_output = true or false

  

True means append the controlled_input (controller output) to the output vector. The default is false.

Description

• 

The PIDClosedLoop command calculates the closed-loop system equations of a system sys with a PID controller pid in the direct path.

• 

The system sys is a SISO (single input, single output) or MIMO (multiple input, multiple output) linear system object created using the DynamicSystems package. The system object can be of types: transfer function (TF), zero-pole-gain (ZPK), coefficients (Coeff), state-space (SS), and diff-equation (DE).

• 

The controller pid is a SISO (single input, single output) system object created using the DynamicSystems package. The system object is generally a transfer function (TF).

• 

If sys is a MIMO system, only one input and one output can be selected to form the closed-loop system with the PID controller pid.

– 

If uc is the ith input of sys, y_ref is the ith  input of the closed-loop.

– 

If yc is the jth output of sys, it remains the jth  output of the closed-loop.  

  

The rest of the inputs unc (non-controlled inputs) and outputs ync (non-controlled outputs) of sys are also included in the inputs and outputs of the closed-loop system.

• 

The pid output (uc) is appended to the output vector of the closed-loop if the option augment_output = true is specified.

• 

The PIDClosedLoop command returns a system object whose type is the same as the type of sys, unless the option outputtype is specified.

Examples

withDynamicSystems:

withControlDesign:

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 2 seconds (time constant is about 0.7 s):

τ0.7

τ0.7

(3)

PIDgainsPIDAutosubsystf,τ,parameters=params

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

(4)

The controller system is designed according to the following expression:

KcPIDgainsKp+PIDgainsKis+PIDgainsKds1+1100PIDgainsKds

Kc10.2115133154945+0.000879895477927287s+1.01771326328058s1+0.0101771326328058s

(5)

sysKcTransferFunctionKc:

PrintSystemsysKc

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

(6)

Calculate the feedback system with the original system to observe all the closed-loop system transfer functions. The controller output Vs is also included using the augment_output option.

feedbackPIDClosedLoopsystf,sysKc,parameters=params,controlled_output=3,augment_output=true:

PrintSystemfeedback

Transfer Functioncontinuous4 output(s); 1 input(s)inputvariable=theta_refsoutputvariable=is,ωs,θs,Vstf1,1=5.707525218×10−7s7+0.00007383461575s6+0.001938610656s5+0.01992714700s4+0.08375976566s3+0.1022235877s2+8.807753734×10−6s2.589350714×10−9s8+5.710010486×10−7s7+0.00003768910326s6+0.0006954648583s5+0.004914660338s4+0.01347328969s3+0.01737375949s2+0.01022227069s+8.807753734×10−7tf2,1=5.707525218×10−7s6+0.00006812709054s5+0.001257339750s4+0.007353749497s3+0.01022227069s2+8.807753734×10−7s2.589350714×10−9s8+5.710010486×10−7s7+0.00003768910326s6+0.0006954648583s5+0.004914660338s4+0.01347328969s3+0.01737375949s2+0.01022227069s+8.807753734×10−7tf3,1=0.01121637189s2+0.1021152227s+8.798954779×10−60.00005088566315s5+0.005610627958s4+0.06101873098s3+0.1113163719s2+0.1021152227s+8.798954779×10−6tf4,1=0.005608185945s5+0.1183558427s4+0.7249716183s3+1.022226173s2+0.00008807753734s0.00005088566315s5+0.005610627958s4+0.06101873098s3+0.1113163719s2+0.1021152227s+8.798954779×10−6

(7)

Plot the step response for the position output, θ:

ResponsePlotfeedback,1,duration=10,gridlines=true,parameters=params,output=θ

See Also

ControlDesign

ControlDesign[PIDAuto]

 


Download Help Document