From: Johnathan Corgan Date: Sun, 27 Sep 2009 20:34:20 +0000 (-0700) Subject: Renamed simplified HRPT script to allow restoring original X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=db2f60baf542ac35151eb7084e274701861bacc5;p=debian%2Fgnuradio Renamed simplified HRPT script to allow restoring original --- diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index 5cefe9d2..8cc7cdbe 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -25,13 +25,13 @@ if PYTHON dist_bin_SCRIPTS = \ demod_hrpt_file.py \ - usrp_rx_hrpt.py \ + usrp_rx_hrpt2.py \ usrp_rx_hrpt_nogui.py \ usrp_rx_lrit.py EXTRA_DIST = \ demod_hrpt_file.grc \ - usrp_rx_hrpt.grc \ + usrp_rx_hrpt2.grc \ usrp_rx_hrpt_nogui.grc \ usrp_rx_lrit.grc endif diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc deleted file mode 100644 index c999a6bf..00000000 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ /dev/null @@ -1,1418 +0,0 @@ - - - Sun Sep 27 10:06:41 2009 - - options - - id - usrp_rx_hrpt - - - _enabled - True - - - title - USRP HRPT Receiver - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - wx_gui - - - category - Custom - - - run - True - - - realtime_scheduling - 1 - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - variable - - id - max_carrier_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (575, 19) - - - _rotation - 0 - - - - variable - - id - sym_rate - - - _enabled - True - - - value - 600*1109 - - - _coordinate - (301, 19) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - sample_rate/sym_rate - - - _coordinate - (397, 19) - - - _rotation - 0 - - - - variable - - id - hs - - - _enabled - True - - - value - int(sps/2.0) - - - _coordinate - (499, 19) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 64e6/decim - - - _coordinate - (198, 17) - - - _rotation - 0 - - - - variable_slider - - id - gain - - - _enabled - True - - - label - RX Gain - - - value - saved_gain - - - min - 0 - - - max - 100 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 1, 1, 1 - - - notebook - - - - _coordinate - (340, 106) - - - _rotation - 0 - - - - variable_text_box - - id - freq - - - _enabled - True - - - label - Frequency - - - value - saved_freq - - - converver - float_converter - - - formatter - None - - - grid_pos - 0, 0, 1, 1 - - - notebook - - - - _coordinate - (199, 106) - - - _rotation - 0 - - - - variable_slider - - id - pll_alpha - - - _enabled - True - - - label - PLL Alpha - - - value - saved_pll_alpha - - - min - 0.0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 2, 1, 1 - - - notebook - - - - _coordinate - (479, 106) - - - _rotation - 0 - - - - variable_slider - - id - sync_alpha - - - _enabled - True - - - label - SYNC Alpha - - - value - saved_sync_alpha - - - min - 0.0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 3, 1, 1 - - - notebook - - - - _coordinate - (618, 106) - - - _rotation - 0 - - - - variable_static_text - - id - side_text - - - _enabled - True - - - label - USRP Side - - - value - side - - - converver - str_converter - - - formatter - None - - - grid_pos - 1, 0, 1, 1 - - - notebook - - - - _coordinate - (828, 20) - - - _rotation - 0 - - - - variable_config - - id - side - - - _enabled - True - - - value - 'A' - - - type - string - - - config_file - config_filename - - - section - 'usrp' - - - option - 'side' - - - writeback - side - - - _coordinate - (194, 253) - - - _rotation - 0 - - - - variable_config - - id - decim - - - _enabled - True - - - value - 16 - - - type - real - - - config_file - config_filename - - - section - 'usrp' - - - option - 'decim' - - - writeback - decim - - - _coordinate - (351, 255) - - - _rotation - 0 - - - - variable_config - - id - saved_freq - - - _enabled - True - - - value - 1698e6 - - - type - real - - - config_file - config_filename - - - section - 'usrp' - - - option - 'freq' - - - writeback - freq - - - _coordinate - (507, 258) - - - _rotation - 0 - - - - variable_config - - id - saved_gain - - - _enabled - True - - - value - 35 - - - type - real - - - config_file - config_filename - - - section - 'usrp' - - - option - 'gain' - - - writeback - gain - - - _coordinate - (664, 259) - - - _rotation - 0 - - - - variable_config - - id - saved_pll_alpha - - - _enabled - True - - - value - 0.05 - - - type - real - - - config_file - config_filename - - - section - 'demod' - - - option - 'pll_alpha' - - - writeback - pll_alpha - - - _coordinate - (823, 258) - - - _rotation - 0 - - - - variable_config - - id - saved_sync_alpha - - - _enabled - True - - - value - 0.05 - - - type - real - - - config_file - config_filename - - - section - 'demod' - - - option - 'sync_alpha' - - - writeback - sync_alpha - - - _coordinate - (981, 258) - - - _rotation - 0 - - - - variable_config - - id - output_filename - - - _enabled - True - - - value - 'frames.dat' - - - type - string - - - config_file - config_filename - - - section - 'output' - - - option - 'filename' - - - writeback - output_filename - - - _coordinate - (1139, 259) - - - _rotation - 0 - - - - variable_static_text - - id - decim_text - - - _enabled - True - - - label - Decimation - - - value - decim - - - converver - float_converter - - - formatter - None - - - grid_pos - 1, 1, 1, 1 - - - notebook - - - - _coordinate - (973, 20) - - - _rotation - 0 - - - - variable - - id - max_sync_offset - - - _enabled - True - - - value - 0.01 - - - _coordinate - (705, 19) - - - _rotation - 0 - - - - variable - - id - config_filename - - - _enabled - True - - - value - 'usrp_rx_hrpt.cfg' - - - _coordinate - (12, 160) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math - - - _coordinate - (11, 102) - - - _rotation - 0 - - - - noaa_hrpt_pll_cf - - id - pll - - - _enabled - True - - - alpha - pll_alpha - - - beta - pll_alpha**2/4.0 - - - max_offset - max_carrier_offset - - - _coordinate - (664, 809) - - - _rotation - 0 - - - - noaa_hrpt_sync_fb - - id - sync - - - _enabled - True - - - alpha - sync_alpha - - - beta - sync_alpha**2/4.0 - - - sps - sps - - - max_offset - max_sync_offset - - - _coordinate - (865, 801) - - - _rotation - 0 - - - - gr_file_sink - - id - frame_sink - - - _enabled - True - - - file - output_filename - - - type - short - - - vlen - 1 - - - _coordinate - (1283, 937) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - deframer - - - _enabled - True - - - _coordinate - (1091, 829) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - _coordinate - (1281, 829) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - pll_scope - - - _enabled - True - - - type - float - - - title - Demod Waveform - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 2,0,1,4 - - - notebook - - - - _coordinate - (631, 632) - - - _rotation - 180 - - - - gr_agc_xx - - id - agc - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (269, 801) - - - _rotation - 0 - - - - gr_fir_filter_xxx - - id - gr_fir_filter_xxx_0 - - - _enabled - True - - - type - ccc - - - decim - 1 - - - taps - mf_taps - - - _coordinate - (418, 817) - - - _rotation - 0 - - - - variable - - id - mf_taps - - - _enabled - True - - - value - [-0.5/hs,]*hs+[0.5/hs,]*hs - - - _coordinate - (830, 154) - - - _rotation - 0 - - - - gr_file_source - - id - file_source - - - _enabled - False - - - file - 'usrp.dat' - - - type - short - - - repeat - False - - - vlen - 1 - - - _coordinate - (215, 490) - - - _rotation - 0 - - - - gr_deinterleave - - id - gr_deinterleave_0 - - - _enabled - False - - - type - float - - - num_streams - 2 - - - vlen - 1 - - - _coordinate - (598, 485) - - - _rotation - 0 - - - - gr_float_to_complex - - id - gr_float_to_complex_0 - - - _enabled - False - - - vlen - 1 - - - _coordinate - (801, 485) - - - _rotation - 0 - - - - gr_short_to_float - - id - s2f - - - _enabled - False - - - _coordinate - (393, 502) - - - _rotation - 0 - - - - virtual_sink - - id - sample_stream - - - _enabled - False - - - stream_id - samples - - - _coordinate - (1027, 498) - - - _rotation - 0 - - - - usrp_simple_source_x - - id - usrp_source - - - _enabled - True - - - type - complex - - - format - - - - which - 0 - - - decimation - decim - - - frequency - freq - - - lo_offset - float('inf') - - - gain - gain - - - side - side - - - rx_ant - RXA - - - hb_filters - - - - _coordinate - (63, 785) - - - _rotation - 0 - - - - virtual_source - - id - virtual_source_0 - - - _enabled - False - - - stream_id - samples - - - _coordinate - (69, 671) - - - _rotation - 0 - - - - gr_fir_filter_xxx_0 - pll - 0 - 0 - - - agc - gr_fir_filter_xxx_0 - 0 - 0 - - - usrp_source - agc - 0 - 0 - - - deframer - decoder - 0 - 0 - - - pll - pll_scope - 0 - 0 - - - pll - sync - 0 - 0 - - - sync - deframer - 0 - 0 - - - deframer - frame_sink - 0 - 0 - - - virtual_source_0 - agc - 0 - 0 - - - file_source - s2f - 0 - 0 - - - s2f - gr_deinterleave_0 - 0 - 0 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 0 - 0 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 1 - 1 - - - gr_float_to_complex_0 - sample_stream - 0 - 0 - - diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py deleted file mode 100755 index 9b19d5e4..00000000 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ /dev/null @@ -1,401 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Sun Sep 27 10:06:41 2009 -################################################## - -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import noaa -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from gnuradio.wxgui import forms -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import usrp as grc_usrp -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import ConfigParser -import math -import wx - -class usrp_rx_hrpt(grc_wxgui.top_block_gui): - - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") - - ################################################## - # Variables - ################################################## - self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(config_filename) - try: decim = self._decim_config.getfloat('usrp', 'decim') - except: decim = 16 - self.decim = decim - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 64e6/decim - self.sps = sps = sample_rate/sym_rate - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(config_filename) - try: side = self._side_config.get('usrp', 'side') - except: side = 'A' - self.side = side - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(config_filename) - try: saved_sync_alpha = self._saved_sync_alpha_config.getfloat('demod', 'sync_alpha') - except: saved_sync_alpha = 0.05 - self.saved_sync_alpha = saved_sync_alpha - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(config_filename) - try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('demod', 'pll_alpha') - except: saved_pll_alpha = 0.05 - self.saved_pll_alpha = saved_pll_alpha - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat('usrp', 'gain') - except: saved_gain = 35 - 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('usrp', 'freq') - except: saved_freq = 1698e6 - self.saved_freq = saved_freq - self.hs = hs = int(sps/2.0) - self.sync_alpha = sync_alpha = saved_sync_alpha - self.side_text = side_text = side - self.pll_alpha = pll_alpha = saved_pll_alpha - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('output', 'filename') - except: output_filename = 'frames.dat' - self.output_filename = output_filename - self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs,]*hs - self.max_sync_offset = max_sync_offset = 0.01 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.gain = gain = saved_gain - self.freq = freq = saved_freq - self.decim_text = decim_text = decim - - ################################################## - # Controls - ################################################## - _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._sync_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - label="SYNC Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._sync_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_sync_alpha_sizer, 0, 3, 1, 1) - self._side_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.side_text, - callback=self.set_side_text, - label="USRP Side", - converter=forms.str_converter(), - ) - self.GridAdd(self._side_text_static_text, 1, 0, 1, 1) - _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._pll_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_pll_alpha_sizer, - value=self.pll_alpha, - callback=self.set_pll_alpha, - label="PLL Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._pll_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_pll_alpha_sizer, - value=self.pll_alpha, - callback=self.set_pll_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_pll_alpha_sizer, 0, 2, 1, 1) - _gain_sizer = wx.BoxSizer(wx.VERTICAL) - self._gain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_gain_sizer, - value=self.gain, - callback=self.set_gain, - label="RX Gain", - converter=forms.float_converter(), - proportion=0, - ) - self._gain_slider = forms.slider( - parent=self.GetWin(), - sizer=_gain_sizer, - value=self.gain, - callback=self.set_gain, - minimum=0, - maximum=100, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_gain_sizer, 0, 1, 1, 1) - self._freq_text_box = forms.text_box( - parent=self.GetWin(), - value=self.freq, - callback=self.set_freq, - label="Frequency", - converter=forms.float_converter(), - ) - self.GridAdd(self._freq_text_box, 0, 0, 1, 1) - self._decim_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.decim_text, - callback=self.set_decim_text, - label="Decimation", - converter=forms.float_converter(), - ) - self.GridAdd(self._decim_text_static_text, 1, 1, 1, 1) - - ################################################## - # Blocks - ################################################## - self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.decoder = noaa.hrpt_decoder() - self.deframer = noaa.hrpt_deframer() - self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.pll_scope = scopesink2.scope_sink_f( - self.GetWin(), - title="Demod Waveform", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.GridAdd(self.pll_scope.win, 2, 0, 1, 4) - self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) - self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") - self.usrp_source.set_decim_rate(decim) - self.usrp_source.set_frequency(freq, verbose=True) - self.usrp_source.set_gain(gain) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) - self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0)) - self.connect((self.usrp_source, 0), (self.agc, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.pll, 0), (self.pll_scope, 0)) - self.connect((self.pll, 0), (self.sync, 0)) - self.connect((self.sync, 0), (self.deframer, 0)) - self.connect((self.deframer, 0), (self.frame_sink, 0)) - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) - self._side_config.write(open(self.config_filename, 'w')) - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) - self._decim_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('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) - self._saved_freq_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'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def set_decim(self, decim): - self.decim = decim - self.set_sample_rate(64e6/self.decim) - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) - self._decim_config.write(open(self.config_filename, 'w')) - self.set_decim_text(self.decim) - self.usrp_source.set_decim_rate(self.decim) - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - - def set_sample_rate(self, sample_rate): - self.sample_rate = sample_rate - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.set_sps(self.sample_rate/self.sym_rate) - self.pll_scope.set_sample_rate(self.sample_rate) - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - - def set_side(self, side): - self.side = side - self.set_side_text(self.side) - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) - self._side_config.write(open(self.config_filename, 'w')) - - def set_saved_sync_alpha(self, saved_sync_alpha): - self.saved_sync_alpha = saved_sync_alpha - self.set_sync_alpha(self.saved_sync_alpha) - - def set_saved_pll_alpha(self, saved_pll_alpha): - self.saved_pll_alpha = saved_pll_alpha - self.set_pll_alpha(self.saved_pll_alpha) - - def set_saved_gain(self, saved_gain): - self.saved_gain = saved_gain - self.set_gain(self.saved_gain) - - def set_saved_freq(self, saved_freq): - self.saved_freq = saved_freq - self.set_freq(self.saved_freq) - - def set_hs(self, hs): - self.hs = hs - self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs,]*self.hs) - - def set_sync_alpha(self, sync_alpha): - self.sync_alpha = sync_alpha - self._sync_alpha_slider.set_value(self.sync_alpha) - self._sync_alpha_text_box.set_value(self.sync_alpha) - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) - - def set_side_text(self, side_text): - self.side_text = side_text - self._side_text_static_text.set_value(self.side_text) - - def set_pll_alpha(self, pll_alpha): - self.pll_alpha = pll_alpha - self._pll_alpha_slider.set_value(self.pll_alpha) - self._pll_alpha_text_box.set_value(self.pll_alpha) - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self.pll.set_alpha(self.pll_alpha) - self.pll.set_beta(self.pll_alpha**2/4.0) - - def set_output_filename(self, output_filename): - self.output_filename = output_filename - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def set_mf_taps(self, mf_taps): - self.mf_taps = mf_taps - self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) - - def set_max_carrier_offset(self, max_carrier_offset): - self.max_carrier_offset = max_carrier_offset - self.pll.set_max_offset(self.max_carrier_offset) - - 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('usrp'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - self.usrp_source.set_gain(self.gain) - - def set_freq(self, freq): - self.freq = 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('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - self.usrp_source.set_frequency(self.freq) - - def set_decim_text(self, decim_text): - self.decim_text = decim_text - self._decim_text_static_text.set_value(self.decim_text) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - if gr.enable_realtime_scheduling() != gr.RT_OK: - print "Error: failed to enable realtime scheduling." - tb = usrp_rx_hrpt() - tb.Run(True) - diff --git a/gr-noaa/apps/usrp_rx_hrpt2.grc b/gr-noaa/apps/usrp_rx_hrpt2.grc new file mode 100644 index 00000000..d42a9eab --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt2.grc @@ -0,0 +1,1418 @@ + + + Sun Sep 27 13:32:47 2009 + + variable + + id + max_carrier_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (575, 19) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (301, 19) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (397, 19) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (499, 19) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + variable_slider + + id + gain + + + _enabled + True + + + label + RX Gain + + + value + saved_gain + + + min + 0 + + + max + 100 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (340, 106) + + + _rotation + 0 + + + + variable_text_box + + id + freq + + + _enabled + True + + + label + Frequency + + + value + saved_freq + + + converver + float_converter + + + formatter + None + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (199, 106) + + + _rotation + 0 + + + + variable_slider + + id + pll_alpha + + + _enabled + True + + + label + PLL Alpha + + + value + saved_pll_alpha + + + min + 0.0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 2, 1, 1 + + + notebook + + + + _coordinate + (479, 106) + + + _rotation + 0 + + + + variable_slider + + id + sync_alpha + + + _enabled + True + + + label + SYNC Alpha + + + value + saved_sync_alpha + + + min + 0.0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 3, 1, 1 + + + notebook + + + + _coordinate + (618, 106) + + + _rotation + 0 + + + + variable_static_text + + id + side_text + + + _enabled + True + + + label + USRP Side + + + value + side + + + converver + str_converter + + + formatter + None + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (828, 20) + + + _rotation + 0 + + + + variable_config + + id + side + + + _enabled + True + + + value + 'A' + + + type + string + + + config_file + config_filename + + + section + 'usrp' + + + option + 'side' + + + writeback + side + + + _coordinate + (194, 253) + + + _rotation + 0 + + + + variable_config + + id + decim + + + _enabled + True + + + value + 16 + + + type + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'decim' + + + writeback + decim + + + _coordinate + (351, 255) + + + _rotation + 0 + + + + variable_config + + id + saved_freq + + + _enabled + True + + + value + 1698e6 + + + type + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'freq' + + + writeback + freq + + + _coordinate + (507, 258) + + + _rotation + 0 + + + + variable_config + + id + saved_gain + + + _enabled + True + + + value + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'gain' + + + writeback + gain + + + _coordinate + (664, 259) + + + _rotation + 0 + + + + variable_config + + id + saved_pll_alpha + + + _enabled + True + + + value + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'pll_alpha' + + + writeback + pll_alpha + + + _coordinate + (823, 258) + + + _rotation + 0 + + + + variable_config + + id + saved_sync_alpha + + + _enabled + True + + + value + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'sync_alpha' + + + writeback + sync_alpha + + + _coordinate + (981, 258) + + + _rotation + 0 + + + + variable_config + + id + output_filename + + + _enabled + True + + + value + 'frames.dat' + + + type + string + + + config_file + config_filename + + + section + 'output' + + + option + 'filename' + + + writeback + output_filename + + + _coordinate + (1139, 259) + + + _rotation + 0 + + + + variable_static_text + + id + decim_text + + + _enabled + True + + + label + Decimation + + + value + decim + + + converver + float_converter + + + formatter + None + + + grid_pos + 1, 1, 1, 1 + + + notebook + + + + _coordinate + (973, 20) + + + _rotation + 0 + + + + variable + + id + max_sync_offset + + + _enabled + True + + + value + 0.01 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + 'usrp_rx_hrpt.cfg' + + + _coordinate + (12, 160) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (11, 102) + + + _rotation + 0 + + + + noaa_hrpt_pll_cf + + id + pll + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (664, 809) + + + _rotation + 0 + + + + noaa_hrpt_sync_fb + + id + sync + + + _enabled + True + + + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset + + + _coordinate + (865, 801) + + + _rotation + 0 + + + + gr_file_sink + + id + frame_sink + + + _enabled + True + + + file + output_filename + + + type + short + + + vlen + 1 + + + _coordinate + (1283, 937) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (1091, 829) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + _coordinate + (1281, 829) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + pll_scope + + + _enabled + True + + + type + float + + + title + Demod Waveform + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 2,0,1,4 + + + notebook + + + + _coordinate + (631, 632) + + + _rotation + 180 + + + + gr_agc_xx + + id + agc + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (269, 801) + + + _rotation + 0 + + + + gr_fir_filter_xxx + + id + gr_fir_filter_xxx_0 + + + _enabled + True + + + type + ccc + + + decim + 1 + + + taps + mf_taps + + + _coordinate + (418, 817) + + + _rotation + 0 + + + + variable + + id + mf_taps + + + _enabled + True + + + value + [-0.5/hs,]*hs+[0.5/hs,]*hs + + + _coordinate + (830, 154) + + + _rotation + 0 + + + + gr_file_source + + id + file_source + + + _enabled + False + + + file + 'usrp.dat' + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (215, 490) + + + _rotation + 0 + + + + gr_deinterleave + + id + gr_deinterleave_0 + + + _enabled + False + + + type + float + + + num_streams + 2 + + + vlen + 1 + + + _coordinate + (598, 485) + + + _rotation + 0 + + + + gr_float_to_complex + + id + gr_float_to_complex_0 + + + _enabled + False + + + vlen + 1 + + + _coordinate + (801, 485) + + + _rotation + 0 + + + + gr_short_to_float + + id + s2f + + + _enabled + False + + + _coordinate + (393, 502) + + + _rotation + 0 + + + + virtual_sink + + id + sample_stream + + + _enabled + False + + + stream_id + samples + + + _coordinate + (1027, 498) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_source + + + _enabled + True + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + + + lo_offset + float('inf') + + + gain + gain + + + side + side + + + rx_ant + RXA + + + hb_filters + + + + _coordinate + (63, 785) + + + _rotation + 0 + + + + virtual_source + + id + virtual_source_0 + + + _enabled + False + + + stream_id + samples + + + _coordinate + (69, 671) + + + _rotation + 0 + + + + options + + id + usrp_rx_hrpt2 + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + 1 + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + gr_fir_filter_xxx_0 + pll + 0 + 0 + + + agc + gr_fir_filter_xxx_0 + 0 + 0 + + + usrp_source + agc + 0 + 0 + + + deframer + decoder + 0 + 0 + + + pll + pll_scope + 0 + 0 + + + pll + sync + 0 + 0 + + + sync + deframer + 0 + 0 + + + deframer + frame_sink + 0 + 0 + + + virtual_source_0 + agc + 0 + 0 + + + file_source + s2f + 0 + 0 + + + s2f + gr_deinterleave_0 + 0 + 0 + + + gr_deinterleave_0 + gr_float_to_complex_0 + 0 + 0 + + + gr_deinterleave_0 + gr_float_to_complex_0 + 1 + 1 + + + gr_float_to_complex_0 + sample_stream + 0 + 0 + + diff --git a/gr-noaa/apps/usrp_rx_hrpt2.py b/gr-noaa/apps/usrp_rx_hrpt2.py new file mode 100755 index 00000000..31933516 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt2.py @@ -0,0 +1,401 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Sun Sep 27 13:32:48 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import usrp as grc_usrp +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import math +import wx + +class usrp_rx_hrpt2(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + + ################################################## + # Variables + ################################################## + self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(config_filename) + try: decim = self._decim_config.getfloat('usrp', 'decim') + except: decim = 16 + self.decim = decim + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(config_filename) + try: side = self._side_config.get('usrp', 'side') + except: side = 'A' + self.side = side + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(config_filename) + try: saved_sync_alpha = self._saved_sync_alpha_config.getfloat('demod', 'sync_alpha') + except: saved_sync_alpha = 0.05 + self.saved_sync_alpha = saved_sync_alpha + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(config_filename) + try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('demod', 'pll_alpha') + except: saved_pll_alpha = 0.05 + self.saved_pll_alpha = saved_pll_alpha + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(config_filename) + try: saved_gain = self._saved_gain_config.getfloat('usrp', 'gain') + except: saved_gain = 35 + 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('usrp', 'freq') + except: saved_freq = 1698e6 + self.saved_freq = saved_freq + self.hs = hs = int(sps/2.0) + self.sync_alpha = sync_alpha = saved_sync_alpha + self.side_text = side_text = side + self.pll_alpha = pll_alpha = saved_pll_alpha + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(config_filename) + try: output_filename = self._output_filename_config.get('output', 'filename') + except: output_filename = 'frames.dat' + self.output_filename = output_filename + self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs,]*hs + self.max_sync_offset = max_sync_offset = 0.01 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.gain = gain = saved_gain + self.freq = freq = saved_freq + self.decim_text = decim_text = decim + + ################################################## + # Controls + ################################################## + _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._sync_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + label="SYNC Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._sync_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_sync_alpha_sizer, 0, 3, 1, 1) + self._side_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.side_text, + callback=self.set_side_text, + label="USRP Side", + converter=forms.str_converter(), + ) + self.GridAdd(self._side_text_static_text, 1, 0, 1, 1) + _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._pll_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_pll_alpha_sizer, + value=self.pll_alpha, + callback=self.set_pll_alpha, + label="PLL Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._pll_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_pll_alpha_sizer, + value=self.pll_alpha, + callback=self.set_pll_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_pll_alpha_sizer, 0, 2, 1, 1) + _gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + label="RX Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + minimum=0, + maximum=100, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_sizer, 0, 1, 1, 1) + self._freq_text_box = forms.text_box( + parent=self.GetWin(), + value=self.freq, + callback=self.set_freq, + label="Frequency", + converter=forms.float_converter(), + ) + self.GridAdd(self._freq_text_box, 0, 0, 1, 1) + self._decim_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.decim_text, + callback=self.set_decim_text, + label="Decimation", + converter=forms.float_converter(), + ) + self.GridAdd(self._decim_text_static_text, 1, 1, 1, 1) + + ################################################## + # Blocks + ################################################## + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.decoder = noaa.hrpt_decoder() + self.deframer = noaa.hrpt_deframer() + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.pll_scope = scopesink2.scope_sink_f( + self.GetWin(), + title="Demod Waveform", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.GridAdd(self.pll_scope.win, 2, 0, 1, 4) + self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") + self.usrp_source.set_decim_rate(decim) + self.usrp_source.set_frequency(freq, verbose=True) + self.usrp_source.set_gain(gain) + + ################################################## + # Connections + ################################################## + self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) + self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0)) + self.connect((self.usrp_source, 0), (self.agc, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.pll, 0), (self.pll_scope, 0)) + self.connect((self.pll, 0), (self.sync, 0)) + self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.deframer, 0), (self.frame_sink, 0)) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp'): + self._side_config.add_section('usrp') + self._side_config.set('usrp', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(self.config_filename) + if not self._decim_config.has_section('usrp'): + self._decim_config.add_section('usrp') + self._decim_config.set('usrp', 'decim', str(self.decim)) + self._decim_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('usrp'): + self._saved_freq_config.add_section('usrp') + self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + self._saved_freq_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'): + self._saved_gain_config.add_section('usrp') + self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('demod'): + self._saved_pll_alpha_config.add_section('demod') + self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(self.config_filename) + if not self._saved_sync_alpha_config.has_section('demod'): + self._saved_sync_alpha_config.add_section('demod') + self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) + self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('output'): + self._output_filename_config.add_section('output') + self._output_filename_config.set('output', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(self.config_filename) + if not self._decim_config.has_section('usrp'): + self._decim_config.add_section('usrp') + self._decim_config.set('usrp', 'decim', str(self.decim)) + self._decim_config.write(open(self.config_filename, 'w')) + self.set_decim_text(self.decim) + self.usrp_source.set_decim_rate(self.decim) + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.set_sps(self.sample_rate/self.sym_rate) + self.pll_scope.set_sample_rate(self.sample_rate) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + + def set_side(self, side): + self.side = side + self.set_side_text(self.side) + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp'): + self._side_config.add_section('usrp') + self._side_config.set('usrp', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + + def set_saved_sync_alpha(self, saved_sync_alpha): + self.saved_sync_alpha = saved_sync_alpha + self.set_sync_alpha(self.saved_sync_alpha) + + def set_saved_pll_alpha(self, saved_pll_alpha): + self.saved_pll_alpha = saved_pll_alpha + self.set_pll_alpha(self.saved_pll_alpha) + + def set_saved_gain(self, saved_gain): + self.saved_gain = saved_gain + self.set_gain(self.saved_gain) + + def set_saved_freq(self, saved_freq): + self.saved_freq = saved_freq + self.set_freq(self.saved_freq) + + def set_hs(self, hs): + self.hs = hs + self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs,]*self.hs) + + def set_sync_alpha(self, sync_alpha): + self.sync_alpha = sync_alpha + self._sync_alpha_slider.set_value(self.sync_alpha) + self._sync_alpha_text_box.set_value(self.sync_alpha) + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(self.config_filename) + if not self._saved_sync_alpha_config.has_section('demod'): + self._saved_sync_alpha_config.add_section('demod') + self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) + self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) + self.sync.set_alpha(self.sync_alpha) + self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_side_text(self, side_text): + self.side_text = side_text + self._side_text_static_text.set_value(self.side_text) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self._pll_alpha_slider.set_value(self.pll_alpha) + self._pll_alpha_text_box.set_value(self.pll_alpha) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('demod'): + self._saved_pll_alpha_config.add_section('demod') + self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self.pll.set_alpha(self.pll_alpha) + self.pll.set_beta(self.pll_alpha**2/4.0) + + def set_output_filename(self, output_filename): + self.output_filename = output_filename + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('output'): + self._output_filename_config.add_section('output') + self._output_filename_config.set('output', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def set_mf_taps(self, mf_taps): + self.mf_taps = mf_taps + self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) + + def set_max_sync_offset(self, max_sync_offset): + self.max_sync_offset = max_sync_offset + self.sync.set_max_offset(self.max_sync_offset) + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + self.pll.set_max_offset(self.max_carrier_offset) + + 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('usrp'): + self._saved_gain_config.add_section('usrp') + self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self.usrp_source.set_gain(self.gain) + + def set_freq(self, freq): + self.freq = 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('usrp'): + self._saved_freq_config.add_section('usrp') + self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + self.usrp_source.set_frequency(self.freq) + + def set_decim_text(self, decim_text): + self.decim_text = decim_text + self._decim_text_static_text.set_value(self.decim_text) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + (options, args) = parser.parse_args() + if gr.enable_realtime_scheduling() != gr.RT_OK: + print "Error: failed to enable realtime scheduling." + tb = usrp_rx_hrpt2() + tb.Run(True) +