Changeset 1243 for applications/pmsm
- Timestamp:
- 11/02/10 21:20:06 (14 years ago)
- Location:
- applications/pmsm
- Files:
-
- 2 added
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/CMakeLists.txt
r1184 r1243 31 31 EXEC (pmsm_estim pmsmsim ekf_obj) 32 32 MEX (pmsm_estim pmsmsim ekf_obj) 33 EXEC (pmsm_ctrl pmsmsim ekf_obj) 34 MEX (pmsm_ctrl pmsmsim ekf_obj) 35 33 36 #EXEC (sim pmsmsim) 34 37 #EXEC (sim_var pmsmsim) -
applications/pmsm/pmsm.h
r1192 r1243 12 12 13 13 //TODO hardcoded RVs!!! 14 RV rx ( "{ia ib om th }");15 RV ru ( "{o_ua o_ub }");16 RV ry ( "{oia oib }");14 // RV rx ( "{ia ib om th }"); 15 // RV ru ( "{o_ua o_ub }"); 16 // RV ry ( "{oia oib }"); 17 17 18 18 // class uipmsm : public uibase{ … … 390 390 391 391 392 393 394 392 /*!@}*/ 395 393 #endif //PMSM_H -
applications/pmsm/pmsmDS.h
r1198 r1243 10 10 ----------------------------------- 11 11 */ 12 13 #ifndef PMSM_DS 14 #define PMSM_DS 12 15 13 16 #include <base/loggers.h> … … 116 119 if ( log_level[logvoltage] ) 117 120 { 118 L.add_vector ( log_level, logvoltage, ru, "model" );121 L.add_vector ( log_level, logvoltage, RV("{ua, ub }"), "model" ); 119 122 } 120 123 } … … 174 177 UIREGISTER ( pmsmDS ); 175 178 179 //! Simulator of PMSM machine with predefined profile on omega 180 class pmsmDSctrl : public pmsmDS 181 { 182 double Ww; 183 double ua; 184 double ub; 185 public: 186 //! Constructor with fixed sampling period 187 pmsmDSctrl() : pmsmDS() 188 { 189 Drv.add(RV ( "{Ww }" )); 190 Urv=RV ( "{ua ub }" ); 191 dtsize = Drv._dsize(); 192 utsize = Urv._dsize(); 193 } 194 195 void getdata ( vec &dt ) const 196 { 197 pmsmDS::getdata(dt); 198 dt(9)=Ww; 199 } 200 void write (const vec &ut ) { 201 ua = ut(0); 202 ub = ut(1); 203 } 204 205 void step() 206 { 207 static int ind=0; 208 static double dW; // increase of W 209 static double Mz; // W 210 t+=125e-6; 211 if ( t>=dt_prof*ind ) 212 { 213 ind++; 214 // check omega profile and set dW 215 if ( ind <2 && profileWw.length() ==1 ) 216 { 217 Ww=profileWw ( 0 ); 218 dW=0.0; 219 } 220 if ( ind<profileWw.length() ) 221 { 222 dW = profileWw ( ind )-profileWw ( ind-1 ); 223 dW *=125e-6/dt_prof; 224 } 225 else 226 { 227 dW = 0; 228 } 229 // Check Mz profile and set Mz 230 if ( ind<profileMz.length() ) 231 { 232 //sudden increase 233 Mz = profileMz(ind); 234 } 235 else 236 { 237 Mz = 0; 238 } 239 } 240 Ww += dW; 241 //Simulate Dt seconds! 242 for ( int i=0; i<Dt; i++ ) 243 { 244 pmsmsim_noreg_step (ua , ub); 245 } 246 }; 247 248 }; 249 250 UIREGISTER ( pmsmDSctrl ); 251 176 252 177 253 //! This class behaves like BM but it is evaluating EKF … … 337 413 338 414 UIREGISTER ( pmsmCRBMz ); 415 416 #endif -
applications/pmsm/simulator_zdenek/simulator.cpp
r326 r1243 484 484 485 485 pmsm_model(5); 486 487 KalmanObs[0]=ualfa; //debug_pwm; // usx 488 KalmanObs[1]=ubeta; // usy 489 490 KalmanObs[2]=x[0]; 491 KalmanObs[3]=x[1]; 492 493 // diagnostic - mean values of stator voltage components - pwm() 494 KalmanObs[4]=usx_av; 495 KalmanObs[5]=usy_av; 496 KalmanObs[6]=usxf; 497 KalmanObs[7]=usyf; 498 486 499 } 487 500 //////////////////////////////////////////////////////////////////////////////////////////////////////