Ejemplo n.º 1
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vv019 Norot")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=429000000,
        	y_per_div=20,
        	y_divs=10,
        	ref_level=10,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        	size=(600,600),
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.dvbt2_pilotgenerator_cc_0 = dvbt2.pilotgenerator_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K_T2GI, dvbt2.PILOT_PP7, dvbt2.GI_1_128, 59, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_OFF, dvbt2.BANDWIDTH_1_7_MHZ, 32768)
        self.dvbt2_p1insertion_cc_0 = dvbt2.p1insertion_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K_T2GI, dvbt2.GI_1_128, 59, dvbt2.PREAMBLE_T2_SISO, dvbt2.SHOWLEVELS_OFF, 3.3)
        self.dvbt2_modulator_bc_0 = dvbt2.modulator_bc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_256QAM, dvbt2.ROTATION_OFF)
        self.dvbt2_ldpc_bb_0 = dvbt2.ldpc_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5)
        self.dvbt2_interleaver_bb_0 = dvbt2.interleaver_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5, dvbt2.MOD_256QAM)
        self.dvbt2_freqinterleaver_cc_0 = dvbt2.freqinterleaver_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K_T2GI, dvbt2.PILOT_PP7, dvbt2.GI_1_128, 59, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, )
        self.dvbt2_framemapper_cc_0 = dvbt2.framemapper_cc(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5, dvbt2.MOD_256QAM, dvbt2.ROTATION_OFF, 202, 3, dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K_T2GI, dvbt2.GI_1_128, dvbt2.L1_MOD_64QAM, dvbt2.PILOT_PP7, 2, 59, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.INPUTMODE_NORMAL, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
        self.dvbt2_cellinterleaver_cc_0 = dvbt2.cellinterleaver_cc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_256QAM, 202, 3)
        self.dvbt2_bch_bb_0 = dvbt2.bch_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5)
        self.dvbt2_bbscrambler_bb_0 = dvbt2.bbscrambler_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5)
        self.dvbt2_bbheader_bb_0 = dvbt2.bbheader_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C3_5, dvbt2.INPUTMODE_HIEFF, dvbt2.INBAND_OFF, 168, 4000000)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(32768, 32768+32768/128, 0, "")
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/re/xfer/vv019.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt2_bbheader_bb_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.dvbt2_p1insertion_cc_0, 0))    
        self.connect((self.dvbt2_bbheader_bb_0, 0), (self.dvbt2_bbscrambler_bb_0, 0))    
        self.connect((self.dvbt2_bbscrambler_bb_0, 0), (self.dvbt2_bch_bb_0, 0))    
        self.connect((self.dvbt2_bch_bb_0, 0), (self.dvbt2_ldpc_bb_0, 0))    
        self.connect((self.dvbt2_cellinterleaver_cc_0, 0), (self.dvbt2_framemapper_cc_0, 0))    
        self.connect((self.dvbt2_framemapper_cc_0, 0), (self.dvbt2_freqinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_freqinterleaver_cc_0, 0), (self.dvbt2_pilotgenerator_cc_0, 0))    
        self.connect((self.dvbt2_interleaver_bb_0, 0), (self.dvbt2_modulator_bc_0, 0))    
        self.connect((self.dvbt2_ldpc_bb_0, 0), (self.dvbt2_interleaver_bb_0, 0))    
        self.connect((self.dvbt2_modulator_bc_0, 0), (self.dvbt2_cellinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_p1insertion_cc_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.dvbt2_pilotgenerator_cc_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
Ejemplo n.º 2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vv034 Dtg016")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=429000000,
        	y_per_div=20,
        	y_divs=10,
        	ref_level=10,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        	size=(600,600),
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.dvbt2_pilotgenerator_cc_0 = dvbt2.pilotgenerator_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.PILOT_PP5, dvbt2.GI_1_16, 500, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_OFF, dvbt2.BANDWIDTH_1_7_MHZ, 4096)
        self.dvbt2_p1insertion_cc_0 = dvbt2.p1insertion_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.GI_1_16, 500, dvbt2.PREAMBLE_T2_SISO, dvbt2.SHOWLEVELS_OFF, 3.3)
        self.dvbt2_modulator_bc_0 = dvbt2.modulator_bc(dvbt2.FECFRAME_SHORT, dvbt2.MOD_QPSK, dvbt2.ROTATION_ON)
        self.dvbt2_ldpc_bb_0 = dvbt2.ldpc_bb(dvbt2.FECFRAME_SHORT, dvbt2.C4_5)
        self.dvbt2_interleaver_bb_0 = dvbt2.interleaver_bb(dvbt2.FECFRAME_SHORT, dvbt2.C4_5, dvbt2.MOD_QPSK)
        self.dvbt2_freqinterleaver_cc_0 = dvbt2.freqinterleaver_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.PILOT_PP5, dvbt2.GI_1_16, 500, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, )
        self.dvbt2_framemapper_cc_0 = dvbt2.framemapper_cc(dvbt2.FECFRAME_SHORT, dvbt2.C4_5, dvbt2.MOD_QPSK, dvbt2.ROTATION_ON, 204, 0, dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.GI_1_16, dvbt2.L1_MOD_QPSK, dvbt2.PILOT_PP5, 2, 500, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.INPUTMODE_NORMAL, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
        self.dvbt2_cellinterleaver_cc_0 = dvbt2.cellinterleaver_cc(dvbt2.FECFRAME_SHORT, dvbt2.MOD_QPSK, 204, 0)
        self.dvbt2_bch_bb_0 = dvbt2.bch_bb(dvbt2.FECFRAME_SHORT, dvbt2.C4_5)
        self.dvbt2_bbscrambler_bb_0 = dvbt2.bbscrambler_bb(dvbt2.FECFRAME_SHORT, dvbt2.C4_5)
        self.dvbt2_bbheader_bb_0 = dvbt2.bbheader_bb(dvbt2.FECFRAME_SHORT, dvbt2.C4_5, dvbt2.INPUTMODE_HIEFF, dvbt2.INBAND_OFF, 168, 4000000)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(4096, 4096+4096/16, 0, "")
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/re/xfer/vv034.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt2_bbheader_bb_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.dvbt2_p1insertion_cc_0, 0))    
        self.connect((self.dvbt2_bbheader_bb_0, 0), (self.dvbt2_bbscrambler_bb_0, 0))    
        self.connect((self.dvbt2_bbscrambler_bb_0, 0), (self.dvbt2_bch_bb_0, 0))    
        self.connect((self.dvbt2_bch_bb_0, 0), (self.dvbt2_ldpc_bb_0, 0))    
        self.connect((self.dvbt2_cellinterleaver_cc_0, 0), (self.dvbt2_framemapper_cc_0, 0))    
        self.connect((self.dvbt2_framemapper_cc_0, 0), (self.dvbt2_freqinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_freqinterleaver_cc_0, 0), (self.dvbt2_pilotgenerator_cc_0, 0))    
        self.connect((self.dvbt2_interleaver_bb_0, 0), (self.dvbt2_modulator_bc_0, 0))    
        self.connect((self.dvbt2_ldpc_bb_0, 0), (self.dvbt2_interleaver_bb_0, 0))    
        self.connect((self.dvbt2_modulator_bc_0, 0), (self.dvbt2_cellinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_p1insertion_cc_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.dvbt2_pilotgenerator_cc_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
Ejemplo n.º 3
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vv009 4Kfft")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = (8000000.0 * 8) / 7

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "bladerf=0,buffers=128,buflen=32768" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(429e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(18, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(-8, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(8750000, 0)
          
        self.dvbt2_pilotgenerator_cc_0 = dvbt2.pilotgenerator_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.PILOT_PP7, dvbt2.GI_1_32, 100, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON, dvbt2.BANDWIDTH_8_0_MHZ, 4096)
        self.dvbt2_p1insertion_cc_0 = dvbt2.p1insertion_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.GI_1_32, 100, dvbt2.PREAMBLE_T2_SISO, dvbt2.SHOWLEVELS_OFF, 3.3)
        self.dvbt2_modulator_bc_0 = dvbt2.modulator_bc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_64QAM, dvbt2.ROTATION_ON)
        self.dvbt2_ldpc_bb_0 = dvbt2.ldpc_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3)
        self.dvbt2_interleaver_bb_0 = dvbt2.interleaver_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3, dvbt2.MOD_64QAM)
        self.dvbt2_freqinterleaver_cc_0 = dvbt2.freqinterleaver_cc(dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.PILOT_PP7, dvbt2.GI_1_32, 100, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, )
        self.dvbt2_framemapper_cc_0 = dvbt2.framemapper_cc(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3, dvbt2.MOD_64QAM, dvbt2.ROTATION_ON, 31, 3, dvbt2.CARRIERS_NORMAL, dvbt2.FFTSIZE_4K, dvbt2.GI_1_32, dvbt2.L1_MOD_16QAM, dvbt2.PILOT_PP7, 2, 100, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_SISO, dvbt2.INPUTMODE_NORMAL, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
        self.dvbt2_cellinterleaver_cc_0 = dvbt2.cellinterleaver_cc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_64QAM, 31, 3)
        self.dvbt2_bch_bb_0 = dvbt2.bch_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3)
        self.dvbt2_bbscrambler_bb_0 = dvbt2.bbscrambler_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3)
        self.dvbt2_bbheader_bb_0 = dvbt2.bbheader_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C2_3, dvbt2.INPUTMODE_NORMAL, dvbt2.INBAND_OFF, 168, 4000000)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(4096, 4096+4096/32, 0, "")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.2, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/run/shm/adv4k64qam.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt2_bbheader_bb_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.dvbt2_p1insertion_cc_0, 0))    
        self.connect((self.dvbt2_bbheader_bb_0, 0), (self.dvbt2_bbscrambler_bb_0, 0))    
        self.connect((self.dvbt2_bbscrambler_bb_0, 0), (self.dvbt2_bch_bb_0, 0))    
        self.connect((self.dvbt2_bch_bb_0, 0), (self.dvbt2_ldpc_bb_0, 0))    
        self.connect((self.dvbt2_cellinterleaver_cc_0, 0), (self.dvbt2_framemapper_cc_0, 0))    
        self.connect((self.dvbt2_framemapper_cc_0, 0), (self.dvbt2_freqinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_freqinterleaver_cc_0, 0), (self.dvbt2_pilotgenerator_cc_0, 0))    
        self.connect((self.dvbt2_interleaver_bb_0, 0), (self.dvbt2_modulator_bc_0, 0))    
        self.connect((self.dvbt2_ldpc_bb_0, 0), (self.dvbt2_interleaver_bb_0, 0))    
        self.connect((self.dvbt2_modulator_bc_0, 0), (self.dvbt2_cellinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_p1insertion_cc_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.dvbt2_pilotgenerator_cc_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
Ejemplo n.º 4
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vv018 Miso")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = (8000000.0) * 8 / 7

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "bladerf=0,buffers=128,buflen=32768" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(429e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(18, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(-8, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(8750000, 0)
          
        self.dvbt2_pilotgenerator_cc_1 = dvbt2.pilotgenerator_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.PILOT_PP2, dvbt2.GI_1_16, 19, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_MISO, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON, dvbt2.BANDWIDTH_8_0_MHZ, 32768)
        self.dvbt2_pilotgenerator_cc_0 = dvbt2.pilotgenerator_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.PILOT_PP2, dvbt2.GI_1_16, 19, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_MISO, dvbt2.MISO_TX2, dvbt2.EQUALIZATION_ON, dvbt2.BANDWIDTH_8_0_MHZ, 32768)
        self.dvbt2_p1insertion_cc_0_0 = dvbt2.p1insertion_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.GI_1_16, 19, dvbt2.PREAMBLE_T2_MISO, dvbt2.SHOWLEVELS_OFF, 3.3)
        self.dvbt2_p1insertion_cc_0 = dvbt2.p1insertion_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.GI_1_16, 19, dvbt2.PREAMBLE_T2_MISO, dvbt2.SHOWLEVELS_OFF, 3.3)
        self.dvbt2_modulator_bc_0 = dvbt2.modulator_bc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_256QAM, dvbt2.ROTATION_ON)
        self.dvbt2_miso_cc_0 = dvbt2.miso_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.PILOT_PP2, dvbt2.GI_1_16, 19, dvbt2.PAPR_OFF, )
        self.dvbt2_ldpc_bb_0 = dvbt2.ldpc_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6)
        self.dvbt2_interleaver_bb_0 = dvbt2.interleaver_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6, dvbt2.MOD_256QAM)
        self.dvbt2_freqinterleaver_cc_0 = dvbt2.freqinterleaver_cc(dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.PILOT_PP2, dvbt2.GI_1_16, 19, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_MISO, )
        self.dvbt2_framemapper_cc_0 = dvbt2.framemapper_cc(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6, dvbt2.MOD_256QAM, dvbt2.ROTATION_ON, 61, 1, dvbt2.CARRIERS_EXTENDED, dvbt2.FFTSIZE_32K, dvbt2.GI_1_16, dvbt2.L1_MOD_64QAM, dvbt2.PILOT_PP2, 2, 19, dvbt2.PAPR_OFF, dvbt2.VERSION_111, dvbt2.PREAMBLE_T2_MISO, dvbt2.INPUTMODE_NORMAL, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
        self.dvbt2_cellinterleaver_cc_0 = dvbt2.cellinterleaver_cc(dvbt2.FECFRAME_NORMAL, dvbt2.MOD_256QAM, 61, 1)
        self.dvbt2_bch_bb_0 = dvbt2.bch_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6)
        self.dvbt2_bbscrambler_bb_0 = dvbt2.bbscrambler_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6)
        self.dvbt2_bbheader_bb_0 = dvbt2.bbheader_bb(dvbt2.FECFRAME_NORMAL, dvbt2.C5_6, dvbt2.INPUTMODE_HIEFF, dvbt2.INBAND_OFF, 168, 4000000)
        self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer(32768, 32768+32768/16, 0, "")
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(32768, 32768+32768/16, 0, "")
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.2, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/run/shm/adv32kmiso.ts", False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.dvbt2_bbheader_bb_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.dvbt2_p1insertion_cc_0, 0))    
        self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.dvbt2_p1insertion_cc_0_0, 0))    
        self.connect((self.dvbt2_bbheader_bb_0, 0), (self.dvbt2_bbscrambler_bb_0, 0))    
        self.connect((self.dvbt2_bbscrambler_bb_0, 0), (self.dvbt2_bch_bb_0, 0))    
        self.connect((self.dvbt2_bch_bb_0, 0), (self.dvbt2_ldpc_bb_0, 0))    
        self.connect((self.dvbt2_cellinterleaver_cc_0, 0), (self.dvbt2_framemapper_cc_0, 0))    
        self.connect((self.dvbt2_framemapper_cc_0, 0), (self.dvbt2_freqinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_freqinterleaver_cc_0, 0), (self.dvbt2_miso_cc_0, 0))    
        self.connect((self.dvbt2_interleaver_bb_0, 0), (self.dvbt2_modulator_bc_0, 0))    
        self.connect((self.dvbt2_ldpc_bb_0, 0), (self.dvbt2_interleaver_bb_0, 0))    
        self.connect((self.dvbt2_miso_cc_0, 1), (self.dvbt2_pilotgenerator_cc_0, 0))    
        self.connect((self.dvbt2_miso_cc_0, 0), (self.dvbt2_pilotgenerator_cc_1, 0))    
        self.connect((self.dvbt2_modulator_bc_0, 0), (self.dvbt2_cellinterleaver_cc_0, 0))    
        self.connect((self.dvbt2_p1insertion_cc_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.dvbt2_p1insertion_cc_0_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.dvbt2_pilotgenerator_cc_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))    
        self.connect((self.dvbt2_pilotgenerator_cc_1, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0))    
