- added TimingGeneratorGardner
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@983 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <cpp/radio/FirComplex.hpp>
|
||||
#include <cpp/radio/interpolation/Farrow.hpp>
|
||||
#include <cpp/radio/interpolation/PolyPhase.hpp>
|
||||
#include <cpp/radio/interpolation/TimingGenerator.hpp>
|
||||
#include <radio/synchronization.h>
|
||||
#include <wav/wav.h>
|
||||
|
||||
@@ -82,6 +83,39 @@ const radio_float_t STR_GAIN_LAG_AQU = (radio_float_t)0.50E-6; // 5E-7
|
||||
const radio_float_t STR_GAIN_LEAD_TRK = (radio_float_t)4.00E-6; // 8E-4
|
||||
const radio_float_t STR_GAIN_LAG_TRK = (radio_float_t)1.00E-9; // 1E-6
|
||||
|
||||
class TimingGeneratorGardner : public Interpolation::TimingGenerator
|
||||
{
|
||||
// Loop-Filter
|
||||
lead_lag_filter_t loop_filter_str;
|
||||
lead_lag_coeff_t str_loopfilter_coeff;
|
||||
|
||||
// Gardner Symbol Timing Recovery
|
||||
str_t m_SymbolTimingRevovery;
|
||||
|
||||
public:
|
||||
TimingGeneratorGardner()
|
||||
: Interpolation::TimingGenerator()
|
||||
{
|
||||
LeadLagInit(&loop_filter_str, 1.0);
|
||||
LeadLagSetCoeff(&str_loopfilter_coeff, STR_GAIN_LEAD_AQU, STR_GAIN_LAG_AQU);
|
||||
}
|
||||
|
||||
virtual ~TimingGeneratorGardner() = default;
|
||||
|
||||
void process(ComplexScalar const &iq)
|
||||
{
|
||||
radio_float_t vc=0;
|
||||
radio_float_t vd=0;
|
||||
|
||||
// Symbol timing recovery
|
||||
vd = STRGardnerProcess(&m_SymbolTimingRevovery, toCpx(iq));
|
||||
vc = LeadLagProcess(&loop_filter_str, &str_loopfilter_coeff, vd);
|
||||
|
||||
// setOmega(vc);
|
||||
update();
|
||||
}
|
||||
};
|
||||
|
||||
void test()
|
||||
{
|
||||
|
||||
@@ -89,6 +123,10 @@ void test()
|
||||
Interpolation::Farrow farrow;
|
||||
farrow.load("/home/jens/farrow_coeff.dat");
|
||||
|
||||
// Setup timing generator
|
||||
Interpolation::TimingGenerator timingGenerator;
|
||||
timingGenerator.setOmega(1.0);
|
||||
|
||||
// Setup IQ data
|
||||
WAVEHEADER header;
|
||||
CVec iq_in = wavLoad("m2_12k_12k_i_q_short.wav", header);
|
||||
@@ -96,19 +134,6 @@ void test()
|
||||
CVec iq_out;
|
||||
iq_out.reserve(8*iq_in.size());
|
||||
|
||||
// Loop-Filter
|
||||
lead_lag_filter_t loop_filter_str;
|
||||
lead_lag_coeff_t str_loopfilter_coeff;
|
||||
|
||||
// Gardner Symbol Timing Recovery
|
||||
str_t m_SymbolTimingRevovery;
|
||||
timing_corrector_t m_timing_corrector;
|
||||
|
||||
LeadLagInit(&loop_filter_str, 1.0);
|
||||
LeadLagSetCoeff(&str_loopfilter_coeff, STR_GAIN_LEAD_AQU, STR_GAIN_LAG_AQU);
|
||||
|
||||
radio_float_t vc=0;
|
||||
radio_float_t vd=0;
|
||||
ComplexScalar iq_ip;
|
||||
size_t k=0;
|
||||
size_t n=0;
|
||||
@@ -124,7 +149,7 @@ void test()
|
||||
n += numFed;
|
||||
remain -= numFed;
|
||||
|
||||
farrow.process_new(0.333);
|
||||
farrow.process_new(timingGenerator);
|
||||
while(farrow.getOutputBuffer().len())
|
||||
{
|
||||
size_t size = std::min(BLOCKSIZE, farrow.getOutputBuffer().len());
|
||||
@@ -134,15 +159,6 @@ void test()
|
||||
iq_out[k++] = farrow.getOutputBuffer().readAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (false)
|
||||
{
|
||||
// Symbol timing recovery
|
||||
vd = STRGardnerProcess(&m_SymbolTimingRevovery, toCpx(iq_ip));
|
||||
vc = LeadLagProcess(&loop_filter_str, &str_loopfilter_coeff, vd);
|
||||
// cout << "Vd = " << vd << ", Vc = " << vc << endl;
|
||||
}
|
||||
|
||||
}
|
||||
wavSave("out.wav", header, iq_out);
|
||||
cout << "End of program" << endl;
|
||||
|
||||
Reference in New Issue
Block a user