ControlDesign - 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

Parameters

Options

Description

Examples

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

Options

• 

Kr = Matrix or 0

  

Specify a feedforward gain Kr (reference input). If Kr = 0, there are no reference inputs r and the returned closed-loop system is autonomous if there are no measured_inputs or non-controlled inputs specified by the user. The default value is 0.

• 

closedloop = true or false

  

True means calculate the closed-loop equations of the state feedback controller, observer, and plant. False means calculate the equations of the state-feedback controller and observer subsystem. The default is false.

• 

stateerror = true or false

  

True means return a state vector with the original states x and the state errors xerr=xxˆ  (difference between each state and its estimate) in the closedloop case with outputtype = ss. False means express the closed-loop state-space equations in terms of the original states x and the state estimates xˆ. The default is false.

• 

controlled_inputs = all or set(posint)

  

Specifies a subset of  sys input indices that are controller outputs. The default is all. A controlled input uc cannot be specified as a measured input.

• 

measured_inputs = none, all or set(posint)

  

Specifies a subset of sys input indices that are not controller outputs and are measured to be input to the observer. The default is none. A measured input um cannot be specified as a controlled input.

• 

controlled_outputs = all or set(posint)

  

Specifies a subset of sys output indices that are regulated by the controller. The default is all. A controlled output yc may be specified as a measured output.

• 

measured_outputs = all or set(posint)

  

Specifies a subset of sys output indices that are measured to be input to the observer. The default is all. A measured output ym may be specified as a controlled output.

• 

augment_output = true or false

  

True means append the controlled_inputs to the output vector in the closedloop case. The default is false.

• 

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

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:

sys1StateSpaceMatrix0,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 ω.

cps2+2Zωs+ω2

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

(3)
• 

The corresponding poles are:

polessolvecp,s

poles:=Z+Z21ω,ZZ21ω

(4)
• 

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

Kc1,Kr1StateFeedback:-PolePlacementsys1,a,b,'return_Kr':

Kc1simplifyevalKc1,a=poles1,b=poles2

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

(5)

Kr1simplifyevalKr1,a=poles1,b=poles2

Kr1:=ω2

(6)
• 

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

L1StateObserver:-PolePlacementsys1,a,b:

L1simplifyevalL1,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.

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

clsys1ControllerObserversys1,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.

a2MatrixRL,KL,0,KJ,BJ,0,0,1,0:

b2Matrix1L,0,0,0,1J,0,0,0,1:

c2Matrix1,0,0,0,1,0,0,0,1:

d2Matrix3,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:

paramsJ=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.

sys2StateSpacea2,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:

Kc2Matrix1.89107,7.35829,70.71068:

Kr2Matrix1,1:

L2Matrix0.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:

cosys2ControllerObserversys2,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:

WComputeQRsys2,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,Kr3LQRsys2,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:

G1LinearAlgebra:-IdentityMatrix3:

H1LinearAlgebra:-ZeroMatrix3:

Q1Matrix5,0,0,0,1,0,0,0,1:

R10.001LinearAlgebra:-IdentityMatrix3:

KgainKalmansys2,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:

LQGControllerObserversys2,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