Changeset 1183 for applications/pmsm

Show
Ignore:
Timestamp:
09/10/10 11:11:33 (14 years ago)
Author:
smidl
Message:

Test passed for both bierman and thorton

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/pmsm/simulator_zdenek/ekf_example/ekf_obj.cpp

    r1182 r1183  
    231231        U = est._R()._L().T(); 
    232232        D =  est._R()._D(); 
    233         if (false){ 
     233         
     234        bool DBG=true; 
     235        if (DBG){ 
    234236                mat L; 
    235237                ivec tmp; 
     
    259261        xref(4) = 34.0; 
    260262         
    261         if (false){ 
     263        if (DBG){ 
    262264                xref = ones(5); 
    263265        } 
     
    348350        thorton(Uf,Df,PSIU,Qf,Gf,Dfold,5); 
    349351         
    350 /*      cout << "bierman double I" <<endl; 
     352        if (DBG){ 
     353                _mu = vec("0.500 0.200 0.300 0.400 0.1"); 
     354        } 
     355         
     356        cout << "bierman double I" <<endl; 
    351357        UDtof(U,D,Utf,Dtf,xref); 
    352358        cout << "Uf: " << Utf << endl; 
    353359        cout << "Df: " << Dtf << endl; 
    354         cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl;*/ 
     360        cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl; 
    355361        mat_to_int(Utf,Uf);              
    356362        vec_to_int(Dtf, Df);  
     
    363369        vec yp = phxu->eval(_mu,u); 
    364370        vec xp=_mu; // used in bierman 
     371         
     372        if (DBG){ 
     373                yp = vec("0.40 0.300"); 
     374        } 
    365375         
    366376        for (int iy=0; iy<dimy; iy++){ 
     
    392402        } 
    393403 
    394 // UDtof(U,D,Utf,Dtf,xref); 
    395 // cout << "Uf: " << Utf << endl; 
    396 // cout << "Df: " << Dtf << endl; 
    397 // cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl; 
     404UDtof(U,D,Utf,Dtf,xref); 
     405cout << "Uf: " << Utf << endl; 
     406cout << "Df: " << Dtf << endl; 
     407cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl; 
    398408 
    399409        int difz[2]; 
     
    401411        int xf[5]; 
    402412        vec_to_int(round_i(elem_div(xp,xref)*(1<<15)), xf); 
    403         int Rf[2]={1,1}; 
    404         //vec_to_int(round_i(R/pow(xref(0),2)*(1<<15)), Rf); 
     413        int Rf[2];//={1,1}; 
     414        vec_to_int(round_i(R/pow(xref(0),2)*(1<<15)), Rf); 
    405415        //beirman(int *difz, int *xp, int *U, int *D, int *R, unsigned int dimy, unsigned int dimx  
    406416         
    407 //      cout <<endl<< "bierman fixed" <<endl; 
    408 //      for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 
    409 //      for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
    410 //      for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 
    411 //  
    412 //      for (i=0; i<2;i++) cout << difz[i] << ","; cout << endl; 
     417        cout <<endl<< "bierman fixed" <<endl; 
     418        cout << "Uf: "; for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 
     419        cout << "Df: "; for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
     420        cout << "xf: "; for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 
     421 
     422        cout << "dz: "; for (i=0; i<2;i++) cout << difz[i] << ","; cout << endl; 
    413423 
    414424        int xf_old[5]; 
     
    417427         
    418428        UDtof(U,D,Utf,Dtf,xref); 
    419 /*      for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 
    420         for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
    421         for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 
    422         cout << endl;*/ 
     429        cout << "Uf: "; for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 
     430        cout << "Df: "; for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
     431        cout << "xf: "; for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 
     432        cout << endl; 
    423433         
    424434