Changeset 62 for tests/pmsm.h
- Timestamp:
- 04/06/08 20:14:56 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tests/pmsm.h
r54 r62 10 10 RV ry ( "7 8", "{oia, oib}", ones_i ( 2 ) ,zeros_i ( 2 )); 11 11 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\$ 13 13 class IMpmsm : public diffbifn { 14 14 double Rs, Ls, dt, Ypm, kp, p, J, Mz; 15 15 16 16 public: 17 IMpmsm() :diffbifn ( rx, ru ) {};17 IMpmsm() :diffbifn (rx.count(), rx, ru ) {}; 18 18 //! Set mechanical and electrical variables 19 19 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;} … … 34 34 xk ( 1 ) = ( 1.0- Rs/Ls*dt ) * ibm - Ypm/Ls*dt*omm * cos ( thm ) + ubm*dt/Ls; 35 35 //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; 37 37 //th 38 38 xk ( 3 ) = rem(thm + omm*dt,2*pi); // <0..2pi> … … 52 52 A ( 1,2 ) = -Ypm/Ls*dt* cos ( thm ); A ( 1,3 ) = Ypm/Ls*dt*omm * ( sin ( thm ) ); 53 53 // 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 ) ); 56 56 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 ) ); 58 58 // d th 59 59 A ( 3,0 ) = 0.0; A ( 3,1 ) = 0.0; A ( 3,2 ) = dt; A ( 3,3 ) = 1.0; … … 64 64 }; 65 65 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\$ 67 67 class OMpmsm: public diffbifn { 68 68 public: 69 OMpmsm() :diffbifn ( rx,ru ) {};69 OMpmsm() :diffbifn (2, rx,ru ) {}; 70 70 71 71 vec eval ( const vec &x0, const vec &u0 ) {