Ejemplo n.º 5
0
        gi = (fftsize * 19) / 128
    elif guard_interval == dvbt2.GI_19_256:
        gi = (fftsize * 19) / 256

    log=gr.logger("dvbt2-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")

    dvbt2_bbheader = dvbt2.bbheader_bb(frame_size, code_rate, input_mode, dvbt2.INBAND_OFF, fec_blocks, 4000000)
    dvbt2_bbscrambler = dvbt2.bbscrambler_bb(frame_size, code_rate)
    dvbt2_bch = dvbt2.bch_bb(frame_size, code_rate)
    dvbt2_ldpc = dvbt2.ldpc_bb(frame_size, code_rate)
    dvbt2_interleaver = dvbt2.interleaver_bb(frame_size, code_rate, constellation)
    dvbt2_modulator = dvbt2.modulator_bc(frame_size, constellation, rotation)
    dvbt2_cellinterleaver = dvbt2.cellinterleaver_cc(frame_size, constellation, fec_blocks, ti_blocks)
    dvbt2_framemapper = dvbt2.framemapper_cc(frame_size, code_rate, constellation, rotation, fec_blocks, ti_blocks, carrier_mode, fft_size, guard_interval, l1_constellation, pilot_pattern, 2, data_symbols, papr_mode, version, mode, input_mode, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
    dvbt2_freqinterleaver = dvbt2.freqinterleaver_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, mode)
    dvbt2_pilotgenerator = dvbt2.pilotgenerator_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, mode, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON, equalization_bandwidth, fftsize)
    dvbt2_paprtr = dvbt2.paprtr_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, papr_vclip, papr_iterations, fftsize)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(fftsize, fftsize+(gi), 0, "")
    dvbt2_p1insertion = dvbt2.p1insertion_cc(carrier_mode, fft_size, guard_interval, data_symbols, mode, dvbt2.SHOWLEVELS_OFF, 3.31)
    blocks_multiply_const = blocks.multiply_const_vcc((0.2, ))
    log.debug("DVB-T2 blocks initialized")

    out = osmosdr.sink(args="numchan=1")
