From 789435387ab3a886cd33304f4f47d60456765b70 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:10:10 -0700 Subject: [PATCH] Updated HRPT receiver to read files recorded as shorts --- gr-noaa/apps/usrp_rx_hrpt.grc | 734 +++++++++++++++++++++------------- gr-noaa/apps/usrp_rx_hrpt.py | 43 +- 2 files changed, 496 insertions(+), 281 deletions(-) diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index c8e09961..8edc2b4e 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 12:45:30 2009 + Sun Sep 20 19:09:57 2009 options @@ -76,45 +76,34 @@ - variable + notebook id - decim + displays _enabled True - value - 16 - - - _coordinate - (186, 10) - - - _rotation - 0 + style + wx.NB_TOP - - - variable - id - hs + labels + ['RX','PLL/SYNC'] - _enabled - True + grid_pos + 1, 0, 1, 2 - value - int(sps/2.0) + notebook + _coordinate - (589, 13) + (9, 99) _rotation @@ -122,45 +111,30 @@ - variable + gr_file_sink id - sym_rate + gr_file_sink_1 _enabled True - value - 600*1109 - - - _coordinate - (383, 7) - - - _rotation - 0 - - - - variable - - id - sps + file + frames.dat - _enabled - True + type + short - value - sample_rate/sym_rate + vlen + 1 _coordinate - (479, 11) + (1253, 805) _rotation @@ -168,22 +142,18 @@ - variable + noaa_hrpt_deframer id - sample_rate + noaa_hrpt_deframer_0 _enabled True - - value - 64e6/decim - _coordinate - (273, 9) + (1063, 809) _rotation @@ -191,42 +161,46 @@ - variable_slider + wxgui_scopesink2 id - pll_alpha + wxgui_scopesink2_0_0 _enabled True - label - PLL Alpha + type + float - value - 0.001 + title + Post-PLL - min - 0.0 + samp_rate + sample_rate - max + v_scale 0.5 - 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 @@ -234,111 +208,46 @@ notebook - - - - _coordinate - (192, 100) - - - _rotation - 0 - - - - variable - - id - max_carrier_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (671, 14) - - - _rotation - 0 - - - - variable - - id - max_sync_offset - - - _enabled - True - - - value - 0.01 + displays, 1 _coordinate - (805, 13) + (597, 618) _rotation - 0 + 180 - notebook + gr_moving_average_xx id - displays + matched_filter _enabled True - style - wx.NB_TOP - - - labels - ['RX','PLL/SYNC'] - - - grid_pos - 1, 0, 1, 2 - - - notebook - - - - _coordinate - (9, 99) + type + complex - _rotation - 0 + length + hs - - - noaa_hrpt_deframer - id - noaa_hrpt_deframer_0 + scale + 1.0/hs - _enabled - True + max_iter + 4000 _coordinate - (1112, 649) + (429, 789) _rotation @@ -349,7 +258,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0 + wxgui_scopesink2_0 _enabled @@ -357,11 +266,11 @@ type - float + complex title - Post-PLL + RX Waveform samp_rate @@ -369,7 +278,7 @@ v_scale - 0.5 + 0 t_scale @@ -389,46 +298,15 @@ grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - displays, 1 - - - _coordinate - (624, 462) - - - _rotation - 180 - - - - gr_throttle - - id - throttle - - - _enabled - True - - - type - complex - - - samples_per_second - sample_rate - - - vlen - 1 + displays, 0 _coordinate - (85, 645) + (430, 895) _rotation @@ -507,7 +385,7 @@ _coordinate - (439, 309) + (430, 531) _rotation @@ -515,10 +393,10 @@ - wxgui_scopesink2 + gr_agc_xx id - wxgui_scopesink2_0 + agr _enabled @@ -529,44 +407,47 @@ complex - title - RX Waveform + rate + 1e-6 - samp_rate - sample_rate + reference + 1.0 - v_scale - 0 + gain + 1.0 - t_scale - 20.0/sample_rate + max_gain + 1.0 - ac_couple - False + _coordinate + (258, 781) - xy_mode - False + _rotation + 0 + + + virtual_source - num_inputs - 1 + id + virtual_source_0 - grid_pos - 1, 0, 1, 1 + _enabled + True - notebook - displays, 0 + stream_id + samples _coordinate - (440, 783) + (62, 805) _rotation @@ -574,38 +455,69 @@ - gr_agc_xx + parameter id - agr + filename _enabled True + + label + Filename + + + value + "" + type - complex + string - rate - 1e-6 + short_id + f - reference - 1.0 + _coordinate + (200, 101) - gain - 1.0 + _rotation + 0 + + + parameter - max_gain - 1.0 + id + decim + + + _enabled + True + + + label + Decimation + + + value + 16 + + + type + intx + + + short_id + d _coordinate - (267, 621) + (304, 101) _rotation @@ -613,30 +525,45 @@ - noaa_hrpt_pll_cf + variable id - noaa_hrpt_pll_cf_0 + max_sync_offset _enabled True - alpha - pll_alpha + value + 0.01 - beta - pll_alpha**2/4.0 + _coordinate + (705, 19) - max_offset + _rotation + 0 + + + + variable + + id max_carrier_offset + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + _coordinate - (645, 629) + (575, 19) _rotation @@ -644,30 +571,45 @@ - gr_file_sink + variable id - gr_file_sink_1 + hs _enabled True - file - frames.dat + value + int(sps/2.0) - type - short + _coordinate + (499, 19) - vlen - 1 + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate _coordinate - (1125, 758) + (397, 19) _rotation @@ -675,34 +617,45 @@ - gr_moving_average_xx + variable id - matched_filter + sym_rate _enabled True - type - complex + value + 600*1109 - length - hs + _coordinate + (301, 19) - scale - 1.0/hs + _rotation + 0 + + + variable - max_iter - 4000 + id + sample_rate + + + _enabled + True + + + value + 64e6/decim _coordinate - (444, 629) + (198, 17) _rotation @@ -710,34 +663,85 @@ - gr_file_source + variable_slider id - src + pll_alpha _enabled True - file - poes-d16.dat + label + PLL Alpha - type - complex + value + 0.005 - repeat - False + min + 0.0 - vlen - 1 + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + _coordinate - (79, 541) + (447, 99) + + + _rotation + 0 + + + + noaa_hrpt_pll_cf + + id + noaa_hrpt_pll_cf_0 + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (624, 789) _rotation @@ -772,7 +776,7 @@ _coordinate - (862, 621) + (832, 781) _rotation @@ -795,7 +799,7 @@ value - 0.005 + 0.1 min @@ -827,13 +831,181 @@ _coordinate - (344, 101) + (593, 98) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (102, 368) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_0 + + + _enabled + True + + + stream_id + samples + + + _coordinate + (1076, 376) _rotation 0 + + gr_throttle + + id + throttle + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (877, 376) + + + _rotation + 0 + + + + gr_deinterleave + + id + gr_deinterleave_0 + + + _enabled + True + + + type + float + + + num_streams + 2 + + + vlen + 1 + + + _coordinate + (466, 363) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_0 + + + _enabled + True + + + _coordinate + (278, 380) + + + _rotation + 0 + + + + gr_float_to_complex + + id + gr_float_to_complex_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (653, 363) + + + _rotation + 0 + + + + virtual_source_0 + agr + 0 + 0 + noaa_hrpt_deframer_0 gr_file_sink_1 @@ -871,26 +1043,50 @@ 0 - throttle - agr + agr + matched_filter + 0 + 0 + + + matched_filter + noaa_hrpt_pll_cf_0 0 0 - src + gr_float_to_complex_0 throttle 0 0 - agr - matched_filter + gr_short_to_float_0 + gr_deinterleave_0 0 0 - matched_filter - noaa_hrpt_pll_cf_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 + 0 + 0 + + + throttle + virtual_sink_0 0 0 diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 032db315..6c50a348 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 12:45:30 2009 +# Generated: Sun Sep 20 19:09:57 2009 ################################################## from gnuradio import eng_notation @@ -20,18 +20,23 @@ import wx class usrp_rx_hrpt(grc_wxgui.top_block_gui): - def __init__(self): + def __init__(self, filename="", decim=16): grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + ################################################## + # Parameters + ################################################## + self.filename = filename + self.decim = decim + ################################################## # Variables ################################################## - self.decim = decim = 16 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.005 - self.pll_alpha = pll_alpha = 0.001 + self.sync_alpha = sync_alpha = 0.1 + self.pll_alpha = pll_alpha = 0.005 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) @@ -98,7 +103,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # 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.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) 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) @@ -119,7 +128,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): peak_hold=False, ) self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", False) self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), @@ -147,16 +155,23 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## # 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.throttle, 0), (self.agr, 0)) - self.connect((self.src, 0), (self.throttle, 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)) + + def set_filename(self, filename): + self.filename = filename def set_decim(self, decim): self.decim = decim @@ -168,11 +183,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate - self.set_sps(self.sample_rate/self.sym_rate) - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.rx_fftsink.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) def set_sps(self, sps): self.sps = sps @@ -206,7 +221,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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() + tb = usrp_rx_hrpt(filename=options.filename, decim=options.decim) tb.Run(True) -- 2.30.2