Exemplo n.º 1
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=70,
                decimation=64,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "bladerf=0,buffers=128,buflen=32768" )
        self.osmosdr_sink_0.set_sample_rate(10e6)
        self.osmosdr_sink_0.set_center_freq(800e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(19, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 10)
        self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(1512, dvbt.T2k, 1)
        self.dvbt_reference_signals_0 = dvbt.reference_signals(gr.sizeof_gr_complex, 1512, 2048, dvbt.QAM16, dvbt.NH, dvbt.C1_2, dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0)
        self.dvbt_reed_solomon_enc_0 = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, 8)
        self.dvbt_inner_coder_0 = dvbt.inner_coder(1, 1512, dvbt.QAM16, dvbt.NH, dvbt.C1_2)
        self.dvbt_energy_dispersal_0 = dvbt.energy_dispersal(1)
        self.dvbt_dvbt_map_0 = dvbt.dvbt_map(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k, 1)
        self.dvbt_convolutional_interleaver_0 = dvbt.convolutional_interleaver(136, 12, 17)
        self.dvbt_bit_inner_interleaver_0 = dvbt.bit_inner_interleaver(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(2048, 2048+64, 0, "")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "test.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt_energy_dispersal_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.dvbt_bit_inner_interleaver_0, 0), (self.dvbt_symbol_inner_interleaver_0, 0))    
        self.connect((self.dvbt_convolutional_interleaver_0, 0), (self.dvbt_inner_coder_0, 0))    
        self.connect((self.dvbt_dvbt_map_0, 0), (self.dvbt_reference_signals_0, 0))    
        self.connect((self.dvbt_energy_dispersal_0, 0), (self.dvbt_reed_solomon_enc_0, 0))    
        self.connect((self.dvbt_inner_coder_0, 0), (self.dvbt_bit_inner_interleaver_0, 0))    
        self.connect((self.dvbt_reed_solomon_enc_0, 0), (self.dvbt_convolutional_interleaver_0, 0))    
        self.connect((self.dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.dvbt_symbol_inner_interleaver_0, 0), (self.dvbt_dvbt_map_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0))    
Exemplo n.º 2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=1200e6,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=10e6,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=70,
                decimation=64,
                taps=None,
                fractional_bw=None,
        )
        self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 10)
        self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(1512, dvbt.T2k, 1)
        self.dvbt_reference_signals_0 = dvbt.reference_signals(gr.sizeof_gr_complex, 1512, 2048, dvbt.QAM16, dvbt.NH, dvbt.C1_2, dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0)
        self.dvbt_reed_solomon_enc_0 = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, 8)
        self.dvbt_inner_coder_0 = dvbt.inner_coder(1, 1512, dvbt.QAM16, dvbt.NH, dvbt.C1_2)
        self.dvbt_energy_dispersal_0 = dvbt.energy_dispersal(1)
        self.dvbt_dvbt_map_0 = dvbt.dvbt_map(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k, 1)
        self.dvbt_convolutional_interleaver_0 = dvbt.convolutional_interleaver(136, 12, 17)
        self.dvbt_bit_inner_interleaver_0 = dvbt.bit_inner_interleaver(1512, dvbt.QAM16, dvbt.NH, dvbt.T2k)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(2048, 2048+64, 0, "")
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.0022097087, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "test.ts", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "testBB.bin", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt_energy_dispersal_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.dvbt_bit_inner_interleaver_0, 0), (self.dvbt_symbol_inner_interleaver_0, 0))    
        self.connect((self.dvbt_convolutional_interleaver_0, 0), (self.dvbt_inner_coder_0, 0))    
        self.connect((self.dvbt_dvbt_map_0, 0), (self.dvbt_reference_signals_0, 0))    
        self.connect((self.dvbt_energy_dispersal_0, 0), (self.dvbt_reed_solomon_enc_0, 0))    
        self.connect((self.dvbt_inner_coder_0, 0), (self.dvbt_bit_inner_interleaver_0, 0))    
        self.connect((self.dvbt_reed_solomon_enc_0, 0), (self.dvbt_convolutional_interleaver_0, 0))    
        self.connect((self.dvbt_reference_signals_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.dvbt_symbol_inner_interleaver_0, 0), (self.dvbt_dvbt_map_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))    