Ejemplo n.º 6
0
    elif guard_interval == dvbt2.GI_19_256:
        gi = (fftsize * 19) / 256

    log = gr.logger("dvbt2-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")

    dvbt2_bbheader = dvbt2.bbheader_bb(frame_size, code_rate, input_mode,
                                       dvbt2.INBAND_OFF, fec_blocks, 4000000)
    dvbt2_bbscrambler = dvbt2.bbscrambler_bb(frame_size, code_rate)
    dvbt2_bch = dvbt2.bch_bb(frame_size, code_rate)
    dvbt2_ldpc = dvbt2.ldpc_bb(frame_size, code_rate)
    dvbt2_interleaver = dvbt2.interleaver_bb(frame_size, code_rate,
                                             constellation)
    dvbt2_modulator = dvbt2.modulator_bc(frame_size, constellation, rotation)
    dvbt2_cellinterleaver = dvbt2.cellinterleaver_cc(frame_size, constellation,
                                                     fec_blocks, ti_blocks)
    dvbt2_framemapper = dvbt2.framemapper_cc(
        frame_size, code_rate, constellation, rotation, fec_blocks, ti_blocks,
        carrier_mode, fft_size, guard_interval, l1_constellation,
        pilot_pattern, 2, data_symbols, papr_mode, version, mode, input_mode,
        dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
    dvbt2_freqinterleaver = dvbt2.freqinterleaver_cc(carrier_mode, fft_size,
                                                     pilot_pattern,
                                                     guard_interval,
Ejemplo 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: dvbt2-blade.py input_file [output_file]\n")
        sys.exit(1)

    version = dvbt2.VERSION_111
    fft_size = dvbt2.FFTSIZE_4K
    input_mode = dvbt2.INPUTMODE_NORMAL
    frame_size = dvbt2.FECFRAME_NORMAL
    code_rate = dvbt2.C2_3
    data_symbols = 100
    fec_blocks = 31
    ti_blocks = 3
    constellation = dvbt2.MOD_64QAM
    rotation = dvbt2.ROTATION_ON
    guard_interval = dvbt2.GI_1_32
    mode = dvbt2.PREAMBLE_T2_SISO
    carrier_mode = dvbt2.CARRIERS_NORMAL
    pilot_pattern = dvbt2.PILOT_PP7
    l1_constellation = dvbt2.L1_MOD_16QAM
    papr_mode = dvbt2.PAPR_OFF
    papr_vclip = 3.3
    papr_iterations = 3

    channel_mhz = 8
    samp_rate = channel_mhz * 8000000.0 / 7
    center_freq = 429000000
    txvga1_gain = -8
    txvga2_gain = 12

    if channel_mhz == 10:
        bandwidth = 10000000
        equalization_bandwidth = dvbt2.BANDWIDTH_10_0_MHZ
    elif channel_mhz == 8:
        bandwidth = 8750000
        equalization_bandwidth = dvbt2.BANDWIDTH_8_0_MHZ
    elif channel_mhz == 7:
        bandwidth = 7000000
        equalization_bandwidth = dvbt2.BANDWIDTH_7_0_MHZ
    elif channel_mhz == 6:
        bandwidth = 5500000
        equalization_bandwidth = dvbt2.BANDWIDTH_6_0_MHZ
    elif channel_mhz == 5:
        bandwidth = 5000000
        equalization_bandwidth = dvbt2.BANDWIDTH_5_0_MHZ
    else:
        bandwidth = 1750000
        equalization_bandwidth = dvbt2.BANDWIDTH_1_7_MHZ

    if fft_size == dvbt2.FFTSIZE_1K:
        fftsize = 1024
    elif fft_size == dvbt2.FFTSIZE_2K:
        fftsize = 2048
    elif fft_size == dvbt2.FFTSIZE_4K:
        fftsize = 4096
    elif fft_size == dvbt2.FFTSIZE_8K:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_8K_T2GI:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_16K:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_16K_T2GI:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_32K:
        fftsize = 32768
    elif fft_size == dvbt2.FFTSIZE_32K_T2GI:
        fftsize = 32768

    if guard_interval == dvbt2.GI_1_32:
        gi = fftsize / 32
    elif guard_interval == dvbt2.GI_1_16:
        gi = fftsize / 16
    elif guard_interval == dvbt2.GI_1_8:
        gi = fftsize / 8
    elif guard_interval == dvbt2.GI_1_4:
        gi = fftsize / 4
    elif guard_interval == dvbt2.GI_1_128:
        gi = fftsize / 128
    elif guard_interval == dvbt2.GI_19_128:
        gi = (fftsize * 19) / 128
    elif guard_interval == dvbt2.GI_19_256:
        gi = (fftsize * 19) / 256

    tb = gr.top_block()

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

    dvbt2_bbheader = dvbt2.bbheader_bb(frame_size, code_rate, input_mode,
                                       dvbt2.INBAND_OFF, fec_blocks, 4000000)
    dvbt2_bbscrambler = dvbt2.bbscrambler_bb(frame_size, code_rate)
    dvbt2_bch = dvbt2.bch_bb(frame_size, code_rate)
    dvbt2_ldpc = dvbt2.ldpc_bb(frame_size, code_rate)
    dvbt2_interleaver = dvbt2.interleaver_bb(frame_size, code_rate,
                                             constellation)
    dvbt2_modulator = dvbt2.modulator_bc(frame_size, constellation, rotation)
    dvbt2_cellinterleaver = dvbt2.cellinterleaver_cc(frame_size, constellation,
                                                     fec_blocks, ti_blocks)
    dvbt2_framemapper = dvbt2.framemapper_cc(
        frame_size, code_rate, constellation, rotation, fec_blocks, ti_blocks,
        carrier_mode, fft_size, guard_interval, l1_constellation,
        pilot_pattern, 2, data_symbols, papr_mode, version, mode, input_mode,
        dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
    dvbt2_freqinterleaver = dvbt2.freqinterleaver_cc(carrier_mode, fft_size,
                                                     pilot_pattern,
                                                     guard_interval,
                                                     data_symbols, papr_mode,
                                                     version, mode)
    dvbt2_pilotgenerator = dvbt2.pilotgenerator_cc(
        carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols,
        papr_mode, version, mode, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON,
        equalization_bandwidth, fftsize)
    dvbt2_paprtr = dvbt2.paprtr_cc(carrier_mode, fft_size, pilot_pattern,
                                   guard_interval, data_symbols, papr_mode,
                                   version, papr_vclip, papr_iterations,
                                   fftsize)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(
        fftsize, fftsize + (gi), 0, "")
    dvbt2_p1insertion = dvbt2.p1insertion_cc(carrier_mode, fft_size,
                                             guard_interval, data_symbols,
                                             mode, dvbt2.SHOWLEVELS_OFF, 3.31)
    blocks_multiply_const = blocks.multiply_const_vcc((0.2, ))

    out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768")
    out.set_sample_rate(samp_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, dvbt2_bbheader)
    tb.connect(dvbt2_bbheader, dvbt2_bbscrambler)
    tb.connect(dvbt2_bbscrambler, dvbt2_bch)
    tb.connect(dvbt2_bch, dvbt2_ldpc)
    tb.connect(dvbt2_ldpc, dvbt2_interleaver)
    tb.connect(dvbt2_interleaver, dvbt2_modulator)
    tb.connect(dvbt2_modulator, dvbt2_cellinterleaver)
    tb.connect(dvbt2_cellinterleaver, dvbt2_framemapper)
    tb.connect(dvbt2_framemapper, dvbt2_freqinterleaver)
    tb.connect(dvbt2_freqinterleaver, dvbt2_pilotgenerator)
    tb.connect(dvbt2_pilotgenerator, dvbt2_paprtr)
    tb.connect(dvbt2_paprtr, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, dvbt2_p1insertion)
    tb.connect(dvbt2_p1insertion, blocks_multiply_const)
    tb.connect(blocks_multiply_const, out)

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

    tb.run()
Ejemplo n.º 8
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: dvbt2-blade.py input_file [output_file]\n");
        sys.exit(1)

    version = dvbt2.VERSION_111
    fft_size = dvbt2.FFTSIZE_4K
    input_mode = dvbt2.INPUTMODE_NORMAL
    frame_size = dvbt2.FECFRAME_NORMAL
    code_rate = dvbt2.C2_3
    data_symbols = 100
    fec_blocks = 31
    ti_blocks = 3
    constellation = dvbt2.MOD_64QAM
    rotation = dvbt2.ROTATION_ON
    guard_interval = dvbt2.GI_1_32
    mode = dvbt2.PREAMBLE_T2_SISO
    carrier_mode = dvbt2.CARRIERS_NORMAL
    pilot_pattern = dvbt2.PILOT_PP7
    l1_constellation = dvbt2.L1_MOD_16QAM
    papr_mode = dvbt2.PAPR_OFF
    papr_vclip = 3.3
    papr_iterations = 3

    channel_mhz = 8
    samp_rate = channel_mhz * 8000000.0 / 7
    center_freq = 429000000
    txvga1_gain = -8
    txvga2_gain = 12

    if channel_mhz == 10:
        bandwidth = 10000000
        equalization_bandwidth = dvbt2.BANDWIDTH_10_0_MHZ
    elif channel_mhz == 8:
        bandwidth = 8750000
        equalization_bandwidth = dvbt2.BANDWIDTH_8_0_MHZ
    elif channel_mhz == 7:
        bandwidth = 7000000
        equalization_bandwidth = dvbt2.BANDWIDTH_7_0_MHZ
    elif channel_mhz == 6:
        bandwidth = 5500000
        equalization_bandwidth = dvbt2.BANDWIDTH_6_0_MHZ
    elif channel_mhz == 5:
        bandwidth = 5000000
        equalization_bandwidth = dvbt2.BANDWIDTH_5_0_MHZ
    else:
        bandwidth = 1750000
        equalization_bandwidth = dvbt2.BANDWIDTH_1_7_MHZ

    if fft_size == dvbt2.FFTSIZE_1K:
        fftsize = 1024
    elif fft_size == dvbt2.FFTSIZE_2K:
        fftsize = 2048
    elif fft_size == dvbt2.FFTSIZE_4K:
        fftsize = 4096
    elif fft_size == dvbt2.FFTSIZE_8K:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_8K_T2GI:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_16K:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_16K_T2GI:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_32K:
        fftsize = 32768
    elif fft_size == dvbt2.FFTSIZE_32K_T2GI:
        fftsize = 32768

    if guard_interval == dvbt2.GI_1_32:
        gi = fftsize / 32
    elif guard_interval == dvbt2.GI_1_16:
        gi = fftsize / 16
    elif guard_interval == dvbt2.GI_1_8:
        gi = fftsize / 8
    elif guard_interval == dvbt2.GI_1_4:
        gi = fftsize / 4
    elif guard_interval == dvbt2.GI_1_128:
        gi = fftsize / 128
    elif guard_interval == dvbt2.GI_19_128:
        gi = (fftsize * 19) / 128
    elif guard_interval == dvbt2.GI_19_256:
        gi = (fftsize * 19) / 256

    tb = gr.top_block()

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

    dvbt2_bbheader = dvbt2.bbheader_bb(frame_size, code_rate, input_mode, dvbt2.INBAND_OFF, fec_blocks, 4000000)
    dvbt2_bbscrambler = dvbt2.bbscrambler_bb(frame_size, code_rate)
    dvbt2_bch = dvbt2.bch_bb(frame_size, code_rate)
    dvbt2_ldpc = dvbt2.ldpc_bb(frame_size, code_rate)
    dvbt2_interleaver = dvbt2.interleaver_bb(frame_size, code_rate, constellation)
    dvbt2_modulator = dvbt2.modulator_bc(frame_size, constellation, rotation)
    dvbt2_cellinterleaver = dvbt2.cellinterleaver_cc(frame_size, constellation, fec_blocks, ti_blocks)
    dvbt2_framemapper = dvbt2.framemapper_cc(frame_size, code_rate, constellation, rotation, fec_blocks, ti_blocks, carrier_mode, fft_size, guard_interval, l1_constellation, pilot_pattern, 2, data_symbols, papr_mode, version, mode, input_mode, dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
    dvbt2_freqinterleaver = dvbt2.freqinterleaver_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, mode)
    dvbt2_pilotgenerator = dvbt2.pilotgenerator_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, mode, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON, equalization_bandwidth, fftsize)
    dvbt2_paprtr = dvbt2.paprtr_cc(carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols, papr_mode, version, papr_vclip, papr_iterations, fftsize)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(fftsize, fftsize+(gi), 0, "")
    dvbt2_p1insertion = dvbt2.p1insertion_cc(carrier_mode, fft_size, guard_interval, data_symbols, mode, dvbt2.SHOWLEVELS_OFF, 3.31)
    blocks_multiply_const = blocks.multiply_const_vcc((0.2, ))

    out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768")
    out.set_sample_rate(samp_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, dvbt2_bbheader)
    tb.connect(dvbt2_bbheader, dvbt2_bbscrambler)
    tb.connect(dvbt2_bbscrambler, dvbt2_bch)
    tb.connect(dvbt2_bch, dvbt2_ldpc)
    tb.connect(dvbt2_ldpc, dvbt2_interleaver)
    tb.connect(dvbt2_interleaver, dvbt2_modulator)
    tb.connect(dvbt2_modulator, dvbt2_cellinterleaver)
    tb.connect(dvbt2_cellinterleaver, dvbt2_framemapper)
    tb.connect(dvbt2_framemapper, dvbt2_freqinterleaver)
    tb.connect(dvbt2_freqinterleaver, dvbt2_pilotgenerator)
    tb.connect(dvbt2_pilotgenerator, dvbt2_paprtr)
    tb.connect(dvbt2_paprtr, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, dvbt2_p1insertion)
    tb.connect(dvbt2_p1insertion, blocks_multiply_const)
    tb.connect(blocks_multiply_const, out)

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

    tb.run()
Ejemplo n.º 9
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: dvbt2-hackrf.py input_file [output_file]\n")
        sys.exit(1)

    try:
        shmaxfile = open('/proc/sys/kernel/shmmax', 'r')
        shmax = int(shmaxfile.readline())
        if shmax < 1024 * 1024 * 1024:
            print("")
            print(
                "In order to run this, the maximum size of shared memory must be > %d"
                % (1024 * 1024 * 1024))
            print("your current maximum is at %d" % (shmax))
            print("please run the following command to fix this:")
            print("")
            print(
                " # sudo sh -c 'echo $(( 1024 * 1024 * 1024 )) > /proc/sys/kernel/shmmax'"
            )
            print("")
            sys.exit(1)

    except Exception as e:
        print(
            "!! Warning: Can't read shared memory maxsize (%s), \n   your maximum might be to low to run this\n"
            % e)

    ## Config Options

    # DVB-T2 Parameters
    version = dvbt2.VERSION_111
    fft_size = dvbt2.FFTSIZE_4K
    input_mode = dvbt2.INPUTMODE_NORMAL
    frame_size = dvbt2.FECFRAME_NORMAL
    code_rate = dvbt2.C2_3
    data_symbols = 100
    fec_blocks = 31
    ti_blocks = 3
    constellation = dvbt2.MOD_64QAM
    rotation = dvbt2.ROTATION_ON
    guard_interval = dvbt2.GI_1_32
    mode = dvbt2.PREAMBLE_T2_SISO
    carrier_mode = dvbt2.CARRIERS_NORMAL
    pilot_pattern = dvbt2.PILOT_PP7
    l1_constellation = dvbt2.L1_MOD_16QAM
    papr_mode = dvbt2.PAPR_OFF
    papr_vclip = 3.3
    papr_iterations = 3
    channel_mhz = 8

    # Hack-RF Parameters
    center_freq = 474000000
    rf_gain = 14
    if_gain = 20
    bb_gain = 20

    ##

    samp_rate = channel_mhz * 8000000.0 / 7

    if channel_mhz == 10:
        bandwidth = 10000000
        equalization_bandwidth = dvbt2.BANDWIDTH_10_0_MHZ
    elif channel_mhz == 8:
        bandwidth = 8750000
        equalization_bandwidth = dvbt2.BANDWIDTH_8_0_MHZ
    elif channel_mhz == 7:
        bandwidth = 7000000
        equalization_bandwidth = dvbt2.BANDWIDTH_7_0_MHZ
    elif channel_mhz == 6:
        bandwidth = 5500000
        equalization_bandwidth = dvbt2.BANDWIDTH_6_0_MHZ
    elif channel_mhz == 5:
        bandwidth = 5000000
        equalization_bandwidth = dvbt2.BANDWIDTH_5_0_MHZ
    else:
        bandwidth = 1750000
        equalization_bandwidth = dvbt2.BANDWIDTH_1_7_MHZ

    if fft_size == dvbt2.FFTSIZE_1K:
        fftsize = 1024
    elif fft_size == dvbt2.FFTSIZE_2K:
        fftsize = 2048
    elif fft_size == dvbt2.FFTSIZE_4K:
        fftsize = 4096
    elif fft_size == dvbt2.FFTSIZE_8K:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_8K_T2GI:
        fftsize = 8192
    elif fft_size == dvbt2.FFTSIZE_16K:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_16K_T2GI:
        fftsize = 16384
    elif fft_size == dvbt2.FFTSIZE_32K:
        fftsize = 32768
    elif fft_size == dvbt2.FFTSIZE_32K_T2GI:
        fftsize = 32768

    if guard_interval == dvbt2.GI_1_32:
        gi = fftsize / 32
    elif guard_interval == dvbt2.GI_1_16:
        gi = fftsize / 16
    elif guard_interval == dvbt2.GI_1_8:
        gi = fftsize / 8
    elif guard_interval == dvbt2.GI_1_4:
        gi = fftsize / 4
    elif guard_interval == dvbt2.GI_1_128:
        gi = fftsize / 128
    elif guard_interval == dvbt2.GI_19_128:
        gi = (fftsize * 19) / 128
    elif guard_interval == dvbt2.GI_19_256:
        gi = (fftsize * 19) / 256

    log = gr.logger("dvbt2-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")

    dvbt2_bbheader = dvbt2.bbheader_bb(frame_size, code_rate, input_mode,
                                       dvbt2.INBAND_OFF, fec_blocks, 4000000)
    dvbt2_bbscrambler = dvbt2.bbscrambler_bb(frame_size, code_rate)
    dvbt2_bch = dvbt2.bch_bb(frame_size, code_rate)
    dvbt2_ldpc = dvbt2.ldpc_bb(frame_size, code_rate)
    dvbt2_interleaver = dvbt2.interleaver_bb(frame_size, code_rate,
                                             constellation)
    dvbt2_modulator = dvbt2.modulator_bc(frame_size, constellation, rotation)
    dvbt2_cellinterleaver = dvbt2.cellinterleaver_cc(frame_size, constellation,
                                                     fec_blocks, ti_blocks)
    dvbt2_framemapper = dvbt2.framemapper_cc(
        frame_size, code_rate, constellation, rotation, fec_blocks, ti_blocks,
        carrier_mode, fft_size, guard_interval, l1_constellation,
        pilot_pattern, 2, data_symbols, papr_mode, version, mode, input_mode,
        dvbt2.RESERVED_OFF, dvbt2.L1_SCRAMBLED_OFF, dvbt2.INBAND_OFF)
    dvbt2_freqinterleaver = dvbt2.freqinterleaver_cc(carrier_mode, fft_size,
                                                     pilot_pattern,
                                                     guard_interval,
                                                     data_symbols, papr_mode,
                                                     version, mode)
    dvbt2_pilotgenerator = dvbt2.pilotgenerator_cc(
        carrier_mode, fft_size, pilot_pattern, guard_interval, data_symbols,
        papr_mode, version, mode, dvbt2.MISO_TX1, dvbt2.EQUALIZATION_ON,
        equalization_bandwidth, fftsize)
    dvbt2_paprtr = dvbt2.paprtr_cc(carrier_mode, fft_size, pilot_pattern,
                                   guard_interval, data_symbols, papr_mode,
                                   version, papr_vclip, papr_iterations,
                                   fftsize)
    digital_ofdm_cyclic_prefixer = digital.ofdm_cyclic_prefixer(
        fftsize, fftsize + (gi), 0, "")
    dvbt2_p1insertion = dvbt2.p1insertion_cc(carrier_mode, fft_size,
                                             guard_interval, data_symbols,
                                             mode, dvbt2.SHOWLEVELS_OFF, 3.31)
    blocks_multiply_const = blocks.multiply_const_vcc((0.2, ))
    log.debug("DVB-T2 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(bandwidth, 0)
    log.debug("Output block initialized")

    tb.connect(src, dvbt2_bbheader)
    tb.connect(dvbt2_bbheader, dvbt2_bbscrambler)
    tb.connect(dvbt2_bbscrambler, dvbt2_bch)
    tb.connect(dvbt2_bch, dvbt2_ldpc)
    tb.connect(dvbt2_ldpc, dvbt2_interleaver)
    tb.connect(dvbt2_interleaver, dvbt2_modulator)
    tb.connect(dvbt2_modulator, dvbt2_cellinterleaver)
    tb.connect(dvbt2_cellinterleaver, dvbt2_framemapper)
    tb.connect(dvbt2_framemapper, dvbt2_freqinterleaver)
    tb.connect(dvbt2_freqinterleaver, dvbt2_pilotgenerator)
    tb.connect(dvbt2_pilotgenerator, dvbt2_paprtr)
    tb.connect(dvbt2_paprtr, digital_ofdm_cyclic_prefixer)
    tb.connect(digital_ofdm_cyclic_prefixer, dvbt2_p1insertion)
    tb.connect(dvbt2_p1insertion, blocks_multiply_const)
    tb.connect(blocks_multiply_const, out)
    log.debug("all blocks connected")

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

    log.debug("running gnuradio")
    tb.run()