예제 #1
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="Direct-sequence spread spectrum")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################

        self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist(
            ([-1, 1]), ([0, 1]), 2, 1).base()

        self.samp_sym = samp_sym = 32
        self.samp_rate = samp_rate = 500e3
        self.samp_chip = samp_chip = 2
        self.init = init = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
        self.generator = generator = 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Despread Signal ',
            peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0_0.win, 2, 3, 1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Received DS Signal',
            peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 1, 1, 2)
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     mod_code="gray",
                                                     verbose=False,
                                                     log=False)

        self.digital_dxpsk_demod_0 = digital.dbpsk_demod(samples_per_symbol=2,
                                                         excess_bw=0.35,
                                                         freq_bw=6.28 / 100.0,
                                                         phase_bw=6.28 / 100.0,
                                                         timing_bw=6.28 /
                                                         100.0,
                                                         mod_code="gray",
                                                         verbose=False,
                                                         log=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.3,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0 + 1.0j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, samp_sym)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_char * 1, 32)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1000)
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_preamble_0 = Spread.preamble_bb(1389, (64 * (1, 1)))
        self.Spread_msg_source_0 = Spread.msg_source(100, 100)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_ds_spreader_0 = Spread.ds_spreader(samp_chip, (generator),
                                                       (init))
        self.Spread_ds_despreader_0 = Spread.ds_despreader(
            samp_chip, 1024, 2045, (generator), (init))
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.Spread_framer_0, 'out'),
                         (self.Spread_sync_0, 'in'))
        self.msg_connect((self.Spread_msg_source_0, 'out'),
                         (self.Spread_framer_0, 'in'))
        self.msg_connect((self.Spread_rx_sync_0, 'out'),
                         (self.Spread_deframer_0, 'in'))
        self.connect((self.Spread_ds_despreader_0, 0),
                     (self.digital_dxpsk_demod_0, 0))
        self.connect((self.Spread_ds_despreader_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.Spread_ds_spreader_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.Spread_preamble_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.Spread_sync_0, 0), (self.Spread_preamble_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.Spread_rx_sync_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.Spread_ds_spreader_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.Spread_ds_despreader_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.digital_dxpsk_demod_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0),
                     (self.channels_channel_model_0, 0))
예제 #2
0
파일: fhss_packets.py 프로젝트: CIG-SDR/CIG
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FHSS Packets")

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.samp_rate = samp_rate = 800000
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(1389 * samp_sym)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Received Spread Spectrum Signal",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Despread Signal",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 11000, 1000, firdes.WIN_HAMMING, 6.76))
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=samp_sym,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=samp_sym,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.01,
        	frequency_offset=1 / samp_rate,
        	epsilon=1 + 0.000001,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init))
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(code_rate, 
                                      samp_sym, 
                                      samp_rate, 
                                      11000, 
                                      10000, 
                                      0.01, 
                                      (generator), 
                                      (init))
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_msg_source_0 = Spread.msg_source(500, 100)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_synthesizer_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.Spread_rx_synthesizer_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.Spread_rx_sync_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.Spread_synthesizer_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.Spread_sync_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.Spread_rx_synthesizer_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_gmsk_demod_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.Spread_framer_0, "out", self.Spread_sync_0, "in")
        self.msg_connect(self.Spread_msg_source_0, "out", self.Spread_framer_0, "in")
        self.msg_connect(self.Spread_rx_sync_0, "out", self.Spread_deframer_0, "in")
예제 #3
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="Direct-sequence spread spectrum")

        ##################################################
        # Variables
        ##################################################

        self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist(
            ([-1, 1]), ([0, 1]), 2, 1).base()

        self.samp_sym = samp_sym = 32
        self.samp_rate = samp_rate = 500e3
        self.samp_chip = samp_chip = 2
        self.init = init = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
        self.generator = generator = 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Received binary',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_2.win)
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     mod_code="gray",
                                                     verbose=False,
                                                     log=False)

        self.digital_dxpsk_demod_0 = digital.dbpsk_demod(samples_per_symbol=2,
                                                         excess_bw=0.35,
                                                         freq_bw=6.28 / 100.0,
                                                         phase_bw=6.28 / 100.0,
                                                         timing_bw=6.28 /
                                                         100.0,
                                                         mod_code="gray",
                                                         verbose=False,
                                                         log=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.3,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0 + 1.0j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_b(
            (0, 1, 0, 1, 0, 1), True, 1, [])
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, samp_sym)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_char * 1, 32)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1000)
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_ds_spreader_0 = Spread.ds_spreader(samp_chip, (generator),
                                                       (init))
        self.Spread_ds_despreader_0 = Spread.ds_despreader(
            samp_chip, 1024, 2045, (generator), (init))
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.Spread_rx_sync_0, 'out'),
                         (self.Spread_deframer_0, 'in'))
        self.connect((self.Spread_ds_despreader_0, 0),
                     (self.digital_dxpsk_demod_0, 0))
        self.connect((self.Spread_ds_spreader_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.wxgui_scopesink2_2, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.Spread_rx_sync_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.blocks_repeat_0, 0), (self.Spread_ds_spreader_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.Spread_ds_despreader_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.digital_dxpsk_demod_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0),
                     (self.channels_channel_model_0, 0))
