Changeset 1314 for applications/pmsm
- Timestamp:
- 03/25/11 19:52:28 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/simulator_zdenek/test_UD.cpp
r1297 r1314 19 19 vec R = vec(" 0.2000 0.3000"); 20 20 21 vec D = randu(5)*0. 9;21 vec D = randu(5)*0.4; 22 22 vec xref = ones(5); 23 23 … … 46 46 47 47 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; 50 50 51 51 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; 53 54 54 55 mat_to_int16(round_i(PhiU*multip/(1<<(15-qAU))),PSIU); //<< make is same … … 91 92 92 93 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; 97 98 98 99 Mat<int16> Ucmp(Uf,5,5); … … 119 120 120 121 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]; 122 123 123 124 /////// Test bierman … … 126 127 vec b; 127 128 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 129 137 for (int16 iy=0; iy<2; iy++){ 130 138 a = U.T()*C.get_row(iy); // a is not modified, but … … 156 164 } 157 165 158 bierman_fast (difz,xf, Uf, Df, Rf, 2, 5);166 bierman_fastC(difz,xf, Uf, Df, Cf, Rf, 2, 5); 159 167 cout << endl<<"after Bierman" <<endl; 160 168 /* cout << "U: " << round_i(U*multip) << endl; … … 166 174 167 175 { 168 imatUcmp(Uf,5,5);169 ivecDcmp(Df,5);176 Mat<int16> Ucmp(Uf,5,5); 177 Vec<int16> Dcmp(Df,5); 170 178 cout << "Delta U: " << round_i(U*multip-Ucmp) << endl; 171 179 cout << "Delat D: " << round_i(D*multip-Dcmp) << endl;