From 350726ae56d46d2c7c1adf71b7049369a428d455 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 2 Apr 2012 22:51:55 -0400 Subject: noaa: moving apps to examples. --- gr-noaa/CMakeLists.txt | 2 +- gr-noaa/apps/CMakeLists.txt | 31 - gr-noaa/apps/file_rx_hrpt.grc | 903 -------------- gr-noaa/apps/file_rx_hrpt.py | 239 ---- gr-noaa/apps/hrpt_decode.grc | 428 ------- gr-noaa/apps/hrpt_decode.py | 98 -- gr-noaa/apps/hrpt_demod.grc | 751 ------------ gr-noaa/apps/hrpt_demod.py | 161 --- gr-noaa/apps/usrp_rx_hrpt.grc | 1975 ------------------------------- gr-noaa/apps/usrp_rx_hrpt.py | 462 -------- gr-noaa/apps/usrp_rx_hrpt_nogui.grc | 1472 ----------------------- gr-noaa/apps/usrp_rx_hrpt_nogui.py | 268 ----- gr-noaa/examples/CMakeLists.txt | 31 + gr-noaa/examples/file_rx_hrpt.grc | 903 ++++++++++++++ gr-noaa/examples/file_rx_hrpt.py | 239 ++++ gr-noaa/examples/hrpt_decode.grc | 428 +++++++ gr-noaa/examples/hrpt_decode.py | 98 ++ gr-noaa/examples/hrpt_demod.grc | 751 ++++++++++++ gr-noaa/examples/hrpt_demod.py | 161 +++ gr-noaa/examples/usrp_rx_hrpt.grc | 1975 +++++++++++++++++++++++++++++++ gr-noaa/examples/usrp_rx_hrpt.py | 462 ++++++++ gr-noaa/examples/usrp_rx_hrpt_nogui.grc | 1472 +++++++++++++++++++++++ gr-noaa/examples/usrp_rx_hrpt_nogui.py | 268 +++++ 23 files changed, 6789 insertions(+), 6789 deletions(-) delete mode 100644 gr-noaa/apps/CMakeLists.txt delete mode 100644 gr-noaa/apps/file_rx_hrpt.grc delete mode 100755 gr-noaa/apps/file_rx_hrpt.py delete mode 100644 gr-noaa/apps/hrpt_decode.grc delete mode 100755 gr-noaa/apps/hrpt_decode.py delete mode 100644 gr-noaa/apps/hrpt_demod.grc delete mode 100755 gr-noaa/apps/hrpt_demod.py delete mode 100644 gr-noaa/apps/usrp_rx_hrpt.grc delete mode 100755 gr-noaa/apps/usrp_rx_hrpt.py delete mode 100644 gr-noaa/apps/usrp_rx_hrpt_nogui.grc delete mode 100755 gr-noaa/apps/usrp_rx_hrpt_nogui.py create mode 100644 gr-noaa/examples/CMakeLists.txt create mode 100644 gr-noaa/examples/file_rx_hrpt.grc create mode 100755 gr-noaa/examples/file_rx_hrpt.py create mode 100644 gr-noaa/examples/hrpt_decode.grc create mode 100755 gr-noaa/examples/hrpt_decode.py create mode 100644 gr-noaa/examples/hrpt_demod.grc create mode 100755 gr-noaa/examples/hrpt_demod.py create mode 100644 gr-noaa/examples/usrp_rx_hrpt.grc create mode 100755 gr-noaa/examples/usrp_rx_hrpt.py create mode 100644 gr-noaa/examples/usrp_rx_hrpt_nogui.grc create mode 100755 gr-noaa/examples/usrp_rx_hrpt_nogui.py (limited to 'gr-noaa') diff --git a/gr-noaa/CMakeLists.txt b/gr-noaa/CMakeLists.txt index a3a5d56db..eeec1cc8c 100644 --- a/gr-noaa/CMakeLists.txt +++ b/gr-noaa/CMakeLists.txt @@ -81,7 +81,7 @@ add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) add_subdirectory(grc) - add_subdirectory(apps) + add_subdirectory(examples) endif(ENABLE_PYTHON) ######################################################################## diff --git a/gr-noaa/apps/CMakeLists.txt b/gr-noaa/apps/CMakeLists.txt deleted file mode 100644 index 233f0ee5f..000000000 --- a/gr-noaa/apps/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - hrpt_decode.py - hrpt_demod.py - file_rx_hrpt.py - usrp_rx_hrpt.py - usrp_rx_hrpt_nogui.py - DESTINATION ${GR_RUNTIME_DIR} - COMPONENT "noaa_python" -) diff --git a/gr-noaa/apps/file_rx_hrpt.grc b/gr-noaa/apps/file_rx_hrpt.grc deleted file mode 100644 index 4097e83d3..000000000 --- a/gr-noaa/apps/file_rx_hrpt.grc +++ /dev/null @@ -1,903 +0,0 @@ - - - Thu Oct 27 13:48:25 2011 - - 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 - max_clock_offset - - - _enabled - True - - - value - 100e-6 - - - _coordinate - (705, 19) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math, os - - - _coordinate - (9, 106) - - - _rotation - 0 - - - - variable - - id - config_filename - - - _enabled - True - - - value - os.environ['HOME']+'/.gnuradio/config.conf' - - - _coordinate - (13, 168) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 4e6 - - - _coordinate - (198, 17) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx - - id - digital_clock_recovery_mm_xx_0 - - - _enabled - True - - - type - float - - - omega - sps/2.0 - - - gain_omega - clock_alpha**2/4.0 - - - mu - 0.5 - - - gain_mu - clock_alpha - - - omega_relative_limit - max_clock_offset - - - _coordinate - (897, 341) - - - _rotation - 0 - - - - virtual_sink - - id - virtual_sink_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (1139, 373) - - - _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 - (470, 357) - - - _rotation - 0 - - - - gr_moving_average_xx - - id - gr_moving_average_xx_0 - - - _enabled - True - - - type - float - - - length - hs - - - scale - 1.0/hs - - - max_iter - 4000 - - - _coordinate - (683, 357) - - - _rotation - 0 - - - - gr_file_sink - - id - frame_sink - - - _enabled - True - - - file - output_filename - - - type - short - - - vlen - 1 - - - unbuffered - False - - - _coordinate - (809, 595) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - verbose - True - - - output - True - - - _coordinate - (810, 496) - - - _rotation - 0 - - - - gr_agc_xx - - id - agc - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (302, 349) - - - _rotation - 0 - - - - gr_interleaved_short_to_complex - - id - gr_interleaved_short_to_complex_0 - - - _enabled - True - - - _coordinate - (92, 377) - - - _rotation - 0 - - - - gr_throttle - - id - throttle - - - _enabled - True - - - type - short - - - samples_per_second - 2*sample_rate - - - vlen - 1 - - - _coordinate - (94, 323) - - - _rotation - 180 - - - - gr_file_source - - id - gr_file_source_0 - - - _enabled - True - - - file - input_filename - - - type - short - - - repeat - False - - - vlen - 1 - - - _coordinate - (95, 257) - - - _rotation - 0 - - - - variable_config - - id - freq - - - _enabled - True - - - value - 1698e6 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'freq' - - - writeback - freq - - - _coordinate - (218, 104) - - - _rotation - 0 - - - - variable_config - - id - gain - - - _enabled - True - - - value - 35 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'gain' - - - writeback - gain - - - _coordinate - (375, 105) - - - _rotation - 0 - - - - variable_config - - id - pll_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'pll_alpha' - - - writeback - pll_alpha - - - _coordinate - (534, 104) - - - _rotation - 0 - - - - variable_config - - id - clock_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'clock_alpha' - - - writeback - clock_alpha - - - _coordinate - (692, 104) - - - _rotation - 0 - - - - variable_config - - id - output_filename - - - _enabled - True - - - value - 'frames.hrpt' - - - type - string - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'filename' - - - writeback - output_filename - - - _coordinate - (850, 105) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - deframer - - - _enabled - True - - - _coordinate - (598, 546) - - - _rotation - 0 - - - - virtual_source - - id - virtual_source_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (90, 542) - - - _rotation - 0 - - - - digital_binary_slicer_fb - - id - digital_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (332, 546) - - - _rotation - 0 - - - - options - - id - file_rx_hrpt - - - _enabled - True - - - title - USRP HRPT Receiver - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - no_gui - - - category - Custom - - - run_options - prompt - - - run - True - - - realtime_scheduling - - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx_0 - virtual_sink_0 - 0 - 0 - - - gr_moving_average_xx_0 - digital_clock_recovery_mm_xx_0 - 0 - 0 - - - pll - gr_moving_average_xx_0 - 0 - 0 - - - agc - pll - 0 - 0 - - - deframer - decoder - 0 - 0 - - - deframer - frame_sink - 0 - 0 - - - gr_interleaved_short_to_complex_0 - agc - 0 - 0 - - - throttle - gr_interleaved_short_to_complex_0 - 0 - 0 - - - gr_file_source_0 - throttle - 0 - 0 - - - virtual_source_0 - digital_binary_slicer_fb_0 - 0 - 0 - - - digital_binary_slicer_fb_0 - deframer - 0 - 0 - - diff --git a/gr-noaa/apps/file_rx_hrpt.py b/gr-noaa/apps/file_rx_hrpt.py deleted file mode 100755 index fcd1832f6..000000000 --- a/gr-noaa/apps/file_rx_hrpt.py +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Thu Oct 27 13:48:25 2011 -################################################## - -from gnuradio import digital -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 ConfigParser -import math, os - -class file_rx_hrpt(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self, "USRP HRPT Receiver") - - ################################################## - # Variables - ################################################## - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 4e6 - self.sps = sps = sample_rate/sym_rate - self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(config_filename) - try: pll_alpha = self._pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') - except: pll_alpha = 0.01 - self.pll_alpha = pll_alpha - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') - except: output_filename = 'frames.hrpt' - self.output_filename = output_filename - self.max_clock_offset = max_clock_offset = 100e-6 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.hs = hs = int(sps/2.0) - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(config_filename) - try: gain = self._gain_config.getfloat('usrp_rx_hrpt', 'gain') - except: gain = 35 - self.gain = gain - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(config_filename) - try: freq = self._freq_config.getfloat('usrp_rx_hrpt', 'freq') - except: freq = 1698e6 - self.freq = freq - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(config_filename) - try: clock_alpha = self._clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') - except: clock_alpha = 0.01 - self.clock_alpha = clock_alpha - - ################################################## - # Blocks - ################################################## - self.throttle = gr.throttle(gr.sizeof_short*1, 2*sample_rate) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) - self.gr_interleaved_short_to_complex_0 = gr.interleaved_short_to_complex() - self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "input_filename", False) - self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.frame_sink.set_unbuffered(False) - self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) - self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() - self.deframer = noaa.hrpt_deframer() - self.decoder = noaa.hrpt_decoder(True,True) - self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) - self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) - self.connect((self.agc, 0), (self.pll, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.deframer, 0), (self.frame_sink, 0)) - self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.agc, 0)) - self.connect((self.throttle, 0), (self.gr_interleaved_short_to_complex_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.throttle, 0)) - self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) - self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) - - def get_sym_rate(self): - return self.sym_rate - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - - def get_sample_rate(self): - return self.sample_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 get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) - - def get_config_filename(self): - return self.config_filename - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp_rx_hrpt'): - self._freq_config.add_section('usrp_rx_hrpt') - self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._freq_config.write(open(self.config_filename, 'w')) - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp_rx_hrpt'): - self._gain_config.add_section('usrp_rx_hrpt') - self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._gain_config.write(open(self.config_filename, 'w')) - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): - self._pll_alpha_config.add_section('usrp_rx_hrpt') - self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._pll_alpha_config.write(open(self.config_filename, 'w')) - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(self.config_filename) - if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): - self._clock_alpha_config.add_section('usrp_rx_hrpt') - self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._clock_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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def get_pll_alpha(self): - return self.pll_alpha - - 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) - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): - self._pll_alpha_config.add_section('usrp_rx_hrpt') - self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._pll_alpha_config.write(open(self.config_filename, 'w')) - - def get_output_filename(self): - return self.output_filename - - 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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def get_max_clock_offset(self): - return self.max_clock_offset - - def set_max_clock_offset(self, max_clock_offset): - self.max_clock_offset = max_clock_offset - - def get_max_carrier_offset(self): - return self.max_carrier_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 get_hs(self): - return self.hs - - def set_hs(self, hs): - self.hs = hs - self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) - - def get_gain(self): - return self.gain - - def set_gain(self, gain): - self.gain = gain - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp_rx_hrpt'): - self._gain_config.add_section('usrp_rx_hrpt') - self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._gain_config.write(open(self.config_filename, 'w')) - - def get_freq(self): - return self.freq - - def set_freq(self, freq): - self.freq = freq - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp_rx_hrpt'): - self._freq_config.add_section('usrp_rx_hrpt') - self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._freq_config.write(open(self.config_filename, 'w')) - - def get_clock_alpha(self): - return self.clock_alpha - - def set_clock_alpha(self, clock_alpha): - self.clock_alpha = clock_alpha - self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) - self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(self.config_filename) - if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): - self._clock_alpha_config.add_section('usrp_rx_hrpt') - self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._clock_alpha_config.write(open(self.config_filename, 'w')) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - tb = file_rx_hrpt() - tb.start() - raw_input('Press Enter to quit: ') - tb.stop() - diff --git a/gr-noaa/apps/hrpt_decode.grc b/gr-noaa/apps/hrpt_decode.grc deleted file mode 100644 index 39fe195d1..000000000 --- a/gr-noaa/apps/hrpt_decode.grc +++ /dev/null @@ -1,428 +0,0 @@ - - - Sun Nov 8 10:48:59 2009 - - options - - id - hrpt_decode - - - _enabled - True - - - title - - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - no_gui - - - category - Custom - - - run_options - run - - - run - True - - - realtime_scheduling - - - - _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 - 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 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math, os - - - _coordinate - (11, 103) - - - _rotation - 0 - - - - variable - - id - max_clock_offset - - - _enabled - True - - - value - 100e-6 - - - _coordinate - (710, 17) - - - _rotation - 0 - - - - variable - - id - sym_rate - - - _enabled - True - - - value - 600*1109 - - - _coordinate - (307, 18) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - sample_rate/sym_rate - - - _coordinate - (400, 17) - - - _rotation - 0 - - - - parameter - - id - decim - - - _enabled - True - - - label - decim - - - value - 32 - - - type - intx - - - short_id - d - - - _coordinate - (202, 102) - - - _rotation - 0 - - - - parameter - - id - pll_alpha - - - _enabled - True - - - label - pll_alpha - - - value - 0.01 - - - type - eng_float - - - short_id - p - - - _coordinate - (294, 101) - - - _rotation - 0 - - - - parameter - - id - clock_alpha - - - _enabled - True - - - label - clock_alpha - - - value - 0.01 - - - type - eng_float - - - short_id - s - - - _coordinate - (395, 101) - - - _rotation - 0 - - - - gr_file_source - - id - file_source - - - _enabled - True - - - file - input_filename - - - type - short - - - repeat - False - - - vlen - 1 - - - _coordinate - (231, 419) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - verbose - True - - - output - True - - - _coordinate - (462, 419) - - - _rotation - 0 - - - - parameter - - id - input_filename - - - _enabled - True - - - label - input_filename - - - value - frames.hrpt - - - type - string - - - short_id - F - - - _coordinate - (522, 100) - - - _rotation - 0 - - - - file_source - decoder - 0 - 0 - - diff --git a/gr-noaa/apps/hrpt_decode.py b/gr-noaa/apps/hrpt_decode.py deleted file mode 100755 index 158780b17..000000000 --- a/gr-noaa/apps/hrpt_decode.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: Hrpt Decode -# Generated: Sun Nov 8 10:49:01 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, os - -class hrpt_decode(gr.top_block): - - def __init__(self, decim=32, pll_alpha=0.01, clock_alpha=0.01, input_filename="frames.hrpt"): - gr.top_block.__init__(self, "Hrpt Decode") - - ################################################## - # Parameters - ################################################## - self.decim = decim - self.pll_alpha = pll_alpha - self.clock_alpha = clock_alpha - self.input_filename = input_filename - - ################################################## - # Variables - ################################################## - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 64e6/decim - self.sps = sps = sample_rate/sym_rate - self.max_clock_offset = max_clock_offset = 100e-6 - 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(True,True) - self.file_source = gr.file_source(gr.sizeof_short*1, input_filename, False) - - ################################################## - # Connections - ################################################## - self.connect((self.file_source, 0), (self.decoder, 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 - - def set_clock_alpha(self, clock_alpha): - self.clock_alpha = clock_alpha - - def set_input_filename(self, input_filename): - self.input_filename = input_filename - - 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_clock_offset(self, max_clock_offset): - self.max_clock_offset = max_clock_offset - - def set_max_carrier_offset(self, max_carrier_offset): - self.max_carrier_offset = max_carrier_offset - - def set_hs(self, hs): - self.hs = hs - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - parser.add_option("-d", "--decim", dest="decim", type="intx", default=32, - help="Set decim [default=%default]") - parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), - help="Set pll_alpha [default=%default]") - parser.add_option("-s", "--clock-alpha", dest="clock_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), - help="Set clock_alpha [default=%default]") - parser.add_option("-F", "--input-filename", dest="input_filename", type="string", default="frames.hrpt", - help="Set frames.hrpt [default=%default]") - (options, args) = parser.parse_args() - tb = hrpt_decode(decim=options.decim, pll_alpha=options.pll_alpha, clock_alpha=options.clock_alpha, input_filename=options.input_filename) - tb.run() - diff --git a/gr-noaa/apps/hrpt_demod.grc b/gr-noaa/apps/hrpt_demod.grc deleted file mode 100644 index f5833b864..000000000 --- a/gr-noaa/apps/hrpt_demod.grc +++ /dev/null @@ -1,751 +0,0 @@ - - - Thu Oct 27 13:51:57 2011 - - options - - id - hrpt_demod - - - _enabled - True - - - title - - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - no_gui - - - category - Custom - - - run_options - run - - - run - True - - - realtime_scheduling - - - - _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 - hs - - - _enabled - True - - - value - int(sps/2.0) - - - _coordinate - (499, 19) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math, os - - - _coordinate - (11, 103) - - - _rotation - 0 - - - - parameter - - id - input_filename - - - _enabled - True - - - label - input_filename - - - value - usrp.dat - - - type - string - - - short_id - F - - - _coordinate - (618, 102) - - - _rotation - 0 - - - - parameter - - id - output_filename - - - _enabled - True - - - label - output_filename - - - value - frames.dat - - - type - string - - - short_id - o - - - _coordinate - (726, 102) - - - _rotation - 180 - - - - gr_file_source - - id - file_source - - - _enabled - True - - - file - input_filename - - - type - short - - - repeat - False - - - vlen - 1 - - - _coordinate - (63, 277) - - - _rotation - 0 - - - - gr_interleaved_short_to_complex - - id - cs2cf - - - _enabled - True - - - _coordinate - (275, 289) - - - _rotation - 0 - - - - gr_agc_xx - - id - agc - - - _enabled - True - - - type - complex - - - rate - 1e-5 - - - reference - 1.0 - - - gain - 1.0/32768.0 - - - max_gain - 1.0 - - - _coordinate - (117, 394) - - - _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 - (292, 402) - - - _rotation - 0 - - - - variable - - id - max_clock_offset - - - _enabled - True - - - value - 100e-6 - - - _coordinate - (710, 17) - - - _rotation - 0 - - - - variable - - id - sym_rate - - - _enabled - True - - - value - 600*1109 - - - _coordinate - (307, 18) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - sample_rate/sym_rate - - - _coordinate - (400, 17) - - - _rotation - 0 - - - - parameter - - id - decim - - - _enabled - True - - - label - decim - - - value - 32 - - - type - intx - - - short_id - d - - - _coordinate - (202, 102) - - - _rotation - 0 - - - - parameter - - id - pll_alpha - - - _enabled - True - - - label - pll_alpha - - - value - 0.01 - - - type - eng_float - - - short_id - p - - - _coordinate - (294, 101) - - - _rotation - 0 - - - - parameter - - id - clock_alpha - - - _enabled - True - - - label - clock_alpha - - - value - 0.01 - - - type - eng_float - - - short_id - s - - - _coordinate - (395, 101) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - verbose - True - - - output - False - - - _coordinate - (1150, 341) - - - _rotation - 180 - - - - gr_file_sink - - id - gr_file_sink_0 - - - _enabled - True - - - file - output_filename - - - type - short - - - vlen - 1 - - - unbuffered - False - - - _coordinate - (1144, 489) - - - _rotation - 180 - - - - gr_moving_average_xx - - id - gr_moving_average_xx_0 - - - _enabled - True - - - type - float - - - length - hs - - - scale - 1.0/hs - - - max_iter - 4000 - - - _coordinate - (504, 402) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 4e6 - - - _coordinate - (198, 17) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx - - id - digital_clock_recovery_mm_xx_0 - - - _enabled - True - - - type - float - - - omega - sps/2.0 - - - gain_omega - clock_alpha**2/4.0 - - - mu - 0.5 - - - gain_mu - clock_alpha - - - omega_relative_limit - max_clock_offset - - - _coordinate - (704, 386) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - noaa_hrpt_deframer_0 - - - _enabled - True - - - _coordinate - (1142, 422) - - - _rotation - 0 - - - - digital_binary_slicer_fb - - id - digital_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (957, 422) - - - _rotation - 0 - - - - file_source - cs2cf - 0 - 0 - - - pll - gr_moving_average_xx_0 - 0 - 0 - - - cs2cf - agc - 0 - 0 - - - agc - pll - 0 - 0 - - - noaa_hrpt_deframer_0 - gr_file_sink_0 - 0 - 0 - - - noaa_hrpt_deframer_0 - decoder - 0 - 0 - - - gr_moving_average_xx_0 - digital_clock_recovery_mm_xx_0 - 0 - 0 - - - digital_clock_recovery_mm_xx_0 - digital_binary_slicer_fb_0 - 0 - 0 - - - digital_binary_slicer_fb_0 - noaa_hrpt_deframer_0 - 0 - 0 - - diff --git a/gr-noaa/apps/hrpt_demod.py b/gr-noaa/apps/hrpt_demod.py deleted file mode 100755 index 38b4b2fe3..000000000 --- a/gr-noaa/apps/hrpt_demod.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: Hrpt Demod -# Generated: Thu Oct 27 13:51:59 2011 -################################################## - -from gnuradio import digital -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, os - -class hrpt_demod(gr.top_block): - - def __init__(self, input_filename="usrp.dat", output_filename="frames.dat", decim=32, pll_alpha=0.01, clock_alpha=0.01): - gr.top_block.__init__(self, "Hrpt Demod") - - ################################################## - # Parameters - ################################################## - self.input_filename = input_filename - self.output_filename = output_filename - self.decim = decim - self.pll_alpha = pll_alpha - self.clock_alpha = clock_alpha - - ################################################## - # Variables - ################################################## - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 4e6 - self.sps = sps = sample_rate/sym_rate - self.max_clock_offset = max_clock_offset = 100e-6 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.hs = hs = int(sps/2.0) - - ################################################## - # Blocks - ################################################## - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() - self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) - self.gr_file_sink_0 = gr.file_sink(gr.sizeof_short*1, output_filename) - self.gr_file_sink_0.set_unbuffered(False) - self.file_source = gr.file_source(gr.sizeof_short*1, input_filename, False) - self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) - self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() - self.decoder = noaa.hrpt_decoder(True,False) - self.cs2cf = gr.interleaved_short_to_complex() - self.agc = gr.agc_cc(1e-5, 1.0, 1.0/32768.0, 1.0) - - ################################################## - # Connections - ################################################## - self.connect((self.file_source, 0), (self.cs2cf, 0)) - self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) - self.connect((self.cs2cf, 0), (self.agc, 0)) - self.connect((self.agc, 0), (self.pll, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_0, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.decoder, 0)) - self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) - self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) - self.connect((self.digital_binary_slicer_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) - - def get_input_filename(self): - return self.input_filename - - def set_input_filename(self, input_filename): - self.input_filename = input_filename - - def get_output_filename(self): - return self.output_filename - - def set_output_filename(self, output_filename): - self.output_filename = output_filename - - def get_decim(self): - return self.decim - - def set_decim(self, decim): - self.decim = decim - - def get_pll_alpha(self): - return self.pll_alpha - - 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 get_clock_alpha(self): - return self.clock_alpha - - def set_clock_alpha(self, clock_alpha): - self.clock_alpha = clock_alpha - self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) - self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) - - def get_sym_rate(self): - return self.sym_rate - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - - def get_sample_rate(self): - return self.sample_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 get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) - - def get_max_clock_offset(self): - return self.max_clock_offset - - def set_max_clock_offset(self, max_clock_offset): - self.max_clock_offset = max_clock_offset - - def get_max_carrier_offset(self): - return self.max_carrier_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 get_hs(self): - return self.hs - - def set_hs(self, hs): - self.hs = hs - self.gr_moving_average_xx_0.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("-F", "--input-filename", dest="input_filename", type="string", default="usrp.dat", - help="Set usrp.dat [default=%default]") - parser.add_option("-o", "--output-filename", dest="output_filename", type="string", default="frames.dat", - help="Set frames.dat [default=%default]") - parser.add_option("-d", "--decim", dest="decim", type="intx", default=32, - help="Set None [default=%default]") - parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), - help="Set None [default=%default]") - parser.add_option("-s", "--clock-alpha", dest="clock_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), - help="Set None [default=%default]") - (options, args) = parser.parse_args() - tb = hrpt_demod(input_filename=options.input_filename, output_filename=options.output_filename, decim=options.decim, pll_alpha=options.pll_alpha, clock_alpha=options.clock_alpha) - tb.run() - diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc deleted file mode 100644 index 26af48ff0..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ /dev/null @@ -1,1975 +0,0 @@ - - - Thu Oct 27 13:26:39 2011 - - options - - id - usrp_rx_hrpt - - - _enabled - True - - - title - USRP HRPT Receiver - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - wx_gui - - - category - Custom - - - run_options - prompt - - - run - True - - - realtime_scheduling - - - - _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_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 - clock_alpha - - - _enabled - True - - - label - Clock Alpha - - - value - saved_clock_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 - - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - - labels - ['Spectrum','Demod'] - - - grid_pos - 2,0,1,4 - - - notebook - - - - _coordinate - (12, 249) - - - _rotation - 0 - - - - wxgui_fftsink2 - - id - rx_fft - - - _enabled - True - - - type - complex - - - title - RX Spectrum - - - samp_rate - sample_rate - - - baseband_freq - freq - - - y_per_div - 5 - - - y_divs - 8 - - - ref_level - -5 - - - ref_scale - 2.0 - - - fft_size - 1024 - - - fft_rate - 15 - - - peak_hold - False - - - average - True - - - avg_alpha - 0.1 - - - win - None - - - win_size - 640, 360 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (477, 457) - - - _rotation - 0 - - - - variable - - id - max_clock_offset - - - _enabled - True - - - value - 100e-6 - - - _coordinate - (705, 19) - - - _rotation - 0 - - - - gr_agc_xx - - id - agc - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (301, 705) - - - _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 - (469, 713) - - - _rotation - 0 - - - - variable_config - - id - addr - - - _enabled - True - - - value - "" - - - type - string - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'addr' - - - writeback - addr - - - _coordinate - (194, 253) - - - _rotation - 0 - - - - uhd_usrp_source - - id - uhd_usrp_source_0 - - - _enabled - True - - - type - complex - - - dev_addr - addr - - - sync - - - - clock_rate - 0.0 - - - num_mboards - 1 - - - ref_source0 - - - - sd_spec0 - - - - ref_source1 - - - - sd_spec1 - - - - ref_source2 - - - - sd_spec2 - - - - ref_source3 - - - - sd_spec3 - - - - ref_source4 - - - - sd_spec4 - - - - ref_source5 - - - - sd_spec5 - - - - ref_source6 - - - - sd_spec6 - - - - ref_source7 - - - - sd_spec7 - - - - nchan - 1 - - - samp_rate - sample_rate - - - center_freq0 - freq - - - gain0 - 0 - - - ant0 - - - - bw0 - 0 - - - center_freq1 - 0 - - - gain1 - 0 - - - ant1 - - - - bw1 - 0 - - - center_freq2 - 0 - - - gain2 - 0 - - - ant2 - - - - bw2 - 0 - - - center_freq3 - 0 - - - gain3 - 0 - - - ant3 - - - - bw3 - 0 - - - center_freq4 - 0 - - - gain4 - 0 - - - ant4 - - - - bw4 - 0 - - - center_freq5 - 0 - - - gain5 - 0 - - - ant5 - - - - bw5 - 0 - - - center_freq6 - 0 - - - gain6 - 0 - - - ant6 - - - - bw6 - 0 - - - center_freq7 - 0 - - - gain7 - 0 - - - ant7 - - - - bw7 - 0 - - - center_freq8 - 0 - - - gain8 - 0 - - - ant8 - - - - bw8 - 0 - - - center_freq9 - 0 - - - gain9 - 0 - - - ant9 - - - - bw9 - 0 - - - center_freq10 - 0 - - - gain10 - 0 - - - ant10 - - - - bw10 - 0 - - - center_freq11 - 0 - - - gain11 - 0 - - - ant11 - - - - bw11 - 0 - - - center_freq12 - 0 - - - gain12 - 0 - - - ant12 - - - - bw12 - 0 - - - center_freq13 - 0 - - - gain13 - 0 - - - ant13 - - - - bw13 - 0 - - - center_freq14 - 0 - - - gain14 - 0 - - - ant14 - - - - bw14 - 0 - - - center_freq15 - 0 - - - gain15 - 0 - - - ant15 - - - - bw15 - 0 - - - center_freq16 - 0 - - - gain16 - 0 - - - ant16 - - - - bw16 - 0 - - - center_freq17 - 0 - - - gain17 - 0 - - - ant17 - - - - bw17 - 0 - - - center_freq18 - 0 - - - gain18 - 0 - - - ant18 - - - - bw18 - 0 - - - center_freq19 - 0 - - - gain19 - 0 - - - ant19 - - - - bw19 - 0 - - - center_freq20 - 0 - - - gain20 - 0 - - - ant20 - - - - bw20 - 0 - - - center_freq21 - 0 - - - gain21 - 0 - - - ant21 - - - - bw21 - 0 - - - center_freq22 - 0 - - - gain22 - 0 - - - ant22 - - - - bw22 - 0 - - - center_freq23 - 0 - - - gain23 - 0 - - - ant23 - - - - bw23 - 0 - - - center_freq24 - 0 - - - gain24 - 0 - - - ant24 - - - - bw24 - 0 - - - center_freq25 - 0 - - - gain25 - 0 - - - ant25 - - - - bw25 - 0 - - - center_freq26 - 0 - - - gain26 - 0 - - - ant26 - - - - bw26 - 0 - - - center_freq27 - 0 - - - gain27 - 0 - - - ant27 - - - - bw27 - 0 - - - center_freq28 - 0 - - - gain28 - 0 - - - ant28 - - - - bw28 - 0 - - - center_freq29 - 0 - - - gain29 - 0 - - - ant29 - - - - bw29 - 0 - - - center_freq30 - 0 - - - gain30 - 0 - - - ant30 - - - - bw30 - 0 - - - center_freq31 - 0 - - - gain31 - 0 - - - ant31 - - - - bw31 - 0 - - - _coordinate - (49, 713) - - - _rotation - 0 - - - - variable_static_text - - id - addr_text - - - _enabled - True - - - label - USRP Addr - - - value - addr - - - converver - str_converter - - - formatter - None - - - grid_pos - 1, 0, 1, 1 - - - notebook - - - - _coordinate - (828, 20) - - - _rotation - 0 - - - - variable_static_text - - id - rate_text - - - _enabled - True - - - label - Baseband Rate - - - value - sample_rate - - - converver - float_converter - - - formatter - None - - - grid_pos - 1, 1, 1, 1 - - - notebook - - - - _coordinate - (973, 20) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math, os - - - _coordinate - (9, 106) - - - _rotation - 0 - - - - variable - - id - config_filename - - - _enabled - True - - - value - os.environ['HOME']+'/.gnuradio/config.conf' - - - _coordinate - (13, 168) - - - _rotation - 0 - - - - variable_config - - id - output_filename - - - _enabled - True - - - value - 'frames.hrpt' - - - type - string - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'filename' - - - writeback - output_filename - - - _coordinate - (990, 255) - - - _rotation - 0 - - - - variable_config - - id - saved_clock_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'clock_alpha' - - - writeback - clock_alpha - - - _coordinate - (832, 254) - - - _rotation - 0 - - - - variable_config - - id - saved_pll_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'pll_alpha' - - - writeback - pll_alpha - - - _coordinate - (674, 254) - - - _rotation - 0 - - - - variable_config - - id - saved_gain - - - _enabled - True - - - value - 35 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'gain' - - - writeback - gain - - - _coordinate - (515, 255) - - - _rotation - 0 - - - - variable_config - - id - saved_freq - - - _enabled - True - - - value - 1698e6 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'freq' - - - writeback - freq - - - _coordinate - (358, 254) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 4e6 - - - _coordinate - (198, 17) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - demod_scope - - - _enabled - True - - - type - float - - - title - Post-Demod - - - samp_rate - sym_rate*2.0 - - - v_scale - 0.5 - - - v_offset - 0 - - - t_scale - 10.0/sym_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - win_size - - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 1 - - - trig_mode - gr.gr_TRIG_MODE_AUTO - - - y_axis_label - Counts - - - _coordinate - (666, 542) - - - _rotation - 180 - - - - gr_moving_average_xx - - id - gr_moving_average_xx_0 - - - _enabled - True - - - type - float - - - length - hs - - - scale - 1.0/hs - - - max_iter - 4000 - - - _coordinate - (682, 713) - - - _rotation - 0 - - - - virtual_sink - - id - virtual_sink_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (1138, 729) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx - - id - digital_clock_recovery_mm_xx_0 - - - _enabled - True - - - type - float - - - omega - sps/2.0 - - - gain_omega - clock_alpha**2/4.0 - - - mu - 0.5 - - - gain_mu - clock_alpha - - - omega_relative_limit - max_clock_offset - - - _coordinate - (896, 697) - - - _rotation - 0 - - - - virtual_source - - id - virtual_source_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (173, 971) - - - _rotation - 0 - - - - digital_binary_slicer_fb - - id - digital_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (423, 975) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - deframer - - - _enabled - True - - - _coordinate - (762, 975) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - verbose - True - - - output - True - - - _coordinate - (974, 925) - - - _rotation - 0 - - - - gr_file_sink - - id - frame_sink - - - _enabled - True - - - file - output_filename - - - type - short - - - vlen - 1 - - - unbuffered - False - - - _coordinate - (973, 1024) - - - _rotation - 0 - - - - deframer - frame_sink - 0 - 0 - - - deframer - decoder - 0 - 0 - - - agc - pll - 0 - 0 - - - agc - rx_fft - 0 - 0 - - - uhd_usrp_source_0 - agc - 0 - 0 - - - pll - gr_moving_average_xx_0 - 0 - 0 - - - gr_moving_average_xx_0 - demod_scope - 0 - 0 - - - gr_moving_average_xx_0 - digital_clock_recovery_mm_xx_0 - 0 - 0 - - - digital_clock_recovery_mm_xx_0 - virtual_sink_0 - 0 - 0 - - - virtual_source_0 - digital_binary_slicer_fb_0 - 0 - 0 - - - digital_binary_slicer_fb_0 - deframer - 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 e603e768e..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ /dev/null @@ -1,462 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Thu Oct 27 13:26:42 2011 -################################################## - -from gnuradio import digital -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import noaa -from gnuradio import uhd -from gnuradio import window -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import forms -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import ConfigParser -import math, os -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.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 4e6 - self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' - self.sps = sps = sample_rate/sym_rate - 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('usrp_rx_hrpt', 'pll_alpha') - except: saved_pll_alpha = 0.01 - 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_rx_hrpt', '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_rx_hrpt', 'freq') - except: saved_freq = 1698e6 - self.saved_freq = saved_freq - self._saved_clock_alpha_config = ConfigParser.ConfigParser() - self._saved_clock_alpha_config.read(config_filename) - try: saved_clock_alpha = self._saved_clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') - except: saved_clock_alpha = 0.01 - self.saved_clock_alpha = saved_clock_alpha - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(config_filename) - try: addr = self._addr_config.get('usrp_rx_hrpt', 'addr') - except: addr = "" - self.addr = addr - self.rate_text = rate_text = sample_rate - 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('usrp_rx_hrpt', 'filename') - except: output_filename = 'frames.hrpt' - self.output_filename = output_filename - self.max_clock_offset = max_clock_offset = 100e-6 - 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.clock_alpha = clock_alpha = saved_clock_alpha - self.addr_text = addr_text = addr - - ################################################## - # Blocks - ################################################## - 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.displays = self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Spectrum") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") - self.GridAdd(self.displays, 2, 0, 1, 4) - _clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._clock_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_clock_alpha_sizer, - value=self.clock_alpha, - callback=self.set_clock_alpha, - label="Clock Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._clock_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_clock_alpha_sizer, - value=self.clock_alpha, - callback=self.set_clock_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_clock_alpha_sizer, 0, 3, 1, 1) - self.uhd_usrp_source_0 = uhd.usrp_source( - device_addr=addr, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1, - ) - self.uhd_usrp_source_0.set_samp_rate(sample_rate) - self.uhd_usrp_source_0.set_center_freq(freq, 0) - self.uhd_usrp_source_0.set_gain(0, 0) - 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=15, - average=True, - avg_alpha=0.1, - title="RX Spectrum", - peak_hold=False, - size=(640, 360), - ) - self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) - self._rate_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.rate_text, - callback=self.set_rate_text, - label="Baseband Rate", - converter=forms.float_converter(), - ) - self.GridAdd(self._rate_text_static_text, 1, 1, 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) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) - _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.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.frame_sink.set_unbuffered(False) - self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) - self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() - self.demod_scope = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-Demod", - sample_rate=sym_rate*2.0, - v_scale=0.5, - v_offset=0, - t_scale=10.0/sym_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - trig_mode=gr.gr_TRIG_MODE_AUTO, - y_axis_label="Counts", - ) - self.displays.GetPage(1).GridAdd(self.demod_scope.win, 0, 0, 1, 1) - self.deframer = noaa.hrpt_deframer() - self.decoder = noaa.hrpt_decoder(True,True) - self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self._addr_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.addr_text, - callback=self.set_addr_text, - label="USRP Addr", - converter=forms.str_converter(), - ) - self.GridAdd(self._addr_text_static_text, 1, 0, 1, 1) - - ################################################## - # Connections - ################################################## - self.connect((self.deframer, 0), (self.frame_sink, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.agc, 0), (self.pll, 0)) - self.connect((self.agc, 0), (self.rx_fft, 0)) - self.connect((self.uhd_usrp_source_0, 0), (self.agc, 0)) - self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) - self.connect((self.gr_moving_average_xx_0, 0), (self.demod_scope, 0)) - self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) - self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) - self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) - - def get_sym_rate(self): - return self.sym_rate - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - self.demod_scope.set_sample_rate(self.sym_rate*2.0) - - def get_sample_rate(self): - return self.sample_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.rx_fft.set_sample_rate(self.sample_rate) - self.uhd_usrp_source_0.set_samp_rate(self.sample_rate) - self.set_rate_text(self.sample_rate) - - def get_config_filename(self): - return self.config_filename - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(self.config_filename) - if not self._addr_config.has_section('usrp_rx_hrpt'): - self._addr_config.add_section('usrp_rx_hrpt') - self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) - self._addr_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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - self._saved_clock_alpha_config = ConfigParser.ConfigParser() - self._saved_clock_alpha_config.read(self.config_filename) - if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): - self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') - self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._saved_clock_alpha_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('usrp_rx_hrpt'): - self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') - self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section('usrp_rx_hrpt'): - self._saved_gain_config.add_section('usrp_rx_hrpt') - self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp_rx_hrpt'): - self._saved_freq_config.add_section('usrp_rx_hrpt') - self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - - def get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) - - def get_saved_pll_alpha(self): - return self.saved_pll_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 get_saved_gain(self): - return self.saved_gain - - def set_saved_gain(self, saved_gain): - self.saved_gain = saved_gain - self.set_gain(self.saved_gain) - - def get_saved_freq(self): - return self.saved_freq - - def set_saved_freq(self, saved_freq): - self.saved_freq = saved_freq - self.set_freq(self.saved_freq) - - def get_saved_clock_alpha(self): - return self.saved_clock_alpha - - def set_saved_clock_alpha(self, saved_clock_alpha): - self.saved_clock_alpha = saved_clock_alpha - self.set_clock_alpha(self.saved_clock_alpha) - - def get_addr(self): - return self.addr - - def set_addr(self, addr): - self.addr = addr - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(self.config_filename) - if not self._addr_config.has_section('usrp_rx_hrpt'): - self._addr_config.add_section('usrp_rx_hrpt') - self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) - self._addr_config.write(open(self.config_filename, 'w')) - self.set_addr_text(self.addr) - - def get_rate_text(self): - return self.rate_text - - def set_rate_text(self, rate_text): - self.rate_text = rate_text - self._rate_text_static_text.set_value(self.rate_text) - - def get_pll_alpha(self): - return self.pll_alpha - - 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.pll.set_alpha(self.pll_alpha) - self.pll.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('usrp_rx_hrpt'): - self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') - self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - - def get_output_filename(self): - return self.output_filename - - 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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def get_max_clock_offset(self): - return self.max_clock_offset - - def set_max_clock_offset(self, max_clock_offset): - self.max_clock_offset = max_clock_offset - - def get_max_carrier_offset(self): - return self.max_carrier_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 get_hs(self): - return self.hs - - def set_hs(self, hs): - self.hs = hs - self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) - - def get_gain(self): - return self.gain - - 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_rx_hrpt'): - self._saved_gain_config.add_section('usrp_rx_hrpt') - self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - - def get_freq(self): - return self.freq - - def set_freq(self, freq): - self.freq = freq - self._freq_text_box.set_value(self.freq) - self.rx_fft.set_baseband_freq(self.freq) - self.uhd_usrp_source_0.set_center_freq(self.freq, 0) - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp_rx_hrpt'): - self._saved_freq_config.add_section('usrp_rx_hrpt') - self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - - def get_clock_alpha(self): - return self.clock_alpha - - def set_clock_alpha(self, clock_alpha): - self.clock_alpha = clock_alpha - self._clock_alpha_slider.set_value(self.clock_alpha) - self._clock_alpha_text_box.set_value(self.clock_alpha) - self._saved_clock_alpha_config = ConfigParser.ConfigParser() - self._saved_clock_alpha_config.read(self.config_filename) - if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): - self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') - self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) - self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) - self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) - - def get_addr_text(self): - return self.addr_text - - def set_addr_text(self, addr_text): - self.addr_text = addr_text - self._addr_text_static_text.set_value(self.addr_text) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - tb = usrp_rx_hrpt() - tb.Run(True) - diff --git a/gr-noaa/apps/usrp_rx_hrpt_nogui.grc b/gr-noaa/apps/usrp_rx_hrpt_nogui.grc deleted file mode 100644 index 5936c94c8..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt_nogui.grc +++ /dev/null @@ -1,1472 +0,0 @@ - - - Thu Oct 27 13:48:57 2011 - - options - - id - usrp_rx_hrpt_nogui - - - _enabled - True - - - title - USRP HRPT Receiver - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - no_gui - - - category - Custom - - - run_options - prompt - - - run - True - - - realtime_scheduling - - - - _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 - max_clock_offset - - - _enabled - True - - - value - 100e-6 - - - _coordinate - (705, 19) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math, os - - - _coordinate - (9, 106) - - - _rotation - 0 - - - - variable - - id - config_filename - - - _enabled - True - - - value - os.environ['HOME']+'/.gnuradio/config.conf' - - - _coordinate - (13, 168) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 4e6 - - - _coordinate - (198, 17) - - - _rotation - 0 - - - - variable_config - - id - clock_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'clock_alpha' - - - writeback - clock_alpha - - - _coordinate - (833, 104) - - - _rotation - 0 - - - - variable_config - - id - pll_alpha - - - _enabled - True - - - value - 0.01 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'pll_alpha' - - - writeback - pll_alpha - - - _coordinate - (675, 104) - - - _rotation - 0 - - - - variable_config - - id - gain - - - _enabled - True - - - value - 35 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'gain' - - - writeback - gain - - - _coordinate - (516, 105) - - - _rotation - 0 - - - - variable_config - - id - freq - - - _enabled - True - - - value - 1698e6 - - - type - real - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'freq' - - - writeback - freq - - - _coordinate - (359, 104) - - - _rotation - 0 - - - - variable_config - - id - output_filename - - - _enabled - True - - - value - 'frames.hrpt' - - - type - string - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'filename' - - - writeback - output_filename - - - _coordinate - (991, 105) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx - - id - digital_clock_recovery_mm_xx_0 - - - _enabled - True - - - type - float - - - omega - sps/2.0 - - - gain_omega - clock_alpha**2/4.0 - - - mu - 0.5 - - - gain_mu - clock_alpha - - - omega_relative_limit - max_clock_offset - - - _coordinate - (897, 341) - - - _rotation - 0 - - - - virtual_sink - - id - virtual_sink_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (1139, 373) - - - _rotation - 0 - - - - uhd_usrp_source - - id - uhd_usrp_source_0 - - - _enabled - True - - - type - complex - - - dev_addr - addr - - - sync - - - - clock_rate - 0.0 - - - num_mboards - 1 - - - ref_source0 - - - - sd_spec0 - - - - ref_source1 - - - - sd_spec1 - - - - ref_source2 - - - - sd_spec2 - - - - ref_source3 - - - - sd_spec3 - - - - ref_source4 - - - - sd_spec4 - - - - ref_source5 - - - - sd_spec5 - - - - ref_source6 - - - - sd_spec6 - - - - ref_source7 - - - - sd_spec7 - - - - nchan - 1 - - - samp_rate - sample_rate - - - center_freq0 - freq - - - gain0 - 0 - - - ant0 - - - - bw0 - 0 - - - center_freq1 - 0 - - - gain1 - 0 - - - ant1 - - - - bw1 - 0 - - - center_freq2 - 0 - - - gain2 - 0 - - - ant2 - - - - bw2 - 0 - - - center_freq3 - 0 - - - gain3 - 0 - - - ant3 - - - - bw3 - 0 - - - center_freq4 - 0 - - - gain4 - 0 - - - ant4 - - - - bw4 - 0 - - - center_freq5 - 0 - - - gain5 - 0 - - - ant5 - - - - bw5 - 0 - - - center_freq6 - 0 - - - gain6 - 0 - - - ant6 - - - - bw6 - 0 - - - center_freq7 - 0 - - - gain7 - 0 - - - ant7 - - - - bw7 - 0 - - - center_freq8 - 0 - - - gain8 - 0 - - - ant8 - - - - bw8 - 0 - - - center_freq9 - 0 - - - gain9 - 0 - - - ant9 - - - - bw9 - 0 - - - center_freq10 - 0 - - - gain10 - 0 - - - ant10 - - - - bw10 - 0 - - - center_freq11 - 0 - - - gain11 - 0 - - - ant11 - - - - bw11 - 0 - - - center_freq12 - 0 - - - gain12 - 0 - - - ant12 - - - - bw12 - 0 - - - center_freq13 - 0 - - - gain13 - 0 - - - ant13 - - - - bw13 - 0 - - - center_freq14 - 0 - - - gain14 - 0 - - - ant14 - - - - bw14 - 0 - - - center_freq15 - 0 - - - gain15 - 0 - - - ant15 - - - - bw15 - 0 - - - center_freq16 - 0 - - - gain16 - 0 - - - ant16 - - - - bw16 - 0 - - - center_freq17 - 0 - - - gain17 - 0 - - - ant17 - - - - bw17 - 0 - - - center_freq18 - 0 - - - gain18 - 0 - - - ant18 - - - - bw18 - 0 - - - center_freq19 - 0 - - - gain19 - 0 - - - ant19 - - - - bw19 - 0 - - - center_freq20 - 0 - - - gain20 - 0 - - - ant20 - - - - bw20 - 0 - - - center_freq21 - 0 - - - gain21 - 0 - - - ant21 - - - - bw21 - 0 - - - center_freq22 - 0 - - - gain22 - 0 - - - ant22 - - - - bw22 - 0 - - - center_freq23 - 0 - - - gain23 - 0 - - - ant23 - - - - bw23 - 0 - - - center_freq24 - 0 - - - gain24 - 0 - - - ant24 - - - - bw24 - 0 - - - center_freq25 - 0 - - - gain25 - 0 - - - ant25 - - - - bw25 - 0 - - - center_freq26 - 0 - - - gain26 - 0 - - - ant26 - - - - bw26 - 0 - - - center_freq27 - 0 - - - gain27 - 0 - - - ant27 - - - - bw27 - 0 - - - center_freq28 - 0 - - - gain28 - 0 - - - ant28 - - - - bw28 - 0 - - - center_freq29 - 0 - - - gain29 - 0 - - - ant29 - - - - bw29 - 0 - - - center_freq30 - 0 - - - gain30 - 0 - - - ant30 - - - - bw30 - 0 - - - center_freq31 - 0 - - - gain31 - 0 - - - ant31 - - - - bw31 - 0 - - - _coordinate - (50, 357) - - - _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 - (470, 357) - - - _rotation - 0 - - - - gr_agc_xx - - id - agc - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (302, 349) - - - _rotation - 0 - - - - gr_moving_average_xx - - id - gr_moving_average_xx_0 - - - _enabled - True - - - type - float - - - length - hs - - - scale - 1.0/hs - - - max_iter - 4000 - - - _coordinate - (683, 357) - - - _rotation - 0 - - - - gr_file_sink - - id - frame_sink - - - _enabled - True - - - file - output_filename - - - type - short - - - vlen - 1 - - - unbuffered - False - - - _coordinate - (809, 595) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - deframer - - - _enabled - True - - - _coordinate - (598, 546) - - - _rotation - 0 - - - - digital_binary_slicer_fb - - id - digital_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (259, 546) - - - _rotation - 0 - - - - virtual_source - - id - virtual_source_0 - - - _enabled - True - - - stream_id - baseband - - - _coordinate - (40, 542) - - - _rotation - 0 - - - - noaa_hrpt_decoder - - id - decoder - - - _enabled - True - - - verbose - True - - - output - True - - - _coordinate - (810, 496) - - - _rotation - 0 - - - - variable_config - - id - addr - - - _enabled - True - - - value - "" - - - type - string - - - config_file - config_filename - - - section - 'usrp_rx_hrpt' - - - option - 'addr' - - - writeback - addr - - - _coordinate - (195, 103) - - - _rotation - 0 - - - - digital_clock_recovery_mm_xx_0 - virtual_sink_0 - 0 - 0 - - - gr_moving_average_xx_0 - digital_clock_recovery_mm_xx_0 - 0 - 0 - - - pll - gr_moving_average_xx_0 - 0 - 0 - - - uhd_usrp_source_0 - agc - 0 - 0 - - - agc - pll - 0 - 0 - - - digital_binary_slicer_fb_0 - deframer - 0 - 0 - - - virtual_source_0 - digital_binary_slicer_fb_0 - 0 - 0 - - - deframer - decoder - 0 - 0 - - - deframer - frame_sink - 0 - 0 - - diff --git a/gr-noaa/apps/usrp_rx_hrpt_nogui.py b/gr-noaa/apps/usrp_rx_hrpt_nogui.py deleted file mode 100755 index 4fc5642ff..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt_nogui.py +++ /dev/null @@ -1,268 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Thu Oct 27 13:49:01 2011 -################################################## - -from gnuradio import digital -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import noaa -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from optparse import OptionParser -import ConfigParser -import math, os - -class usrp_rx_hrpt_nogui(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self, "USRP HRPT Receiver") - - ################################################## - # Variables - ################################################## - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 4e6 - self.sps = sps = sample_rate/sym_rate - self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(config_filename) - try: pll_alpha = self._pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') - except: pll_alpha = 0.01 - self.pll_alpha = pll_alpha - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') - except: output_filename = 'frames.hrpt' - self.output_filename = output_filename - self.max_clock_offset = max_clock_offset = 100e-6 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.hs = hs = int(sps/2.0) - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(config_filename) - try: gain = self._gain_config.getfloat('usrp_rx_hrpt', 'gain') - except: gain = 35 - self.gain = gain - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(config_filename) - try: freq = self._freq_config.getfloat('usrp_rx_hrpt', 'freq') - except: freq = 1698e6 - self.freq = freq - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(config_filename) - try: clock_alpha = self._clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') - except: clock_alpha = 0.01 - self.clock_alpha = clock_alpha - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(config_filename) - try: addr = self._addr_config.get('usrp_rx_hrpt', 'addr') - except: addr = "" - self.addr = addr - - ################################################## - # Blocks - ################################################## - self.uhd_usrp_source_0 = uhd.usrp_source( - device_addr=addr, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1, - ) - self.uhd_usrp_source_0.set_samp_rate(sample_rate) - self.uhd_usrp_source_0.set_center_freq(freq, 0) - self.uhd_usrp_source_0.set_gain(0, 0) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) - self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.frame_sink.set_unbuffered(False) - self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) - self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() - self.deframer = noaa.hrpt_deframer() - self.decoder = noaa.hrpt_decoder(True,True) - self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) - self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) - self.connect((self.uhd_usrp_source_0, 0), (self.agc, 0)) - self.connect((self.agc, 0), (self.pll, 0)) - self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) - self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.deframer, 0), (self.frame_sink, 0)) - - def get_sym_rate(self): - return self.sym_rate - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - - def get_sample_rate(self): - return self.sample_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.uhd_usrp_source_0.set_samp_rate(self.sample_rate) - - def get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) - - def get_config_filename(self): - return self.config_filename - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(self.config_filename) - if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): - self._clock_alpha_config.add_section('usrp_rx_hrpt') - self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._clock_alpha_config.write(open(self.config_filename, 'w')) - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): - self._pll_alpha_config.add_section('usrp_rx_hrpt') - self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._pll_alpha_config.write(open(self.config_filename, 'w')) - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp_rx_hrpt'): - self._gain_config.add_section('usrp_rx_hrpt') - self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._gain_config.write(open(self.config_filename, 'w')) - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp_rx_hrpt'): - self._freq_config.add_section('usrp_rx_hrpt') - self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._freq_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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(self.config_filename) - if not self._addr_config.has_section('usrp_rx_hrpt'): - self._addr_config.add_section('usrp_rx_hrpt') - self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) - self._addr_config.write(open(self.config_filename, 'w')) - - def get_pll_alpha(self): - return self.pll_alpha - - def set_pll_alpha(self, pll_alpha): - self.pll_alpha = pll_alpha - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): - self._pll_alpha_config.add_section('usrp_rx_hrpt') - self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) - self._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 get_output_filename(self): - return self.output_filename - - 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('usrp_rx_hrpt'): - self._output_filename_config.add_section('usrp_rx_hrpt') - self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def get_max_clock_offset(self): - return self.max_clock_offset - - def set_max_clock_offset(self, max_clock_offset): - self.max_clock_offset = max_clock_offset - - def get_max_carrier_offset(self): - return self.max_carrier_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 get_hs(self): - return self.hs - - def set_hs(self, hs): - self.hs = hs - self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) - - def get_gain(self): - return self.gain - - def set_gain(self, gain): - self.gain = gain - self._gain_config = ConfigParser.ConfigParser() - self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp_rx_hrpt'): - self._gain_config.add_section('usrp_rx_hrpt') - self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) - self._gain_config.write(open(self.config_filename, 'w')) - - def get_freq(self): - return self.freq - - def set_freq(self, freq): - self.freq = freq - self._freq_config = ConfigParser.ConfigParser() - self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp_rx_hrpt'): - self._freq_config.add_section('usrp_rx_hrpt') - self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) - self._freq_config.write(open(self.config_filename, 'w')) - self.uhd_usrp_source_0.set_center_freq(self.freq, 0) - - def get_clock_alpha(self): - return self.clock_alpha - - def set_clock_alpha(self, clock_alpha): - self.clock_alpha = clock_alpha - self._clock_alpha_config = ConfigParser.ConfigParser() - self._clock_alpha_config.read(self.config_filename) - if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): - self._clock_alpha_config.add_section('usrp_rx_hrpt') - self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) - self._clock_alpha_config.write(open(self.config_filename, 'w')) - self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) - self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) - - def get_addr(self): - return self.addr - - def set_addr(self, addr): - self.addr = addr - self._addr_config = ConfigParser.ConfigParser() - self._addr_config.read(self.config_filename) - if not self._addr_config.has_section('usrp_rx_hrpt'): - self._addr_config.add_section('usrp_rx_hrpt') - self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) - self._addr_config.write(open(self.config_filename, 'w')) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - tb = usrp_rx_hrpt_nogui() - tb.start() - raw_input('Press Enter to quit: ') - tb.stop() - diff --git a/gr-noaa/examples/CMakeLists.txt b/gr-noaa/examples/CMakeLists.txt new file mode 100644 index 000000000..233f0ee5f --- /dev/null +++ b/gr-noaa/examples/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +include(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + hrpt_decode.py + hrpt_demod.py + file_rx_hrpt.py + usrp_rx_hrpt.py + usrp_rx_hrpt_nogui.py + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "noaa_python" +) diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc new file mode 100644 index 000000000..4097e83d3 --- /dev/null +++ b/gr-noaa/examples/file_rx_hrpt.grc @@ -0,0 +1,903 @@ + + + Thu Oct 27 13:48:25 2011 + + 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 + max_clock_offset + + + _enabled + True + + + value + 100e-6 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math, os + + + _coordinate + (9, 106) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + os.environ['HOME']+'/.gnuradio/config.conf' + + + _coordinate + (13, 168) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 4e6 + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx + + id + digital_clock_recovery_mm_xx_0 + + + _enabled + True + + + type + float + + + omega + sps/2.0 + + + gain_omega + clock_alpha**2/4.0 + + + mu + 0.5 + + + gain_mu + clock_alpha + + + omega_relative_limit + max_clock_offset + + + _coordinate + (897, 341) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (1139, 373) + + + _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 + (470, 357) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + float + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (683, 357) + + + _rotation + 0 + + + + gr_file_sink + + id + frame_sink + + + _enabled + True + + + file + output_filename + + + type + short + + + vlen + 1 + + + unbuffered + False + + + _coordinate + (809, 595) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + verbose + True + + + output + True + + + _coordinate + (810, 496) + + + _rotation + 0 + + + + gr_agc_xx + + id + agc + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (302, 349) + + + _rotation + 0 + + + + gr_interleaved_short_to_complex + + id + gr_interleaved_short_to_complex_0 + + + _enabled + True + + + _coordinate + (92, 377) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + short + + + samples_per_second + 2*sample_rate + + + vlen + 1 + + + _coordinate + (94, 323) + + + _rotation + 180 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + input_filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (95, 257) + + + _rotation + 0 + + + + variable_config + + id + freq + + + _enabled + True + + + value + 1698e6 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'freq' + + + writeback + freq + + + _coordinate + (218, 104) + + + _rotation + 0 + + + + variable_config + + id + gain + + + _enabled + True + + + value + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'gain' + + + writeback + gain + + + _coordinate + (375, 105) + + + _rotation + 0 + + + + variable_config + + id + pll_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'pll_alpha' + + + writeback + pll_alpha + + + _coordinate + (534, 104) + + + _rotation + 0 + + + + variable_config + + id + clock_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'clock_alpha' + + + writeback + clock_alpha + + + _coordinate + (692, 104) + + + _rotation + 0 + + + + variable_config + + id + output_filename + + + _enabled + True + + + value + 'frames.hrpt' + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'filename' + + + writeback + output_filename + + + _coordinate + (850, 105) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (598, 546) + + + _rotation + 0 + + + + virtual_source + + id + virtual_source_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (90, 542) + + + _rotation + 0 + + + + digital_binary_slicer_fb + + id + digital_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (332, 546) + + + _rotation + 0 + + + + options + + id + file_rx_hrpt + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run_options + prompt + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx_0 + virtual_sink_0 + 0 + 0 + + + gr_moving_average_xx_0 + digital_clock_recovery_mm_xx_0 + 0 + 0 + + + pll + gr_moving_average_xx_0 + 0 + 0 + + + agc + pll + 0 + 0 + + + deframer + decoder + 0 + 0 + + + deframer + frame_sink + 0 + 0 + + + gr_interleaved_short_to_complex_0 + agc + 0 + 0 + + + throttle + gr_interleaved_short_to_complex_0 + 0 + 0 + + + gr_file_source_0 + throttle + 0 + 0 + + + virtual_source_0 + digital_binary_slicer_fb_0 + 0 + 0 + + + digital_binary_slicer_fb_0 + deframer + 0 + 0 + + diff --git a/gr-noaa/examples/file_rx_hrpt.py b/gr-noaa/examples/file_rx_hrpt.py new file mode 100755 index 000000000..fcd1832f6 --- /dev/null +++ b/gr-noaa/examples/file_rx_hrpt.py @@ -0,0 +1,239 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Thu Oct 27 13:48:25 2011 +################################################## + +from gnuradio import digital +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 ConfigParser +import math, os + +class file_rx_hrpt(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "USRP HRPT Receiver") + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 4e6 + self.sps = sps = sample_rate/sym_rate + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(config_filename) + try: pll_alpha = self._pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') + except: pll_alpha = 0.01 + self.pll_alpha = pll_alpha + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(config_filename) + try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') + except: output_filename = 'frames.hrpt' + self.output_filename = output_filename + self.max_clock_offset = max_clock_offset = 100e-6 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(config_filename) + try: gain = self._gain_config.getfloat('usrp_rx_hrpt', 'gain') + except: gain = 35 + self.gain = gain + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(config_filename) + try: freq = self._freq_config.getfloat('usrp_rx_hrpt', 'freq') + except: freq = 1698e6 + self.freq = freq + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(config_filename) + try: clock_alpha = self._clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: clock_alpha = 0.01 + self.clock_alpha = clock_alpha + + ################################################## + # Blocks + ################################################## + self.throttle = gr.throttle(gr.sizeof_short*1, 2*sample_rate) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.gr_interleaved_short_to_complex_0 = gr.interleaved_short_to_complex() + self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "input_filename", False) + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.frame_sink.set_unbuffered(False) + self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() + self.deframer = noaa.hrpt_deframer() + self.decoder = noaa.hrpt_decoder(True,True) + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + + ################################################## + # Connections + ################################################## + self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.deframer, 0), (self.frame_sink, 0)) + self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.agc, 0)) + self.connect((self.throttle, 0), (self.gr_interleaved_short_to_complex_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.throttle, 0)) + self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) + self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) + + def get_sym_rate(self): + return self.sym_rate + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def get_sample_rate(self): + return self.sample_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 get_sps(self): + return self.sps + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) + + def get_config_filename(self): + return self.config_filename + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(self.config_filename) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._freq_config.write(open(self.config_filename, 'w')) + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(self.config_filename) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._gain_config.write(open(self.config_filename, 'w')) + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(self.config_filename) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._pll_alpha_config.write(open(self.config_filename, 'w')) + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def get_pll_alpha(self): + return self.pll_alpha + + 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) + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(self.config_filename) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._pll_alpha_config.write(open(self.config_filename, 'w')) + + def get_output_filename(self): + return self.output_filename + + 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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def get_max_clock_offset(self): + return self.max_clock_offset + + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def get_max_carrier_offset(self): + return self.max_carrier_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 get_hs(self): + return self.hs + + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + + def get_gain(self): + return self.gain + + def set_gain(self, gain): + self.gain = gain + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(self.config_filename) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._gain_config.write(open(self.config_filename, 'w')) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(self.config_filename) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._freq_config.write(open(self.config_filename, 'w')) + + def get_clock_alpha(self): + return self.clock_alpha + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_alpha_config.write(open(self.config_filename, 'w')) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + (options, args) = parser.parse_args() + tb = file_rx_hrpt() + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() + diff --git a/gr-noaa/examples/hrpt_decode.grc b/gr-noaa/examples/hrpt_decode.grc new file mode 100644 index 000000000..39fe195d1 --- /dev/null +++ b/gr-noaa/examples/hrpt_decode.grc @@ -0,0 +1,428 @@ + + + Sun Nov 8 10:48:59 2009 + + options + + id + hrpt_decode + + + _enabled + True + + + title + + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run_options + run + + + run + True + + + realtime_scheduling + + + + _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 + 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 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math, os + + + _coordinate + (11, 103) + + + _rotation + 0 + + + + variable + + id + max_clock_offset + + + _enabled + True + + + value + 100e-6 + + + _coordinate + (710, 17) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (307, 18) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (400, 17) + + + _rotation + 0 + + + + parameter + + id + decim + + + _enabled + True + + + label + decim + + + value + 32 + + + type + intx + + + short_id + d + + + _coordinate + (202, 102) + + + _rotation + 0 + + + + parameter + + id + pll_alpha + + + _enabled + True + + + label + pll_alpha + + + value + 0.01 + + + type + eng_float + + + short_id + p + + + _coordinate + (294, 101) + + + _rotation + 0 + + + + parameter + + id + clock_alpha + + + _enabled + True + + + label + clock_alpha + + + value + 0.01 + + + type + eng_float + + + short_id + s + + + _coordinate + (395, 101) + + + _rotation + 0 + + + + gr_file_source + + id + file_source + + + _enabled + True + + + file + input_filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (231, 419) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + verbose + True + + + output + True + + + _coordinate + (462, 419) + + + _rotation + 0 + + + + parameter + + id + input_filename + + + _enabled + True + + + label + input_filename + + + value + frames.hrpt + + + type + string + + + short_id + F + + + _coordinate + (522, 100) + + + _rotation + 0 + + + + file_source + decoder + 0 + 0 + + diff --git a/gr-noaa/examples/hrpt_decode.py b/gr-noaa/examples/hrpt_decode.py new file mode 100755 index 000000000..158780b17 --- /dev/null +++ b/gr-noaa/examples/hrpt_decode.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: Hrpt Decode +# Generated: Sun Nov 8 10:49:01 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, os + +class hrpt_decode(gr.top_block): + + def __init__(self, decim=32, pll_alpha=0.01, clock_alpha=0.01, input_filename="frames.hrpt"): + gr.top_block.__init__(self, "Hrpt Decode") + + ################################################## + # Parameters + ################################################## + self.decim = decim + self.pll_alpha = pll_alpha + self.clock_alpha = clock_alpha + self.input_filename = input_filename + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self.max_clock_offset = max_clock_offset = 100e-6 + 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(True,True) + self.file_source = gr.file_source(gr.sizeof_short*1, input_filename, False) + + ################################################## + # Connections + ################################################## + self.connect((self.file_source, 0), (self.decoder, 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 + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + + def set_input_filename(self, input_filename): + self.input_filename = input_filename + + 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_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + + def set_hs(self, hs): + self.hs = hs + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=32, + help="Set decim [default=%default]") + parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), + help="Set pll_alpha [default=%default]") + parser.add_option("-s", "--clock-alpha", dest="clock_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), + help="Set clock_alpha [default=%default]") + parser.add_option("-F", "--input-filename", dest="input_filename", type="string", default="frames.hrpt", + help="Set frames.hrpt [default=%default]") + (options, args) = parser.parse_args() + tb = hrpt_decode(decim=options.decim, pll_alpha=options.pll_alpha, clock_alpha=options.clock_alpha, input_filename=options.input_filename) + tb.run() + diff --git a/gr-noaa/examples/hrpt_demod.grc b/gr-noaa/examples/hrpt_demod.grc new file mode 100644 index 000000000..f5833b864 --- /dev/null +++ b/gr-noaa/examples/hrpt_demod.grc @@ -0,0 +1,751 @@ + + + Thu Oct 27 13:51:57 2011 + + options + + id + hrpt_demod + + + _enabled + True + + + title + + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run_options + run + + + run + True + + + realtime_scheduling + + + + _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 + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (499, 19) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math, os + + + _coordinate + (11, 103) + + + _rotation + 0 + + + + parameter + + id + input_filename + + + _enabled + True + + + label + input_filename + + + value + usrp.dat + + + type + string + + + short_id + F + + + _coordinate + (618, 102) + + + _rotation + 0 + + + + parameter + + id + output_filename + + + _enabled + True + + + label + output_filename + + + value + frames.dat + + + type + string + + + short_id + o + + + _coordinate + (726, 102) + + + _rotation + 180 + + + + gr_file_source + + id + file_source + + + _enabled + True + + + file + input_filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (63, 277) + + + _rotation + 0 + + + + gr_interleaved_short_to_complex + + id + cs2cf + + + _enabled + True + + + _coordinate + (275, 289) + + + _rotation + 0 + + + + gr_agc_xx + + id + agc + + + _enabled + True + + + type + complex + + + rate + 1e-5 + + + reference + 1.0 + + + gain + 1.0/32768.0 + + + max_gain + 1.0 + + + _coordinate + (117, 394) + + + _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 + (292, 402) + + + _rotation + 0 + + + + variable + + id + max_clock_offset + + + _enabled + True + + + value + 100e-6 + + + _coordinate + (710, 17) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (307, 18) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (400, 17) + + + _rotation + 0 + + + + parameter + + id + decim + + + _enabled + True + + + label + decim + + + value + 32 + + + type + intx + + + short_id + d + + + _coordinate + (202, 102) + + + _rotation + 0 + + + + parameter + + id + pll_alpha + + + _enabled + True + + + label + pll_alpha + + + value + 0.01 + + + type + eng_float + + + short_id + p + + + _coordinate + (294, 101) + + + _rotation + 0 + + + + parameter + + id + clock_alpha + + + _enabled + True + + + label + clock_alpha + + + value + 0.01 + + + type + eng_float + + + short_id + s + + + _coordinate + (395, 101) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + verbose + True + + + output + False + + + _coordinate + (1150, 341) + + + _rotation + 180 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled + True + + + file + output_filename + + + type + short + + + vlen + 1 + + + unbuffered + False + + + _coordinate + (1144, 489) + + + _rotation + 180 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + float + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (504, 402) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 4e6 + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx + + id + digital_clock_recovery_mm_xx_0 + + + _enabled + True + + + type + float + + + omega + sps/2.0 + + + gain_omega + clock_alpha**2/4.0 + + + mu + 0.5 + + + gain_mu + clock_alpha + + + omega_relative_limit + max_clock_offset + + + _coordinate + (704, 386) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + noaa_hrpt_deframer_0 + + + _enabled + True + + + _coordinate + (1142, 422) + + + _rotation + 0 + + + + digital_binary_slicer_fb + + id + digital_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (957, 422) + + + _rotation + 0 + + + + file_source + cs2cf + 0 + 0 + + + pll + gr_moving_average_xx_0 + 0 + 0 + + + cs2cf + agc + 0 + 0 + + + agc + pll + 0 + 0 + + + noaa_hrpt_deframer_0 + gr_file_sink_0 + 0 + 0 + + + noaa_hrpt_deframer_0 + decoder + 0 + 0 + + + gr_moving_average_xx_0 + digital_clock_recovery_mm_xx_0 + 0 + 0 + + + digital_clock_recovery_mm_xx_0 + digital_binary_slicer_fb_0 + 0 + 0 + + + digital_binary_slicer_fb_0 + noaa_hrpt_deframer_0 + 0 + 0 + + diff --git a/gr-noaa/examples/hrpt_demod.py b/gr-noaa/examples/hrpt_demod.py new file mode 100755 index 000000000..38b4b2fe3 --- /dev/null +++ b/gr-noaa/examples/hrpt_demod.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: Hrpt Demod +# Generated: Thu Oct 27 13:51:59 2011 +################################################## + +from gnuradio import digital +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, os + +class hrpt_demod(gr.top_block): + + def __init__(self, input_filename="usrp.dat", output_filename="frames.dat", decim=32, pll_alpha=0.01, clock_alpha=0.01): + gr.top_block.__init__(self, "Hrpt Demod") + + ################################################## + # Parameters + ################################################## + self.input_filename = input_filename + self.output_filename = output_filename + self.decim = decim + self.pll_alpha = pll_alpha + self.clock_alpha = clock_alpha + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 4e6 + self.sps = sps = sample_rate/sym_rate + self.max_clock_offset = max_clock_offset = 100e-6 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + + ################################################## + # Blocks + ################################################## + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.gr_file_sink_0 = gr.file_sink(gr.sizeof_short*1, output_filename) + self.gr_file_sink_0.set_unbuffered(False) + self.file_source = gr.file_source(gr.sizeof_short*1, input_filename, False) + self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() + self.decoder = noaa.hrpt_decoder(True,False) + self.cs2cf = gr.interleaved_short_to_complex() + self.agc = gr.agc_cc(1e-5, 1.0, 1.0/32768.0, 1.0) + + ################################################## + # Connections + ################################################## + self.connect((self.file_source, 0), (self.cs2cf, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.cs2cf, 0), (self.agc, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.decoder, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) + self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) + self.connect((self.digital_binary_slicer_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) + + def get_input_filename(self): + return self.input_filename + + def set_input_filename(self, input_filename): + self.input_filename = input_filename + + def get_output_filename(self): + return self.output_filename + + def set_output_filename(self, output_filename): + self.output_filename = output_filename + + def get_decim(self): + return self.decim + + def set_decim(self, decim): + self.decim = decim + + def get_pll_alpha(self): + return self.pll_alpha + + 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 get_clock_alpha(self): + return self.clock_alpha + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + + def get_sym_rate(self): + return self.sym_rate + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def get_sample_rate(self): + return self.sample_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 get_sps(self): + return self.sps + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) + + def get_max_clock_offset(self): + return self.max_clock_offset + + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def get_max_carrier_offset(self): + return self.max_carrier_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 get_hs(self): + return self.hs + + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.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("-F", "--input-filename", dest="input_filename", type="string", default="usrp.dat", + help="Set usrp.dat [default=%default]") + parser.add_option("-o", "--output-filename", dest="output_filename", type="string", default="frames.dat", + help="Set frames.dat [default=%default]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=32, + help="Set None [default=%default]") + parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), + help="Set None [default=%default]") + parser.add_option("-s", "--clock-alpha", dest="clock_alpha", type="eng_float", default=eng_notation.num_to_str(0.01), + help="Set None [default=%default]") + (options, args) = parser.parse_args() + tb = hrpt_demod(input_filename=options.input_filename, output_filename=options.output_filename, decim=options.decim, pll_alpha=options.pll_alpha, clock_alpha=options.clock_alpha) + tb.run() + diff --git a/gr-noaa/examples/usrp_rx_hrpt.grc b/gr-noaa/examples/usrp_rx_hrpt.grc new file mode 100644 index 000000000..26af48ff0 --- /dev/null +++ b/gr-noaa/examples/usrp_rx_hrpt.grc @@ -0,0 +1,1975 @@ + + + Thu Oct 27 13:26:39 2011 + + options + + id + usrp_rx_hrpt + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + wx_gui + + + category + Custom + + + run_options + prompt + + + run + True + + + realtime_scheduling + + + + _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_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 + clock_alpha + + + _enabled + True + + + label + Clock Alpha + + + value + saved_clock_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 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['Spectrum','Demod'] + + + grid_pos + 2,0,1,4 + + + notebook + + + + _coordinate + (12, 249) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_fft + + + _enabled + True + + + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + freq + + + y_per_div + 5 + + + y_divs + 8 + + + ref_level + -5 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 15 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + win + None + + + win_size + 640, 360 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (477, 457) + + + _rotation + 0 + + + + variable + + id + max_clock_offset + + + _enabled + True + + + value + 100e-6 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + gr_agc_xx + + id + agc + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (301, 705) + + + _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 + (469, 713) + + + _rotation + 0 + + + + variable_config + + id + addr + + + _enabled + True + + + value + "" + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'addr' + + + writeback + addr + + + _coordinate + (194, 253) + + + _rotation + 0 + + + + uhd_usrp_source + + id + uhd_usrp_source_0 + + + _enabled + True + + + type + complex + + + dev_addr + addr + + + sync + + + + clock_rate + 0.0 + + + num_mboards + 1 + + + ref_source0 + + + + sd_spec0 + + + + ref_source1 + + + + sd_spec1 + + + + ref_source2 + + + + sd_spec2 + + + + ref_source3 + + + + sd_spec3 + + + + ref_source4 + + + + sd_spec4 + + + + ref_source5 + + + + sd_spec5 + + + + ref_source6 + + + + sd_spec6 + + + + ref_source7 + + + + sd_spec7 + + + + nchan + 1 + + + samp_rate + sample_rate + + + center_freq0 + freq + + + gain0 + 0 + + + ant0 + + + + bw0 + 0 + + + center_freq1 + 0 + + + gain1 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq2 + 0 + + + gain2 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq3 + 0 + + + gain3 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq4 + 0 + + + gain4 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq5 + 0 + + + gain5 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq6 + 0 + + + gain6 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq7 + 0 + + + gain7 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq8 + 0 + + + gain8 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq9 + 0 + + + gain9 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq10 + 0 + + + gain10 + 0 + + + ant10 + + + + bw10 + 0 + + + center_freq11 + 0 + + + gain11 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq12 + 0 + + + gain12 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq13 + 0 + + + gain13 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq14 + 0 + + + gain14 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq15 + 0 + + + gain15 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq16 + 0 + + + gain16 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq17 + 0 + + + gain17 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq18 + 0 + + + gain18 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq19 + 0 + + + gain19 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq20 + 0 + + + gain20 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq21 + 0 + + + gain21 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq22 + 0 + + + gain22 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq23 + 0 + + + gain23 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq24 + 0 + + + gain24 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq25 + 0 + + + gain25 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq26 + 0 + + + gain26 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq27 + 0 + + + gain27 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq28 + 0 + + + gain28 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq29 + 0 + + + gain29 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq30 + 0 + + + gain30 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq31 + 0 + + + gain31 + 0 + + + ant31 + + + + bw31 + 0 + + + _coordinate + (49, 713) + + + _rotation + 0 + + + + variable_static_text + + id + addr_text + + + _enabled + True + + + label + USRP Addr + + + value + addr + + + converver + str_converter + + + formatter + None + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (828, 20) + + + _rotation + 0 + + + + variable_static_text + + id + rate_text + + + _enabled + True + + + label + Baseband Rate + + + value + sample_rate + + + converver + float_converter + + + formatter + None + + + grid_pos + 1, 1, 1, 1 + + + notebook + + + + _coordinate + (973, 20) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math, os + + + _coordinate + (9, 106) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + os.environ['HOME']+'/.gnuradio/config.conf' + + + _coordinate + (13, 168) + + + _rotation + 0 + + + + variable_config + + id + output_filename + + + _enabled + True + + + value + 'frames.hrpt' + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'filename' + + + writeback + output_filename + + + _coordinate + (990, 255) + + + _rotation + 0 + + + + variable_config + + id + saved_clock_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'clock_alpha' + + + writeback + clock_alpha + + + _coordinate + (832, 254) + + + _rotation + 0 + + + + variable_config + + id + saved_pll_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'pll_alpha' + + + writeback + pll_alpha + + + _coordinate + (674, 254) + + + _rotation + 0 + + + + variable_config + + id + saved_gain + + + _enabled + True + + + value + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'gain' + + + writeback + gain + + + _coordinate + (515, 255) + + + _rotation + 0 + + + + variable_config + + id + saved_freq + + + _enabled + True + + + value + 1698e6 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'freq' + + + writeback + freq + + + _coordinate + (358, 254) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 4e6 + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + demod_scope + + + _enabled + True + + + type + float + + + title + Post-Demod + + + samp_rate + sym_rate*2.0 + + + v_scale + 0.5 + + + v_offset + 0 + + + t_scale + 10.0/sym_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + win_size + + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + trig_mode + gr.gr_TRIG_MODE_AUTO + + + y_axis_label + Counts + + + _coordinate + (666, 542) + + + _rotation + 180 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + float + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (682, 713) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (1138, 729) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx + + id + digital_clock_recovery_mm_xx_0 + + + _enabled + True + + + type + float + + + omega + sps/2.0 + + + gain_omega + clock_alpha**2/4.0 + + + mu + 0.5 + + + gain_mu + clock_alpha + + + omega_relative_limit + max_clock_offset + + + _coordinate + (896, 697) + + + _rotation + 0 + + + + virtual_source + + id + virtual_source_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (173, 971) + + + _rotation + 0 + + + + digital_binary_slicer_fb + + id + digital_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (423, 975) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (762, 975) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + verbose + True + + + output + True + + + _coordinate + (974, 925) + + + _rotation + 0 + + + + gr_file_sink + + id + frame_sink + + + _enabled + True + + + file + output_filename + + + type + short + + + vlen + 1 + + + unbuffered + False + + + _coordinate + (973, 1024) + + + _rotation + 0 + + + + deframer + frame_sink + 0 + 0 + + + deframer + decoder + 0 + 0 + + + agc + pll + 0 + 0 + + + agc + rx_fft + 0 + 0 + + + uhd_usrp_source_0 + agc + 0 + 0 + + + pll + gr_moving_average_xx_0 + 0 + 0 + + + gr_moving_average_xx_0 + demod_scope + 0 + 0 + + + gr_moving_average_xx_0 + digital_clock_recovery_mm_xx_0 + 0 + 0 + + + digital_clock_recovery_mm_xx_0 + virtual_sink_0 + 0 + 0 + + + virtual_source_0 + digital_binary_slicer_fb_0 + 0 + 0 + + + digital_binary_slicer_fb_0 + deframer + 0 + 0 + + diff --git a/gr-noaa/examples/usrp_rx_hrpt.py b/gr-noaa/examples/usrp_rx_hrpt.py new file mode 100755 index 000000000..e603e768e --- /dev/null +++ b/gr-noaa/examples/usrp_rx_hrpt.py @@ -0,0 +1,462 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Thu Oct 27 13:26:42 2011 +################################################## + +from gnuradio import digital +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio import uhd +from gnuradio import window +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import math, os +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.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 4e6 + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self.sps = sps = sample_rate/sym_rate + 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('usrp_rx_hrpt', 'pll_alpha') + except: saved_pll_alpha = 0.01 + 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_rx_hrpt', '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_rx_hrpt', 'freq') + except: saved_freq = 1698e6 + self.saved_freq = saved_freq + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(config_filename) + try: saved_clock_alpha = self._saved_clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: saved_clock_alpha = 0.01 + self.saved_clock_alpha = saved_clock_alpha + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(config_filename) + try: addr = self._addr_config.get('usrp_rx_hrpt', 'addr') + except: addr = "" + self.addr = addr + self.rate_text = rate_text = sample_rate + 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('usrp_rx_hrpt', 'filename') + except: output_filename = 'frames.hrpt' + self.output_filename = output_filename + self.max_clock_offset = max_clock_offset = 100e-6 + 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.clock_alpha = clock_alpha = saved_clock_alpha + self.addr_text = addr_text = addr + + ################################################## + # Blocks + ################################################## + 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.displays = self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Spectrum") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") + self.GridAdd(self.displays, 2, 0, 1, 4) + _clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._clock_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + label="Clock Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._clock_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_clock_alpha_sizer, 0, 3, 1, 1) + self.uhd_usrp_source_0 = uhd.usrp_source( + device_addr=addr, + io_type=uhd.io_type.COMPLEX_FLOAT32, + num_channels=1, + ) + self.uhd_usrp_source_0.set_samp_rate(sample_rate) + self.uhd_usrp_source_0.set_center_freq(freq, 0) + self.uhd_usrp_source_0.set_gain(0, 0) + 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=15, + average=True, + avg_alpha=0.1, + title="RX Spectrum", + peak_hold=False, + size=(640, 360), + ) + self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) + self._rate_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.rate_text, + callback=self.set_rate_text, + label="Baseband Rate", + converter=forms.float_converter(), + ) + self.GridAdd(self._rate_text_static_text, 1, 1, 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) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + _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.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.frame_sink.set_unbuffered(False) + self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() + self.demod_scope = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-Demod", + sample_rate=sym_rate*2.0, + v_scale=0.5, + v_offset=0, + t_scale=10.0/sym_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=gr.gr_TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.displays.GetPage(1).GridAdd(self.demod_scope.win, 0, 0, 1, 1) + self.deframer = noaa.hrpt_deframer() + self.decoder = noaa.hrpt_decoder(True,True) + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self._addr_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.addr_text, + callback=self.set_addr_text, + label="USRP Addr", + converter=forms.str_converter(), + ) + self.GridAdd(self._addr_text_static_text, 1, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.deframer, 0), (self.frame_sink, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.agc, 0), (self.rx_fft, 0)) + self.connect((self.uhd_usrp_source_0, 0), (self.agc, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.demod_scope, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) + self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) + self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) + + def get_sym_rate(self): + return self.sym_rate + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + self.demod_scope.set_sample_rate(self.sym_rate*2.0) + + def get_sample_rate(self): + return self.sample_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.rx_fft.set_sample_rate(self.sample_rate) + self.uhd_usrp_source_0.set_samp_rate(self.sample_rate) + self.set_rate_text(self.sample_rate) + + def get_config_filename(self): + return self.config_filename + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(self.config_filename) + if not self._addr_config.has_section('usrp_rx_hrpt'): + self._addr_config.add_section('usrp_rx_hrpt') + self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) + self._addr_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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_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('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(self.config_filename) + if not self._saved_gain_config.has_section('usrp_rx_hrpt'): + self._saved_gain_config.add_section('usrp_rx_hrpt') + self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section('usrp_rx_hrpt'): + self._saved_freq_config.add_section('usrp_rx_hrpt') + self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + + def get_sps(self): + return self.sps + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) + + def get_saved_pll_alpha(self): + return self.saved_pll_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 get_saved_gain(self): + return self.saved_gain + + def set_saved_gain(self, saved_gain): + self.saved_gain = saved_gain + self.set_gain(self.saved_gain) + + def get_saved_freq(self): + return self.saved_freq + + def set_saved_freq(self, saved_freq): + self.saved_freq = saved_freq + self.set_freq(self.saved_freq) + + def get_saved_clock_alpha(self): + return self.saved_clock_alpha + + def set_saved_clock_alpha(self, saved_clock_alpha): + self.saved_clock_alpha = saved_clock_alpha + self.set_clock_alpha(self.saved_clock_alpha) + + def get_addr(self): + return self.addr + + def set_addr(self, addr): + self.addr = addr + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(self.config_filename) + if not self._addr_config.has_section('usrp_rx_hrpt'): + self._addr_config.add_section('usrp_rx_hrpt') + self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) + self._addr_config.write(open(self.config_filename, 'w')) + self.set_addr_text(self.addr) + + def get_rate_text(self): + return self.rate_text + + def set_rate_text(self, rate_text): + self.rate_text = rate_text + self._rate_text_static_text.set_value(self.rate_text) + + def get_pll_alpha(self): + return self.pll_alpha + + 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.pll.set_alpha(self.pll_alpha) + self.pll.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('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + + def get_output_filename(self): + return self.output_filename + + 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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def get_max_clock_offset(self): + return self.max_clock_offset + + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def get_max_carrier_offset(self): + return self.max_carrier_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 get_hs(self): + return self.hs + + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + + def get_gain(self): + return self.gain + + 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_rx_hrpt'): + self._saved_gain_config.add_section('usrp_rx_hrpt') + self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self._freq_text_box.set_value(self.freq) + self.rx_fft.set_baseband_freq(self.freq) + self.uhd_usrp_source_0.set_center_freq(self.freq, 0) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section('usrp_rx_hrpt'): + self._saved_freq_config.add_section('usrp_rx_hrpt') + self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + + def get_clock_alpha(self): + return self.clock_alpha + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self._clock_alpha_slider.set_value(self.clock_alpha) + self._clock_alpha_text_box.set_value(self.clock_alpha) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) + self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + + def get_addr_text(self): + return self.addr_text + + def set_addr_text(self, addr_text): + self.addr_text = addr_text + self._addr_text_static_text.set_value(self.addr_text) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + (options, args) = parser.parse_args() + tb = usrp_rx_hrpt() + tb.Run(True) + diff --git a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc new file mode 100644 index 000000000..5936c94c8 --- /dev/null +++ b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc @@ -0,0 +1,1472 @@ + + + Thu Oct 27 13:48:57 2011 + + options + + id + usrp_rx_hrpt_nogui + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run_options + prompt + + + run + True + + + realtime_scheduling + + + + _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 + max_clock_offset + + + _enabled + True + + + value + 100e-6 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math, os + + + _coordinate + (9, 106) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + os.environ['HOME']+'/.gnuradio/config.conf' + + + _coordinate + (13, 168) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 4e6 + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + variable_config + + id + clock_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'clock_alpha' + + + writeback + clock_alpha + + + _coordinate + (833, 104) + + + _rotation + 0 + + + + variable_config + + id + pll_alpha + + + _enabled + True + + + value + 0.01 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'pll_alpha' + + + writeback + pll_alpha + + + _coordinate + (675, 104) + + + _rotation + 0 + + + + variable_config + + id + gain + + + _enabled + True + + + value + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'gain' + + + writeback + gain + + + _coordinate + (516, 105) + + + _rotation + 0 + + + + variable_config + + id + freq + + + _enabled + True + + + value + 1698e6 + + + type + real + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'freq' + + + writeback + freq + + + _coordinate + (359, 104) + + + _rotation + 0 + + + + variable_config + + id + output_filename + + + _enabled + True + + + value + 'frames.hrpt' + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'filename' + + + writeback + output_filename + + + _coordinate + (991, 105) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx + + id + digital_clock_recovery_mm_xx_0 + + + _enabled + True + + + type + float + + + omega + sps/2.0 + + + gain_omega + clock_alpha**2/4.0 + + + mu + 0.5 + + + gain_mu + clock_alpha + + + omega_relative_limit + max_clock_offset + + + _coordinate + (897, 341) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (1139, 373) + + + _rotation + 0 + + + + uhd_usrp_source + + id + uhd_usrp_source_0 + + + _enabled + True + + + type + complex + + + dev_addr + addr + + + sync + + + + clock_rate + 0.0 + + + num_mboards + 1 + + + ref_source0 + + + + sd_spec0 + + + + ref_source1 + + + + sd_spec1 + + + + ref_source2 + + + + sd_spec2 + + + + ref_source3 + + + + sd_spec3 + + + + ref_source4 + + + + sd_spec4 + + + + ref_source5 + + + + sd_spec5 + + + + ref_source6 + + + + sd_spec6 + + + + ref_source7 + + + + sd_spec7 + + + + nchan + 1 + + + samp_rate + sample_rate + + + center_freq0 + freq + + + gain0 + 0 + + + ant0 + + + + bw0 + 0 + + + center_freq1 + 0 + + + gain1 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq2 + 0 + + + gain2 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq3 + 0 + + + gain3 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq4 + 0 + + + gain4 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq5 + 0 + + + gain5 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq6 + 0 + + + gain6 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq7 + 0 + + + gain7 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq8 + 0 + + + gain8 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq9 + 0 + + + gain9 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq10 + 0 + + + gain10 + 0 + + + ant10 + + + + bw10 + 0 + + + center_freq11 + 0 + + + gain11 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq12 + 0 + + + gain12 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq13 + 0 + + + gain13 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq14 + 0 + + + gain14 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq15 + 0 + + + gain15 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq16 + 0 + + + gain16 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq17 + 0 + + + gain17 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq18 + 0 + + + gain18 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq19 + 0 + + + gain19 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq20 + 0 + + + gain20 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq21 + 0 + + + gain21 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq22 + 0 + + + gain22 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq23 + 0 + + + gain23 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq24 + 0 + + + gain24 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq25 + 0 + + + gain25 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq26 + 0 + + + gain26 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq27 + 0 + + + gain27 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq28 + 0 + + + gain28 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq29 + 0 + + + gain29 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq30 + 0 + + + gain30 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq31 + 0 + + + gain31 + 0 + + + ant31 + + + + bw31 + 0 + + + _coordinate + (50, 357) + + + _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 + (470, 357) + + + _rotation + 0 + + + + gr_agc_xx + + id + agc + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (302, 349) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + float + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (683, 357) + + + _rotation + 0 + + + + gr_file_sink + + id + frame_sink + + + _enabled + True + + + file + output_filename + + + type + short + + + vlen + 1 + + + unbuffered + False + + + _coordinate + (809, 595) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (598, 546) + + + _rotation + 0 + + + + digital_binary_slicer_fb + + id + digital_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (259, 546) + + + _rotation + 0 + + + + virtual_source + + id + virtual_source_0 + + + _enabled + True + + + stream_id + baseband + + + _coordinate + (40, 542) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + verbose + True + + + output + True + + + _coordinate + (810, 496) + + + _rotation + 0 + + + + variable_config + + id + addr + + + _enabled + True + + + value + "" + + + type + string + + + config_file + config_filename + + + section + 'usrp_rx_hrpt' + + + option + 'addr' + + + writeback + addr + + + _coordinate + (195, 103) + + + _rotation + 0 + + + + digital_clock_recovery_mm_xx_0 + virtual_sink_0 + 0 + 0 + + + gr_moving_average_xx_0 + digital_clock_recovery_mm_xx_0 + 0 + 0 + + + pll + gr_moving_average_xx_0 + 0 + 0 + + + uhd_usrp_source_0 + agc + 0 + 0 + + + agc + pll + 0 + 0 + + + digital_binary_slicer_fb_0 + deframer + 0 + 0 + + + virtual_source_0 + digital_binary_slicer_fb_0 + 0 + 0 + + + deframer + decoder + 0 + 0 + + + deframer + frame_sink + 0 + 0 + + diff --git a/gr-noaa/examples/usrp_rx_hrpt_nogui.py b/gr-noaa/examples/usrp_rx_hrpt_nogui.py new file mode 100755 index 000000000..4fc5642ff --- /dev/null +++ b/gr-noaa/examples/usrp_rx_hrpt_nogui.py @@ -0,0 +1,268 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Thu Oct 27 13:49:01 2011 +################################################## + +from gnuradio import digital +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio import uhd +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from optparse import OptionParser +import ConfigParser +import math, os + +class usrp_rx_hrpt_nogui(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "USRP HRPT Receiver") + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 4e6 + self.sps = sps = sample_rate/sym_rate + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(config_filename) + try: pll_alpha = self._pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') + except: pll_alpha = 0.01 + self.pll_alpha = pll_alpha + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(config_filename) + try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') + except: output_filename = 'frames.hrpt' + self.output_filename = output_filename + self.max_clock_offset = max_clock_offset = 100e-6 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(config_filename) + try: gain = self._gain_config.getfloat('usrp_rx_hrpt', 'gain') + except: gain = 35 + self.gain = gain + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(config_filename) + try: freq = self._freq_config.getfloat('usrp_rx_hrpt', 'freq') + except: freq = 1698e6 + self.freq = freq + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(config_filename) + try: clock_alpha = self._clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: clock_alpha = 0.01 + self.clock_alpha = clock_alpha + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(config_filename) + try: addr = self._addr_config.get('usrp_rx_hrpt', 'addr') + except: addr = "" + self.addr = addr + + ################################################## + # Blocks + ################################################## + self.uhd_usrp_source_0 = uhd.usrp_source( + device_addr=addr, + io_type=uhd.io_type.COMPLEX_FLOAT32, + num_channels=1, + ) + self.uhd_usrp_source_0.set_samp_rate(sample_rate) + self.uhd_usrp_source_0.set_center_freq(freq, 0) + self.uhd_usrp_source_0.set_gain(0, 0) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.frame_sink.set_unbuffered(False) + self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() + self.deframer = noaa.hrpt_deframer() + self.decoder = noaa.hrpt_decoder(True,True) + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + + ################################################## + # Connections + ################################################## + self.connect((self.gr_moving_average_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.uhd_usrp_source_0, 0), (self.agc, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.digital_binary_slicer_fb_0, 0), (self.deframer, 0)) + self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.deframer, 0), (self.frame_sink, 0)) + + def get_sym_rate(self): + return self.sym_rate + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def get_sample_rate(self): + return self.sample_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.uhd_usrp_source_0.set_samp_rate(self.sample_rate) + + def get_sps(self): + return self.sps + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + self.digital_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) + + def get_config_filename(self): + return self.config_filename + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_alpha_config.write(open(self.config_filename, 'w')) + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(self.config_filename) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._pll_alpha_config.write(open(self.config_filename, 'w')) + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(self.config_filename) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._gain_config.write(open(self.config_filename, 'w')) + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(self.config_filename) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._freq_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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(self.config_filename) + if not self._addr_config.has_section('usrp_rx_hrpt'): + self._addr_config.add_section('usrp_rx_hrpt') + self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) + self._addr_config.write(open(self.config_filename, 'w')) + + def get_pll_alpha(self): + return self.pll_alpha + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(self.config_filename) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._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 get_output_filename(self): + return self.output_filename + + 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('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def get_max_clock_offset(self): + return self.max_clock_offset + + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def get_max_carrier_offset(self): + return self.max_carrier_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 get_hs(self): + return self.hs + + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + + def get_gain(self): + return self.gain + + def set_gain(self, gain): + self.gain = gain + self._gain_config = ConfigParser.ConfigParser() + self._gain_config.read(self.config_filename) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) + self._gain_config.write(open(self.config_filename, 'w')) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self._freq_config = ConfigParser.ConfigParser() + self._freq_config.read(self.config_filename) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) + self._freq_config.write(open(self.config_filename, 'w')) + self.uhd_usrp_source_0.set_center_freq(self.freq, 0) + + def get_clock_alpha(self): + return self.clock_alpha + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_alpha_config.write(open(self.config_filename, 'w')) + self.digital_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.digital_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + + def get_addr(self): + return self.addr + + def set_addr(self, addr): + self.addr = addr + self._addr_config = ConfigParser.ConfigParser() + self._addr_config.read(self.config_filename) + if not self._addr_config.has_section('usrp_rx_hrpt'): + self._addr_config.add_section('usrp_rx_hrpt') + self._addr_config.set('usrp_rx_hrpt', 'addr', str(self.addr)) + self._addr_config.write(open(self.config_filename, 'w')) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + (options, args) = parser.parse_args() + tb = usrp_rx_hrpt_nogui() + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() + -- cgit