.

Observer

Overview

Overview

The Mechaware Observer (OBS) block is a general purpose discrete linear system implementation of a 2 input, 1 output system of first order difference equations. The order of the specified system can be up to 16 (defined by MEIXmpMaxObserverSize) . Observer blocks can be incorporated in a variety of applications including, state observation and state feedback, disturbance observation, and system simulation.

Observer Block Diagram

The coefficients for this block are as follows:

 

Observer Data(.txt)

The file name of a text file containing the coefficients. See General Text Files.

Ts

Sample period of the filter algorithm. This is the cycle time of the BiQuad block in Simulink simulation. This value has no effect on the BiQuad execution on the controller.

Subsample Code

A code which determines the schedule for updating this block (every sample, even samples only, etc.) See Subsampling.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Generating Text Files

The matrices that make up an observer are stored as text files. They can be generated using one of the Matlab Utilities. Advanced users can manually write their text file if the coefficients are already known.

Reading Text Files

Text files can be read by loading with the mdl2mw utility.

Explanation of text file format

Below is a sample text file for a 5th order observer (5 x 5).

observer

  A - State Transition Matrix n x n
  B - Matrix n x 2
  C - Matrix 1 x n
  D - Matrix 1 x 2

 

Matlab/Simulink

Simulink Interface

Observer Simulink Block

The Observer Filter block performs computation for a general purpose discrete linear system (order up to 16). The Inputs to the block are double precision value, and may be connected to the output of any other MechaWare block. The Enable input is used to enable/disbable observer output.  When enable is 0 Observer output is 0 and all internal data registers are set to zero.  When  enable is 1 the Observer functions a 2 input 1 output discreet linear state space system.

The Output ufb is also double precision and can be used for the inputs of other MechaWare blocks.  The states output reflects the internal states of the observer.  These states can be read individually or as a linear combination of the states by connecting this output to the Matrix Gain block.  See below for the observer coefficient and data structures. 

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. See User Data Storage for details.

The block's update schedule is determined by the Subsample Code (See Subsampling). The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink Model:

Observer Parameters Dialog Box

Observer Structures

Note the dimensions of the coefficient matrices are:

k = system order (maximum order is 16)

A:  k x k
B:   1 x 2
C:  1 x k
D:  k x 2

Z Domain

Z Domain Equation 1

Z Domain Equation 2

 

Difference Equations (the following assume a 3rd order observer)

Difference Equation 1

Difference Equation 2

Difference Equation 3

Difference Equation 4

 

Observer Structure
Element
Description
OBS.b1 B(z): ufb(z)/u(z) numerator
OBS.a1 A(z): ufb(z)/u(z) denominator
OBS.b2 B(z): ufb(z)/ymeas(z) numerator
OBS.a2 A(z): ufb(z)/ymeas(z) denominator
OBS.A State transition matrix
OBS.B Input state matrix
OBS.C Output coupling matrix
OBS.D Input to Output coupling matrix
OBS.Ts Sample Rate
OBS.sys Matlab LTI object

C++ API

OBSBlock

Declaration

Public Method

 
OBSBlock&   OBS();
  Required Header: mechaware.h

Description

The Observer block implements a 2 input 1 output linear system. It is a state space model implemented in discrete time. System parameters are stored in a data file which is downloaded when the mechaware model is loaded. The firmware will support up to a 16th order system.

Parameters

 

long

OBS().Length

Order of the observer.  Maximum order is 16

std::vector<double>

OBS().A, OBS().B, OBS().C, OBS().D

The observer coefficient matrices, A, B, C, and D

std::vector<double>

OBS().X[ ]

The internal states of the observer, X array.  The maximum array size is 16 (defined by  MEIXmpMaxObserverSize)

Methods

Block Methods

 

See Also

Matrix Gain

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2012 Motion Engineering