Changeset 236

Show
Ignore:
Timestamp:
01/15/09 16:33:18 (15 years ago)
Author:
peroutka
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pmsm/simulator_zdenek/simulator.cpp

    r227 r236  
    7676// stator voltage components in alfa beta (inluding impact of the real dc-link voltage) 
    7777static double ualfa=0., ubeta=0.; 
     78 
     79 
     80/////////////////// POMOCNE FUNKCE ////////////////////////////////// 
     81double 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 
    7898 
    7999void pmsmsim_set_parameters(double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0) 
     
    368388void pmsmsim_noreg_step(double ua, double ub)            // you must link array KalmanObs[] to EKF modul 
    369389{ 
    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); 
    375401} 
    376402//////////////////////////////////////////////////////////////////////////////////////////////////////