Exemplo n.º 3
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        infile = args[0]
        outfile = None
    elif nargs == 2:
        infile = args[0]
        outfile = args[1]
    else:
        sys.stderr.write("Usage: dvbt-hackrf.py infile [output_file]\n")
        sys.exit(1)

    ## Config Options
    config = DVBTConfig('dvbt.conf')

    # DVB-T Parameters
    channel_mhz = config.get_channel_mhz()
    mode = config.get_mode()
    code_rate = config.get_code_rate()
    constellation = config.get_constellation()
    guard_interval = config.get_guard_interval()

    # Hack-RF Parameters
    center_freq = config.get_center_freq()
    rf_gain = config.get_hackrf_rf_gain()
    if_gain = config.get_hackrf_if_gain()
    bb_gain = config.get_hackrf_bb_gain()

    ##

    samp_rate = 10000000.0

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if guard_interval == dvbt.G1_32:
        gi = carriers / 32
    elif guard_interval == dvbt.G1_16:
        gi = carriers / 16
    elif guard_interval == dvbt.G1_8:
        gi = carriers / 8
    elif guard_interval == dvbt.G1_4:
        gi = carriers / 4

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    log = gr.logger("dvbt-hackrf")
    log.set_level("DEBUG")
    log.debug("logger initilized")

    tb = gr.top_block()
    log.debug("top block initialized")

    src = blocks.file_source(gr.sizeof_char, infile, True)
    log.debug("source block initialized")

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51,
                                                  (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver(
        (136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation,
                                        dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver(
        (1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver(
        (1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH,
                                  mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex,
                                                    (1512 * factor), carriers,
                                                    constellation, dvbt.NH,
                                                    code_rate, code_rate,
                                                    dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)),
                          True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(
        carriers, carriers + (gi), 0, "")
    rational_resampler_xxx = filter.rational_resampler_ccc(interpolation=70,
                                                           decimation=64,
                                                           taps=None,
                                                           fractional_bw=None)
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, ))
    log.debug("DVB-T blocks initialized")

    out = osmosdr.sink(args="numchan=1")
    out.set_sample_rate(samp_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(rf_gain, 0)
    out.set_if_gain(if_gain, 0)
    out.set_bb_gain(bb_gain, 0)
    out.set_antenna("", 0)
    out.set_bandwidth(0, 0)
    log.debug("Output block initialized")

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, rational_resampler_xxx)
    tb.connect(rational_resampler_xxx, out)
    log.debug("all blocks connected")

    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    log.debug("running gnuradio")
    tb.run()
Exemplo n.º 4
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        infile = args[0]
        outfile = None
    elif nargs == 2:
        infile = args[0]
        outfile = args[1]
    else:
        sys.stderr.write("Usage: dvbt-blade.py input_file [output_file]\n")
        sys.exit(1)

    channel_mhz = 6
    mode = dvbt.T2k
    code_rate = dvbt.C1_2
    constellation = dvbt.QPSK
    symbol_rate = channel_mhz * 8000000.0 / 7
    center_freq = 441000000
    txvga1_gain = -4
    txvga2_gain = 25

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    tb = gr.top_block()

    src = blocks.file_source(gr.sizeof_char, infile, True)

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51,
                                                  (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver(
        (136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation,
                                        dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver(
        (1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver(
        (1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH,
                                  mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex,
                                                    (1512 * factor), carriers,
                                                    constellation, dvbt.NH,
                                                    code_rate, code_rate,
                                                    dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)),
                          True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(
        carriers, carriers + (64 * factor), 0, "")
    blocks_multiply_const_vxx = blocks.multiply_const_vcc(
        (0.0022097087 * 2.5, ))

    out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768")
    out.set_sample_rate(symbol_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(txvga2_gain, 0)
    out.set_bb_gain(txvga1_gain, 0)
    out.set_bandwidth(bandwidth, 0)

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, out)

    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    tb.run()
Exemplo n.º 5
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        infile  = args[0]
        outfile = None
    elif nargs == 2:
        infile  = args[0]
        outfile  = args[1]
    else:
        sys.stderr.write("Usage: dvbt-blade.py input_file [output_file]\n");
        sys.exit(1)

    channel_mhz = 6
    mode = dvbt.T2k
    code_rate = dvbt.C1_2
    constellation = dvbt.QPSK
    symbol_rate = channel_mhz * 8000000.0 / 7
    center_freq = 441000000
    txvga1_gain = -4
    txvga2_gain = 25

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    tb = gr.top_block()

    src = blocks.file_source(gr.sizeof_char, infile, True)

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(64 * factor), 0, "")
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, ))

    out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768")
    out.set_sample_rate(symbol_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(txvga2_gain, 0)
    out.set_bb_gain(txvga1_gain, 0)
    out.set_bandwidth(bandwidth, 0)

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, out)


    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    tb.run()
Exemplo n.º 6
0
    def __init__(self):
        gr.top_block.__init__(self, "Dvbt App1")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=70,
            decimation=64,
            taps=None,
            fractional_bw=None,
        )
        self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)),
                                     True, 10)
        self.dvbt_symbol_inner_interleaver_0 = dvbt.symbol_inner_interleaver(
            1512, dvbt.T2k, 1)
        self.dvbt_reference_signals_0 = dvbt.reference_signals(
            gr.sizeof_gr_complex, 1512, 2048, dvbt.QAM16, dvbt.NH, dvbt.C1_2,
            dvbt.C1_2, dvbt.G1_32, dvbt.T2k, 0, 0)
        self.dvbt_reed_solomon_enc_0 = dvbt.reed_solomon_enc(
            2, 8, 0x11d, 255, 239, 8, 51, 8)
        self.dvbt_inner_coder_0 = dvbt.inner_coder(1, 1512, dvbt.QAM16,
                                                   dvbt.NH, dvbt.C1_2)
        self.dvbt_energy_dispersal_0 = dvbt.energy_dispersal(1)
        self.dvbt_dvbt_map_0 = dvbt.dvbt_map(1512, dvbt.QAM16, dvbt.NH,
                                             dvbt.T2k, 1)
        self.dvbt_convolutional_interleaver_0 = dvbt.convolutional_interleaver(
            136, 12, 17)
        self.dvbt_bit_inner_interleaver_0 = dvbt.bit_inner_interleaver(
            1512, dvbt.QAM16, dvbt.NH, dvbt.T2k)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(
            2048, 2048 + 64, 0, '')
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (0.0022097087, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       'input', False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   'output', False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0),
                     (self.dvbt_energy_dispersal_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.dvbt_bit_inner_interleaver_0, 0),
                     (self.dvbt_symbol_inner_interleaver_0, 0))
        self.connect((self.dvbt_convolutional_interleaver_0, 0),
                     (self.dvbt_inner_coder_0, 0))
        self.connect((self.dvbt_dvbt_map_0, 0),
                     (self.dvbt_reference_signals_0, 0))
        self.connect((self.dvbt_energy_dispersal_0, 0),
                     (self.dvbt_reed_solomon_enc_0, 0))
        self.connect((self.dvbt_inner_coder_0, 0),
                     (self.dvbt_bit_inner_interleaver_0, 0))
        self.connect((self.dvbt_reed_solomon_enc_0, 0),
                     (self.dvbt_convolutional_interleaver_0, 0))
        self.connect((self.dvbt_reference_signals_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.dvbt_symbol_inner_interleaver_0, 0),
                     (self.dvbt_dvbt_map_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.digital_ofdm_cyclic_prefixer_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_file_sink_0, 0))