예제 #4
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Frame / sync / deframer chain")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 500e3

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            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,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=32,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=32,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.01,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.001,
            frequency_offset=0.0,
            epsilon=1.000001,
            taps=(1.0 + 1.0j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((20, ))
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_msg_source_0 = Spread.msg_source(500, 255)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_sync_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.Spread_rx_sync_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.digital_gmsk_demod_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.Spread_framer_0, "out", self.Spread_sync_0, "in")
        self.msg_connect(self.Spread_msg_source_0, "out", self.Spread_framer_0,
                         "in")
        self.msg_connect(self.Spread_rx_sync_0, "out", self.Spread_deframer_0,
                         "in")
예제 #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FHSS Packets")

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.samp_rate = samp_rate = 800000
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(1389 * samp_sym)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Received Spread Spectrum Signal",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Despread Signal",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 11000, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=samp_sym,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=samp_sym,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.01,
            frequency_offset=1 / samp_rate,
            epsilon=1 + 0.000001,
            taps=(1.0 + 1.0j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate,
                                                       (generator), (init))
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(
            code_rate, samp_sym, samp_rate, 11000, 10000, 0.01, (generator),
            (init))
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_msg_source_0 = Spread.msg_source(500, 100)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_synthesizer_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.Spread_rx_synthesizer_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.Spread_rx_sync_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.Spread_synthesizer_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.Spread_sync_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.Spread_rx_synthesizer_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_gmsk_demod_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.Spread_framer_0, "out", self.Spread_sync_0, "in")
        self.msg_connect(self.Spread_msg_source_0, "out", self.Spread_framer_0,
                         "in")
        self.msg_connect(self.Spread_rx_sync_0, "out", self.Spread_deframer_0,
                         "in")
예제 #6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Frame / sync / deframer chain")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 500e3

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	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,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=32,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=32,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.01,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.001,
        	frequency_offset=0.0,
        	epsilon=1.000001,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((20, ))
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_msg_source_0 = Spread.msg_source(500, 255)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_sync_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.Spread_rx_sync_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.digital_gmsk_demod_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.Spread_framer_0, "out", self.Spread_sync_0, "in")
        self.msg_connect(self.Spread_msg_source_0, "out", self.Spread_framer_0, "in")
        self.msg_connect(self.Spread_rx_sync_0, "out", self.Spread_deframer_0, "in")
예제 #7
0
파일: dsss_sync.py 프로젝트: CIG-SDR/CIG
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Direct-sequence spread spectrum")

        ##################################################
        # Variables
        ##################################################
        self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist(([-1, 1]), ([0, 1]), 2, 1).base()
        self.samp_sym = samp_sym = 32
        self.samp_rate = samp_rate = 500e3
        self.samp_chip = samp_chip = 2
        self.init = init = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
        self.generator = generator = 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Despread Signal ",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0_0.win, 2, 3, 1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Received DS Signal",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 1, 1, 2)
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
        	samples_per_symbol=2,
        	excess_bw=0.35,
        	mod_code="gray",
        	verbose=False,
        	log=False)
        	
        self.digital_dxpsk_demod_0 = digital.dbpsk_demod(
        	samples_per_symbol=2,
        	excess_bw=0.35,
        	freq_bw=6.28/100.0,
        	phase_bw=6.28/100.0,
        	timing_bw=6.28/100.0,
        	mod_code="gray",
        	verbose=False,
        	log=False
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.3,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, samp_sym)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_char*1, 32)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1000)
        self.Spread_sync_0 = Spread.sync()
        self.Spread_rx_sync_0 = Spread.rx_sync(12)
        self.Spread_preamble_0 = Spread.preamble_bb(1389, (64*(1, 1)))
        self.Spread_msg_source_0 = Spread.msg_source(100, 100)
        self.Spread_framer_0 = Spread.framer(0)
        self.Spread_ds_spreader_0 = Spread.ds_spreader(samp_chip, (generator), (init))
        self.Spread_ds_despreader_0 = Spread.ds_despreader(samp_chip, 
                                     1024, 
                                     2045, 
                                     (generator), 
                                     (init))
        self.Spread_deframer_0 = Spread.deframer(0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0), (self.Spread_ds_despreader_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.Spread_ds_spreader_0, 0))
        self.connect((self.Spread_ds_despreader_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.Spread_sync_0, 0), (self.Spread_preamble_0, 0))
        self.connect((self.Spread_preamble_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.Spread_ds_despreader_0, 0), (self.digital_dxpsk_demod_0, 0))
        self.connect((self.digital_dxpsk_demod_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.Spread_rx_sync_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_dxpsk_mod_0, 0))
        self.connect((self.Spread_ds_spreader_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.Spread_framer_0, "out", self.Spread_sync_0, "in")
        self.msg_connect(self.Spread_msg_source_0, "out", self.Spread_framer_0, "in")
        self.msg_connect(self.Spread_rx_sync_0, "out", self.Spread_deframer_0, "in")