コード例 #1
0
ファイル: qam64_b200.py プロジェクト: cn0xroot/gr-qam
    def __init__(self):
        gr.top_block.__init__(self, "Qam64 B200")

        ##################################################
        # Variables
        ##################################################
        self.interpolation = interpolation = 2
        self.samp_rate = samp_rate = 5056941 * interpolation
        self.rrc_taps = rrc_taps = 50
        self.gain = gain = 83
        self.center_freq = center_freq = 441000000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = 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(samp_rate*4),
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		otw_format="sc16",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.qam_trellis_enc_bb_0 = qam.trellis_enc_bb()
        self.qam_transport_framing_enc_bb_0 = qam.transport_framing_enc_bb()
        self.qam_reed_solomon_enc_bb_0 = qam.reed_solomon_enc_bb()
        self.qam_randomizer_bb_0 = qam.randomizer_bb()
        self.qam_interleaver_bb_0 = qam.interleaver_bb(128,4)
        self.qam_frame_sync_enc_bb_0 = qam.frame_sync_enc_bb(6)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(interpolation, (firdes.root_raised_cosine(0.14, samp_rate, samp_rate/interpolation, 0.18, rrc_taps)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([complex(1,1), complex(1,-1), complex(1,-3), complex(-3,-1), complex(-3,1), complex(1,3), complex(-3,-3), complex(-3,3), complex(-1,1), complex(-1,-1), complex(3,1), complex(-1,3), complex(-1,-3), complex(3,-1), complex(3,-3), complex(3,3), complex(5,1), complex(1,-5), complex(1,-7), complex(-7,-1), complex(-3,5), complex(5,3), complex(-7,-3), complex(-3,7), complex(-1,5), complex(-5,-1), complex(7,1), complex(-1,7), complex(-5,-3), complex(3,-5), complex(3,-7), complex(7,3), complex(1,5), complex(5,-1), complex(5,-3), complex(-3,-5), complex(-7,1), complex(1,7), complex(-3,-7), complex(-7,3), complex(-5,1), complex(-1,-5), complex(3,5), complex(-5,3), complex(-1,-7), complex(7,-1), complex(7,-3), complex(3,7), complex(5,5), complex(5,-5), complex(5,-7), complex(-7,-5), complex(-7,5), complex(5,7), complex(-7,-7), complex(-7,7), complex(-5,5), complex(-5,-5), complex(7,5), complex(-5,7), complex(-5,-7), complex(7,-5), complex(7,-7), complex(7,7)]), 1)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=5555,
        	server=True,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.qam_interleaver_bb_0, 0), (self.qam_randomizer_bb_0, 0))
        self.connect((self.qam_randomizer_bb_0, 0), (self.qam_frame_sync_enc_bb_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0, 0), (self.qam_trellis_enc_bb_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.qam_transport_framing_enc_bb_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.qam_reed_solomon_enc_bb_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.qam_trellis_enc_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.qam_reed_solomon_enc_bb_0, 0), (self.qam_interleaver_bb_0, 0))