Exemplo n.º 7
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        infile  = args[0]
        outfile = None
    elif nargs == 2:
        infile   = args[0]
        outfile  = args[1]
    else:
        sys.stderr.write("Usage: dvbt-hackrf.py infile [output_file]\n");
        sys.exit(1)

    ## Config Options
    config = DVBTConfig('dvbt.conf')

    # DVB-T Parameters
    channel_mhz = config.get_channel_mhz()
    mode = config.get_mode()
    code_rate = config.get_code_rate()
    constellation = config.get_constellation()
    guard_interval = config.get_guard_interval()

    # Hack-RF Parameters
    center_freq = config.get_center_freq()
    rf_gain = config.get_hackrf_rf_gain()
    if_gain = config.get_hackrf_if_gain()
    bb_gain = config.get_hackrf_bb_gain()

    ##

    samp_rate = 10000000.0

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if guard_interval == dvbt.G1_32:
        gi = carriers / 32
    elif guard_interval == dvbt.G1_16:
        gi = carriers / 16
    elif guard_interval == dvbt.G1_8:
        gi = carriers / 8
    elif guard_interval == dvbt.G1_4:
        gi = carriers / 4

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    log=gr.logger("dvbt-hackrf")
    log.set_level("DEBUG");
    log.debug("logger initilized")

    tb = gr.top_block()
    log.debug("top block initialized")

    src = blocks.file_source(gr.sizeof_char, infile, True)
    log.debug("source block initialized")

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "")
    rational_resampler_xxx = filter.rational_resampler_ccc(interpolation=70, decimation=64, taps=None, fractional_bw=None)
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, ))
    log.debug("DVB-T blocks initialized")

    out = osmosdr.sink(args="numchan=1")
    out.set_sample_rate(samp_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(rf_gain, 0)
    out.set_if_gain(if_gain, 0)
    out.set_bb_gain(bb_gain, 0)
    out.set_antenna("", 0)
    out.set_bandwidth(0, 0)
    log.debug("Output block initialized")

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, rational_resampler_xxx)
    tb.connect(rational_resampler_xxx, out)
    log.debug("all blocks connected")

    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    log.debug("running gnuradio")
    tb.run()
