Changeset 3790

Show
Ignore:
Timestamp:
05/12/07 14:24:40 (6 years ago)
Author:
jgaeddert
Message:

adding new test to SymbolSyncPoly DSP; method to change loop filter bandwidth

Location:
experimental/components/SymbolSyncPoly
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/SymbolSyncPoly/autotest_sources/SymbolSyncPoly_testsuite.h

    r3786 r3790  
    1010 
    1111#include "test_02.h" 
     12#include "test_03.h" 
    1213 
    1314// 
    1415// A simple test suite: Just inherit CxxTest::TestSuite and write tests! 
    1516// 
     17 
     18unsigned 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 
    1633 
    1734// NOTE: " : public CxxTest::TestSuite" must be on the same line as the class 
     
    160177    } 
    161178 
    162  
    163179    // test_02 
    164     void testSymbolSynchronizationTimingOffset() 
     180    void testSymbolSynchronizationTimingOffset_02() 
    165181    { 
    166         std::cout << std::endl << "testSymbolSynchronizationTimingOffset" << std::endl; 
     182        std::cout << std::endl << "testSymbolSynchronizationTimingOffset_02" << std::endl; 
    167183        SymbolSyncPolyDSP symbolSync; 
    168184 
    169185        // Init variables shall match the values used in MATLAB to get the test vectors and 
    170186        // expected result 
    171         unsigned int Npfb_02 = 32; 
    172187        unsigned int N_out_02 = N_in_02; 
    173188 
     
    179194 
    180195        symbolSync.ConfigureFilterBank(type_02, k_02, m_02, beta_02, Npfb_02); 
     196        symbolSync.UpdateTimingLoopFilterCoefficients(alpha_s_02, beta_s_02); 
    181197 
    182198        //send test data 
     
    202218        std::cout << "num_correct_symbols : " << num_correct_symbols << std::endl; 
    203219 
    204         TS_ASSERT(num_correct_symbols > 150); 
     220        TS_ASSERT(num_correct_symbols > 200); 
    205221 
    206222        delete [] I_out_02; 
     
    208224    } 
    209225 
     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 
    210272}; 
    211273 
  • experimental/components/SymbolSyncPoly/autotest_sources/test_02.h

    r3786 r3790  
    1414unsigned int m_02 = 4;          // Symbol delay 
    1515float beta_02 = 0.25;           // Excess bandwidth factor 
     16unsigned int Npfb_02 = 32;      // Number of filters in filter bank 
     17 
    1618short Ac_02 = 10000;            // Signal amplitude 
     19 
     20float alpha_s_02 = 0.05f;       // Loop control feedback coefficient 
     21float beta_s_02 = 1.025f;       // Loop control feedforware coefficient 
    1722 
    1823short I_in_02[512] = { 
  • experimental/components/SymbolSyncPoly/src/SymbolSyncPolyDSP.h

    r3786 r3790  
    6161            float _beta, 
    6262            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    } 
    6370 
    6471    /// Estimate timing information