From 5928825be7a4f887b27877418ad8c017863c21fc Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 16 Dec 2009 09:50:54 -0800 Subject: [PATCH] gr-noaa: work-in-progress for LRIT reception Reworked usrp_rx_lrit to get to constellation Added file_rx_lrit to read from capture file --- gr-noaa/apps/Makefile.am | 2 + gr-noaa/apps/file_rx_lrit.grc | 1372 +++++++++++++++++++++++++++++++ gr-noaa/apps/file_rx_lrit.py | 337 ++++++++ gr-noaa/apps/usrp_rx_lrit.grc | 1456 ++++++++++++++++++++------------- gr-noaa/apps/usrp_rx_lrit.py | 426 ++++++---- 5 files changed, 2888 insertions(+), 705 deletions(-) create mode 100644 gr-noaa/apps/file_rx_lrit.grc create mode 100755 gr-noaa/apps/file_rx_lrit.py diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index e246ba76..8fb6fbef 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -27,6 +27,7 @@ dist_bin_SCRIPTS = \ hrpt_decode.py \ hrpt_demod.py \ file_rx_hrpt.py \ + file_rx_lrit.py \ usrp_rx_hrpt.py \ usrp_rx_hrpt_nogui.py \ usrp_rx_lrit.py @@ -35,6 +36,7 @@ EXTRA_DIST = \ hrpt_decode.grc \ hrpt_demod.grc \ file_rx_hrpt.grc \ + file_rx_lrit.grc \ usrp_rx_hrpt.grc \ usrp_rx_hrpt_nogui.grc \ usrp_rx_lrit.grc diff --git a/gr-noaa/apps/file_rx_lrit.grc b/gr-noaa/apps/file_rx_lrit.grc new file mode 100644 index 00000000..ee6da2a3 --- /dev/null +++ b/gr-noaa/apps/file_rx_lrit.grc @@ -0,0 +1,1372 @@ + + + Wed Dec 16 09:14:28 2009 + + options + + id + file_rx_lrit + + + _enabled + True + + + title + LRIT Receiver (from capture file) + + + author + + + + description + + + + window_size + 4095, 4095 + + + generate_options + wx_gui + + + category + Custom + + + run_options + prompt + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + symbol_rate + + + _enabled + True + + + value + 293e3 + + + _coordinate + (347, 10) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/symbol_rate + + + _coordinate + (445, 10) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + os.environ['HOME']+'/.gnuradio/config.conf' + + + _coordinate + (11, 136) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import os + + + _coordinate + (10, 82) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (249, 10) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_spectrum + + + _enabled + True + + + type + complex + + + title + Baseband Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 0 + + + y_per_div + 5 + + + y_divs + 10 + + + ref_level + 50 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 15 + + + peak_hold + False + + + average + True + + + avg_alpha + 0 + + + win + None + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (267, 556) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + lrit.dat + + + type + complex + + + repeat + False + + + vlen + 1 + + + _coordinate + (79, 729) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle_0 + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (60, 824) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + rx_waveform + + + _enabled + True + + + type + complex + + + title + Baseband Waveform + + + samp_rate + sample_rate + + + v_scale + 0 + + + v_offset + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + win_size + + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (267, 915) + + + _rotation + 0 + + + + variable_slider + + id + gain_mu + + + _enabled + True + + + label + Gain Mu + + + value + saved_gain_mu + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (478, 91) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + costas_spectrum + + + _enabled + True + + + type + complex + + + title + PLL Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + -15 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0 + + + win + window.hanning + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (916, 535) + + + _rotation + 0 + + + + gr_clock_recovery_mm_xx + + id + gr_clock_recovery_mm_xx_0 + + + _enabled + True + + + type + complex + + + omega + sps + + + gain_omega + (gain_mu**2)/4.0 + + + mu + 0.5 + + + gain_mu + gain_mu + + + omega_relative_limit + 50e-6 + + + _coordinate + (915, 789) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + costas_spectrum_0 + + + _enabled + True + + + type + complex + + + title + Bit Sync Spectrum + + + samp_rate + symbol_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + -15 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0 + + + win + window.hanning + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 3 + + + _coordinate + (1160, 539) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['USRP RX', 'RRC Filter', 'PLL', 'MM'] + + + grid_pos + 1, 0, 1, 2 + + + notebook + + + + _coordinate + (15, 206) + + + _rotation + 0 + + + + variable_slider + + id + costas_alpha + + + _enabled + True + + + label + Costas Alpha + + + value + saved_costas_alpha + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (338, 90) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + costas_waveform + + + _enabled + True + + + type + complex + + + title + PLL Waveform + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + v_offset + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + win_size + + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (915, 928) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + mm_waveform + + + _enabled + True + + + type + complex + + + title + Constellation + + + samp_rate + symbol_rate + + + v_scale + 0.5 + + + v_offset + 0 + + + t_scale + 20.0/symbol_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + win_size + + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 3 + + + _coordinate + (1160, 922) + + + _rotation + 0 + + + + variable_config + + id + saved_costas_alpha + + + _enabled + True + + + value + 0.2 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'costas_alpha' + + + writeback + costas_alpha + + + _coordinate + (251, 244) + + + _rotation + 0 + + + + variable_config + + id + saved_gain_mu + + + _enabled + True + + + value + 0.2 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'gain_mu' + + + writeback + gain_mu + + + _coordinate + (411, 242) + + + _rotation + 0 + + + + parameter + + id + decim + + + _enabled + True + + + label + Decim + + + value + 160 + + + type + intx + + + short_id + d + + + _coordinate + (249, 90) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rrc_spectrum + + + _enabled + True + + + type + complex + + + title + RRC Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + -15 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0 + + + win + window.hanning + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (705, 534) + + + _rotation + 0 + + + + gr_agc_xx + + id + gr_agc_xx_0 + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0/32767.0 + + + max_gain + 1.0 + + + _coordinate + (273, 800) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + rx_waveform_0 + + + _enabled + True + + + type + complex + + + title + RRC Waveform + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + v_offset + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + win_size + + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (706, 927) + + + _rotation + 0 + + + + gr_costas_loop_cc + + id + costas + + + _enabled + True + + + alpha + costas_alpha + + + beta + (costas_alpha**2)/4.0 + + + max_freq + 50e-6*sps + + + min_freq + -50e-6*sps + + + order + 2 + + + _coordinate + (706, 792) + + + _rotation + 0 + + + + root_raised_cosine_filter + + id + rrc + + + _enabled + True + + + type + fir_filter_ccf + + + decim + 1 + + + interp + 1 + + + gain + 1 + + + samp_rate + sample_rate + + + sym_rate + symbol_rate + + + alpha + 0.25 + + + ntaps + int(11*sample_rate/symbol_rate) + + + _coordinate + (448, 784) + + + _rotation + 0 + + + + rrc + rx_waveform_0 + 0 + 0 + + + rrc + rrc_spectrum + 0 + 0 + + + gr_agc_xx_0 + rrc + 0 + 0 + + + gr_throttle_0 + rx_waveform + 0 + 0 + + + gr_throttle_0 + rx_spectrum + 0 + 0 + + + gr_throttle_0 + gr_agc_xx_0 + 0 + 0 + + + gr_file_source_0 + gr_throttle_0 + 0 + 0 + + + rrc + costas + 0 + 0 + + + costas + costas_spectrum + 0 + 0 + + + costas + costas_waveform + 0 + 0 + + + costas + gr_clock_recovery_mm_xx_0 + 0 + 0 + + + gr_clock_recovery_mm_xx_0 + costas_spectrum_0 + 0 + 0 + + + gr_clock_recovery_mm_xx_0 + mm_waveform + 0 + 0 + + diff --git a/gr-noaa/apps/file_rx_lrit.py b/gr-noaa/apps/file_rx_lrit.py new file mode 100755 index 00000000..9a50631f --- /dev/null +++ b/gr-noaa/apps/file_rx_lrit.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: LRIT Receiver (from capture file) +# Generated: Wed Dec 16 09:16:13 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import window +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import os +import wx + +class file_rx_lrit(grc_wxgui.top_block_gui): + + def __init__(self, decim=160): + grc_wxgui.top_block_gui.__init__(self, title="LRIT Receiver (from capture file)") + + ################################################## + # Parameters + ################################################## + self.decim = decim + + ################################################## + # Variables + ################################################## + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self.symbol_rate = symbol_rate = 293e3 + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(config_filename) + try: saved_gain_mu = self._saved_gain_mu_config.getfloat('usrp_rx_lrit', 'gain_mu') + except: saved_gain_mu = 0.2 + self.saved_gain_mu = saved_gain_mu + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(config_filename) + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat('usrp_rx_lrit', 'costas_alpha') + except: saved_costas_alpha = 0.2 + self.saved_costas_alpha = saved_costas_alpha + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/symbol_rate + self.gain_mu = gain_mu = saved_gain_mu + self.costas_alpha = costas_alpha = saved_costas_alpha + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RRC Filter") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "MM") + self.GridAdd(self.displays, 1, 0, 1, 2) + + ################################################## + # Controls + ################################################## + _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_mu_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + label="Gain Mu", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_mu_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_mu_sizer, 0, 1, 1, 1) + _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._costas_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + label="Costas Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._costas_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_costas_alpha_sizer, 0, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.costas = gr.costas_loop_cc(costas_alpha, (costas_alpha**2)/4.0, 50e-6*sps, -50e-6*sps, 2) + self.costas_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(2).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="PLL Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(2).GridAdd(self.costas_spectrum.win, 0, 0, 1, 1) + self.costas_spectrum_0 = fftsink2.fft_sink_c( + self.displays.GetPage(3).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=symbol_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="Bit Sync Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(3).GridAdd(self.costas_spectrum_0.win, 0, 0, 1, 1) + self.costas_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="PLL Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.costas_waveform.win, 1, 0, 1, 1) + self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_cc(sps, (gain_mu**2)/4.0, 0.5, gain_mu, 50e-6) + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) + self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) + self.mm_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(3).GetWin(), + title="Constellation", + sample_rate=symbol_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/symbol_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(3).GridAdd(self.mm_waveform.win, 1, 0, 1, 1) + self.rrc = gr.fir_filter_ccf(1, firdes.root_raised_cosine( + 1, sample_rate, symbol_rate, 0.25, int(11*sample_rate/symbol_rate))) + self.rrc_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(1).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="RRC Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(1).GridAdd(self.rrc_spectrum.win, 0, 0, 1, 1) + self.rx_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=0, + y_per_div=5, + y_divs=10, + ref_level=50, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, + average=True, + avg_alpha=None, + title="Baseband Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_spectrum.win, 0, 0, 1, 1) + self.rx_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="Baseband Waveform", + sample_rate=sample_rate, + v_scale=0, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.rx_waveform.win, 1, 0, 1, 1) + self.rx_waveform_0 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="RRC Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.rx_waveform_0.win, 1, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.rrc, 0), (self.rx_waveform_0, 0)) + self.connect((self.rrc, 0), (self.rrc_spectrum, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.rrc, 0)) + self.connect((self.gr_throttle_0, 0), (self.rx_waveform, 0)) + self.connect((self.gr_throttle_0, 0), (self.rx_spectrum, 0)) + self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.rrc, 0), (self.costas, 0)) + self.connect((self.costas, 0), (self.costas_spectrum, 0)) + self.connect((self.costas, 0), (self.costas_waveform, 0)) + self.connect((self.costas, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.costas_spectrum_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.mm_waveform, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_symbol_rate(self, symbol_rate): + self.symbol_rate = symbol_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.costas_spectrum_0.set_sample_rate(self.symbol_rate) + self.mm_waveform.set_sample_rate(self.symbol_rate) + self.rrc.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + + def set_saved_gain_mu(self, saved_gain_mu): + self.saved_gain_mu = saved_gain_mu + self.set_gain_mu(self.saved_gain_mu) + + def set_saved_costas_alpha(self, saved_costas_alpha): + self.saved_costas_alpha = saved_costas_alpha + self.set_costas_alpha(self.saved_costas_alpha) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.rx_spectrum.set_sample_rate(self.sample_rate) + self.rx_waveform.set_sample_rate(self.sample_rate) + self.costas_spectrum.set_sample_rate(self.sample_rate) + self.costas_waveform.set_sample_rate(self.sample_rate) + self.rrc_spectrum.set_sample_rate(self.sample_rate) + self.rx_waveform_0.set_sample_rate(self.sample_rate) + self.rrc.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + + def set_sps(self, sps): + self.sps = sps + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps) + + def set_gain_mu(self, gain_mu): + self.gain_mu = gain_mu + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) + self.gr_clock_recovery_mm_xx_0.set_gain_omega((self.gain_mu**2)/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.gain_mu) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_costas_alpha(self, costas_alpha): + self.costas_alpha = costas_alpha + self._costas_alpha_slider.set_value(self.costas_alpha) + self._costas_alpha_text_box.set_value(self.costas_alpha) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self.costas.set_alpha(self.costas_alpha) + self.costas.set_beta((self.costas_alpha**2)/4.0) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=160, + help="Set Decim [default=%default]") + (options, args) = parser.parse_args() + tb = file_rx_lrit(decim=options.decim) + tb.Run(True) + diff --git a/gr-noaa/apps/usrp_rx_lrit.grc b/gr-noaa/apps/usrp_rx_lrit.grc index 55fe3978..aca10039 100644 --- a/gr-noaa/apps/usrp_rx_lrit.grc +++ b/gr-noaa/apps/usrp_rx_lrit.grc @@ -1,6 +1,6 @@ - Sat Aug 29 11:26:03 2009 + Wed Dec 16 09:47:16 2009 options @@ -35,6 +35,10 @@ category Custom + + run_options + prompt + run True @@ -56,7 +60,7 @@ variable id - samp_rate + sample_rate _enabled @@ -68,7 +72,7 @@ _coordinate - (10, 81) + (245, 9) _rotation @@ -91,7 +95,7 @@ _coordinate - (11, 148) + (351, 9) _rotation @@ -110,11 +114,11 @@ value - samp_rate/symbol_rate + sample_rate/symbol_rate _coordinate - (12, 214) + (456, 9) _rotation @@ -122,42 +126,45 @@ - variable_text_box + import id - decim + import_0 _enabled True - label - Decim + import + import os - value - saved_decim + _coordinate + (9, 83) - converver - int_converter + _rotation + 0 + + + variable - formatter - None + id + config_filename - grid_pos - 0, 0, 1, 1 + _enabled + True - notebook - + value + os.environ['HOME']+'/.gnuradio/config.conf' _coordinate - (243, 13) + (10, 142) _rotation @@ -165,58 +172,42 @@ - wxgui_scopesink2 + variable_text_box id - wxgui_scopesink2_0 + freq _enabled True - type - complex - - - title - Waveform - - - samp_rate - samp_rate - - - v_scale - 0.5 - - - t_scale - 20.0/samp_rate + label + Frequency - ac_couple - False + value + saved_freq - xy_mode - True + converver + float_converter - num_inputs - 1 + formatter + None grid_pos - 1, 0, 1, 1 + 0, 0, 1, 1 notebook - displays, 0 + _coordinate - (434, 551) + (247, 149) _rotation @@ -224,38 +215,42 @@ - gr_agc_xx + variable_config id - gr_agc_xx_0 + saved_freq _enabled True + + value + 1691e6 + type - complex + real - rate - 1e-6 + config_file + config_filename - reference - 1.0 + section + 'usrp_rx_lrit' - gain - 1.0/32767.0 + option + 'freq' - max_gain - 1.0 + writeback + freq _coordinate - (261, 493) + (246, 299) _rotation @@ -263,50 +258,42 @@ - root_raised_cosine_filter + variable_config id - root_raised_cosine_filter_0 + saved_offset _enabled - False - - - type - fir_filter_ccf - - - decim - 1 + True - interp - 1 + value + 0 - gain - 1 + type + real - samp_rate - samp_rate + config_file + config_filename - sym_rate - symbol_rate + section + 'usrp_rx_lrit' - alpha - 0.5 + option + 'offset' - ntaps - 50 + writeback + offset _coordinate - (618, 373) + (406, 300) _rotation @@ -314,58 +301,54 @@ - usrp_simple_source_x + variable_slider id - usrp_simple_source_x_0 + offset _enabled - False - - - type - complex + True - format - + label + Offset - which - 0 + value + saved_offset - decimation - decim + min + -50e3 - frequency - freq + max + 50e3 - lo_offset - float('inf') + num_steps + 100 - gain - gain + style + wx.SL_HORIZONTAL - side - B + converver + float_converter - rx_ant - RXA + grid_pos + 0, 1, 1, 1 - hb_filters + notebook _coordinate - (11, 477) + (390, 149) _rotation @@ -373,105 +356,109 @@ - wxgui_fftsink2 + variable_slider id - wxgui_fftsink2_0 + costas_alpha _enabled True - type - complex + label + Costas Alpha - title - Spectrum + value + saved_costas_alpha - samp_rate - samp_rate + min + 0 - baseband_freq - freq + max + 0.5 - y_per_div - 10 + num_steps + 100 - y_divs - 10 + style + wx.SL_HORIZONTAL - ref_level - 50 + converver + float_converter - fft_size - 1024 + grid_pos + 1, 1, 1, 1 - fft_rate - 30 + notebook + - peak_hold - False + _coordinate + (813, 152) - average - False + _rotation + 0 + + + variable_slider - avg_alpha - 0 + id + gain_mu - grid_pos - 0, 0, 1, 1 + _enabled + True - notebook - displays, 0 + label + Gain Mu - _coordinate - (434, 337) + value + saved_gain_mu - _rotation + min 0 - - - gr_throttle - id - gr_throttle_0 + max + 0.5 - _enabled - True + num_steps + 100 - type - complex + style + wx.SL_HORIZONTAL - samples_per_second - samp_rate + converver + float_converter - vlen - 1 + grid_pos + 1, 2, 1, 1 + + + notebook + _coordinate - (181, 663) + (957, 151) _rotation @@ -479,34 +466,335 @@ - wxgui_scopesink2 + variable_config id - wxgui_scopesink2_1 + saved_gain _enabled True - type - complex + value + 33 - title - Scope Plot + type + real + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'gain' + + + writeback + gain + + + _coordinate + (565, 300) + + + _rotation + 0 + + + + variable_config + + id + saved_decim + + + _enabled + True + + + value + 160 + + + type + int + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'decim' + + + writeback + decim + + + _coordinate + (725, 300) + + + _rotation + 0 + + + + variable_text_box + + id + decim + + + _enabled + True + + + label + Decim + + + value + saved_decim + + + converver + int_converter + + + formatter + None + + + grid_pos + 0, 2, 1, 1 + + + notebook + + + + _coordinate + (672, 151) + + + _rotation + 0 + + + + variable_config + + id + saved_costas_alpha + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'costas_alpha' + + + writeback + costas_alpha + + + _coordinate + (885, 298) + + + _rotation + 0 + + + + variable_config + + id + saved_gain_mu + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'gain_mu' + + + writeback + gain_mu + + + _coordinate + (1046, 298) + + + _rotation + 0 + + + + variable_config + + id + side + + + _enabled + True + + + value + 'A' + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_lrit' + + + option + 'side' + + + writeback + side + + + _coordinate + (1102, 152) + + + _rotation + 0 + + + + gr_agc_xx + + id + gr_agc_xx_0 + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0/32767.0 + + + max_gain + 1.0 + + + _coordinate + (286, 729) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + rx_waveform + + + _enabled + True + + + type + complex + + + title + RX Waveform samp_rate - samp_rate + sample_rate v_scale - 0.4 + 0 + + + v_offset + 0 t_scale - 20.0/samp_rate + 20.0/sample_rate ac_couple @@ -514,54 +802,165 @@ xy_mode - True + False num_inputs 1 + + win_size + + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (281, 862) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_spectrum + + + _enabled + True + + + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + freq + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 50 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + win + None + + + win_size + + grid_pos 0, 0, 1, 1 notebook - displays, 1 + displays, 0 _coordinate - (1126, 251) + (280, 468) + + + _rotation + 0 + + + + root_raised_cosine_filter + + id + root_raised_cosine_filter_0 + + + _enabled + True + + + type + fir_filter_ccf + + + decim + 1 - _rotation - 0 + interp + 1 - - - gr_probe_mpsk_snr_c - id - gr_probe_mpsk_snr_c_0 + gain + 1 - _enabled - True + samp_rate + sample_rate - type - snr + sym_rate + symbol_rate alpha - 0.0001 + 0.25 - probe_rate - 10 + ntaps + int(11*sample_rate/symbol_rate) _coordinate - (1126, 723) + (472, 713) _rotation @@ -569,10 +968,10 @@ - wxgui_numbersink2 + wxgui_scopesink2 id - wxgui_numbersink2_0 + rrc_waveform _enabled @@ -580,63 +979,47 @@ type - float + complex title - SNR - - - units - dB + RRC Waveform samp_rate - 10 - - - min_value - 0 - - - max_value - 30 + sample_rate - factor - 1.0 - - - decimal_places - 1 + v_scale + 0.5 - ref_level + v_offset 0 - number_rate - 10 + t_scale + 20.0/sample_rate - peak_hold + ac_couple False - average + xy_mode False - avg_alpha - 0 + num_inputs + 1 - show_gauge - True + win_size + grid_pos - 2, 0, 1, 1 + 1, 0, 1, 1 notebook @@ -644,7 +1027,7 @@ _coordinate - (1335, 651) + (768, 866) _rotation @@ -652,85 +1035,86 @@ - gr_mpsk_receiver_cc + wxgui_fftsink2 id - gr_mpsk_receiver_cc_0 + rrc_spectrum _enabled True - M - 2 + type + complex - theta - 0 + title + RRC Spectrum - alpha - costas_alpha + samp_rate + sample_rate - beta - costas_alpha*costas_alpha/4.0 + baseband_freq + freq+offset - fmin - -0.05 + y_per_div + 10 - fmax - 0.05 + y_divs + 10 - mu - 0.5 + ref_level + -15 - gain_mu - gain_mu + ref_scale + 2.0 - omega - sps + fft_size + 1024 - gain_omega - gain_mu*gain_mu/4.0 + fft_rate + 15 - omega_relative_limit - 0.05 + peak_hold + False - _coordinate - (881, 437) + average + False - _rotation + avg_alpha 0 - - - gr_complex_to_real - id - gr_complex_to_real_0 + win + None - _enabled - True + win_size + - vlen - 1 + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 _coordinate - (1133, 521) + (767, 499) _rotation @@ -738,37 +1122,38 @@ - gr_char_to_float + gr_costas_loop_cc id - gr_char_to_float_0 + costas _enabled True - _coordinate - (1523, 521) + alpha + costas_alpha - _rotation - 0 + beta + (costas_alpha**2.0)/4.0 - - - gr_binary_slicer_fb - id - gr_binary_slicer_fb_0 + max_freq + 50e-6*sps - _enabled - True + min_freq + -50e-6*sps + + + order + 2 _coordinate - (1343, 521) + (767, 721) _rotation @@ -776,10 +1161,10 @@ - gr_add_const_vxx + wxgui_fftsink2 id - gr_add_const_vxx_0 + costas_spectrum _enabled @@ -787,69 +1172,75 @@ type - float + complex - const - 48.0 + title + PLL Spectrum - vlen - 1 + samp_rate + sample_rate - _coordinate - (1707, 517) + baseband_freq + freq+offset - _rotation - 0 + y_per_div + 10 - - - gr_float_to_char - id - gr_float_to_char_0 + y_divs + 10 - _enabled - True + ref_level + -15 - _coordinate - (1878, 521) + ref_scale + 2.0 - _rotation - 0 + fft_size + 1024 - - - gr_file_sink - id - gr_file_sink_0 + fft_rate + 15 - _enabled - True + peak_hold + False - file - bits.dat + average + False - type - byte + avg_alpha + 0 - vlen - 1 + win + None + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 2 _coordinate - (2059, 517) + (969, 502) _rotation @@ -857,112 +1248,86 @@ - gr_file_source + wxgui_fftsink2 id - gr_file_source_0 + mm_spectrum _enabled True - - file - lrit.dat - type complex - repeat - False - - - vlen - 1 + title + Bit Sync Spectrum - _coordinate - (11, 655) + samp_rate + symbol_rate - _rotation + baseband_freq 0 - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - labels - ['USRP RX', 'Costas Output'] + y_per_div + 10 - grid_pos - 2, 0, 1, 3 + y_divs + 10 - notebook - + ref_level + -15 - _coordinate - (14, 351) + ref_scale + 2.0 - _rotation - 0 + fft_size + 1024 - - - variable_config - id - saved_decim + fft_rate + 15 - _enabled - True + peak_hold + False - value - 160 + average + False - type - int + avg_alpha + 0 - config_file - config_filename + win + None - section - main + win_size + - option - decim + grid_pos + 0, 0, 1, 1 - writeback - decim + notebook + displays, 3 _coordinate - (246, 172) + (1225, 503) _rotation @@ -970,54 +1335,66 @@ - variable_slider + wxgui_scopesink2 id - gain + costas_waveform + + + _enabled + True + + + type + complex + + + title + PLL Waveform - _enabled - True + samp_rate + sample_rate - label - Gain + v_scale + 0.5 - value - saved_gain + v_offset + 0 - min - 0 + t_scale + 20.0/sample_rate - max - 115 + ac_couple + False - num_steps - 115 + xy_mode + False - style - wx.SL_HORIZONTAL + num_inputs + 1 - converver - float_converter + win_size + grid_pos - 0, 1, 1, 1 + 1, 0, 1, 1 notebook - + displays, 2 _coordinate - (411, 11) + (968, 852) _rotation @@ -1025,42 +1402,42 @@ - variable_config + gr_clock_recovery_mm_xx id - saved_gain + mm_sync _enabled True - value - 33 + type + complex - type - real + omega + sps - config_file - config_filename + gain_omega + (gain_mu**2)/4.0 - section - main + mu + 0.5 - option - gain + gain_mu + gain_mu - writeback - gain + omega_relative_limit + 50e-6*sps _coordinate - (412, 172) + (969, 722) _rotation @@ -1068,54 +1445,66 @@ - variable_slider + wxgui_scopesink2 id - freq + mm_const _enabled True - label - Frequency + type + complex - value - saved_freq + title + Constellation - min - 135e6 + samp_rate + symbol_rate - max - 139e6 + v_scale + 0.5 - num_steps - 400 + v_offset + 0 - style - wx.SL_HORIZONTAL + t_scale + 20.0/symbol_rate - converver - float_converter + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + win_size + grid_pos - 0, 2, 1, 1 + 1, 0, 1, 1 notebook - + displays, 3 _coordinate - (574, 12) + (1225, 859) _rotation @@ -1123,42 +1512,34 @@ - variable_config + notebook id - saved_freq + displays _enabled True - value - 137e6 - - - type - real - - - config_file - config_filename + style + wx.NB_TOP - section - main + labels + ['USRP RX','RRC','PLL','Const'] - option - freq + grid_pos + 2, 0, 1, 3 - writeback - freq + notebook + _coordinate - (576, 170) + (10, 228) _rotation @@ -1169,7 +1550,7 @@ variable_slider id - costas_alpha + gain _enabled @@ -1177,11 +1558,11 @@ label - Costas Alpha + Gain value - saved_costas_alpha + saved_gain min @@ -1189,11 +1570,11 @@ max - 0.5 + 115 num_steps - 100 + 115 style @@ -1213,7 +1594,7 @@ _coordinate - (738, 13) + (532, 150) _rotation @@ -1221,42 +1602,30 @@ - variable_config + gr_throttle id - saved_costas_alpha + gr_throttle_0 _enabled - True - - - value - 0.005 + False type - real - - - config_file - config_filename - - - section - main + complex - option - costas_alpha + samples_per_second + sample_rate - writeback - costas_alpha + vlen + 1 _coordinate - (739, 170) + (63, 859) _rotation @@ -1264,42 +1633,34 @@ - variable_config + gr_file_source id - saved_gain_mu + gr_file_source_0 _enabled - True + False - value - 0.005 + file + lrit.dat type - real - - - config_file - config_filename - - - section - main + complex - option - gain_mu + repeat + False - writeback - gain_mu + vlen + 1 _coordinate - (900, 170) + (36, 943) _rotation @@ -1307,77 +1668,58 @@ - variable_slider + usrp_simple_source_x id - gain_mu + usrp_simple_source_x_0 _enabled True - label - Gain Mu + type + complex - value - saved_gain_mu + format + - min + which 0 - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 1, 1, 1, 1 + decimation + decim - notebook - + frequency + freq+offset - _coordinate - (902, 13) + lo_offset + float('inf') - _rotation - 0 + gain + gain - - - variable - id - config_filename + side + side - _enabled - True + rx_ant + RXA - value - "usrp_rx_lrit.cfg" + hb_filters + _coordinate - (13, 283) + (19, 713) _rotation @@ -1385,14 +1727,14 @@ - usrp_simple_source_x_0 - gr_agc_xx_0 + gr_agc_xx_0 + root_raised_cosine_filter_0 0 0 - gr_agc_xx_0 - wxgui_scopesink2_0 + gr_throttle_0 + gr_agc_xx_0 0 0 @@ -1403,74 +1745,80 @@ 0 - gr_throttle_0 + usrp_simple_source_x_0 gr_agc_xx_0 0 0 - gr_probe_mpsk_snr_c_0 - wxgui_numbersink2_0 + usrp_simple_source_x_0 + rx_spectrum + 0 + 0 + + + gr_throttle_0 + rx_spectrum 0 0 - gr_mpsk_receiver_cc_0 - gr_probe_mpsk_snr_c_0 + usrp_simple_source_x_0 + rx_waveform 0 0 - gr_agc_xx_0 - gr_mpsk_receiver_cc_0 + gr_throttle_0 + rx_waveform 0 0 - gr_mpsk_receiver_cc_0 - wxgui_scopesink2_1 + root_raised_cosine_filter_0 + rrc_waveform 0 0 - gr_agc_xx_0 - wxgui_fftsink2_0 + root_raised_cosine_filter_0 + rrc_spectrum 0 0 - gr_mpsk_receiver_cc_0 - gr_complex_to_real_0 + root_raised_cosine_filter_0 + costas 0 0 - gr_complex_to_real_0 - gr_binary_slicer_fb_0 + costas + costas_spectrum 0 0 - gr_binary_slicer_fb_0 - gr_char_to_float_0 + costas + costas_waveform 0 0 - gr_char_to_float_0 - gr_add_const_vxx_0 + costas + mm_sync 0 0 - gr_add_const_vxx_0 - gr_float_to_char_0 + mm_sync + mm_spectrum 0 0 - gr_float_to_char_0 - gr_file_sink_0 + mm_sync + mm_const 0 0 diff --git a/gr-noaa/apps/usrp_rx_lrit.py b/gr-noaa/apps/usrp_rx_lrit.py index bc313e3a..9a3d7020 100755 --- a/gr-noaa/apps/usrp_rx_lrit.py +++ b/gr-noaa/apps/usrp_rx_lrit.py @@ -2,19 +2,22 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP LRIT Receiver -# Generated: Sat Aug 29 11:26:03 2009 +# Generated: Wed Dec 16 09:49:15 2009 ################################################## +from gnuradio import eng_notation from gnuradio import gr +from gnuradio import window from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import forms -from gnuradio.wxgui import numbersink2 from gnuradio.wxgui import scopesink2 -from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import usrp as grc_usrp from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import ConfigParser +import os import wx class usrp_rx_lrit(grc_wxgui.top_block_gui): @@ -25,36 +28,47 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): ################################################## # Variables ################################################## - self.config_filename = config_filename = "usrp_rx_lrit.cfg" + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' self._saved_decim_config = ConfigParser.ConfigParser() self._saved_decim_config.read(config_filename) - try: saved_decim = self._saved_decim_config.getint("main", "decim") + try: saved_decim = self._saved_decim_config.getint('usrp_rx_lrit', 'decim') except: saved_decim = 160 self.saved_decim = saved_decim self.decim = decim = saved_decim self.symbol_rate = symbol_rate = 293e3 + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(config_filename) + try: saved_offset = self._saved_offset_config.getfloat('usrp_rx_lrit', 'offset') + except: saved_offset = 0 + self.saved_offset = saved_offset self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(config_filename) - try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu") + try: saved_gain_mu = self._saved_gain_mu_config.getfloat('usrp_rx_lrit', 'gain_mu') except: saved_gain_mu = 0.005 self.saved_gain_mu = saved_gain_mu self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat("main", "gain") + try: saved_gain = self._saved_gain_config.getfloat('usrp_rx_lrit', 'gain') except: saved_gain = 33 self.saved_gain = saved_gain self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(config_filename) - try: saved_freq = self._saved_freq_config.getfloat("main", "freq") - except: saved_freq = 137e6 + try: saved_freq = self._saved_freq_config.getfloat('usrp_rx_lrit', 'freq') + except: saved_freq = 1691e6 self.saved_freq = saved_freq self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(config_filename) - try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha") + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat('usrp_rx_lrit', 'costas_alpha') except: saved_costas_alpha = 0.005 self.saved_costas_alpha = saved_costas_alpha - self.samp_rate = samp_rate = 64e6/decim - self.sps = sps = samp_rate/symbol_rate + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/symbol_rate + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(config_filename) + try: side = self._side_config.get('usrp_rx_lrit', 'side') + except: side = 'A' + self.side = side + self.offset = offset = saved_offset self.gain_mu = gain_mu = saved_gain_mu self.gain = gain = saved_gain self.freq = freq = saved_freq @@ -65,7 +79,9 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RRC") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Const") self.GridAdd(self.displays, 2, 0, 1, 3) ################################################## @@ -78,7 +94,30 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): label="Decim", converter=forms.int_converter(), ) - self.GridAdd(self._decim_text_box, 0, 0, 1, 1) + self.GridAdd(self._decim_text_box, 0, 2, 1, 1) + _offset_sizer = wx.BoxSizer(wx.VERTICAL) + self._offset_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_offset_sizer, + value=self.offset, + callback=self.set_offset, + label="Offset", + converter=forms.float_converter(), + proportion=0, + ) + self._offset_slider = forms.slider( + parent=self.GetWin(), + sizer=_offset_sizer, + value=self.offset, + callback=self.set_offset, + minimum=-50e3, + maximum=50e3, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_offset_sizer, 0, 1, 1, 1) _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_mu_text_box = forms.text_box( parent=self.GetWin(), @@ -101,7 +140,7 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1) + self.GridAdd(_gain_mu_sizer, 1, 2, 1, 1) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), @@ -124,30 +163,15 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_gain_sizer, 0, 1, 1, 1) - _freq_sizer = wx.BoxSizer(wx.VERTICAL) + self.GridAdd(_gain_sizer, 1, 0, 1, 1) self._freq_text_box = forms.text_box( parent=self.GetWin(), - sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="Frequency", converter=forms.float_converter(), - proportion=0, ) - self._freq_slider = forms.slider( - parent=self.GetWin(), - sizer=_freq_sizer, - value=self.freq, - callback=self.set_freq, - minimum=135e6, - maximum=139e6, - num_steps=400, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_freq_sizer, 0, 2, 1, 1) + self.GridAdd(self._freq_text_box, 0, 0, 1, 1) _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) self._costas_alpha_text_box = forms.text_box( parent=self.GetWin(), @@ -170,131 +194,193 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1) + self.GridAdd(_costas_alpha_sizer, 1, 1, 1, 1) ################################################## # Blocks ################################################## - self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) + self.costas = gr.costas_loop_cc(costas_alpha, (costas_alpha**2.0)/4.0, 50e-6*sps, -50e-6*sps, 2) + self.costas_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(2).GetWin(), + baseband_freq=freq+offset, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, + average=False, + avg_alpha=None, + title="PLL Spectrum", + peak_hold=False, + ) + self.displays.GetPage(2).GridAdd(self.costas_spectrum.win, 0, 0, 1, 1) + self.costas_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="PLL Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.costas_waveform.win, 1, 0, 1, 1) self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) - self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() - self.gr_char_to_float_0 = gr.char_to_float() - self.gr_complex_to_real_0 = gr.complex_to_real(1) - self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) - self.gr_float_to_char_0 = gr.float_to_char() - self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05) - self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c( - type='snr', - alpha=0.0001, - probe_rate=10, + self.mm_const = scopesink2.scope_sink_c( + self.displays.GetPage(3).GetWin(), + title="Constellation", + sample_rate=symbol_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/symbol_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, ) - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) - self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=freq, + self.displays.GetPage(3).GridAdd(self.mm_const.win, 1, 0, 1, 1) + self.mm_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(3).GetWin(), + baseband_freq=0, y_per_div=10, y_divs=10, - ref_level=50, - sample_rate=samp_rate, + ref_level=-15, + ref_scale=2.0, + sample_rate=symbol_rate, fft_size=1024, - fft_rate=30, + fft_rate=15, average=False, avg_alpha=None, - title="Spectrum", + title="Bit Sync Spectrum", peak_hold=False, ) - self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) - self.wxgui_numbersink2_0 = numbersink2.number_sink_f( + self.displays.GetPage(3).GridAdd(self.mm_spectrum.win, 0, 0, 1, 1) + self.mm_sync = gr.clock_recovery_mm_cc(sps, (gain_mu**2)/4.0, 0.5, gain_mu, 50e-6*sps) + self.root_raised_cosine_filter_0 = gr.fir_filter_ccf(1, firdes.root_raised_cosine( + 1, sample_rate, symbol_rate, 0.25, int(11*sample_rate/symbol_rate))) + self.rrc_spectrum = fftsink2.fft_sink_c( self.displays.GetPage(1).GetWin(), - unit="dB", - minval=0, - maxval=30, - factor=1.0, - decimal_places=1, - ref_level=0, - sample_rate=10, - number_rate=10, + baseband_freq=freq+offset, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, average=False, avg_alpha=None, - label="SNR", + title="RRC Spectrum", peak_hold=False, - show_gauge=True, ) - self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( - self.displays.GetPage(0).GetWin(), - title="Waveform", - sample_rate=samp_rate, + self.displays.GetPage(1).GridAdd(self.rrc_spectrum.win, 0, 0, 1, 1) + self.rrc_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="RRC Waveform", + sample_rate=sample_rate, v_scale=0.5, - t_scale=20.0/samp_rate, + v_offset=0, + t_scale=20.0/sample_rate, ac_couple=False, - xy_mode=True, + xy_mode=False, num_inputs=1, ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_1 = scopesink2.scope_sink_c( - self.displays.GetPage(1).GetWin(), - title="Scope Plot", - sample_rate=samp_rate, - v_scale=0.4, - t_scale=20.0/samp_rate, + self.displays.GetPage(1).GridAdd(self.rrc_waveform.win, 1, 0, 1, 1) + self.rx_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=freq, + y_per_div=10, + y_divs=10, + ref_level=50, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=False, + avg_alpha=None, + title="RX Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_spectrum.win, 0, 0, 1, 1) + self.rx_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="RX Waveform", + sample_rate=sample_rate, + v_scale=0, + v_offset=0, + t_scale=20.0/sample_rate, ac_couple=False, - xy_mode=True, + xy_mode=False, num_inputs=1, ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1) + self.displays.GetPage(0).GridAdd(self.rx_waveform.win, 1, 0, 1, 1) + self.usrp_simple_source_x_0 = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") + self.usrp_simple_source_x_0.set_decim_rate(decim) + self.usrp_simple_source_x_0.set_frequency(freq+offset, verbose=True) + self.usrp_simple_source_x_0.set_gain(gain) ################################################## # Connections ################################################## - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) - self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0)) - self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0)) - self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) - self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) - self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.root_raised_cosine_filter_0, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.rx_spectrum, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.rx_waveform, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.rrc_waveform, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.rrc_spectrum, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.costas, 0)) + self.connect((self.costas, 0), (self.costas_spectrum, 0)) + self.connect((self.costas, 0), (self.costas_waveform, 0)) + self.connect((self.costas, 0), (self.mm_sync, 0)) + self.connect((self.mm_sync, 0), (self.mm_spectrum, 0)) + self.connect((self.mm_sync, 0), (self.mm_const, 0)) def set_config_filename(self, config_filename): self.config_filename = config_filename - self._saved_decim_config = ConfigParser.ConfigParser() - self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) - self._saved_decim_config.write(open(self.config_filename, 'w')) - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "gain", str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_lrit'): + self._saved_freq_config.add_section('usrp_rx_lrit') + self._saved_freq_config.set('usrp_rx_lrit', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(self.config_filename) + if not self._saved_offset_config.has_section('usrp_rx_lrit'): + self._saved_offset_config.add_section('usrp_rx_lrit') + self._saved_offset_config.set('usrp_rx_lrit', 'offset', str(self.offset)) + self._saved_offset_config.write(open(self.config_filename, 'w')) + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(self.config_filename) + if not self._saved_gain_config.has_section('usrp_rx_lrit'): + self._saved_gain_config.add_section('usrp_rx_lrit') + self._saved_gain_config.set('usrp_rx_lrit', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section('usrp_rx_lrit'): + self._saved_decim_config.add_section('usrp_rx_lrit') + self._saved_decim_config.set('usrp_rx_lrit', 'decim', str(self.decim)) + self._saved_decim_config.write(open(self.config_filename, 'w')) self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_lrit'): + self._side_config.add_section('usrp_rx_lrit') + self._side_config.set('usrp_rx_lrit', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) def set_saved_decim(self, saved_decim): self.saved_decim = saved_decim @@ -302,18 +388,26 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): def set_decim(self, decim): self.decim = decim - self.set_samp_rate(64e6/self.decim) - self._decim_text_box.set_value(self.decim) + self.set_sample_rate(64e6/self.decim) self._saved_decim_config = ConfigParser.ConfigParser() self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) + if not self._saved_decim_config.has_section('usrp_rx_lrit'): + self._saved_decim_config.add_section('usrp_rx_lrit') + self._saved_decim_config.set('usrp_rx_lrit', 'decim', str(self.decim)) self._saved_decim_config.write(open(self.config_filename, 'w')) + self._decim_text_box.set_value(self.decim) + self.usrp_simple_source_x_0.set_decim_rate(self.decim) def set_symbol_rate(self, symbol_rate): self.symbol_rate = symbol_rate - self.set_sps(self.samp_rate/self.symbol_rate) + self.set_sps(self.sample_rate/self.symbol_rate) + self.root_raised_cosine_filter_0.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + self.mm_spectrum.set_sample_rate(self.symbol_rate) + self.mm_const.set_sample_rate(self.symbol_rate) + + def set_saved_offset(self, saved_offset): + self.saved_offset = saved_offset + self.set_offset(self.saved_offset) def set_saved_gain_mu(self, saved_gain_mu): self.saved_gain_mu = saved_gain_mu @@ -331,65 +425,95 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): self.saved_costas_alpha = saved_costas_alpha self.set_costas_alpha(self.saved_costas_alpha) - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.set_sps(self.samp_rate/self.symbol_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) - self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) - self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate) + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.rx_waveform.set_sample_rate(self.sample_rate) + self.rx_spectrum.set_sample_rate(self.sample_rate) + self.root_raised_cosine_filter_0.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + self.rrc_waveform.set_sample_rate(self.sample_rate) + self.rrc_spectrum.set_sample_rate(self.sample_rate) + self.costas_spectrum.set_sample_rate(self.sample_rate) + self.costas_waveform.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps - self.gr_mpsk_receiver_cc_0.set_omega(self.sps) + self.mm_sync.set_omega(self.sps) + + def set_side(self, side): + self.side = side + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_lrit'): + self._side_config.add_section('usrp_rx_lrit') + self._side_config.set('usrp_rx_lrit', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + + def set_offset(self, offset): + self.offset = offset + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(self.config_filename) + if not self._saved_offset_config.has_section('usrp_rx_lrit'): + self._saved_offset_config.add_section('usrp_rx_lrit') + self._saved_offset_config.set('usrp_rx_lrit', 'offset', str(self.offset)) + self._saved_offset_config.write(open(self.config_filename, 'w')) + self._offset_slider.set_value(self.offset) + self._offset_text_box.set_value(self.offset) + self.rrc_spectrum.set_baseband_freq(self.freq+self.offset) + self.costas_spectrum.set_baseband_freq(self.freq+self.offset) + self.usrp_simple_source_x_0.set_frequency(self.freq+self.offset) def set_gain_mu(self, gain_mu): self.gain_mu = gain_mu - self.gr_mpsk_receiver_cc_0.set_gain_mu(self.gain_mu) - self.gr_mpsk_receiver_cc_0.set_gain_omega(self.gain_mu*self.gain_mu/4.0) + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) self._saved_gain_mu_config.write(open(self.config_filename, 'w')) - self._gain_mu_slider.set_value(self.gain_mu) - self._gain_mu_text_box.set_value(self.gain_mu) + self.mm_sync.set_gain_omega((self.gain_mu**2)/4.0) + self.mm_sync.set_gain_mu(self.gain_mu) def set_gain(self, gain): self.gain = gain - self._gain_slider.set_value(self.gain) - self._gain_text_box.set_value(self.gain) self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "gain", str(self.gain)) + if not self._saved_gain_config.has_section('usrp_rx_lrit'): + self._saved_gain_config.add_section('usrp_rx_lrit') + self._saved_gain_config.set('usrp_rx_lrit', 'gain', str(self.gain)) self._saved_gain_config.write(open(self.config_filename, 'w')) + self._gain_slider.set_value(self.gain) + self._gain_text_box.set_value(self.gain) + self.usrp_simple_source_x_0.set_gain(self.gain) def set_freq(self, freq): self.freq = freq - self.wxgui_fftsink2_0.set_baseband_freq(self.freq) - self._freq_slider.set_value(self.freq) self._freq_text_box.set_value(self.freq) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_lrit'): + self._saved_freq_config.add_section('usrp_rx_lrit') + self._saved_freq_config.set('usrp_rx_lrit', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) + self.rx_spectrum.set_baseband_freq(self.freq) + self.rrc_spectrum.set_baseband_freq(self.freq+self.offset) + self.costas_spectrum.set_baseband_freq(self.freq+self.offset) + self.usrp_simple_source_x_0.set_frequency(self.freq+self.offset) def set_costas_alpha(self, costas_alpha): self.costas_alpha = costas_alpha - self.gr_mpsk_receiver_cc_0.set_alpha(self.costas_alpha) - self.gr_mpsk_receiver_cc_0.set_beta(self.costas_alpha*self.costas_alpha/4.0) self._costas_alpha_slider.set_value(self.costas_alpha) self._costas_alpha_text_box.set_value(self.costas_alpha) self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self.costas.set_alpha(self.costas_alpha) + self.costas.set_beta((self.costas_alpha**2.0)/4.0) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") -- 2.30.2