Changeset 62 for tests/pmsm.h

Show
Ignore:
Timestamp:
04/06/08 20:14:56 (16 years ago)
Author:
smidl
Message:

nova simulace s EKFfixed a novy EKF na plnych maticich

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tests/pmsm.h

    r54 r62  
    1010RV ry ( "7 8", "{oia, oib}", ones_i ( 2 ) ,zeros_i ( 2 )); 
    1111 
    12 //! State evolution model for a PMSM drive and its derivative with respect to $x$ 
     12//! State evolution model for a PMSM drive and its derivative with respect to \$x\$ 
    1313class IMpmsm : public diffbifn { 
    1414        double Rs, Ls, dt, Ypm, kp, p,  J, Mz; 
    1515 
    1616public: 
    17         IMpmsm() :diffbifn ( rx, ru ) {}; 
     17        IMpmsm() :diffbifn (rx.count(), rx, ru ) {}; 
    1818        //! Set mechanical and electrical variables 
    1919        void set_parameters ( double Rs0, double Ls0, double dt0, double Ypm0, double kp0, double p0, double J0, double Mz0 ) {Rs=Rs0; Ls=Ls0; dt=dt0; Ypm=Ypm0; kp=kp0; p=p0; J=J0; Mz=Mz0;} 
     
    3434                xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 
    3535                //om 
    36                 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz; 
     36                xk ( 2 ) = omm;// + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz; 
    3737                //th 
    3838                xk ( 3 ) = rem(thm + omm*dt,2*pi); // <0..2pi> 
     
    5252                A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 
    5353                // d om 
    54                 A ( 2,0 ) = kp*p*p * Ypm/J*dt* ( - sin ( thm ) ); 
    55                 A ( 2,1 ) = kp*p*p * Ypm/J*dt* ( cos ( thm ) ); 
     54                A ( 2,0 ) = 0.0;//kp*p*p * Ypm/J*dt* ( - sin ( thm ) ); 
     55                A ( 2,1 ) = 0.0;//kp*p*p * Ypm/J*dt* ( cos ( thm ) ); 
    5656                A ( 2,2 ) = 1.0; 
    57                 A ( 2,3 ) = kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) ); 
     57                A ( 2,3 ) = 0.0;//kp*p*p * Ypm/J*dt* ( -ibm * sin ( thm )-iam * cos ( thm ) ); 
    5858                // d th 
    5959                A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; 
     
    6464}; 
    6565 
    66 //! Observation model for PMSM drive and its derivative with respect to $x$ 
     66//! Observation model for PMSM drive and its derivative with respect to \$x\$ 
    6767class OMpmsm: public diffbifn { 
    6868public: 
    69         OMpmsm() :diffbifn ( rx,ru ) {}; 
     69        OMpmsm() :diffbifn (2, rx,ru ) {}; 
    7070 
    7171        vec eval ( const vec &x0, const vec &u0 ) {