.

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

Evaluate Block

This block allows you to specify whether the block executes Every Sample, Every Other Sample (Odd or Even), or Every Fourth Sample (and specify the First, Second, Third, or Fourth). This provides greater flexibility in controlling the execution of a model and to preserve performance for other areas of motion control.
User Defined Block Priority When selected, allows you to enter a Priority Code to modify Execution Ordering of this block. For more information, see Block Execution Order and User Defined Block Priority.
Priority For an explanation of how the Priority field is used by the MechaWare Model Downloader, see Block Execution Order and User Defined Block Priority.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Generating Text Files

Text files 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.

Sample Observer Text File

 
%define system to be implemented by observer block 
Ts=1/8000; 
theta=60*pi/180 
w1=200 
wlp=1000*2*pi; 
p1=w1 
p2=abs(p1)*5*(cos(theta)+1j*sin(theta)); 
p3=conj(p2); 


slowpass=tf(wlp^2,[1 2*wlp wlp^2]) 
[nb,na]=tfdata(slowpass,'v'); 
nc=real([p1+p2+p3 p1*p2+p2*p3+p1*p3 p1*p2*p3]*nb(3)) 
dc=real(conv([1 0],na)); 
[A,B,C,D]=linmod('OBSPVDdemo');


% make matlab linear system  
obspvd=ss(A,B,C,D); 
%convert continous to discrete 
dobspvd=c2d(obspvd,Ts); 
dobsp=dobspvd(1,:); 
dobsv=dobspvd(2,:);
dobsd=dobspvd(3,:); 
%make mechaware observer 
MWobsp=MWOBS(dobsp,'MWobsp'); % Creates Matlab Observer Structure 
%and Writes data to text file. 
MWobsv=MWOBS(dobsv,'MWobsv'); 
MWobsd=MWOBS(dobsd,'MWobsv');

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 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 Evaluate Block. 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

 
class OBSBlock: public virtual Block
{
public:
	// User accessible coefficients
	unsigned long Length;
	std::vector	A;
	std::vector	B;
	std::vector	C;
	std::vector	D;
};
  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< Length Order of the observer. Maximum order is 16
std::vector<double> A, B, C, D The observer coefficient matrices, A, B, C, and D

Methods

Block Methods

 

See Also

Matrix Gain

 

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