Exemplo n.º 8
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        port    = int(args[0])
        outfile = None
    elif nargs == 2:
        port     = int(args[0])
        outfile  = args[1]
    else:
        sys.stderr.write("Usage: dvbt-blade.py port [output_file]\n");
        sys.exit(1)

    channel_mhz = 6
    mode = dvbt.T2k
    code_rate = dvbt.C1_2
    constellation = dvbt.QPSK
    guard_interval = dvbt.G1_32
    symbol_rate = channel_mhz * 8000000.0 / 7
    center_freq = 441000000
    tx_gain = 83 # max 89.5

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if guard_interval == dvbt.G1_32:
        gi = carriers / 32
    elif guard_interval == dvbt.G1_16:
        gi = carriers / 16
    elif guard_interval == dvbt.G1_8:
        gi = carriers / 8
    elif guard_interval == dvbt.G1_4:
        gi = carriers / 4

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    tb = gr.top_block()

    out = uhd.usrp_sink(
        	device_addr="recv_frame_size=65536,num_recv_frames=128,send_frame_size=65536,num_send_frames=128,master_clock_rate=" + str(symbol_rate*4),
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		otw_format="sc16",
        		channels=range(1),
        	),
        )
    out.set_samp_rate(symbol_rate)
    out.set_center_freq(center_freq, 0)
    out.set_gain(tx_gain, 0)

    #src = blocks.udp_source(gr.sizeof_char*1, "127.0.0.1", port, 18800, True)
    src = grc_blks2.tcp_source(gr.sizeof_char*1, "127.0.0.1", port, True)

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "")
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, ))

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, out)


    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    tb.run()
Exemplo n.º 9
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        port    = int(args[0])
        outfile = None
    elif nargs == 2:
        port     = int(args[0])
        outfile  = args[1]
    else:
        sys.stderr.write("Usage: dvbt-hackrf.py port [output_file]\n");
        sys.exit(1)

    channel_mhz = 6
    mode = dvbt.T2k
    code_rate = dvbt.C1_2
    constellation = dvbt.QPSK
    guard_interval = dvbt.G1_32
    symbol_rate = channel_mhz * 8000000.0 / 7
    center_freq = 441000000
    rf_gain = 14
    if_gain = 40

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if guard_interval == dvbt.G1_32:
        gi = carriers / 32
    elif guard_interval == dvbt.G1_16:
        gi = carriers / 16
    elif guard_interval == dvbt.G1_8:
        gi = carriers / 8
    elif guard_interval == dvbt.G1_4:
        gi = carriers / 4

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    tb = gr.top_block()

    src = grc_blks2.tcp_source(gr.sizeof_char*1, "127.0.0.1", port, True)

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, dvbt.G1_32, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "")
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087 * 2.5, ))

    out = osmosdr.sink(args="hackrf=0")
    out.set_sample_rate(symbol_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(rf_gain, 0)
    out.set_if_gain(if_gain, 0)
    out.set_bandwidth(bandwidth, 0)

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, out)


    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    tb.run()
