Changeset 81
- Timestamp:
- 04/18/08 14:10:47 (17 years ago)
- Location:
- pmsm
- Files:
-
- 1 added
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pmsm/CMakeLists.txt
r73 r81 38 38 target_link_libraries (pmsm_sim2 ${BdmLibs} pmsmsim ) 39 39 target_link_libraries (pmsm_sim3 ${BdmLibs} pmsmsim ekf_obj) 40 41 add_executable (sim_var sim_var.cpp) 42 target_link_libraries (sim_var ${BdmLibs} pmsmsim) -
pmsm/pmsm.h
r72 r81 3 3 4 4 #include <stat/libFN.h> 5 #include <userinfo.h> 5 6 6 7 … … 9 10 RV ru ( "5 6", "{ua, ub}", ones_i ( 2 ) ,zeros_i ( 2 )); 10 11 RV ry ( "7 8", "{oia, oib}", ones_i ( 2 ) ,zeros_i ( 2 )); 12 13 class uipmsm : public uicompound{ 14 double Rs, Ls, dt, Ypm, kp, p, J, Mz; 15 }; 11 16 12 17 //! State evolution model for a PMSM drive and its derivative with respect to \$x\$ … … 37 42 xk ( 2 ) = omm + kp*p*p * Ypm/J*dt* ( ibm * cos ( thm )-iam * sin ( thm ) ) - p/J*dt*Mz; 38 43 //th 39 xk ( 3 ) = rem(thm + omm*dt,2*pi); // <0..2pi> 44 xk ( 3 ) = thm + omm*dt; // <0..2pi> 45 if ( xk ( 3 ) >pi ) xk ( 3 )-=2*pi; 46 if ( xk ( 3 ) <-pi ) xk ( 3 ) +=2*pi; 40 47 return xk; 41 48 } -
pmsm/pmsm_sim2.cpp
r72 r81 42 42 xtrue(3)=x[3]; 43 43 44 ll = -0.5* ( 4 * 1.83787706640935 +_P ->logdet() +xtrue* ( inv(_P->to_mat())*xtrue ));44 ll = -0.5* ( 4 * 1.83787706640935 +_P.logdet() +_P.invqform(xtrue)); 45 45 } 46 46 }; -
pmsm/pmsm_sim3.cpp
r72 r81 150 150 Dt.set_row ( tK, concat ( dt,ut)); 151 151 XtE.set_row ( tK,KFEep.mean() ); 152 double qNaN = std::numeric_limits<double>::quiet_NaN();153 152 XtM.set_row ( tK,Mep.mean() ); 154 153 }