Changeset 135 for pmsm/simulator_zdenek

Show
Ignore:
Timestamp:
07/25/08 15:04:05 (16 years ago)
Author:
smidl
Message:

oprava simulatoru

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pmsm/simulator_zdenek/simulator.cpp

    r130 r135  
    7373// real-time 
    7474double 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) 
     77static double ualfa=0., ubeta=0.; 
    7578 
    7679void pmsmsim_set_parameters(double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0) 
     
    114117  citac2=abs(0-(int)(DT/h)); //VS: oprava, je to spravne? 
    115118  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--; 
    116123 
    117124  modulace=1;           // THIPWM 
     
    304311void pmsmsim_step(double Ww)            // you must link array KalmanObs[] to EKF modul 
    305312{ 
    306   double Umk, ua, ub; 
     313  double Umk, ub, uc; 
    307314 
    308315//  while (t<=t_end) 
     
    310317    pwm(modulace); 
    311318//    *us=KalmanObs[0]; *(us+1)=KalmanObs[1]; 
     319//     *us=ualfa; *(us+1)=ubeta; 
    312320    pmsm_model(5); 
    313321 
     
    315323    { 
    316324      // 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 
    322331       
    323332      // real sampling - considered transport delay equal to the sampling period 
     
    341350      Isx=x[0];Isy=x[1];speed=x[2];theta=x[3]; 
    342351 
     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 
    343360      h_reg_counter=0; 
    344361    }