Show
Ignore:
Timestamp:
08/01/11 22:11:09 (13 years ago)
Author:
smidl
Message:

MPF v C

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/pmsm/simulator_zdenek/simulator.cpp

    r1306 r1380  
    4242 
    4343// system state 
    44 double x[9]; // (isx,isy,wme,theta_e,M,Fsd,Isd,Isq,Mz) 
     44static double x[9]; // (isx,isy,wme,theta_e,M,Fsd,Isd,Isq,Mz) 
    4545 
    4646// internal variables of PWM module 
     
    7070 
    7171// output for EKF (voltages and measured currents, which are fed to KalmanObs) 
    72 double KalmanObs[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};      // usx, usy, Isx, Isy, usx_av, usy_av 
     72static double KalmanObs[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};      // usx, usy, Isx, Isy, usx_av, usy_av 
    7373 
    7474// real-time 
    75 double t=0.; //VS removed static due to clash with export in .h 
     75static double t=0.; //VS removed static due to clash with export in .h 
    7676 
    7777// stator voltage components in alfa beta (inluding impact of the real dc-link voltage) 
     
    510510////////////////////////////////////////////////////////////////////////////////////////////////////// 
    511511////////////////////////////////////////////////////////////////////////////////////////////////////// 
     512 
     513// for mexfile 
     514void pmsmsim_fill_parameters(double x_out[10]){ 
     515        x_out[0]= Rs; 
     516        x_out[1]= Ls; 
     517        x_out[2]= Fmag; 
     518        x_out[3]= Bf; 
     519        x_out[4]= p; 
     520        x_out[5]= kp; 
     521        x_out[6]= J; 
     522        x_out[7]= Uc; 
     523        x_out[8]= DT; 
     524        x_out[9]= h; 
     525} 
     526void pmsmsim_fill_xy(double xout[9], double yout[6]){ 
     527        for (int i=0;i<9;i++){ 
     528                xout[i]=x[i]; 
     529        } 
     530        for (int i=0;i<6;i++){ 
     531                yout[i]=KalmanObs[i]; 
     532        } 
     533} 
     534double pmsmsim_get_t() 
     535{ 
     536 return t; 
     537} 
     538