Changeset 1314 for applications

Show
Ignore:
Timestamp:
03/25/11 19:52:28 (13 years ago)
Author:
smidl
Message:

test UD pro int/long variantu

Files:
1 modified

Legend:

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

    r1297 r1314  
    1919        vec R = vec(" 0.2000 0.3000"); 
    2020         
    21                 vec D = randu(5)*0.9; 
     21                vec D = randu(5)*0.4; 
    2222                vec xref = ones(5); 
    2323 
     
    4646         
    4747        mat PhiU =A*U; 
    48 /*      cout << "A*U" << round_i(PhiU*multip) <<endl; 
    49         cout << "PSIU: "; for (i=0; i<25;i++) cout << PSIU[i] << ","; cout <<endl;*/ 
     48        cout << "A*U" << round_i(PhiU*multip) <<endl; 
     49        cout << "PSIU: "; for (i=0; i<25;i++) cout << PSIU[i] << ","; cout <<endl; 
    5050         
    5151        Mat<int16> PUcmp(PSIU,5,5); 
    52 //      cout << "Delta PSI: " << round_i(PhiU*multip-(1<<(15-qAU))*PUcmp) <<endl; 
     52        imat PUcmpi=PUcmp; 
     53        cout << "Delta PSI: " << round_i(PhiU*multip-(1<<(15-qAU))*PUcmp) <<endl; 
    5354         
    5455        mat_to_int16(round_i(PhiU*multip/(1<<(15-qAU))),PSIU); //<< make is same 
     
    9192         
    9293        cout << endl<<"after thorton " <<endl; 
    93 //      cout << "U: " << round_i(U*multip) << endl; 
    94 //      cout << "D: " << round_i(D*multip) << endl; 
    95 //      cout << "Uf: "; for (i=0; i<25;i++) {cout << Uf[i] << ","; ((i+1)%5==0)? cout << endl:cout<<""; } 
    96 //      cout << "Df: "; for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
     94        cout << "U: " << round_i(U*multip) << endl; 
     95        cout << "D: " << round_i(D*multip) << endl; 
     96        cout << "Uf: "; for (i=0; i<25;i++) {cout << Uf[i] << ","; ((i+1)%5==0)? cout << endl:cout<<""; } 
     97        cout << "Df: "; for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
    9798 
    9899        Mat<int16> Ucmp(Uf,5,5); 
     
    119120         
    120121        int16 xf_old[5]; 
    121         vec_to_int16(ivec(xf,5),xf_old); 
     122        for (i=0;i<5;i++) xf_old[i]=xf[i]; 
    122123         
    123124        /////// Test bierman 
     
    126127        vec b; 
    127128        mat C = zeros(2,5); 
    128         C(0,0)=1.0;C(1,1)=1.0; 
     129        C(0,0)=.05;C(0,1)=-.01; 
     130        C(1,0)=0.; C(1,1) = .07; 
     131         
     132        int16 Cf[10]; 
     133        imat iC=round_i(C*multip); 
     134        mat_to_int16(iC, Cf); 
     135         
     136         
    129137        for (int16 iy=0; iy<2; iy++){ 
    130138                a     = U.T()*C.get_row(iy);    // a is not modified, but  
     
    156164        } 
    157165         
    158         bierman_fast(difz,xf, Uf, Df, Rf, 2, 5); 
     166        bierman_fastC(difz,xf, Uf, Df, Cf, Rf, 2, 5); 
    159167        cout << endl<<"after Bierman" <<endl; 
    160168/*      cout << "U: " << round_i(U*multip) << endl; 
     
    166174 
    167175        { 
    168         imat Ucmp(Uf,5,5); 
    169         ivec Dcmp(Df,5); 
     176        Mat<int16> Ucmp(Uf,5,5); 
     177        Vec<int16> Dcmp(Df,5); 
    170178        cout << "Delta U: " << round_i(U*multip-Ucmp) << endl; 
    171179        cout << "Delat D: " << round_i(D*multip-Dcmp) << endl;