determine the equations of the subsystem comprised of a state feedback controller and an observer - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim Toolboxes : MapleSim Control Design Toolbox : ControlDesign Package : System Manipulation : ControlDesign/ControllerObserver

ControlDesign[ControllerObserver] - determine the equations of the subsystem comprised of a state feedback controller and an observer

Calling Sequence

ControllerObserver(sys, Kc, L, opts)

Parameters

sys

-

System; system object

Kc

-

Matrix; state feedback gain

L

-

Matrix; observer gain

opts

-

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

Description

• 

The ControllerObserver command calculates the equations of the subsystem comprised of a state feedback controller and an observer, where sys is the plant, Kc is the state feedback controller gain, and L is the observer gain. In the diagram below, this subsystem corresponds to the blocks enclosed in the solid-line box.

• 

The closed-loop system equations of the state feedback controller, observer and plant can be obtained using the closedloop option. In the diagram below, the closed-loop system corresponds to the blocks enclosed in the dashed-line box.

• 

When the option Kr is specified, the state feedback controller is governed by the control law  uc=Kc.xˆ+Kr.r, where xˆ is the estimated state vector, and r is the reference vector. The reference vector r contains a reference signal for each controlled output, yc_ref.

• 

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). It is assumed that the state feedback controller gains, Kc and Kr, are obtained using the sys representation obtained by DynamicSystems[StateSpace].

• 

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

• 

The controller-observer subsystem inputs are

– 

the reference inputs r=yc_ref (when a non-zero Kr Matrix is specified)

– 

the measured_inputs um

– 

the measured_outputs ym (renamed y_meas)

  

The controller-observer outputs are

– 

the controlled_inputs uc

  

The controller-observer states (in state-space) are

– 

the estimated states xˆ (renamed x_est)

• 

The closed-loop system inputs are

– 

the reference inputs r=yc_ref (when a non-zero Kr Matrix is specified)

– 

the measured_inputs um 

– 

the non-controlled inputs unc (e.g. disturbances)

  

The closed-loop system outputs are

– 

the controlled_outputs yc 

– 

the non-controlled outputs ync 

– 

the controlled_inputs uc (if augment_output = true)

  

The closed-loop system states (in state-space) are

– 

the sys states x and

– 

the estimated states xˆ (renamed x_est)

  

Or when stateerror = true 

– 

the sys states x and

– 

the state errors xerr=xxˆ (renamed x_err).

Examples

withControlDesign:

withDynamicSystems:

Example: State feedback control with observer of linear model for the steering of a vehicle with nonslipping wheels

• 

The following second order system represents a linear model for the steering of a vehicle with nonslipping wheels:

sys1:=StateSpaceMatrix0,1,0,0,Matrixα,1,Matrix1,0,Matrix1,1:

PrintSystemsys1

State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable=u1toutputvariable=y1tstatevariable=x1t,x2ta=0100b=α1c=10d=0

(1)
• 

Checking whether the system is observable.

Observablesys1

true

(2)
• 

Defining the characteristic polynomial with damping ratio Z and natural frequency ω.

cp:=s2+2Zωs+ω2

cp:=2Zωs+ω2+s2

(3)
• 

The corresponding poles are:

poles:=solvecp,s

poles:=Z+Z21ω,ZZ21ω

(4)
• 

Designing the state feedback controller gains (Kc and Kr) by  pole placement:

Kc1,Kr1:=StateFeedback:-PolePlacementsys1,a,b,'return_Kr':

Kc1:=simplifyevalKc1,a=poles1,b=poles2

Kc1:=ω2αω2+2Zω

(5)

Kr1:=simplifyevalKr1,a=poles1,b=poles2

Kr1:=ω2

(6)
• 

Designing the state observer with gain L by pole placement as well.

L1:=StateObserver:-PolePlacementsys1,a,b:

L1:=simplifyevalL1,a=poles1,b=poles2

L1:=2Zωω2

(7)
• 

The controller-observer subsystem is obtained next. Note that the state, input, and output variables of the returned system object are renamed accordingly.

cosys1:=ControllerObserversys1,Kc1,L1,':-Kr'=Kr1:

PrintSystemcosys1

State Spacecontinuous1 output(s); 2 input(s); 2 state(s)inputvariable=y1_reft,y1_meastoutputvariable=u1tstatevariable=x1_estt,x2_estta=ω2α2Zω1αω2α+2Zω2ω2ω2α2Zωb=ω2α2Zωω2ω2c=ω2ω2α2Zωd=ω20

(8)
• 

The closed-loop equations of the state feedback control system with observer are obtained using the closedloop = true option. Using stateerror = true, augment_output = true, and outputtype = de, we obtain the closed-loop equations of sys1 with state feedback controller with Kc and Kr gains and observer with gain L. The returned system object is a set of differential equations, where the differential variables are x1, x2, x1_err and x2_err, and the outputs are y1 and u1 (controller output).

clsys1:=ControllerObserversys1,Kc1,L1,':-Kr'=Kr1,':-closedloop'=true,':-stateerror'=true,':-augment_output'=true,':-outputtype'=de:

PrintSystemclsys1

