Changeset 130 for pmsm

Show
Ignore:
Timestamp:
07/07/08 15:45:24 (16 years ago)
Author:
smidl
Message:

saturace na zadanem napeti v PWM + ukaldani "skutecnych" napeti do KalmanObs?

Location:
pmsm/simulator_zdenek
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pmsm/simulator_zdenek/regulace.cpp

    r44 r130  
    164164  filtr(Um/Ucn_2,&Urmf,Treg/Tfurm); 
    165165 
     166// saturation of modulation depth going to PWM 
     167  if (Um>Ucn_2*Urm_max) Um=Ucn_2*Urm_max;  // linear modulation area only - ensure max. modulation depth 
     168 
    166169/////// PRECHOD ZPET DO SIMULACE ////////////// 
    167170  *u=Um; 
  • pmsm/simulator_zdenek/simulator.cpp

    r108 r130  
    5858static double us[2]={0.,0.};    // format us={us_alfa, us_beta} 
    5959 
     60// variables for calculation of mean values of stator voltage components 
     61static double usx_av=0., usy_av=0.,sum_usx_av=0.,sum_usy_av=0.; 
     62 
     63// variables for calculation of mean values of stator current components - (alfa, beta) 
     64static double isx_av=0., isy_av=0.,sum_isx_av=0.,sum_isy_av=0.; 
     65 
     66// stator voltage components filtering 
     67static double usxf=0.,usyf=0.,Tf=0.01; 
     68static unsigned int start_filter=1; 
     69 
    6070// output for EKF (voltages and measured currents, which are fed to KalmanObs) 
    61 double KalmanObs[4]={0.,0.,0.,0.};      // usx, usy, Isx, Isy 
     71double KalmanObs[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};      // usx, usy, Isx, Isy, usx_av, usy_av 
    6272 
    6373// real-time 
     
    8797  h_reg=125e-6;         // fpwm = 4kHz 
    8898  h_reg_counter_mez=(int)(h_reg/h);         // emulation of operation of DSP timer 
    89   h_reg_counter=h_reg_counter_mez; 
     99  //h_reg_counter=h_reg_counter_mez; 
     100  h_reg_counter=1; 
    90101  h_reg_real=h_reg_counter_mez*h;           // real sampling period 
    91102 
     
    155166 
    156167  for (i=0;i<3;i++) 
    157   { dtr[i]=ubytek(fabs(iabc[i])); 
     168  { dtr[i]=ubytek(fabs(iabc[i]))*0.; 
    158169    dd[i]=dtr[i]*.73; 
    159170  } 
     
    182193 
    183194  // emulation of DSP timers 
    184   if ((citac==citac_PR)||(citac==0)) smer*=-1; 
     195  if ((citac==citac_PR)||(citac==0)) 
     196  { 
     197    smer*=-1; 
     198    // calculation of stator voltage components mean values 
     199    usx_av=h/h_reg*sum_usx_av; 
     200    usy_av=h/h_reg*sum_usy_av; 
     201    // reset of sum accumulators 
     202    sum_usx_av=0.; 
     203    sum_usy_av=0.; 
     204     
     205    // stator current components mean values - reference frame (alfa, beta) 
     206    isx_av=h/h_reg*sum_isx_av; 
     207    isy_av=h/h_reg*sum_isy_av; 
     208    // reset of sum accumulators 
     209    sum_isx_av=0.; 
     210    sum_isy_av=0.; 
     211  } 
    185212  if ((citac2==citac_PR)||(citac2==0)) smer2*=-1; 
    186213  citac+=smer; 
    187214  citac2+=smer2; 
     215   
     216  // calculation of stator voltage components mean values - sum 
     217  sum_usx_av+=*us; 
     218  sum_usy_av+=*(us+1); 
     219   
     220  // stator voltage components filtering 
     221  //if (start_filter==1) 
     222  usxf+=(*us-usxf)*h/h_reg; 
     223  usyf+=(*(us+1)-usyf)*h/h_reg; 
     224   
     225  // stator current components mean values - reference frame (alfa, beta) 
     226  sum_isx_av+=*x; 
     227  sum_isy_av+=*(x+1); 
    188228} 
    189229 
     
    280320      KalmanObs[0]=ua;                     // usx 
    281321      KalmanObs[1]=(ua+2.*ub)/sqrt(3.);    // usy 
    282       KalmanObs[2]=Isx; 
    283       KalmanObs[3]=Isy; 
     322       
     323      // real sampling - considered transport delay equal to the sampling period 
     324/*     KalmanObs[2]=Isx; 
     325     KalmanObs[3]=Isy;*/ 
     326      // ideal sampling 
     327      KalmanObs[2]=x[0]; 
     328      KalmanObs[3]=x[1]; 
     329       
     330      // diagnostic - mean values of stator voltage components - pwm() 
     331      KalmanObs[4]=usx_av; 
     332      KalmanObs[5]=usy_av; 
     333      KalmanObs[6]=usxf; 
     334      KalmanObs[7]=usyf; 
     335      KalmanObs[8]=isx_av; 
     336      KalmanObs[9]=isy_av;       
    284337 
    285338      vektor_regulace(0,0,Urm_max,Ww,u,Isx,Isy,theta,speed,U_modulace,Uc,Ucn,REZIM_REGULACE);   // rezim=1 ... reg. rychlosti, rezim=0 ... reg. momentu 
  • pmsm/simulator_zdenek/simulator.h

    r108 r130  
    2222extern double x[9];  
    2323extern double t;  
    24 extern double KalmanObs[4]; 
     24extern double KalmanObs[10];