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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

C.4 Innovation Computational Functions C Code<br />

− to update the vector of past values of u from [u(t−d), ..., u(t−δ)] to [u(t−d+δ), ..., u(t)].<br />

function name innovation number of zero crossing<br />

surfaces<br />

0<br />

implicit n initial discrete state ⊛<br />

input port size 5 real parameter vector []<br />

output port size 1 integer parameter vector<br />

[]<br />

input event port size [1] initial firing vector []<br />

output event port size [] direct feed through y<br />

initial continuous state [] time dependence n<br />

#include <br />

#include <br />

#include <br />

/∗ i n p u t = [Y;V; z ( t−d ) ] ∗/<br />

void f u n c t i o n ( double ∗ , double ∗) ;<br />

Table C.3: Arguments of the Innovation Function.<br />

⊛ = a null vector of length 2*(d/Dt)+2, (i.e. 22).<br />

void i n n o v a t i o n ( s c i c o s b l o c k ∗ block , int f l a g )<br />

{<br />

double d=1,Dt =0.1;<br />

int n=10; /∗ ( d/Dt ) ; ∗/ /∗ Auto conversion d o u b l e −> i n t ∗/<br />

int nz , i , j ;<br />

/∗ Remark t h a t t h e r e i s NO TEST: Dt has to d i v i d e d ! ! ∗/<br />

nz=2∗n+2;<br />

if ( f l a g ==4)<br />

{/∗ INITIALISATION ∗/<br />

/∗ Already done . I t i s i m p o s s i b l e to change t h e dimension o f ..<br />

t h e s t a t e space from here ∗/<br />

}<br />

else if( f l a g ==1| f l a g ==6)<br />

{/∗ OUTPUT ∗/<br />

block−>outptr [ 0 ] [ 0 ] = block−>z [ nz −1];}<br />

else if( f l a g ==2)<br />

{/∗ DERIVATIVE ∗/<br />

/∗ d e l a y e d i n p u t ( index 2 ,3 ,4) ∗/<br />

double I , wr=block−>i n p t r [ 0 ] [ 3 ] , Tl=block−>i n p t r [ 0 ] [ 4 ] ;<br />

if ( block−>i n p t r [ 0 ] [ 2 ] > 0 . 5 ) { I=block−>i n p t r [ 0 ] [ 2 ] ; }<br />

else{ I =0.5;}<br />

double Y=block−>i n p t r [ 0 ] [ 0 ] , V=block−>i n p t r [ 0 ] [ 1 ] ;<br />

160

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

Saved successfully!

Ooh no, something went wrong!