Changeset 236
- Timestamp:
- 01/15/09 16:33:18 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pmsm/simulator_zdenek/simulator.cpp
r227 r236 76 76 // stator voltage components in alfa beta (inluding impact of the real dc-link voltage) 77 77 static double ualfa=0., ubeta=0.; 78 79 80 /////////////////// POMOCNE FUNKCE ////////////////////////////////// 81 double uhel(double x, double y) 82 { 83 double th; 84 85 if (x==0) 86 if (y==0) th=0.; 87 else if (y>0) th=M_PI/2.; 88 else th=-M_PI/2.; 89 else 90 th=atan(y/x); 91 92 if (x<0) th+=M_PI; 93 94 return th; 95 } 96 ///////////////////////////////////////////////////////////////////// 97 78 98 79 99 void pmsmsim_set_parameters(double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0) … … 368 388 void pmsmsim_noreg_step(double ua, double ub) // you must link array KalmanObs[] to EKF modul 369 389 { 370 *us=ua; 371 *(us+1)=ub; 372 // pwm(modulace); 373 pmsm_model(5); 374 390 double kor_Uc; 391 392 *u=sqrt(ua*ua+ub*ub); 393 *(u+1)=uhel(ua,ub); 394 395 // uprava velikosti vzhledem k Uc!=Ucn 396 kor_Uc=230./Ucn; 397 *u*=kor_Uc; 398 399 pwm(modulace); 400 pmsm_model(5); 375 401 } 376 402 //////////////////////////////////////////////////////////////////////////////////////////////////////