From 7c4b43a1a4b3ff6c99fe96805f8d4518a22eb0a5 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 23 Sep 2009 11:40:19 -0700 Subject: [PATCH] Split HRPT script into live receive and post-processing Cleanup debug info Created 'demod_hrpt_file.py' Updated 'usrp_rx_hrpt.py' with GUI, USRP, and config file --- gr-noaa/apps/.gitignore | 1 + gr-noaa/apps/Makefile.am | 2 + gr-noaa/apps/demod_hrpt_file.grc | 781 +++++++++++++++++++++++ gr-noaa/apps/demod_hrpt_file.py | 130 ++++ gr-noaa/apps/usrp_rx_hrpt.cfg | 13 + gr-noaa/apps/usrp_rx_hrpt.grc | 986 +++++++++++++++++++----------- gr-noaa/apps/usrp_rx_hrpt.py | 352 ++++++++--- gr-noaa/lib/noaa_hrpt_decoder.cc | 8 +- gr-noaa/lib/noaa_hrpt_deframer.cc | 4 +- 9 files changed, 1841 insertions(+), 436 deletions(-) create mode 100644 gr-noaa/apps/.gitignore create mode 100644 gr-noaa/apps/demod_hrpt_file.grc create mode 100755 gr-noaa/apps/demod_hrpt_file.py create mode 100644 gr-noaa/apps/usrp_rx_hrpt.cfg diff --git a/gr-noaa/apps/.gitignore b/gr-noaa/apps/.gitignore new file mode 100644 index 00000000..773a6df9 --- /dev/null +++ b/gr-noaa/apps/.gitignore @@ -0,0 +1 @@ +*.dat diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index 23b8240c..906638ff 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -24,10 +24,12 @@ include $(top_srcdir)/Makefile.common if PYTHON dist_bin_SCRIPTS = \ + demod_hrpt_file.py \ usrp_rx_hrpt.py \ usrp_rx_lrit.py EXTRA_DIST = \ + demod_hrpt_file.grc \ usrp_rx_hrpt.grc \ usrp_rx_lrit.grc endif diff --git a/gr-noaa/apps/demod_hrpt_file.grc b/gr-noaa/apps/demod_hrpt_file.grc new file mode 100644 index 00000000..4a5e8717 --- /dev/null +++ b/gr-noaa/apps/demod_hrpt_file.grc @@ -0,0 +1,781 @@ + + + Wed Sep 23 11:37:25 2009 + + options + + id + demod_hrpt_file + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + max_sync_offset + + + _enabled + True + + + value + 0.01 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + variable + + id + max_carrier_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (575, 19) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (499, 19) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (397, 19) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (301, 19) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + parameter + + id + decim + + + _enabled + True + + + label + Decimation + + + value + 16 + + + type + intx + + + short_id + d + + + _coordinate + (404, 102) + + + _rotation + 0 + + + + parameter + + id + pll_alpha + + + _enabled + True + + + label + + + + value + 0.05 + + + type + eng_float + + + short_id + p + + + _coordinate + (516, 102) + + + _rotation + 0 + + + + parameter + + id + sync_alpha + + + _enabled + True + + + label + + + + value + 0.05 + + + type + eng_float + + + short_id + s + + + _coordinate + (601, 103) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 92) + + + _rotation + 0 + + + + parameter + + id + filename + + + _enabled + True + + + label + Filename + + + value + usrp.dat + + + type + string + + + short_id + F + + + _coordinate + (200, 101) + + + _rotation + 0 + + + + gr_file_source + + id + file_source + + + _enabled + True + + + file + filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (102, 368) + + + _rotation + 0 + + + + gr_short_to_float + + id + s2f + + + _enabled + True + + + _coordinate + (305, 380) + + + _rotation + 0 + + + + gr_deinterleave + + id + deinterleave + + + _enabled + True + + + type + float + + + num_streams + 2 + + + vlen + 1 + + + _coordinate + (526, 363) + + + _rotation + 0 + + + + gr_float_to_complex + + id + f2c + + + _enabled + True + + + vlen + 1 + + + _coordinate + (730, 363) + + + _rotation + 0 + + + + virtual_sink + + id + samples_sink + + + _enabled + True + + + stream_id + samples + + + _coordinate + (968, 376) + + + _rotation + 0 + + + + virtual_source + + id + samples_source + + + _enabled + True + + + stream_id + samples + + + _coordinate + (104, 479) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + matched_filter + + + _enabled + True + + + type + complex + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (302, 463) + + + _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 + (504, 463) + + + _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 + (711, 455) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (935, 483) + + + _rotation + 0 + + + + gr_file_sink + + id + file_sink + + + _enabled + True + + + file + output + + + type + short + + + vlen + 1 + + + _coordinate + (1136, 479) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + _coordinate + (1135, 542) + + + _rotation + 0 + + + + parameter + + id + output + + + _enabled + True + + + label + Output + + + value + frames.dat + + + type + string + + + short_id + o + + + _coordinate + (302, 101) + + + _rotation + 0 + + + + deframer + file_sink + 0 + 0 + + + sync + deframer + 0 + 0 + + + pll + sync + 0 + 0 + + + matched_filter + pll + 0 + 0 + + + s2f + deinterleave + 0 + 0 + + + deinterleave + f2c + 1 + 1 + + + deinterleave + f2c + 0 + 0 + + + file_source + s2f + 0 + 0 + + + deframer + decoder + 0 + 0 + + + f2c + samples_sink + 0 + 0 + + + samples_source + matched_filter + 0 + 0 + + diff --git a/gr-noaa/apps/demod_hrpt_file.py b/gr-noaa/apps/demod_hrpt_file.py new file mode 100755 index 00000000..a1469e9e --- /dev/null +++ b/gr-noaa/apps/demod_hrpt_file.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Wed Sep 23 11:37:25 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 optparse import OptionParser +import math + +class demod_hrpt_file(gr.top_block): + + def __init__(self, decim=16, pll_alpha=0.05, sync_alpha=0.05, filename="usrp.dat", output="frames.dat"): + gr.top_block.__init__(self, "USRP HRPT Receiver") + + ################################################## + # Parameters + ################################################## + self.decim = decim + self.pll_alpha = pll_alpha + self.sync_alpha = sync_alpha + self.filename = filename + self.output = output + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self.max_sync_offset = max_sync_offset = 0.01 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + + ################################################## + # Blocks + ################################################## + self.decoder = noaa.hrpt_decoder() + self.deframer = noaa.hrpt_deframer() + self.deinterleave = gr.deinterleave(gr.sizeof_float*1) + self.f2c = gr.float_to_complex(1) + self.file_sink = gr.file_sink(gr.sizeof_short*1, output) + self.file_source = gr.file_source(gr.sizeof_short*1, filename, False) + self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.s2f = gr.short_to_float() + self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + + ################################################## + # Connections + ################################################## + self.connect((self.deframer, 0), (self.file_sink, 0)) + self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.pll, 0), (self.sync, 0)) + self.connect((self.matched_filter, 0), (self.pll, 0)) + self.connect((self.s2f, 0), (self.deinterleave, 0)) + self.connect((self.deinterleave, 1), (self.f2c, 1)) + self.connect((self.deinterleave, 0), (self.f2c, 0)) + self.connect((self.file_source, 0), (self.s2f, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.f2c, 0), (self.matched_filter, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self.pll.set_alpha(self.pll_alpha) + self.pll.set_beta(self.pll_alpha**2/4.0) + + def set_sync_alpha(self, sync_alpha): + self.sync_alpha = sync_alpha + self.sync.set_alpha(self.sync_alpha) + self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_filename(self, filename): + self.filename = filename + + def set_output(self, output): + self.output = output + + 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) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + + 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_hs(self, hs): + self.hs = hs + self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, + help="Set Decimation [default=%default]") + parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), + help="Set pll_alpha [default=%default]") + parser.add_option("-s", "--sync-alpha", dest="sync_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), + help="Set sync_alpha [default=%default]") + parser.add_option("-F", "--filename", dest="filename", type="string", default="usrp.dat", + help="Set Filename [default=%default]") + parser.add_option("-o", "--output", dest="output", type="string", default="frames.dat", + help="Set Output [default=%default]") + (options, args) = parser.parse_args() + tb = demod_hrpt_file(decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha, filename=options.filename, output=options.output) + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() + diff --git a/gr-noaa/apps/usrp_rx_hrpt.cfg b/gr-noaa/apps/usrp_rx_hrpt.cfg new file mode 100644 index 00000000..69f3c0bf --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt.cfg @@ -0,0 +1,13 @@ +[output] +filename = frames.dat + +[demod] +pll_alpha = 0.05 +sync_alpha = 0.05 + +[usrp] +freq = 1698000000.0 +decim = 16 +side = A +gain = 35.0 + diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index f629ae8b..90d86876 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 19:30:16 2009 + Wed Sep 23 11:32:00 2009 options @@ -53,22 +53,22 @@ - import + variable id - import_0 + max_carrier_offset _enabled True - import - import math + value + 2*math.pi*100e3/sample_rate _coordinate - (9, 202) + (575, 19) _rotation @@ -76,34 +76,34 @@ - notebook + gr_moving_average_xx id - displays + matched_filter _enabled True - style - wx.NB_TOP + type + complex - labels - ['RX','PLL/SYNC'] + length + hs - grid_pos - 1, 0, 1, 2 + scale + 1.0/hs - notebook - + max_iter + 4000 _coordinate - (9, 99) + (441, 723) _rotation @@ -111,93 +111,114 @@ - wxgui_scopesink2 + import id - wxgui_scopesink2_0_0 + import_0 _enabled True - type - float + import + import math - title - Post-PLL + _coordinate + (11, 76) - samp_rate - sample_rate + _rotation + 0 + + + variable - v_scale - 0.5 + id + config_filename - t_scale - 20.0/sample_rate + _enabled + True - ac_couple - False + value + 'usrp_rx_hrpt.cfg' - xy_mode - False + _coordinate + (12, 129) - num_inputs - 1 + _rotation + 0 + + + variable - grid_pos - 0, 0, 1, 1 + id + sym_rate - notebook - displays, 1 + _enabled + True + + + value + 600*1109 _coordinate - (597, 618) + (301, 19) _rotation - 180 + 0 - gr_moving_average_xx + variable id - matched_filter + sps _enabled True - type - complex + value + sample_rate/sym_rate - length + _coordinate + (397, 19) + + + _rotation + 0 + + + + variable + + id hs - scale - 1.0/hs + _enabled + True - max_iter - 4000 + value + int(sps/2.0) _coordinate - (429, 789) + (499, 19) _rotation @@ -205,58 +226,77 @@ - wxgui_scopesink2 + variable id - wxgui_scopesink2_0 + sample_rate _enabled True - type - complex + value + 64e6/decim - title - RX Waveform + _coordinate + (198, 17) - samp_rate - sample_rate + _rotation + 0 + + + + variable_slider + + id + gain - v_scale + _enabled + True + + + label + RX Gain + + + value + saved_gain + + + min 0 - t_scale - 20.0/sample_rate + max + 100 - ac_couple - False + num_steps + 100 - xy_mode - False + style + wx.SL_HORIZONTAL - num_inputs - 1 + converver + float_converter grid_pos - 1, 0, 1, 1 + 0, 1, 1, 1 notebook - displays, 0 + _coordinate - (430, 895) + (340, 106) _rotation @@ -264,78 +304,97 @@ - wxgui_fftsink2 + variable_text_box id - rx_fftsink + freq _enabled True - type - complex + label + Frequency - title - RX Spectrum + value + saved_freq - samp_rate - sample_rate + converver + float_converter - baseband_freq - 1698e6 + formatter + None - y_per_div - 5 + grid_pos + 0, 0, 1, 1 - y_divs - 8 + notebook + - ref_level - -5 + _coordinate + (199, 106) - ref_scale - 2.0 + _rotation + 0 + + + variable_slider - fft_size - 1024 + id + pll_alpha - fft_rate - 30 + _enabled + True - peak_hold - False + label + PLL Alpha - average - True + value + saved_pll_alpha - avg_alpha - 0.1 + min + 0.0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter grid_pos - 0, 0, 1, 1 + 0, 2, 1, 1 notebook - displays, 0 + _coordinate - (430, 531) + (479, 106) _rotation @@ -343,38 +402,54 @@ - gr_agc_xx + variable_slider id - agr + sync_alpha _enabled True - type - complex + label + SYNC Alpha - rate - 1e-6 + value + saved_sync_alpha - reference - 1.0 + min + 0.0 - gain - 1.0 + max + 0.5 - max_gain - 1.0 + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 3, 1, 1 + + + notebook + _coordinate - (258, 781) + (618, 106) _rotation @@ -382,22 +457,42 @@ - virtual_source + variable_static_text id - virtual_source_0 + side_text _enabled True - stream_id - samples + label + USRP Side + + + value + side + + + converver + str_converter + + + formatter + None + + + grid_pos + 1, 0, 1, 1 + + + notebook + _coordinate - (62, 805) + (828, 20) _rotation @@ -405,34 +500,42 @@ - parameter + variable_config id - filename + side _enabled True - - label - Filename - value - "" + 'A' type string - short_id - f + config_file + config_filename + + + section + 'usrp' + + + option + 'side' + + + writeback + side _coordinate - (200, 101) + (194, 253) _rotation @@ -440,7 +543,7 @@ - parameter + variable_config id decim @@ -449,25 +552,33 @@ _enabled True - - label - Decimation - value 16 type - intx + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'decim' - short_id - d + writeback + decim _coordinate - (304, 101) + (351, 255) _rotation @@ -475,10 +586,10 @@ - variable + variable_config id - max_sync_offset + saved_freq _enabled @@ -486,34 +597,31 @@ value - 0.01 + 1698e6 - _coordinate - (705, 19) + type + real - _rotation - 0 + config_file + config_filename - - - variable - id - max_carrier_offset + section + 'usrp' - _enabled - True + option + 'freq' - value - 2*math.pi*100e3/sample_rate + writeback + freq _coordinate - (575, 19) + (507, 258) _rotation @@ -521,10 +629,10 @@ - variable + variable_config id - hs + saved_gain _enabled @@ -532,11 +640,31 @@ value - int(sps/2.0) + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'gain' + + + writeback + gain _coordinate - (499, 19) + (664, 259) _rotation @@ -544,10 +672,10 @@ - variable + variable_config id - sps + saved_pll_alpha _enabled @@ -555,11 +683,31 @@ value - sample_rate/sym_rate + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'pll_alpha' + + + writeback + pll_alpha _coordinate - (397, 19) + (823, 258) _rotation @@ -567,10 +715,10 @@ - variable + variable_config id - sym_rate + saved_sync_alpha _enabled @@ -578,11 +726,31 @@ value - 600*1109 + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'sync_alpha' + + + writeback + sync_alpha _coordinate - (301, 19) + (981, 258) _rotation @@ -590,10 +758,10 @@ - variable + variable_config id - sample_rate + output_filename _enabled @@ -601,11 +769,31 @@ value - 64e6/decim + 'frames.dat' + + + type + string + + + config_file + config_filename + + + section + 'output' + + + option + 'filename' + + + writeback + output_filename _coordinate - (198, 17) + (1139, 259) _rotation @@ -613,10 +801,10 @@ - variable_slider + variable_static_text id - pll_alpha + decim_text _enabled @@ -624,43 +812,54 @@ label - PLL Alpha + Decimation value - 0.005 + decim - min - 0.0 + converver + float_converter - max - 0.5 + formatter + None - num_steps - 500 + grid_pos + 1, 1, 1, 1 - style - wx.SL_HORIZONTAL + notebook + - converver - float_converter + _coordinate + (973, 20) - grid_pos - 0, 0, 1, 1 + _rotation + 0 + + + variable - notebook - + id + max_sync_offset + + + _enabled + True + + + value + 0.01 _coordinate - (447, 99) + (705, 19) _rotation @@ -668,30 +867,58 @@ - noaa_hrpt_pll_cf + usrp_simple_source_x + + id + usrp_source + + + _enabled + True + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + - id - noaa_hrpt_pll_cf_0 + lo_offset + float('inf') - _enabled - True + gain + gain - alpha - pll_alpha + side + side - beta - pll_alpha**2/4.0 + rx_ant + RXA - max_offset - max_carrier_offset + hb_filters + _coordinate - (624, 789) + (56, 699) _rotation @@ -699,34 +926,38 @@ - noaa_hrpt_sync_fb + gr_agc_xx id - noaa_hrpt_sync_fb_0 + agc _enabled True - alpha - sync_alpha + type + complex - beta - sync_alpha**2/4.0 + rate + 1e-6 - sps - sps + reference + 1.0 - max_offset - max_sync_offset + gain + 1.0 + + + max_gain + 1.0 _coordinate - (832, 781) + (273, 715) _rotation @@ -734,54 +965,58 @@ - variable_slider + wxgui_scopesink2 id - sync_alpha + rx_scope _enabled True - label - SYNC Alpha + type + complex - value - 0.1 + title + RX Waveform - min - 0.0 + samp_rate + sample_rate - max - 0.5 + v_scale + 0 - num_steps - 500 + t_scale + 20.0/sample_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + False + + + num_inputs + 1 grid_pos - 0, 1, 1, 1 + 1, 0, 1, 1 notebook - + displays, 0 _coordinate - (593, 98) + (439, 829) _rotation @@ -789,57 +1024,78 @@ - gr_file_source + wxgui_fftsink2 id - gr_file_source_0 + rx_fft _enabled True - file - filename + type + complex - type - short + title + RX Spectrum - repeat - False + samp_rate + sample_rate - vlen - 1 + baseband_freq + freq - _coordinate - (102, 368) + y_per_div + 5 - _rotation - 0 + y_divs + 8 - - - virtual_sink - id - virtual_sink_0 + ref_level + -5 - _enabled + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average True - stream_id - samples + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 _coordinate - (1076, 376) + (439, 465) _rotation @@ -847,10 +1103,10 @@ - gr_throttle + wxgui_scopesink2 id - throttle + pll_scope _enabled @@ -858,50 +1114,82 @@ type - complex + float + + + title + Post-PLL - samples_per_second + samp_rate sample_rate - vlen + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs 1 + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + _coordinate - (877, 376) + (605, 552) _rotation - 0 + 180 - gr_deinterleave + notebook id - gr_deinterleave_0 + displays _enabled True - type - float + style + wx.NB_TOP - num_streams - 2 + labels + ['RX','Demod'] - vlen - 1 + grid_pos + 2, 0, 1, 4 + + + notebook + _coordinate - (466, 363) + (15, 237) _rotation @@ -909,18 +1197,30 @@ - gr_short_to_float + noaa_hrpt_pll_cf id - gr_short_to_float_0 + pll _enabled True + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + _coordinate - (278, 380) + (632, 723) _rotation @@ -928,22 +1228,34 @@ - gr_float_to_complex + noaa_hrpt_sync_fb id - gr_float_to_complex_0 + sync _enabled True - vlen - 1 + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset _coordinate - (653, 363) + (840, 715) _rotation @@ -951,30 +1263,18 @@ - gr_file_sink + noaa_hrpt_deframer id - gr_file_sink_1 + deframer _enabled True - - file - frames.dat - - - type - short - - - vlen - 1 - _coordinate - (1265, 917) + (1071, 743) _rotation @@ -982,10 +1282,10 @@ - noaa_hrpt_deframer + noaa_hrpt_decoder id - noaa_hrpt_deframer_0 + decoder _enabled @@ -993,7 +1293,7 @@ _coordinate - (1063, 809) + (1274, 743) _rotation @@ -1001,18 +1301,30 @@ - noaa_hrpt_decoder + gr_file_sink id - noaa_hrpt_decoder_0 + frame_sink _enabled True + + file + output_filename + + + type + short + + + vlen + 1 + _coordinate - (1266, 809) + (1273, 851) _rotation @@ -1020,98 +1332,62 @@ - virtual_source_0 - agr - 0 - 0 - - - noaa_hrpt_deframer_0 - gr_file_sink_1 + deframer + frame_sink 0 0 - noaa_hrpt_sync_fb_0 - noaa_hrpt_deframer_0 + sync + deframer 0 0 - noaa_hrpt_pll_cf_0 - noaa_hrpt_sync_fb_0 + pll + sync 0 0 - noaa_hrpt_pll_cf_0 - wxgui_scopesink2_0_0 + pll + pll_scope 0 0 - agr - wxgui_scopesink2_0 + agc + rx_scope 0 0 - agr - rx_fftsink + agc + rx_fft 0 0 - agr + agc matched_filter 0 0 matched_filter - noaa_hrpt_pll_cf_0 - 0 - 0 - - - gr_float_to_complex_0 - throttle - 0 - 0 - - - gr_short_to_float_0 - gr_deinterleave_0 - 0 - 0 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 1 - 1 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 0 - 0 - - - gr_file_source_0 - gr_short_to_float_0 + pll 0 0 - throttle - virtual_sink_0 + deframer + decoder 0 0 - noaa_hrpt_deframer_0 - noaa_hrpt_decoder_0 + usrp_source + agc 0 0 diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index b29af565..7efbecd3 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 20 19:30:17 2009 +# Generated: Wed Sep 23 11:32:04 2009 ################################################## from gnuradio import eng_notation @@ -13,41 +13,77 @@ from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 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, filename="", decim=16): + def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") - ################################################## - # Parameters - ################################################## - self.filename = filename - self.decim = decim - ################################################## # 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.sync_alpha = sync_alpha = 0.1 - self.pll_alpha = pll_alpha = 0.005 + 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.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.max_sync_offset = max_sync_offset = 0.01 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate self.hs = hs = int(sps/2.0) + self.gain = gain = saved_gain + self.freq = freq = saved_freq + self.decim_text = decim_text = decim ################################################## # Notebooks ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL/SYNC") - self.GridAdd(self.displays, 1, 0, 1, 2) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") + self.GridAdd(self.displays, 2, 0, 1, 4) ################################################## # Controls @@ -69,12 +105,20 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): callback=self.set_sync_alpha, minimum=0.0, maximum=0.5, - num_steps=500, + num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) - self.GridAdd(_sync_alpha_sizer, 0, 1, 1, 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(), @@ -92,30 +136,75 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): callback=self.set_pll_alpha, minimum=0.0, maximum=0.5, - num_steps=500, + 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(_pll_alpha_sizer, 0, 0, 1, 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.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_float*1) - self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, filename, False) - self.gr_float_to_complex_0 = gr.float_to_complex(1) - self.gr_short_to_float_0 = gr.short_to_float() + 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.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) - self.noaa_hrpt_decoder_0 = noaa.hrpt_decoder() - self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() - self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) - self.rx_fftsink = fftsink2.fft_sink_c( + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.pll_scope = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-PLL", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.pll_scope.win, 0, 0, 1, 1) + self.rx_fft = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), - baseband_freq=1698e6, + baseband_freq=freq, y_per_div=5, y_divs=8, ref_level=-5, @@ -128,9 +217,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): title="RX Spectrum", peak_hold=False, ) - self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) + self.rx_scope = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), title="RX Waveform", sample_rate=sample_rate, @@ -140,44 +228,83 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): xy_mode=False, num_inputs=1, ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-PLL", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) + self.displays.GetPage(0).GridAdd(self.rx_scope.win, 1, 0, 1, 1) + 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.throttle, 0), (self.agr, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_1, 0)) - self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.agr, 0), (self.rx_fftsink, 0)) - self.connect((self.agr, 0), (self.matched_filter, 0)) - self.connect((self.matched_filter, 0), (self.noaa_hrpt_pll_cf_0, 0)) - self.connect((self.gr_float_to_complex_0, 0), (self.throttle, 0)) - self.connect((self.gr_short_to_float_0, 0), (self.gr_deinterleave_0, 0)) - self.connect((self.gr_deinterleave_0, 1), (self.gr_float_to_complex_0, 1)) - self.connect((self.gr_deinterleave_0, 0), (self.gr_float_to_complex_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.noaa_hrpt_decoder_0, 0)) - - def set_filename(self, filename): - self.filename = filename + self.connect((self.deframer, 0), (self.frame_sink, 0)) + self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.pll, 0), (self.sync, 0)) + self.connect((self.pll, 0), (self.pll_scope, 0)) + self.connect((self.agc, 0), (self.rx_scope, 0)) + self.connect((self.agc, 0), (self.rx_fft, 0)) + self.connect((self.agc, 0), (self.matched_filter, 0)) + self.connect((self.matched_filter, 0), (self.pll, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.usrp_source, 0), (self.agc, 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 @@ -185,49 +312,124 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate - self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.set_sps(self.sample_rate/self.sym_rate) + self.rx_scope.set_sample_rate(self.sample_rate) + self.rx_fft.set_sample_rate(self.sample_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_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha - self.noaa_hrpt_sync_fb_0.set_alpha(self.sync_alpha) - self.noaa_hrpt_sync_fb_0.set_beta(self.sync_alpha**2/4.0) 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.noaa_hrpt_pll_cf_0.set_alpha(self.pll_alpha) - self.noaa_hrpt_pll_cf_0.set_beta(self.pll_alpha**2/4.0) + 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_max_sync_offset(self, max_sync_offset): self.max_sync_offset = max_sync_offset - self.noaa_hrpt_sync_fb_0.set_max_offset(self.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.noaa_hrpt_pll_cf_0.set_max_offset(self.max_carrier_offset) + self.pll.set_max_offset(self.max_carrier_offset) def set_hs(self, hs): self.hs = hs self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs) + 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) + self.rx_fft.set_baseband_freq(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]") - parser.add_option("-f", "--filename", dest="filename", type="string", default="", - help="Set Filename [default=%default]") - parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, - help="Set Decimation [default=%default]") (options, args) = parser.parse_args() - tb = usrp_rx_hrpt(filename=options.filename, decim=options.decim) + tb = usrp_rx_hrpt() tb.Run(True) diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc index 4fae0173..8cfaa913 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -59,17 +59,17 @@ noaa_hrpt_decoder::work(int noutput_items, while (i < noutput_items) { unsigned short word = in[i++]; d_word_count++; - fprintf(stderr, "%5u: ", d_word_count); + //fprintf(stderr, "%5u: ", d_word_count); for (int pos = 0; pos < 10; pos++) { char ch = (word & (1 << 9)) ? '1' : '0'; word = word << 1; - fprintf(stderr, "%c ", ch); + //fprintf(stderr, "%c ", ch); } - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); if (d_word_count == 11090) { d_word_count = 0; - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); } } diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc index 77a8e326..b0de09c9 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -91,7 +91,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_shifter = (d_shifter << 1) | bit; // MSB transmitted first if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { - //fprintf(stderr, "SYNC #%i", frames_seen++); + fprintf(stderr, "SYNC #%i", frames_seen++); out[j++] = SYNC1; out[j++] = SYNC2; out[j++] = SYNC3; @@ -109,7 +109,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_word = 0; d_bit_count = HRPT_BITS_PER_WORD; if (--d_word_count == 0) { - //fprintf(stderr, "...done\n"); + fprintf(stderr, "...done\n"); enter_idle(); } } -- 2.30.2