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

}<br />

C.2 Computational Function for the Simulation of the DC Machine<br />

i n t b l o c k −>n e v p r t ;<br />

i n t b l o c k −>nz ;<br />

d o u b l e ∗ b l o c k −>z ;<br />

i n t b l o c k −>nx ;<br />

d o u b l e ∗ b l o c k −>x;<br />

d o u b l e ∗ b l o c k −>xd ;<br />

d o u b l e ∗ b l o c k −>r e s ;<br />

i n t b l o c k −>nin ;<br />

i n t ∗ b l o c k −>i n s z ;<br />

d o u b l e ∗∗block −>i n p t r ;<br />

i n t b l o c k −>nout ;<br />

i n t ∗ b l o c k −>o u t s z ;<br />

d o u b l e ∗∗block −>o u t p t r ;<br />

i n t b l o c k −>nevout ;<br />

i n t b l o c k −>nrpar ;<br />

d o u b l e ∗ b l o c k −>rpar ;<br />

i n t b l o c k −>nipar ;<br />

i n t ∗ b l o c k −>i p a r ;<br />

i n t b l o c k −>ng ;<br />

d o u b l e ∗ b l o c k −>g;<br />

i n t ∗ b l o c k −>j r o o t ;<br />

char b l o c k −>l a b e l [ 4 1 ] ;<br />

∗/<br />

if ( f l a g == 4) { /∗ i n i t i a l i z a t i o n ∗/<br />

DCmachine bloc init ( block , f l a g ) ;<br />

} else if( f l a g == 1) { /∗ o u tput computation ∗/<br />

set b l o c k e r r o r ( DCmachine bloc outputs ( block , f l a g ) ) ;<br />

} else if( f l a g == 0) { /∗ d e r i v a t i v e or r e s i d u a l ..<br />

computation ∗/<br />

set b l o c k e r r o r ( DCmachine bloc deriv ( block , f l a g ) ) ;<br />

} else if ( f l a g == 5) { /∗ ending ∗/<br />

set b l o c k e r r o r ( DCmachine bloc ending ( block , f l a g ) ) ;<br />

}<br />

int DCmachine bloc init ( s c i c o s b l o c k ∗ block , int f l a g )<br />

{return 0;}<br />

int DCmachine bloc outputs ( s c i c o s b l o c k ∗ block , int f l a g )<br />

{ block−>outptr [ 0 ] [ 0 ] = block−>x [ 0 ] ;<br />

block−>outptr [ 0 ] [ 1 ] = block−>x [ 1 ] ;<br />

return 0;}<br />

int DCmachine bloc deriv ( s c i c o s b l o c k ∗ block , int f l a g )<br />

{double L=1.22 , Res =5.4183 , Laf =0.068;<br />

double J =0.0044 , B=0.0026 , p=0;<br />

double I=block−>x [ 0 ] , wr=block−>x [ 1 ] ;<br />

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

block−>xd [ 0 ] = (V−Res∗ I−Laf ∗wr∗ I ) /L ;<br />

block−>xd [ 1 ] = ( Laf ∗ I ∗ I−B∗wr−p∗pow( wr , 2 . 0 8 )−Tl ) /J ;<br />

return 0;}<br />

156

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

Saved successfully!

Ooh no, something went wrong!