GNU Radio's DAB Package
ofdm_ffe_all_in_one_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 #ifndef INCLUDED_DAB_OFDM_FFE_ALL_IN_ONE_IMPL_H
23 #define INCLUDED_DAB_OFDM_FFE_ALL_IN_ONE_IMPL_H
24 
26 
27 namespace gr {
28  namespace dab {
29 
30 /*!
31  * \brief calculates fine frequency error estimation and averages it
32  * \ingroup DAB
33  * \param symbol_length number of samples in an OFDM symbol
34  * \param fft_length number of samples in an OFDM symbol without the cyclic prefix
35  * \param num_symbols number of symbols to use for averaging (more symbols is better, but symbols towards the end of the frame tend to have larger time offsets and worse values)
36  * \param alpha how fast should we adapt to new FFS error values (1=immediately)
37  * \param sample_rate sampling rate - needed to calculate the offset estimation in Hz
38  *
39  * input: port 0: complex - actual data; port 1: byte - trigger signal indicating the start of a frame
40  * output: float fine frequency offset estimation (in radian per sample)
41  *
42  * this is an all in one version of ffe in ofdm_sync_dab.py, because the flow graph does not allow to only calculate the estimation when its needed
43  */
45 {
46  private:
47 
48  float calc_ffe_estimate(const gr_complex *iptr);
49 
50  unsigned int d_symbol_length; // length of a symbol in samples
51  unsigned int d_fft_length; // length of a symbol without cyclic prefix in samples
52  unsigned int d_num_symbols; // number of symbols per frame to average over
53  float d_alpha; // adjustment speed factor
54  unsigned int d_sample_rate; // sample rate -- only needed to print the ffs error in Hz
55 
56  unsigned int d_cur_symbol; // which symbol in the frame is currently under observation?
57  unsigned int d_cur_sample; // which sample in the symbol is currently under observation?
58  float d_ffs_error_sum; // sum of error samples in current frame
59  float d_estimated_error; // total estimated error
60  float d_estimated_error_per_sample; // total estimated error / fft_length
61 
62  public:
63  ofdm_ffe_all_in_one_impl (unsigned int symbol_length, unsigned int fft_length, unsigned int num_symbols, float alpha, unsigned int sample_rate);
64  /*! \return fine frequency error estimate in Hz */
65  float ffe_estimate() { return d_estimated_error_per_sample*d_sample_rate/(2*M_PI); }
66  int work (int noutput_items,
67  gr_vector_const_void_star &input_items,
68  gr_vector_void_star &output_items);
69 };
70 
71 }
72 }
73 
74 #endif /* INCLUDED_DAB_OFDM_FFE_ALL_IN_ONE_H */
ofdm_ffe_all_in_one_impl(unsigned int symbol_length, unsigned int fft_length, unsigned int num_symbols, float alpha, unsigned int sample_rate)
<+description of block+>
Definition: ofdm_ffe_all_in_one.h:36
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
float ffe_estimate()
Definition: ofdm_ffe_all_in_one_impl.h:65
Definition: complex_to_interleaved_float_vcf.h:28
calculates fine frequency error estimation and averages it
Definition: ofdm_ffe_all_in_one_impl.h:44