Exemplo n.º 10
0
def main(args):
    d = 'Transmit a DVB-T signal using the HackRF and gr-dvbt'
    parser = argparse.ArgumentParser()

    mode_help = '# of carriers. Options: t2k, t8k (default).'
    parser.add_argument('-m', '--mode', dest='mode', default='t8k',
                        type=str, help=mode_help)

    ch_help = 'channel width in MHz. Options: 5, 6, 7, 8 (default).'
    parser.add_argument('-c', '--channel', dest='channel', default=8,
                        metavar='CH', type=int, help=ch_help)

    const_help = 'constellation. qpsk, qam16, qam64 (default).'
    parser.add_argument('-C', '--cons', dest='cons', default='qam64',
                        metavar='TYPE', type=str, help=const_help)

    rate_help = 'Viterbi rate. 1/2, 2/3, 3/4, 5/6, 7/8 (default).'
    parser.add_argument('-r', '--rate', dest='rate', default='7/8',
                        type=str, help=rate_help)

    guard_help = 'guard interval. 1/32 (default), 1/16, 1/8, 1/4.'
    parser.add_argument('-g', '--guard', dest='interval', default='1/32',
                        metavar='D', type=str, help=guard_help)

    freq_help = 'center frequency (Hz). Default is 429e6.'
    parser.add_argument('-f', '--freq', dest='freq', default=429e6,
                        type=float, help=freq_help)

    vga1_help = 'bladeRF TXVGA1 gain. Default is -6.'
    parser.add_argument('--txvga1', dest='txvga1', default=-6,
                        metavar='gain', type=int, help=vga1_help)

    vga2_help = 'bladeRF TXVGA2 gain. Default is 9.'
    parser.add_argument('--txvga2', dest='txvga2', default=9,
                        metavar='gain', type=int, help=vga2_help)

    outfile_help = 'write to specified file.'
    parser.add_argument('-o', '--output', dest='outfile', default=None,
                        metavar='OUT', type=str, help=outfile_help)

    parser.add_argument('infile', metavar='input-file', type=str,
                        help='Input file')

    args = parser.parse_args()
    print args

    if args.mode.lower() == 't2k':
        mode = dvbt.T2k
    elif args.mode.lower() == 't8k':
        mode  = dvbt.T8k
    else:
        sys.stderr.write('Invalid mode provided: ' + args.mode + '\n')
        sys.exit(1)

    if args.channel < 5 or args.channel > 8:
        sys.stderr.write('Invalid channel: ' + str(args.channel) + '\n')
        sys.exit(1)
    else:
        channel_mhz = args.channel

    if args.cons.lower() == 'qpsk':
        constellation = dvbt.QPSK
    elif args.cons.lower() == 'qam16':
        constellation = dvbt.QAM16
    elif args.cons.lower() == 'qam64':
        constellation = dvbt.QAM64
    else:
        sys.stderr.write('Invalid constellation type: ' + args.cons + '\n')
        sys.exit(1)

    if args.rate == '1/2':
        code_rate = dvbt.C1_2
    elif args.rate == '2/3':
        code_rate = dvbt.C2_3
    elif args.rate == '3/4':
        code_rate = dvbt.C3_4
    elif args.rate == '5/6':
        code_rate = dvbt.C5_6
    elif args.rate == '7/8':
        code_rate = dvbt.C7_8
    else:
        sys.stderr.write('Invalid Viterbi rate: ' + args.rate + '\n')
        sys.exit(1)

    if args.interval == '1/32':
        guard_interval = dvbt.G1_32
    elif args.interval == '1/16':
        guard_interval = dvbt.G1_16
    elif args.interval == '1/8':
        guard_interval = dvbt.G1_8
    elif args.interval == '1/4':
        guard_interval = dvbt.G1_4
    else:
        sys.stderr.write('Invalid guard interval: ' + args.interval + '\n')
        sys.exit(1)

    if args.freq < 300e6 or args.freq > 3.8e9:
        sys.stderr.write('Invalid center frequency: ' + str(args.freq) + '\n')
        sys.exit(1)
    else:
        center_freq = int(args.freq)

    if args.txvga1 < -35 or args.txvga1 > -4:
        sys.stderr.write('Invalid bladeRF TXVGA1 gain: ' +
                         str(args.txvga1) + '\n')
        sys.exit(1)
    else:
        txvga1_gain = args.txvga1

    if args.txvga2 < 0 or args.txvga2 > 25:
        sys.stderr.write('Invalid bladeRF TXVGA2 gain: ' +
                         str(args.txvga2) + '\n')
        sys.exit(1)
    else:
        txvga2_gain = args.txvga2

    infile = args.infile
    outfile = args.outfile
    symbol_rate = channel_mhz * 8000000.0 / 7

    if mode == dvbt.T2k:
        factor = 1
        carriers = 2048
    elif mode == dvbt.T8k:
        factor = 4
        carriers = 8192

    if guard_interval == dvbt.G1_32:
        gi = carriers / 32
    elif guard_interval == dvbt.G1_16:
        gi = carriers / 16
    elif guard_interval == dvbt.G1_8:
        gi = carriers / 8
    elif guard_interval == dvbt.G1_4:
        gi = carriers / 4

    if channel_mhz == 8:
        bandwidth = 8750000
    elif channel_mhz == 7:
        bandwidth = 7000000
    elif channel_mhz == 6:
        bandwidth = 6000000
    elif channel_mhz == 5:
        bandwidth = 5000000
    else:
        bandwidth = 8750000

    tb = gr.top_block()

    src = blocks.file_source(gr.sizeof_char, infile, True)

    dvbt_energy_dispersal = dvbt.energy_dispersal(1 * factor)
    dvbt_reed_solomon_enc = dvbt.reed_solomon_enc(2, 8, 0x11d, 255, 239, 8, 51, (8 * factor))
    dvbt_convolutional_interleaver = dvbt.convolutional_interleaver((136 * factor), 12, 17)
    dvbt_inner_coder = dvbt.inner_coder(1, (1512 * factor), constellation, dvbt.NH, code_rate)
    dvbt_bit_inner_interleaver = dvbt.bit_inner_interleaver((1512 * factor), constellation, dvbt.NH, mode)
    dvbt_symbol_inner_interleaver = dvbt.symbol_inner_interleaver((1512 * factor), mode, 1)
    dvbt_dvbt_map = dvbt.dvbt_map((1512 * factor), constellation, dvbt.NH, mode, 1)
    dvbt_reference_signals = dvbt.reference_signals(gr.sizeof_gr_complex, (1512 * factor), carriers, constellation, dvbt.NH, code_rate, code_rate, guard_interval, mode, 0, 0)
    fft_vxx = fft.fft_vcc(carriers, False, (window.rectangular(carriers)), True, 10)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(carriers, carriers+(gi), 0, "")
    blocks_multiply_const_vxx = blocks.multiply_const_vcc((0.0022097087, ))

    out = osmosdr.sink("buffers=128,buflen=32768")
    out.set_sample_rate(symbol_rate)
    out.set_center_freq(center_freq, 0)
    out.set_freq_corr(0, 0)
    out.set_gain(txvga2_gain, 0)
    out.set_bb_gain(txvga1_gain, 0)
    out.set_bandwidth(bandwidth, 0)

    tb.connect(src, dvbt_energy_dispersal)
    tb.connect(dvbt_energy_dispersal, dvbt_reed_solomon_enc)
    tb.connect(dvbt_reed_solomon_enc, dvbt_convolutional_interleaver)
    tb.connect(dvbt_convolutional_interleaver, dvbt_inner_coder)
    tb.connect(dvbt_inner_coder, dvbt_bit_inner_interleaver)
    tb.connect(dvbt_bit_inner_interleaver, dvbt_symbol_inner_interleaver)
    tb.connect(dvbt_symbol_inner_interleaver, dvbt_dvbt_map)
    tb.connect(dvbt_dvbt_map, dvbt_reference_signals)
    tb.connect(dvbt_reference_signals, fft_vxx)
    tb.connect(fft_vxx, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, blocks_multiply_const_vxx)
    tb.connect(blocks_multiply_const_vxx, out)


    if outfile:
        dst = blocks.file_sink(gr.sizeof_gr_complex, outfile)
        tb.connect(blocks_multiply_const_vxx, dst)

    tb.run()