Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / python / gnuradio / blks2impl / ofdm_sync_fixed.py @ c091c56e

History | View | Annotate | Download (1.9 kB)

1 ce165145 trondeau
#!/usr/bin/env python
2 ce165145 trondeau
#
3 ce165145 trondeau
# Copyright 2007 Free Software Foundation, Inc.
4 ce165145 trondeau
# 
5 ce165145 trondeau
# This file is part of GNU Radio
6 ce165145 trondeau
# 
7 ce165145 trondeau
# GNU Radio is free software; you can redistribute it and/or modify
8 ce165145 trondeau
# it under the terms of the GNU General Public License as published by
9 ce165145 trondeau
# the Free Software Foundation; either version 3, or (at your option)
10 ce165145 trondeau
# any later version.
11 ce165145 trondeau
# 
12 ce165145 trondeau
# GNU Radio is distributed in the hope that it will be useful,
13 ce165145 trondeau
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ce165145 trondeau
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ce165145 trondeau
# GNU General Public License for more details.
16 ce165145 trondeau
# 
17 ce165145 trondeau
# You should have received a copy of the GNU General Public License
18 ce165145 trondeau
# along with GNU Radio; see the file COPYING.  If not, write to
19 ce165145 trondeau
# the Free Software Foundation, Inc., 51 Franklin Street,
20 ce165145 trondeau
# Boston, MA 02110-1301, USA.
21 ce165145 trondeau
# 
22 ce165145 trondeau
23 ce165145 trondeau
import math
24 ce165145 trondeau
from gnuradio import gr
25 ce165145 trondeau
26 ce165145 trondeau
class ofdm_sync_fixed(gr.hier_block2):
27 8bce0d9e trondeau
    def __init__(self, fft_length, cp_length, nsymbols, freq_offset, logging=False):
28 ce165145 trondeau
29 ce165145 trondeau
        gr.hier_block2.__init__(self, "ofdm_sync_fixed",
30 ce165145 trondeau
                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
31 8bce0d9e trondeau
                                gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
32 ce165145 trondeau
33 ce165145 trondeau
        # Use a fixed trigger point instead of sync block
34 ce165145 trondeau
        symbol_length = fft_length + cp_length
35 8bce0d9e trondeau
        pkt_length = nsymbols*symbol_length
36 8bce0d9e trondeau
        data = (pkt_length)*[0,]
37 ce165145 trondeau
        data[(symbol_length)-1] = 1
38 ce165145 trondeau
        self.peak_trigger = gr.vector_source_b(data, True)
39 ce165145 trondeau
40 8bce0d9e trondeau
        # Use a pre-defined frequency offset
41 8bce0d9e trondeau
        foffset = (pkt_length)*[math.pi*freq_offset,]
42 8bce0d9e trondeau
        self.frequency_offset = gr.vector_source_f(foffset, True)
43 8bce0d9e trondeau
44 8bce0d9e trondeau
        self.connect(self, gr.null_sink(gr.sizeof_gr_complex))
45 8bce0d9e trondeau
        self.connect(self.frequency_offset, (self,0))
46 ce165145 trondeau
        self.connect(self.peak_trigger, (self,1))
47 ce165145 trondeau
48 ce165145 trondeau
        if logging:
49 ce165145 trondeau
            self.connect(self.peak_trigger, gr.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat"))