コード例 #2
0
ファイル: qam64_hackrf.py プロジェクト: EQ4/gr-qam
    def __init__(self):
        gr.top_block.__init__(self, "Qam64 HackRF")

        ##################################################
        # Variables
        ##################################################
        self.interpolation = interpolation = 2
        self.samp_rate = samp_rate = 5056941 * interpolation
        self.rrc_taps = rrc_taps = 50
        self.gain = gain = 40
        self.center_freq = center_freq = 441000000

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink( args="hackrf=0" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(14, 0)
        self.osmosdr_sink_0.set_if_gain(gain, 0)
        self.osmosdr_sink_0.set_bb_gain(-4, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(6000000, 0)

        self.qam_trellis_enc_bb_0 = qam.trellis_enc_bb()
        self.qam_transport_framing_enc_bb_0 = qam.transport_framing_enc_bb()
        self.qam_reed_solomon_enc_bb_0 = qam.reed_solomon_enc_bb()
        self.qam_randomizer_bb_0 = qam.randomizer_bb()
        self.qam_interleaver_bb_0 = qam.interleaver_bb(128,4)
        self.qam_frame_sync_enc_bb_0 = qam.frame_sync_enc_bb(6)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(interpolation, (firdes.root_raised_cosine(0.14, samp_rate, samp_rate/interpolation, 0.18, rrc_taps)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([complex(1,1), complex(1,-1), complex(1,-3), complex(-3,-1), complex(-3,1), complex(1,3), complex(-3,-3), complex(-3,3), complex(-1,1), complex(-1,-1), complex(3,1), complex(-1,3), complex(-1,-3), complex(3,-1), complex(3,-3), complex(3,3), complex(5,1), complex(1,-5), complex(1,-7), complex(-7,-1), complex(-3,5), complex(5,3), complex(-7,-3), complex(-3,7), complex(-1,5), complex(-5,-1), complex(7,1), complex(-1,7), complex(-5,-3), complex(3,-5), complex(3,-7), complex(7,3), complex(1,5), complex(5,-1), complex(5,-3), complex(-3,-5), complex(-7,1), complex(1,7), complex(-3,-7), complex(-7,3), complex(-5,1), complex(-1,-5), complex(3,5), complex(-5,3), complex(-1,-7), complex(7,-1), complex(7,-3), complex(3,7), complex(5,5), complex(5,-5), complex(5,-7), complex(-7,-5), complex(-7,5), complex(5,7), complex(-7,-7), complex(-7,7), complex(-5,5), complex(-5,-5), complex(7,5), complex(-5,7), complex(-5,-7), complex(7,-5), complex(7,-7), complex(7,7)]), 1)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=5555,
        	server=True,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.qam_interleaver_bb_0, 0), (self.qam_randomizer_bb_0, 0))
        self.connect((self.qam_randomizer_bb_0, 0), (self.qam_frame_sync_enc_bb_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0, 0), (self.qam_trellis_enc_bb_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.qam_transport_framing_enc_bb_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.qam_reed_solomon_enc_bb_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.qam_trellis_enc_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.qam_reed_solomon_enc_bb_0, 0), (self.qam_interleaver_bb_0, 0))
コード例 #3
0
ファイル: qam64.py プロジェクト: EQ4/gr-qam
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Qam64")
        _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 = 5056941 * 2
        self.rrc_taps = rrc_taps = 50
        self.gain = gain = 0
        self.center_freq = center_freq = 441000000

        ##################################################
        # Blocks
        ##################################################
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="TX gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=25,
        	num_steps=25,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_gain_sizer)
        self.qam_trellis_enc_bb_0 = qam.trellis_enc_bb()
        self.qam_transport_framing_enc_bb_0 = qam.transport_framing_enc_bb()
        self.qam_reed_solomon_enc_bb_0 = qam.reed_solomon_enc_bb()
        self.qam_randomizer_bb_0 = qam.randomizer_bb()
        self.qam_interleaver_bb_0 = qam.interleaver_bb(128,4)
        self.qam_frame_sync_enc_bb_0 = qam.frame_sync_enc_bb(6)
        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(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(gain, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(-4, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(6000000, 0)
          
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(2, (firdes.root_raised_cosine(0.14, samp_rate, samp_rate/2, 0.18, rrc_taps)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([complex(1,1), complex(1,-1), complex(1,-3), complex(-3,-1), complex(-3,1), complex(1,3), complex(-3,-3), complex(-3,3), complex(-1,1), complex(-1,-1), complex(3,1), complex(-1,3), complex(-1,-3), complex(3,-1), complex(3,-3), complex(3,3), complex(5,1), complex(1,-5), complex(1,-7), complex(-7,-1), complex(-3,5), complex(5,3), complex(-7,-3), complex(-3,7), complex(-1,5), complex(-5,-1), complex(7,1), complex(-1,7), complex(-5,-3), complex(3,-5), complex(3,-7), complex(7,3), complex(1,5), complex(5,-1), complex(5,-3), complex(-3,-5), complex(-7,1), complex(1,7), complex(-3,-7), complex(-7,3), complex(-5,1), complex(-1,-5), complex(3,5), complex(-5,3), complex(-1,-7), complex(7,-1), complex(7,-3), complex(3,7), complex(5,5), complex(5,-5), complex(5,-7), complex(-7,-5), complex(-7,5), complex(5,7), complex(-7,-7), complex(-7,7), complex(-5,5), complex(-5,-5), complex(7,5), complex(-5,7), complex(-5,-7), complex(7,-5), complex(7,-7), complex(7,7)]), 1)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/argilo/git/gr-qam/in.fifo", False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.qam_reed_solomon_enc_bb_0, 0), (self.qam_interleaver_bb_0, 0))
        self.connect((self.qam_trellis_enc_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.qam_transport_framing_enc_bb_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.qam_reed_solomon_enc_bb_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.qam_interleaver_bb_0, 0), (self.qam_randomizer_bb_0, 0))
        self.connect((self.qam_randomizer_bb_0, 0), (self.qam_frame_sync_enc_bb_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0, 0), (self.qam_trellis_enc_bb_0, 0))
コード例 #4
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Qam64 Double")
        _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 = 5056941 * 3
        self.rrc_taps = rrc_taps = 20
        self.gain = gain = 0
        self.center_freq = center_freq = 438000000

        ##################################################
        # Blocks
        ##################################################
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label="TX gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=25,
            num_steps=25,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self.qam_trellis_enc_bb_0_0 = qam.trellis_enc_bb()
        self.qam_trellis_enc_bb_0 = qam.trellis_enc_bb()
        self.qam_transport_framing_enc_bb_0_0 = qam.transport_framing_enc_bb()
        self.qam_transport_framing_enc_bb_0 = qam.transport_framing_enc_bb()
        self.qam_reed_solomon_enc_bb_0_0 = qam.reed_solomon_enc_bb()
        self.qam_reed_solomon_enc_bb_0 = qam.reed_solomon_enc_bb()
        self.qam_randomizer_bb_0_0 = qam.randomizer_bb()
        self.qam_randomizer_bb_0 = qam.randomizer_bb()
        self.qam_interleaver_bb_0_0 = qam.interleaver_bb(128, 4)
        self.qam_interleaver_bb_0 = qam.interleaver_bb(128, 4)
        self.qam_frame_sync_enc_bb_0_0 = qam.frame_sync_enc_bb(6)
        self.qam_frame_sync_enc_bb_0 = qam.frame_sync_enc_bb(6)
        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(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(gain, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(-4, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(12000000, 0)

        self.interp_fir_filter_xxx_0_0 = filter.interp_fir_filter_ccc(
            3, (firdes.root_raised_cosine(0.07, samp_rate, samp_rate / 3, 0.18,
                                          rrc_taps)))
        self.interp_fir_filter_xxx_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(
            3, (firdes.root_raised_cosine(0.07, samp_rate, samp_rate / 3, 0.18,
                                          rrc_taps)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc(([
            complex(1, 1),
            complex(1, -1),
            complex(1, -3),
            complex(-3, -1),
            complex(-3, 1),
            complex(1, 3),
            complex(-3, -3),
            complex(-3, 3),
            complex(-1, 1),
            complex(-1, -1),
            complex(3, 1),
            complex(-1, 3),
            complex(-1, -3),
            complex(3, -1),
            complex(3, -3),
            complex(3, 3),
            complex(5, 1),
            complex(1, -5),
            complex(1, -7),
            complex(-7, -1),
            complex(-3, 5),
            complex(5, 3),
            complex(-7, -3),
            complex(-3, 7),
            complex(-1, 5),
            complex(-5, -1),
            complex(7, 1),
            complex(-1, 7),
            complex(-5, -3),
            complex(3, -5),
            complex(3, -7),
            complex(7, 3),
            complex(1, 5),
            complex(5, -1),
            complex(5, -3),
            complex(-3, -5),
            complex(-7, 1),
            complex(1, 7),
            complex(-3, -7),
            complex(-7, 3),
            complex(-5, 1),
            complex(-1, -5),
            complex(3, 5),
            complex(-5, 3),
            complex(-1, -7),
            complex(7, -1),
            complex(7, -3),
            complex(3, 7),
            complex(5, 5),
            complex(5, -5),
            complex(5, -7),
            complex(-7, -5),
            complex(-7, 5),
            complex(5, 7),
            complex(-7, -7),
            complex(-7, 7),
            complex(-5, 5),
            complex(-5, -5),
            complex(7, 5),
            complex(-5, 7),
            complex(-5, -7),
            complex(7, -5),
            complex(7, -7),
            complex(7, 7)
        ]), 1)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([
            complex(1, 1),
            complex(1, -1),
            complex(1, -3),
            complex(-3, -1),
            complex(-3, 1),
            complex(1, 3),
            complex(-3, -3),
            complex(-3, 3),
            complex(-1, 1),
            complex(-1, -1),
            complex(3, 1),
            complex(-1, 3),
            complex(-1, -3),
            complex(3, -1),
            complex(3, -3),
            complex(3, 3),
            complex(5, 1),
            complex(1, -5),
            complex(1, -7),
            complex(-7, -1),
            complex(-3, 5),
            complex(5, 3),
            complex(-7, -3),
            complex(-3, 7),
            complex(-1, 5),
            complex(-5, -1),
            complex(7, 1),
            complex(-1, 7),
            complex(-5, -3),
            complex(3, -5),
            complex(3, -7),
            complex(7, 3),
            complex(1, 5),
            complex(5, -1),
            complex(5, -3),
            complex(-3, -5),
            complex(-7, 1),
            complex(1, 7),
            complex(-3, -7),
            complex(-7, 3),
            complex(-5, 1),
            complex(-1, -5),
            complex(3, 5),
            complex(-5, 3),
            complex(-1, -7),
            complex(7, -1),
            complex(7, -3),
            complex(3, 7),
            complex(5, 5),
            complex(5, -5),
            complex(5, -7),
            complex(-7, -5),
            complex(-7, 5),
            complex(5, 7),
            complex(-7, -7),
            complex(-7, 7),
            complex(-5, 5),
            complex(-5, -5),
            complex(7, 5),
            complex(-5, 7),
            complex(-5, -7),
            complex(7, -5),
            complex(7, -7),
            complex(7, 7)
        ]), 1)
        self.blocks_packed_to_unpacked_xx_0_0 = blocks.packed_to_unpacked_bb(
            7, gr.GR_MSB_FIRST)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            7, gr.GR_MSB_FIRST)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/argilo/git/advqam64.ts", False)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/argilo/git/advqam64.ts", True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 3000000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -3000000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.qam_reed_solomon_enc_bb_0, 0),
                     (self.qam_interleaver_bb_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0, 0),
                     (self.qam_trellis_enc_bb_0, 0))
        self.connect((self.qam_randomizer_bb_0, 0),
                     (self.qam_frame_sync_enc_bb_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.qam_reed_solomon_enc_bb_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.qam_trellis_enc_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.qam_transport_framing_enc_bb_0, 0))
        self.connect((self.qam_interleaver_bb_0, 0),
                     (self.qam_randomizer_bb_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.interp_fir_filter_xxx_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0_0, 0),
                     (self.qam_trellis_enc_bb_0_0, 0))
        self.connect((self.qam_randomizer_bb_0_0, 0),
                     (self.qam_frame_sync_enc_bb_0_0, 0))
        self.connect((self.qam_interleaver_bb_0_0, 0),
                     (self.qam_randomizer_bb_0_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0_0, 0),
                     (self.qam_reed_solomon_enc_bb_0_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.qam_transport_framing_enc_bb_0_0, 0))
        self.connect((self.qam_trellis_enc_bb_0_0, 0),
                     (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0),
                     (self.interp_fir_filter_xxx_0_0, 0))
        self.connect((self.qam_reed_solomon_enc_bb_0_0, 0),
                     (self.qam_interleaver_bb_0_0, 0))
コード例 #5
0
    def __init__(self):
        gr.top_block.__init__(self, "Qam64 HackRF")

        ##################################################
        # Variables
        ##################################################
        self.interpolation = interpolation = 2
        self.samp_rate = samp_rate = 5056941 * interpolation
        self.rrc_taps = rrc_taps = 50
        self.gain = gain = 40
        self.center_freq = center_freq = 441000000

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink(args="hackrf=0")
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(14, 0)
        self.osmosdr_sink_0.set_if_gain(gain, 0)
        self.osmosdr_sink_0.set_bb_gain(-4, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(6000000, 0)

        self.qam_trellis_enc_bb_0 = qam.trellis_enc_bb()
        self.qam_transport_framing_enc_bb_0 = qam.transport_framing_enc_bb()
        self.qam_reed_solomon_enc_bb_0 = qam.reed_solomon_enc_bb()
        self.qam_randomizer_bb_0 = qam.randomizer_bb()
        self.qam_interleaver_bb_0 = qam.interleaver_bb(128, 4)
        self.qam_frame_sync_enc_bb_0 = qam.frame_sync_enc_bb(6)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(
            interpolation, (firdes.root_raised_cosine(
                0.14, samp_rate, samp_rate / interpolation, 0.18, rrc_taps)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([
            complex(1, 1),
            complex(1, -1),
            complex(1, -3),
            complex(-3, -1),
            complex(-3, 1),
            complex(1, 3),
            complex(-3, -3),
            complex(-3, 3),
            complex(-1, 1),
            complex(-1, -1),
            complex(3, 1),
            complex(-1, 3),
            complex(-1, -3),
            complex(3, -1),
            complex(3, -3),
            complex(3, 3),
            complex(5, 1),
            complex(1, -5),
            complex(1, -7),
            complex(-7, -1),
            complex(-3, 5),
            complex(5, 3),
            complex(-7, -3),
            complex(-3, 7),
            complex(-1, 5),
            complex(-5, -1),
            complex(7, 1),
            complex(-1, 7),
            complex(-5, -3),
            complex(3, -5),
            complex(3, -7),
            complex(7, 3),
            complex(1, 5),
            complex(5, -1),
            complex(5, -3),
            complex(-3, -5),
            complex(-7, 1),
            complex(1, 7),
            complex(-3, -7),
            complex(-7, 3),
            complex(-5, 1),
            complex(-1, -5),
            complex(3, 5),
            complex(-5, 3),
            complex(-1, -7),
            complex(7, -1),
            complex(7, -3),
            complex(3, 7),
            complex(5, 5),
            complex(5, -5),
            complex(5, -7),
            complex(-7, -5),
            complex(-7, 5),
            complex(5, 7),
            complex(-7, -7),
            complex(-7, 7),
            complex(-5, 5),
            complex(-5, -5),
            complex(7, 5),
            complex(-5, 7),
            complex(-5, -7),
            complex(7, -5),
            complex(7, -7),
            complex(7, 7)
        ]), 1)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            7, gr.GR_MSB_FIRST)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
            itemsize=gr.sizeof_char * 1,
            addr="127.0.0.1",
            port=5555,
            server=True,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.osmosdr_sink_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.qam_interleaver_bb_0, 0),
                     (self.qam_randomizer_bb_0, 0))
        self.connect((self.qam_randomizer_bb_0, 0),
                     (self.qam_frame_sync_enc_bb_0, 0))
        self.connect((self.qam_frame_sync_enc_bb_0, 0),
                     (self.qam_trellis_enc_bb_0, 0))
        self.connect((self.blks2_tcp_source_0, 0),
                     (self.qam_transport_framing_enc_bb_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.qam_reed_solomon_enc_bb_0, 0))
        self.connect((self.qam_transport_framing_enc_bb_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.qam_trellis_enc_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.qam_reed_solomon_enc_bb_0, 0),
                     (self.qam_interleaver_bb_0, 0))
コード例 #6
0
ファイル: qam-blade.py プロジェクト: drmpeg/dtv-utils
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: qam-blade.py input_file [output_file]\n");
        sys.exit(1)

    samp_rate = 5056941 * 2
    center_freq = 429000000
    rrc_taps = 100
    txvga1_gain = -6
    txvga2_gain = 9
    bandwidth = 6000000
    I_taps = 128
    J_increment = 4
    Control_Word = 6

    tb = gr.top_block()

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

    qam_transport_framing = qam.transport_framing_enc_bb()
    blocks_packed_to_unpacked = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
    qam_reed_solomon = qam.reed_solomon_enc_bb()
    qam_interleaver = qam.interleaver_bb(I_taps,J_increment)
    qam_randomizer = qam.randomizer_bb()
    qam_frame_sync = qam.frame_sync_enc_bb(Control_Word)
    qam_trellis = qam.trellis_enc_bb()
    digital_chunks_to_symbols = digital.chunks_to_symbols_bc(([complex(1,1), complex(1,-1), complex(1,-3), complex(-3,-1), complex(-3,1), complex(1,3), complex(-3,-3), complex(-3,3), complex(-1,1), complex(-1,-1), complex(3,1), complex(-1,3), complex(-1,-3), complex(3,-1), complex(3,-3), complex(3,3), complex(5,1), complex(1,-5), complex(1,-7), complex(-7,-1), complex(-3,5), complex(5,3), complex(-7,-3), complex(-3,7), complex(-1,5), complex(-5,-1), complex(7,1), complex(-1,7), complex(-5,-3), complex(3,-5), complex(3,-7), complex(7,3), complex(1,5), complex(5,-1), complex(5,-3), complex(-3,-5), complex(-7,1), complex(1,7), complex(-3,-7), complex(-7,3), complex(-5,1), complex(-1,-5), complex(3,5), complex(-5,3), complex(-1,-7), complex(7,-1), complex(7,-3), complex(3,7), complex(5,5), complex(5,-5), complex(5,-7), complex(-7,-5), complex(-7,5), complex(5,7), complex(-7,-7), complex(-7,7), complex(-5,5), complex(-5,-5), complex(7,5), complex(-5,7), complex(-5,-7), complex(7,-5), complex(7,-7), complex(7,7)]), 1)

    interp_fir_filter = filter.interp_fir_filter_ccc(2, (firdes.root_raised_cosine(0.14, samp_rate, samp_rate/2, 0.18, rrc_taps)))
    interp_fir_filter.declare_sample_delay(0)

    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, qam_transport_framing)
    tb.connect(qam_transport_framing, blocks_packed_to_unpacked)
    tb.connect(blocks_packed_to_unpacked, qam_reed_solomon)
    tb.connect(qam_reed_solomon, qam_interleaver)
    tb.connect(qam_interleaver, qam_randomizer)
    tb.connect(qam_randomizer, qam_frame_sync)
    tb.connect(qam_frame_sync, qam_trellis)
    tb.connect(qam_trellis, digital_chunks_to_symbols)
    tb.connect(digital_chunks_to_symbols, interp_fir_filter)
    tb.connect(interp_fir_filter, out)


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

    tb.run()