Changeset 3767

Show
Ignore:
Timestamp:
05/09/07 17:14:43 (6 years ago)
Author:
jgaeddert
Message:

kinda working... needs thorough testing

Location:
experimental/components/CostasLoop/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/CostasLoop/src/CostasLoop.cpp

    r3729 r3767  
    2626#include "CostasLoop.h" 
    2727 
     28#undef LOGGING 
     29 
    2830CostasLoop_i::CostasLoop_i(const char *uuid, omni_condition *condition) :  
    2931    Resource_impl(uuid), component_running(condition) 
    3032{ 
     33    UpdateLoopFilterCoefficients(0.001); 
     34 
    3135    dataIn_0 = new standardInterfaces_i::complexShort_p("IF_in"); 
    3236    dataOut_0 = new standardInterfaces_i::complexShort_u("baseband_out"); 
     
    128132 
    129133    PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); 
    130     unsigned int I_in_0_length, Q_in_0_length; 
     134    unsigned int I_in_0_length, Q_in_0_length, N; 
     135 
     136#ifdef LOGGING 
     137    std::ofstream input_log; 
     138    input_log.open("cl_input_log.dat"); 
     139 
     140    std::ofstream output_log; 
     141    output_log.open("cl_output_log.dat"); 
     142#endif 
    131143 
    132144    while( true ) 
     
    151163            I_out_0.length( I_in_0_length ); 
    152164            Q_out_0.length( Q_in_0_length ); 
     165             
     166            N = I_in_0_length; 
    153167        } 
    154168 
    155         // 
     169#ifdef LOGGING 
     170        for ( unsigned int i=0; i<N; i++ ) 
     171            input_log       << (*I_in_0)[i] << "  " << (*Q_in_0)[i] << std::endl; 
     172#endif 
     173 
    156174        // do work here 
    157         // 
     175        for ( unsigned int i=0; i<N; i++ ) { 
     176            LockPhase( (*I_in_0)[i], (*Q_in_0)[i], I_out_0[i], Q_out_0[i] ); 
     177        } 
     178 
     179#ifdef LOGGING 
     180        for ( unsigned int i=0; i<N; i++ ) 
     181            output_log      << I_out_0[i] << "  " << Q_out_0[i] << std::endl; 
     182#endif 
     183 
    158184 
    159185        DEBUG(7, CostasLoop, "Emptying port buffer...") 
     
    164190 
    165191    } 
    166 } 
    167  
    168  
     192 
     193#ifdef LOGGING 
     194    input_log.close(); 
     195    output_log.close(); 
     196#endif 
     197 
     198} 
     199 
     200 
  • experimental/components/CostasLoop/src/CostasLoopDSP.cpp

    r3755 r3767  
    5757    BT = ( BT < BT_MIN ) ? BT_MIN : BT; 
    5858    BT = ( BT > BT_MAX ) ? BT_MAX : BT; 
    59     float k1 = Ac; 
     59    float k1 = 1.0f; 
    6060 
    6161    beta = 2*BT/(XI+1/(4*XI))/k1; 
    6262    alpha = 2*XI*beta; 
     63 
     64    beta /= Ac; 
     65    alpha /= Ac; 
    6366} 
    6467 
     
    8891    // switch (order) 
    8992    pd2 = ( I_out > 0.0f ) ? Q_out : -Q_out; 
    90     pd2 /= Ac; 
    9193} 
    9294