Changeset 135 for pmsm/simulator_zdenek
- Timestamp:
- 07/25/08 15:04:05 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pmsm/simulator_zdenek/simulator.cpp
r130 r135 73 73 // real-time 74 74 double t=0.; //VS removed static due to clash with export in .h 75 76 // stator voltage components in alfa beta (inluding impact of the real dc-link voltage) 77 static double ualfa=0., ubeta=0.; 75 78 76 79 void pmsmsim_set_parameters(double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0) … … 114 117 citac2=abs(0-(int)(DT/h)); //VS: oprava, je to spravne? 115 118 citac_PR=h_reg_counter_mez; 119 120 // first interrupt occur after first period match => add 1 to both counter registers 121 citac++;smer=1; 122 citac2--; 116 123 117 124 modulace=1; // THIPWM … … 304 311 void pmsmsim_step(double Ww) // you must link array KalmanObs[] to EKF modul 305 312 { 306 double Umk, u a, ub;313 double Umk, ub, uc; 307 314 308 315 // while (t<=t_end) … … 310 317 pwm(modulace); 311 318 // *us=KalmanObs[0]; *(us+1)=KalmanObs[1]; 319 // *us=ualfa; *(us+1)=ubeta; 312 320 pmsm_model(5); 313 321 … … 315 323 { 316 324 // voltages and measured currents for EKF 317 Umk=*u*Uc/Ucn; 318 ua=Umk*cos(*(u+1)); 319 ub=Umk*cos(*(u+1)-2./3.*M_PI); 320 KalmanObs[0]=ua; // usx 321 KalmanObs[1]=(ua+2.*ub)/sqrt(3.); // usy 325 // Umk=*u*Uc/Ucn; 326 // ualfa=Umk*cos(*(u+1)); 327 // ub=Umk*cos(*(u+1)-2./3.*M_PI); 328 KalmanObs[0]=ualfa; // usx 329 //KalmanObs[1]=(ualfa+2.*ub)/sqrt(3.); // usy 330 KalmanObs[1]=ubeta; // usy 322 331 323 332 // real sampling - considered transport delay equal to the sampling period … … 341 350 Isx=x[0];Isy=x[1];speed=x[2];theta=x[3]; 342 351 352 // include ideal commanded stator voltage 353 Umk=*u*Uc/Ucn; 354 ualfa=Umk*cos(*(u+1)); // usx = usa 355 ub=Umk*cos(*(u+1)-2./3.*M_PI); 356 ubeta=(ualfa+2.*ub)/sqrt(3.); // usy 357 // uc=-ualfa-ub; 358 // ubeta=(ub-uc)/sqrt(3.); 359 343 360 h_reg_counter=0; 344 361 }