Changeset 3386

Show
Ignore:
Timestamp:
04/10/07 17:19:10 (6 years ago)
Author:
jgaeddert
Message:

Binding SymbolSyncPolyDSP to component structure

Location:
experimental/components/SymbolSyncPoly
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/SymbolSyncPoly/SymbolSyncPoly.cpp

    r3374 r3386  
    3838    //Start the thread containing the writer's processing function  
    3939    processing_thread->start(); 
     40 
     41    isConfigured_pulseShape = true; 
     42    isConfigured_k          = false; 
     43    isConfigured_m          = false; 
     44    isConfigured_beta       = false; 
     45    isConfigured_Npfb       = false; 
    4046 
    4147} 
     
    120126            CORBA::UShort simple_temp; 
    121127            props[i].value >>= simple_temp; 
    122             simple_1_value = simple_temp; 
     128            _k = simple_temp; 
     129            isConfigured_k = true; 
    123130        } else if (strcmp(props[i].id, "DCE:99bf718e-e44e-11db-99e4-00123f63025f") == 0) { 
    124131            // m : symbol delay 
    125132            CORBA::UShort simple_temp; 
    126133            props[i].value >>= simple_temp; 
    127             simple_2_value = simple_temp; 
     134            _m = simple_temp; 
     135            isConfigured_m = true; 
    128136        } else if (strcmp(props[i].id, "DCE:afc47b82-e44e-11db-b1f3-00123f63025f") == 0) { 
    129137            // beta : excess bandwidth factor 
    130138            CORBA::Float simple_temp; 
    131139            props[i].value >>= simple_temp; 
    132             simple_3_value = simple_temp; 
     140            _beta = simple_temp; 
     141            isConfigured_beta = true; 
    133142        } else if (strcmp(props[i].id, "DCE:bea3b19a-e44e-11db-a3dd-00123f63025f") == 0) { 
    134             // N : number of filters in bank 
     143            // Npfb : number of filters in bank 
    135144            CORBA::UShort simple_temp; 
    136145            props[i].value >>= simple_temp; 
    137             simple_4_value = simple_temp; 
     146            _Npfb = simple_temp; 
     147            isConfigured_Npfb = true; 
    138148        } else { 
    139149            // unknown property 
     
    142152        } 
    143153    } 
     154 
     155    /// \todo configure filter bank type 
     156    /// 
     157    /// Once all properties have been configured, create the filter bank 
     158    if ( isConfigured_k     && 
     159         isConfigured_m     && 
     160         isConfigured_beta  && 
     161         isConfigured_Npfb ) 
     162    { 
     163        DEBUG(5, SymbolSyncPoly, "configuring filter bank for " <<  
     164              "rrcos" << ", k=" << _k << ", m=" << _m << ", beta=" << _beta << ", Npfb=" << Npfb) 
     165        ConfigureFilterBank("rrcos", _k, _m, _beta, _Npfb); 
     166    } 
    144167} 
    145168 
     
    150173    PortTypes::ShortSequence I_out_0, Q_out_0; 
    151174 
    152  
    153175    PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); 
    154     CORBA::UShort I_in_0_length, Q_in_0_length; 
     176    unsigned int I_in_0_length, Q_in_0_length, N_in(0), N_out(0); 
     177    short * I_in(NULL); 
     178    short * Q_in(NULL); 
     179    short * I_out(NULL); 
     180    short * Q_out(NULL); 
    155181 
    156182    while( true ) 
    157183    { 
     184        // Get data from port 
    158185        dataIn_0->getData(I_in_0, Q_in_0); 
    159186 
     187        // Read input data length 
    160188        I_in_0_length = I_in_0->length(); 
    161189        Q_in_0_length = Q_in_0->length(); 
    162190 
    163         I_out_0.length(); //must define length of output 
    164         Q_out_0.length(); //must define length of output 
    165  
    166         /*insert code here to do work*/ 
    167  
    168  
    169  
    170  
    171  
     191        if ( I_in_0_length != Q_in_0_length ) { 
     192            // Not sure how to handle multiple-length inputs 
     193            std::cerr << "ERROR: SymbolSyncPoly_i::ProcessData()" << std::endl 
     194                      << "  => Not sure how to handle multiple-length inputs" << std::endl; 
     195            throw 0; 
     196        } else { 
     197            N_in = I_in_0_length; 
     198        } 
     199 
     200        // Configure output data length 
     201        if ( I_out == NULL ) { 
     202            I_out = new short[2*N_in/k]; 
     203            Q_out = new short[2*N_in/k]; 
     204            N_out = 2*N_in/k; 
     205        } else if ( N_out < (2*N_in/k) ) { 
     206            delete [] I_out; 
     207            delete [] Q_out; 
     208            I_out = new short[2*N_in/k]; 
     209            Q_out = new short[2*N_in/k]; 
     210            N_out = 2*N_in/k; 
     211        } else { 
     212            // Nothing to do 
     213        } 
     214 
     215        // Main signal processing algorithm 
     216        SynchronizeAndDecimate( 
     217            I_in, Q_in, N_in, 
     218            I_out, Q_out, N_out); 
     219 
     220        I_out_0.length(N_out); 
     221        Q_out_0.length(N_out); 
     222 
     223        /// \todo Initialize I_out_0 and Q_out_0 from array instead 
     224        /// of copying values in loop 
     225        for (unsigned int ii=0; ii<N_out; ii++) { 
     226            I_out_0[ii] = I_out[ii]; 
     227            Q_out_0[ii] = Q_out[ii]; 
     228        } 
    172229 
    173230        dataIn_0->bufferEmptied(); 
  • experimental/components/SymbolSyncPoly/SymbolSyncPoly.h

    r3374 r3386  
    7474    ///   - \ref prop_m 
    7575    ///   - \ref prop_beta 
    76     ///   - \ref prop_N 
     76    ///   - \ref prop_Npfb 
    7777    void configure(const CF::Properties&) 
    7878        throw (CORBA::SystemException, 
     
    9494    omni_thread *processing_thread;     ///< for component writer function 
    9595     
     96    // Configuration variables 
    9697    //CORBA::String simple_0_value; 
    97     CORBA::UShort simple_1_value; 
    98     CORBA::UShort simple_2_value; 
    99     CORBA::Float simple_3_value; 
    100     CORBA::UShort simple_4_value; 
     98    unsigned int _k; 
     99    unsigned int _m; 
     100    float _beta; 
     101    unsigned int _Npfb; 
    101102     
    102103    // list components provides and uses ports 
    103104    standardInterfaces_i::complexShort_p *dataIn_0; 
    104105    standardInterfaces_i::complexShort_u *dataOut_0; 
     106 
     107    // configuration flags 
     108    bool isConfigured_pulseShape; 
     109    bool isConfigured_k; 
     110    bool isConfigured_m; 
     111    bool isConfigured_beta; 
     112    bool isConfigured_Npfb; 
    105113     
    106114}; 
  • experimental/components/SymbolSyncPoly/SymbolSyncPoly.prf.xml

    r3326 r3386  
    2020    </simple> 
    2121    <simple type="float" id="DCE:afc47b82-e44e-11db-b1f3-00123f63025f" name="beta" mode="readwrite"> 
    22         <description>Excess bandwidth factor</description>  
     22        <description>Excess bandwidth factor, 0&lt;beta&lt;1</description>  
    2323        <value>0.3</value>  
    2424        <kind kindtype="configure"/> 
    2525    </simple> 
    26     <simple type="ushort" id="DCE:bea3b19a-e44e-11db-a3dd-00123f63025f" name="N" mode="readwrite"> 
     26    <simple type="ushort" id="DCE:bea3b19a-e44e-11db-a3dd-00123f63025f" name="Npfb" mode="readwrite"> 
    2727        <description>Number of filters in bank</description>  
    2828        <value>16</value>  
  • experimental/components/SymbolSyncPoly/SymbolSyncPolyDSP.cpp

    r3383 r3386  
    5656    k = 0; 
    5757    v = 0; 
     58 
     59    isConfigured = false; 
    5860} 
    5961 
     
    8991    k = _k; 
    9092    Npfb = (int) _Npfb; 
     93 
     94    isConfigured = true; 
    9195} 
    9296 
     
    126130        unsigned int & N_out) 
    127131{ 
     132    if ( !isConfigured ) { 
     133        std::cerr << "ERROR: SymbolSyncPolyDSP::SynchronizeAndDecimate() :" << std::endl 
     134                  << "  => must call ConfigureFilterBank() before invoking this method" << std::endl; 
     135        throw 0; 
     136    } 
     137 
    128138    unsigned int i(0); 
     139    unsigned int N_out_max(N_out); 
    129140    N_out = 0; 
    130141 
     
    189200            I_out[N_out] = mf_i; 
    190201            Q_out[N_out] = mf_q; 
    191             N_out++; 
     202 
     203            // Throw exception if buffer is too small 
     204            if ( N_out == N_out_max ) { 
     205                std::cerr << "ERROR: SymbolSyncPolyDSP::SynchronizeAndDecimate() :" << std::endl 
     206                          << "  => output array is full " << std::endl; 
     207                throw 0; 
     208            } else { 
     209                N_out++; 
     210            } 
    192211             
    193212            GenerateErrorSignal(); 
  • experimental/components/SymbolSyncPoly/SymbolSyncPolyDSP.h

    r3383 r3386  
    6565    /// 
    6666    /// This method performs simultaneous synchronization and decimation.  It 
    67     /// assumes that the calling platform takes care of memory management 
     67    /// assumes that the calling platform takes care of memory management. 
     68    /// N_out initially stores the number of memory elements allocated to 
     69    /// I_out and Q_out, and assumes that this number is sufficiently large 
     70    /// to run the algorithm.  The method returns N_out as the actual number 
     71    /// of elements stored in I_out and Q_out.  This is approximately 
     72    /// \f$ N_{out} \approx N_{in}/k \f$ 
    6873    void SynchronizeAndDecimate(short * I_in, 
    6974            short * Q_in, 
     
    120125    flow_control lc;    ///< loop flow control state 
    121126 
     127    bool isConfigured;  ///< flag set when ConfigureFilterBank() is invoked properly 
     128 
    122129  private: 
    123130    /// Disallow copy constructor 
  • experimental/components/SymbolSyncPoly/documentation.txt

    r3371 r3386  
    4040CORBA::Float 
    4141 
    42 \subsection prop_N Number of Filter in Bank (DCE:bea3b19a-e44e-11db-a3dd-00123f63025f) 
     42\subsection prop_Npfb Number of Filter in Bank (DCE:bea3b19a-e44e-11db-a3dd-00123f63025f) 
    4343CORBA::UShort 
    4444