28.01.2013 Views

Adaptative high-gain extended Kalman filter and applications

Adaptative high-gain extended Kalman filter and applications

Adaptative high-gain extended Kalman filter and applications

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

tel-00559107, version 1 - 24 Jan 2011<br />

4.3 real-time Implementation<br />

− the two last blocks are <strong>gain</strong> factors that adjust the measured signals to the appropriate<br />

scale 23 .<br />

The implementation of the two main blocks is done with the RTAICblock block that<br />

appears in the RTAI-lib palette. It is an adaptation of the Cblock2 block of the palette<br />

Others 24 .<br />

Generally speaking, Scicos blocks are composed of two files: the interfacing function <strong>and</strong><br />

the computational function. The role of the interfacing function is to link the computational<br />

function to Scicos. It defines how the computational function has to be interpreted <strong>and</strong> what<br />

the appearance of the Scicos block actually is (number of entry points, size <strong>and</strong> name of the<br />

block, etc.). The computational function is the core of the block. It defines what the block<br />

does. Most of the time a flag parameter is used to specify which part of the computational<br />

function has to be considered. As may be guessed from its name, the computational function<br />

of this block has to be written in C code. The structure is similar to that of a Matlab<br />

S-function (see [41], Chpt. 9, in particular Sec. 9.5.2).<br />

The calculation of a solution for the Riccati equation requires several matrix multiplications.<br />

We examined the two following approaches:<br />

1. Scicos is embedded into Scilab, which deals pretty smoothly with the multiplication of<br />

matrices. Scilab is built from several FORTRAN, C <strong>and</strong> C++ routines <strong>and</strong> is open<br />

source. This means that the original files are serviceable from Scilab source code. In<br />

order to use those routines in C, the header<br />

#include <br />

is required. The two routines we need are<br />

(a) extern int C2F(dmmul)(); that takes the matrices A, B, C as input parameters<br />

<strong>and</strong> outputs the matrix C = A × B,<br />

(b) extern int C2F(dmmul)(); that takes the matrices A, B, C as input parameters<br />

<strong>and</strong> outputs the matrix C = C + A × B,<br />

Combinations of those two functions enable us to perform all the matrix multiplications<br />

required. In addition, recall that the Ricatti matrix of <strong>Kalman</strong>-like <strong>filter</strong>s is square<br />

symmetric, i.e., for a dim(n × n) matrix, only n(n + 1)/2 integrations (or updates)<br />

are required. A small program that transforms the square matrix into a corresponding<br />

column vector <strong>and</strong> vice versa, must be developed.<br />

2. the matrices used have particular shapes:<br />

− A(u) is an upper diagonal matrix,<br />

− Q <strong>and</strong> R are taken diagonal,<br />

− b ∗ (z, u) is lower triangular.<br />

23 The I/O card delivers a digital input positive signal on the range (0 − 5), while the maximum current<br />

supported by the DC supply is 10 A. The scaling factor is therefore 2. The scaling factor for the voltage is 60.<br />

24 The palette Others is a regular Scicos palette. Since those two functions need to interact with the real-time<br />

routine of the operating system <strong>and</strong> have to be taken from the RTAI-lib palette.<br />

86

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!