summaryrefslogtreecommitdiff
path: root/gr-noaa/apps/usrp_rx_hrpt.py
diff options
context:
space:
mode:
authorJohnathan Corgan2009-09-27 10:15:04 -0700
committerJohnathan Corgan2009-09-27 10:15:04 -0700
commitec8c8e0e9d68383279b0fb51a52adf04f11fd88a (patch)
tree758889bdb1c3a5e68055e579f77f324ce9cf181c /gr-noaa/apps/usrp_rx_hrpt.py
parent9a64a37f23ea4ea7571ad6dff873a2b43551b9aa (diff)
downloadgnuradio-ec8c8e0e9d68383279b0fb51a52adf04f11fd88a.tar.gz
gnuradio-ec8c8e0e9d68383279b0fb51a52adf04f11fd88a.tar.bz2
gnuradio-ec8c8e0e9d68383279b0fb51a52adf04f11fd88a.zip
General improvements in HRPT receiver
Added usrp_rx_hrpt_nogui script Simplified usrp_rx_hrpt script for lower CPU usage Changed matched filtering taps to be whole symbol
Diffstat (limited to 'gr-noaa/apps/usrp_rx_hrpt.py')
-rwxr-xr-xgr-noaa/apps/usrp_rx_hrpt.py82
1 files changed, 24 insertions, 58 deletions
diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py
index 7efbecd3a..9b19d5e4f 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: Wed Sep 23 11:32:04 2009
+# Generated: Sun Sep 27 10:06:41 2009
##################################################
from gnuradio import eng_notation
@@ -10,7 +10,6 @@ from gnuradio import gr
from gnuradio import noaa
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
-from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from gnuradio.wxgui import scopesink2
from grc_gnuradio import usrp as grc_usrp
@@ -62,6 +61,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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
@@ -70,22 +70,14 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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.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), "Demod")
- self.GridAdd(self.displays, 2, 0, 1, 4)
-
- ##################################################
# Controls
##################################################
_sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -189,11 +181,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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.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.displays.GetPage(1).GetWin(),
- title="Post-PLL",
+ self.GetWin(),
+ title="Demod Waveform",
sample_rate=sample_rate,
v_scale=0.5,
t_scale=20.0/sample_rate,
@@ -201,34 +193,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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=freq,
- y_per_div=5,
- y_divs=8,
- ref_level=-5,
- ref_scale=2.0,
- sample_rate=sample_rate,
- fft_size=1024,
- fft_rate=30,
- average=True,
- avg_alpha=0.1,
- title="RX Spectrum",
- peak_hold=False,
- )
- 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,
- v_scale=0,
- t_scale=20.0/sample_rate,
- ac_couple=False,
- xy_mode=False,
- num_inputs=1,
- )
- self.displays.GetPage(0).GridAdd(self.rx_scope.win, 1, 0, 1, 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)
@@ -238,16 +203,14 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
##################################################
# Connections
##################################################
- 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.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
@@ -314,8 +277,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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.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):
@@ -348,6 +309,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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)
@@ -387,6 +352,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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)
@@ -395,10 +364,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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)
-
def set_gain(self, gain):
self.gain = gain
self._gain_slider.set_value(self.gain)
@@ -421,7 +386,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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
@@ -430,6 +394,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
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)