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

Online Help

All Products    Maple    MapleSim


ControlDesign

  

ComputeQR

  

compute the Q, R, and N matrices used in an LQR design based on a desired time constant of the closed-loop system

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

ComputeQR(sys, Tc, opts)

Parameters

sys

-

System; system object

Tc

-

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

opts

-

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

Options

• 

computeN = truefalse

  

True means include the N weighting matrix in the returned record. 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 ComputeQR command returns a record containing the Q and R weighting matrices needed by the LQR command. Optionally, the cross-coupling matrix N (weighting on the state-input term in the quadratic cost function) is included in the returned record to be used with the corresponding option of the LQR command.

• 

The computation of the weighting matrices is based on the desired time constant, Tc (seconds), of the closed-loop system.

• 

The system sys is a continuous or discrete-time linear system object created using the DynamicSystems package. The system object must be in state-space (SS) form. The state-space system can be either single-input/single-output (SISO) or multiple-input/multiple-output (MIMO).

• 

The ComputeQR command invokes the ReduceSystem command to remove the structural uncontrollable states of sys which may arise from using the Subsystem command before ComputeQR. The computed weighting matrices are obtained based in the reduced system (when applicable).

Examples

withControlDesign:

withDynamicSystems:

Here is a state-space system corresponding to a DC motor model:

sys_aMatrixdJ,KJ,0,KL,RL,0,1,0,0:

sys_bMatrix0,1J,1L,0,0,0:

sys_cMatrix0,1,0,1,0,0,0,0,1:

sys_dMatrix0,0,0,0,0,0:

sysStateSpacesys_a,sys_b,sys_c,sys_d,inputvariable=Vt,Tt,outputvariable=i_outt,omega_outt,theta_outt,statevariable=ωt,it,θt:

PrintSystemsys

State Spacecontinuous3 output(s); 2 input(s); 3 state(s)inputvariable=Vt,Ttoutputvariable=i_outt,omega_outt,theta_outtstatevariable=ωt,it,θta=dJKJ0KLRL0100b=01J1L000c=010100001d=000000

(1)

The numeric values of the model parameters are as follows:

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

Extract a subsystem with the desired input and output.

subsysSubsystemsys,1,2

subsysState Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable=Vtoutputvariable=omega_outtstatevariable=ωt,it,θt

(2)

Compute the weighting Matrices Q and R for a desired time constant of 1 second:

τ1:

QRComputeQRsubsys,τ,parameters=params

QRRecordQ=1.0.0.0.0.0.0.0.0.,R=0.00804031799261397

(3)

Use the previous result to compute the state feedback gain:

KcLQRsubsys,QR:-Q,QR:-R,parameters=params

Kc0.9634507842906180.4012318809856630

(4)

Optionally, compute the weighting Matrix N:

QRNComputeQRsubsys,τ,computeN=true,parameters=params

QRNRecordQ=1.0.0.0.0.0.0.0.0.,R=0.00804031799261397,N=0.0.0.

(5)

Use matrices Q, R, and N to compute the state feedback gain. In this case, N is a zero Matrix, so the result is the same as before:

KcLQRsubsys,QRN:-Q,QRN:-R,N=QRN:-N,parameters=params

Kc0.9634507842906180.4012318809856630

(6)

See Also

ControlDesign

ControlDesign[LQR]

ControlDesign[LQRContinuous]

ControlDesign[LQRDiscrete]