Changeset 3790
- Timestamp:
- 05/12/07 14:24:40 (6 years ago)
- Location:
- experimental/components/SymbolSyncPoly
- Files:
-
- 1 added
- 3 modified
-
autotest_sources/SymbolSyncPoly_testsuite.h (modified) (5 diffs)
-
autotest_sources/test_02.h (modified) (1 diff)
-
autotest_sources/test_03.h (added)
-
src/SymbolSyncPolyDSP.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
experimental/components/SymbolSyncPoly/autotest_sources/SymbolSyncPoly_testsuite.h
r3786 r3790 10 10 11 11 #include "test_02.h" 12 #include "test_03.h" 12 13 13 14 // 14 15 // A simple test suite: Just inherit CxxTest::TestSuite and write tests! 15 16 // 17 18 unsigned int CountSymbolErrors( short * msg_in_i, 19 short * msg_in_q, 20 short * msg_out_i, 21 short * msg_out_q, 22 short tol, 23 unsigned int N) 24 { 25 unsigned int num_errors(0); 26 for (unsigned int i=0; i<N; i++) { 27 if ( abs(msg_in_i[i]-msg_out_i[i]) > tol && abs(msg_in_q[i]-msg_out_q[i]) > tol ) 28 num_errors++; 29 } 30 return num_errors; 31 } 32 16 33 17 34 // NOTE: " : public CxxTest::TestSuite" must be on the same line as the class … … 160 177 } 161 178 162 163 179 // test_02 164 void testSymbolSynchronizationTimingOffset ()180 void testSymbolSynchronizationTimingOffset_02() 165 181 { 166 std::cout << std::endl << "testSymbolSynchronizationTimingOffset " << std::endl;182 std::cout << std::endl << "testSymbolSynchronizationTimingOffset_02" << std::endl; 167 183 SymbolSyncPolyDSP symbolSync; 168 184 169 185 // Init variables shall match the values used in MATLAB to get the test vectors and 170 186 // expected result 171 unsigned int Npfb_02 = 32;172 187 unsigned int N_out_02 = N_in_02; 173 188 … … 179 194 180 195 symbolSync.ConfigureFilterBank(type_02, k_02, m_02, beta_02, Npfb_02); 196 symbolSync.UpdateTimingLoopFilterCoefficients(alpha_s_02, beta_s_02); 181 197 182 198 //send test data … … 202 218 std::cout << "num_correct_symbols : " << num_correct_symbols << std::endl; 203 219 204 TS_ASSERT(num_correct_symbols > 150);220 TS_ASSERT(num_correct_symbols > 200); 205 221 206 222 delete [] I_out_02; … … 208 224 } 209 225 226 227 // test_03 228 void testSymbolSynchronizationTimingOffset_03() 229 { 230 std::cout << std::endl << "testSymbolSynchronizationTimingOffset_03" << std::endl; 231 SymbolSyncPolyDSP symbolSync; 232 233 // Init variables shall match the values used in MATLAB to get the test vectors and 234 // expected result 235 unsigned int N_out_03 = N_in_03; 236 237 //Need some buffer for mismatched samples per symbol 238 short* I_out_03 = new short[N_out_03]; 239 short* Q_out_03 = new short[N_out_03]; 240 memset( I_out_03, 0, N_out_03*sizeof(short) ); 241 memset( Q_out_03, 0, N_out_03*sizeof(short) ); 242 243 symbolSync.ConfigureFilterBank(type_03, k_03, m_03, beta_03, Npfb_03); 244 symbolSync.UpdateTimingLoopFilterCoefficients(alpha_s_03, beta_s_03); 245 246 //send test data 247 symbolSync.SynchronizeAndDecimate( 248 I_in_03, 249 Q_in_03, 250 N_in_03, 251 I_out_03, 252 Q_out_03, 253 N_out_03); 254 255 // hard decision to see if we recovered the message correctly 256 unsigned int num_errors_2_percent; 257 num_errors_2_percent = 258 CountSymbolErrors(I_out_03+m_03-1, Q_out_03+m_03-1, msg_i_03, msg_q_03, Ac_03/50, N_out_03-m_03); 259 std::cout << " num errors outside 2% tolerance = " << num_errors_2_percent << std::endl; 260 TS_ASSERT(num_errors_2_percent < 50); 261 262 unsigned int num_errors_5_percent; 263 num_errors_5_percent = 264 CountSymbolErrors(I_out_03+m_03-1, Q_out_03+m_03-1, msg_i_03, msg_q_03, Ac_03/20, N_out_03-m_03); 265 std::cout << " num errors outside 5% tolerance = " << num_errors_5_percent << std::endl; 266 TS_ASSERT(num_errors_5_percent < 20); 267 268 delete [] I_out_03; 269 delete [] Q_out_03; 270 } 271 210 272 }; 211 273 -
experimental/components/SymbolSyncPoly/autotest_sources/test_02.h
r3786 r3790 14 14 unsigned int m_02 = 4; // Symbol delay 15 15 float beta_02 = 0.25; // Excess bandwidth factor 16 unsigned int Npfb_02 = 32; // Number of filters in filter bank 17 16 18 short Ac_02 = 10000; // Signal amplitude 19 20 float alpha_s_02 = 0.05f; // Loop control feedback coefficient 21 float beta_s_02 = 1.025f; // Loop control feedforware coefficient 17 22 18 23 short I_in_02[512] = { -
experimental/components/SymbolSyncPoly/src/SymbolSyncPolyDSP.h
r3786 r3790 61 61 float _beta, 62 62 unsigned int _Npfb); 63 64 /// 65 ///\todo change to : void UpdateTimingLoopFilterCoefficients(float _BT); 66 void UpdateTimingLoopFilterCoefficients(float _alpha, float _beta) { 67 alpha = _alpha; 68 beta = _beta; 69 } 63 70 64 71 /// Estimate timing information