Diff. Equationcontinuous2 output(s); 1 input(s)inputvariable=y1_reftoutputvariable=y1t,u1tde={[x1.t={ω2αx1t+1αω2α+2Zωx2t +ω2αx1_errt+αω2α+2Zωx2_errt +ω2αy1_reft, x2.t={ω2x1t+ω2α2Zωx2t+ω2x1_errt ω2α+2Zωx2_errt+ω2y1_reft, x1_err.t=2Zωx1_errt+x2_errt, x2_err.t=ω2x1_errt, y1t=x1t, u1t={ω2x1t+ω2α2Zωx2t+ω2x1_errt ω2α+2Zωx2_errt+ω2y1_reft]

(9)

Example: DC motor model state feedback control with observer

• 

The following DC motor example demonstrates the use of the parameters, controlled_inputs, measured_inputs, controlled_outputs and  measured_outputs options.

a2:=MatrixRL,KL,0,KJ,BJ,0,0,1,0:

b2:=Matrix1L,0,0,0,1J,0,0,0,1:

c2:=Matrix1,0,0,0,1,0,0,0,1:

d2:=Matrix3,3:

• 

The numeric values for the DC motor stator inductance L, stator resistance R, electromotive force (emf) constant K, rotor moment of inertia J, and damping ratio B are given next:

params:=J=0.01,K=0.01,L=0.5,R=1,B=0.1:

• 

The input variables are the source voltage Vt, the torque load Tt and the rotor angular speed reference wreft, and the output variables are the stator current it, the rotor angular speed wt and the integral of the rotor speed error zt.

sys2:=StateSpacea2,b2,c2,d2,'inputvariable'=Vt,Tt,wreft,'outputvariable'=it,wt,zt:

PrintSystemsys2

State Spacecontinuous3 output(s); 3 input(s); 3 state(s)inputvariable=Vt,Tt,wreftoutputvariable=it,wt,ztstatevariable=x1t,x2t,x3ta=RLKL0KJBJ0010b=1L0001J000−1c=100010001d=000000000

(10)
• 

The state feedback controller and observer gains are given next:

Kc2:=Matrix1.89107,7.35829,70.71068:

Kr2:=Matrix1,1:

L2:=Matrix0.08028,0.00148,990.05009,0.98010,0.98010,10.09948:

• 

The controlled input is the source voltage Vt. The measured input is wreft. The controlled output is zt. The measured outputs are wt and zt.

• 

The controller-observer subsystem equations are obtained next:

cosys2:=ControllerObserversys2,Kc2,L2,'Kr'=Kr2,'parameters'=params,'controlled_inputs'=1,'measured_inputs'=3,'controlled_outputs'=3,'measured_outputs'=2,3:

PrintSystemcosys2

State Spacecontinuous1 output(s); 3 input(s); 3 state(s)inputvariable=wreft,w_meast,z_meastoutputvariable=Vtstatevariable=x1_estt,x2_estt,x3_estta=5.7821414.81686141.419881.01000.050090.98010.00.0199000000000000310.09948b=0.0.08028−0.001480.990.050090.98010−1.0.9801010.09948c=1.891077.3582970.71068d=000

(11)
• 

It is also possible to obtain an LQG controller by computing LQR and Kalman gains. First, compute the weighting matrices:

W:=ComputeQRsys2,0.4,'parameters'=params

W:=RecordQ=1.0.0.0.1.0.0.0.1.,R=0.3213212275656410.3322913622826560.003214574044135420.332291362282655210.0455234353071.207135397236790.003214574044135431.207135397236790.160000000000000

(12)

Kc3,Kr3:=LQRsys2,W:-Q,W:-R,'parameters'=params,'return_Kr'

Kc3,Kr3:=1.033133251786640.001432595818157930.01221569878646450.00003885095144810890.02256713578095620.0007454378908559090.01762937313173960.02796504464171512.49392402957048,2.033133251786640.008567404181842070.01221569878646450.01003885095144810.1225671357809560.0007454378908559090.01762937313173960.9720349553582852.49392402957049

(13)

Then define the noise matrices and compute the Kalman gain:

G1:=LinearAlgebra:-IdentityMatrix3:

H1:=LinearAlgebra:-ZeroMatrix3:

Q1:=Matrix5,0,0,0,1,0,0,0,1:

R1:=0.001LinearAlgebra:-IdentityMatrix3:

Kgain:=Kalmansys2,G1,H1,Q1,R1,'parameters'=params1

Kgain:=68.73571982445120.6569966705915180.004052745997648820.65699667059151823.17761952135540.3576473293517190.004052745997648820.35764732935171931.6320623200853

(14)

Then compute LQG controller by combining the Kalman filter with LQR controller:

LQG:=ControllerObserversys2,Kc3,Kgain,'Kr'=Kr3,'parameters'=params:

PrintSystemLQG

State Spacecontinuous3 output(s); 6 input(s); 3 state(s)inputvariable=i_reft,w_reft,z_reft,i_meast,w_meast,z_meastoutputvariable=Vt,Tt,wreftstatevariable=x1_estt,x2_estt,x3_estta=72.801986328024480.67413147895520190.0284841435705777930.346888424553293235.434333099451010.43219111843730940.0216821191293884370.614387626006566434.12598634965579b=4.0662665035732780.017134808363684140.02443139757292897668.735719824451210.65699667059151770.0040527459976488171.003885095144810612.2567135780956190.074543789085590920.656996670591517723.177619521355390.35764732935171850.0176293731317396230.9720349553582852.49392402957048540.0040527459976488170.357647329351718531.632062320085307c=1.03313325178663870.00143259581815792820.0122156987864644880.000038850951448108850.0225671357809561870.00074543789085590930.017629373131739620.0279650446417151062.493924029570485d=2.033133251786638950.008567404181842069870.01221569878646448780000.0100388509514481063−0.122567135780956196−0.000745437890855909276000−0.01762937313173962290.972034955358284991−2.49392402957048542000

(15)

See Also

ControlDesign, ControlDesign[ComputeQR], ControlDesign[Kalman], ControlDesign[LQR], ControlDesign[StateFeedback], ControlDesign[StateFeedback][Ackermann], ControlDesign[StateFeedback][PolePlacement], ControlDesign[StateObserver][Ackermann], ControlDesign[StateObserver][Observer], ControlDesign[StateObserver][PolePlacement]


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