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")
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")
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Fhss Sync") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_sym = samp_sym = 32 self.tone_freq = tone_freq = 2000 self.samp_rate = samp_rate = 800e3 self.init = init = 1, 1, 1, 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1, 0, 1, 1 self.code_rate = code_rate = int(samp_sym * 10000) ################################################## # Blocks ################################################## _tone_freq_sizer = wx.BoxSizer(wx.VERTICAL) self._tone_freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_tone_freq_sizer, value=self.tone_freq, callback=self.set_tone_freq, label='Tone Frequency', converter=forms.float_converter(), proportion=0, ) self._tone_freq_slider = forms.slider( parent=self.GetWin(), sizer=_tone_freq_sizer, value=self.tone_freq, callback=self.set_tone_freq, minimum=-1 * samp_rate / 2, maximum=samp_rate / 2, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_tone_freq_sizer) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title='Received Spread Spectrum ', ) self.Add(self.wxgui_waterfallsink2_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.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.1, frequency_offset=1 / samp_rate, epsilon=1 + 0.0000, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, tone_freq, 2, 0) self.analog_random_source_x_0 = blocks.vector_source_b( map(int, numpy.random.randint(0, 2, 1000)), True) self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init)) self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer( code_rate, samp_sym, samp_rate, 12000, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym) self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.Spread_cpfsk_demod_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.Spread_cpfsk_mod_0, 0), (self.Spread_synthesizer_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.Spread_cpfsk_demod_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.Spread_synthesizer_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_random_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_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.channels_channel_model_0, 0), (self.wxgui_waterfallsink2_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="fhss_test") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_sym = samp_sym = 64 self.samp_rate = samp_rate = 400e3 self.init = init = 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1 self.code_rate = code_rate = int(samp_sym * 500) ################################################## # Blocks ################################################## self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Received Spread Spectrum ", ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_numbersink2_0_0_0_0_0 = numbersink2.number_sink_f( self.GetWin(), unit="Units", minval=-100e5, maxval=100e5, factor=1.0, decimal_places=10, ref_level=0, sample_rate=samp_rate, number_rate=60, average=False, avg_alpha=None, label="Error", peak_hold=False, show_gauge=False, ) self.Add(self.wxgui_numbersink2_0_0_0_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.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "serial=F54381")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source("internal", 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(500e6, 0) self.uhd_usrp_source_0.set_gain(47, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "serial=F54358")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_clock_source("internal", 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(500e6, 0) self.uhd_usrp_sink_0.set_gain(50, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.blocks_vector_source_x_0 = blocks.vector_source_b((1, 1, 1, 1), True, 1, []) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((.9, )) self.blks2_error_rate_0 = grc_blks2.error_rate( type='BER', win_size=1000, bits_per_symbol=1, ) self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init)) self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer( code_rate, samp_sym, samp_rate, 12000, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym) self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0_0_0_0_0, 0)) self.connect((self.Spread_cpfsk_demod_0, 0), (self.blks2_error_rate_0, 1)) self.connect((self.blocks_vector_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_error_rate_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.Spread_rx_synthesizer_0, 0)) self.connect((self.Spread_synthesizer_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.Spread_cpfsk_demod_0, 0)) self.connect((self.Spread_cpfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.Spread_synthesizer_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "Fhss Rx") ################################################## # Variables ################################################## self.samp_sym = samp_sym = 12000 * 3 self.transistion = transistion = 50 self.tone_freq = tone_freq = 0 self.sideband_rx = sideband_rx = 6000 self.sideband = sideband = 6000 self.samp_rate = samp_rate = 12000 self.interpolation = interpolation = 4 self.init = init = 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1 self.code_rate = code_rate = int(samp_sym * 1) self.carrier = carrier = 10000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=1, decimation=interpolation, taps=None, fractional_bw=None, ) self.freq_xlating_fir_filter_xxx_0_0_0 = filter.freq_xlating_fir_filter_ccc( 1, (filter.firdes.low_pass(1, samp_rate * 4, carrier + sideband_rx, 1000)), carrier, samp_rate * 4) script, inputwav, outputBinary = argv self.blocks_wavfile_source_0_1 = blocks.wavfile_source(inputwav, False) self.blocks_throttle_1_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char * 1, outputBinary, False) self.blocks_file_sink_0_0.set_unbuffered(False) self.Spread_rx_synthesizer_0_0 = Spread.rx_synthesizer( code_rate, samp_sym, samp_rate, 12000 / 2, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_demod_0_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.Spread_cpfsk_demod_0_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.Spread_rx_synthesizer_0_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.blocks_float_to_complex_0_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.Spread_cpfsk_demod_0_0, 0)) self.connect((self.blocks_throttle_1_0, 0), (self.Spread_rx_synthesizer_0_0, 0)) self.connect((self.blocks_wavfile_source_0_1, 0), (self.blocks_float_to_complex_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.blocks_throttle_1_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="fhss_test") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_sym = samp_sym = 64 self.samp_rate = samp_rate = 400e3 self.init = init = 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1 self.code_rate = code_rate = int(samp_sym * 500) ################################################## # Blocks ################################################## self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Received Spread Spectrum ", ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_numbersink2_0_0_0_0_0 = numbersink2.number_sink_f( self.GetWin(), unit="Units", minval=-100e5, maxval=100e5, factor=1.0, decimal_places=10, ref_level=0, sample_rate=samp_rate, number_rate=60, average=False, avg_alpha=None, label="Error", peak_hold=False, show_gauge=False, ) self.Add(self.wxgui_numbersink2_0_0_0_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.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "serial=F54381")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source("internal", 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(500e6, 0) self.uhd_usrp_source_0.set_gain(47, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "serial=F54358")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_clock_source("internal", 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(500e6, 0) self.uhd_usrp_sink_0.set_gain(50, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.blocks_vector_source_x_0 = blocks.vector_source_b((1,1,1,1), True, 1, []) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((.9, )) self.blks2_error_rate_0 = grc_blks2.error_rate( type='BER', win_size=1000, bits_per_symbol=1, ) self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init)) self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(code_rate, samp_sym, samp_rate, 12000, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym) self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0_0_0_0_0, 0)) self.connect((self.Spread_cpfsk_demod_0, 0), (self.blks2_error_rate_0, 1)) self.connect((self.blocks_vector_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_error_rate_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.Spread_rx_synthesizer_0, 0)) self.connect((self.Spread_synthesizer_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.Spread_cpfsk_demod_0, 0)) self.connect((self.Spread_cpfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.Spread_synthesizer_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Fhss Sync") ################################################## # Variables ################################################## self.samp_sym = samp_sym = 64 self.tone_freq = tone_freq = 2000 self.samp_rate = samp_rate = 800e3 self.init = init = 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1 self.code_rate = code_rate = int(samp_sym * 10000) ################################################## # Blocks ################################################## _tone_freq_sizer = wx.BoxSizer(wx.VERTICAL) self._tone_freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_tone_freq_sizer, value=self.tone_freq, callback=self.set_tone_freq, label="Tone Frequency", converter=forms.float_converter(), proportion=0, ) self._tone_freq_slider = forms.slider( parent=self.GetWin(), sizer=_tone_freq_sizer, value=self.tone_freq, callback=self.set_tone_freq, minimum=-1 * samp_rate / 2, maximum=samp_rate / 2, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_tone_freq_sizer) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Received Spread Spectrum ", ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="Units", minval=0, maxval=1, factor=1.0, decimal_places=10, ref_level=0, sample_rate=samp_rate, number_rate=15, average=False, avg_alpha=None, label="Error Rate", peak_hold=False, show_gauge=False, ) self.Add(self.wxgui_numbersink2_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.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.1, frequency_offset=1 / samp_rate, epsilon=1 + 0.0000, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False ) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blks2_error_rate_0 = grc_blks2.error_rate( type='BER', win_size=1000, bits_per_symbol=2, ) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tone_freq, 2, 0) self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True) self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init)) self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(code_rate, samp_sym, samp_rate, 12000, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym) self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.Spread_rx_synthesizer_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.Spread_cpfsk_demod_0, 0)) self.connect((self.Spread_cpfsk_mod_0, 0), (self.Spread_synthesizer_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.blks2_error_rate_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0)) self.connect((self.Spread_cpfsk_demod_0, 0), (self.blks2_error_rate_0, 1)) self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.Spread_synthesizer_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.wxgui_waterfallsink2_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.Spread_rx_synthesizer_0, 0))