From b6101982e270948b4a3185ee745ed76bb8661552 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 15 Aug 2009 12:30:45 -0700 Subject: Created new gr-noaa top-level component. Initial work: - Carrier recovery/mixer PLL block - Start of POES grc pipeline, recovers Manchester symbols only - Start of GOES grc pipeline, recovers BPSK symbols only --- gr-noaa/.gitignore | 2 + gr-noaa/Makefile.am | 31 + gr-noaa/grc/.gitignore | 1 + gr-noaa/grc/Makefile.am | 30 + gr-noaa/grc/noaa_carrier_pll_cc.xml | 34 + gr-noaa/grc/rx_goes.grc | 1454 +++++++++++++++++++++++++++++++++++ gr-noaa/grc/rx_poes.grc | 845 ++++++++++++++++++++ gr-noaa/lib/.gitignore | 4 + gr-noaa/lib/Makefile.am | 40 + gr-noaa/lib/noaa_carrier_pll_cc.cc | 82 ++ gr-noaa/lib/noaa_carrier_pll_cc.h | 55 ++ gr-noaa/swig/.gitignore | 6 + gr-noaa/swig/Makefile.am | 65 ++ gr-noaa/swig/Makefile.swig.gen | 259 +++++++ gr-noaa/swig/__init__.py | 28 + gr-noaa/swig/noaa_carrier_pll_cc.i | 37 + gr-noaa/swig/noaa_swig.i | 29 + 17 files changed, 3002 insertions(+) create mode 100644 gr-noaa/.gitignore create mode 100644 gr-noaa/Makefile.am create mode 100644 gr-noaa/grc/.gitignore create mode 100644 gr-noaa/grc/Makefile.am create mode 100644 gr-noaa/grc/noaa_carrier_pll_cc.xml create mode 100755 gr-noaa/grc/rx_goes.grc create mode 100755 gr-noaa/grc/rx_poes.grc create mode 100644 gr-noaa/lib/.gitignore create mode 100644 gr-noaa/lib/Makefile.am create mode 100644 gr-noaa/lib/noaa_carrier_pll_cc.cc create mode 100644 gr-noaa/lib/noaa_carrier_pll_cc.h create mode 100644 gr-noaa/swig/.gitignore create mode 100644 gr-noaa/swig/Makefile.am create mode 100644 gr-noaa/swig/Makefile.swig.gen create mode 100644 gr-noaa/swig/__init__.py create mode 100644 gr-noaa/swig/noaa_carrier_pll_cc.i create mode 100644 gr-noaa/swig/noaa_swig.i (limited to 'gr-noaa') diff --git a/gr-noaa/.gitignore b/gr-noaa/.gitignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/gr-noaa/.gitignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/gr-noaa/Makefile.am b/gr-noaa/Makefile.am new file mode 100644 index 000000000..fa03f1088 --- /dev/null +++ b/gr-noaa/Makefile.am @@ -0,0 +1,31 @@ +# +# Copyright 2009 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 $(top_srcdir)/Makefile.common + +SUBDIRS = lib + +if PYTHON +SUBDIRS += swig +endif + +SUBDIRS += grc + diff --git a/gr-noaa/grc/.gitignore b/gr-noaa/grc/.gitignore new file mode 100644 index 000000000..70845e08e --- /dev/null +++ b/gr-noaa/grc/.gitignore @@ -0,0 +1 @@ +Makefile.in diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am new file mode 100644 index 000000000..18144040d --- /dev/null +++ b/gr-noaa/grc/Makefile.am @@ -0,0 +1,30 @@ +# +# Copyright 2009 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 $(top_srcdir)/Makefile.common + +grcblocksdir = $(prefix)/share/gnuradio/grc/blocks +dist_grcblocks_DATA = \ + noaa_carrier_pll_cc.xml + +EXTRA_DIST = \ + rx_goes.grc \ + rx_poes.grc diff --git a/gr-noaa/grc/noaa_carrier_pll_cc.xml b/gr-noaa/grc/noaa_carrier_pll_cc.xml new file mode 100644 index 000000000..7b1fdc8f2 --- /dev/null +++ b/gr-noaa/grc/noaa_carrier_pll_cc.xml @@ -0,0 +1,34 @@ + + + Carrier PLL + noaa_carrier_pll_cc + NOAA + from gnuradio import noaa + noaa.carrier_pll_cc($alpha, $beta, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Max Offset + max_offset + real + + + in + complex + + + out + complex + + diff --git a/gr-noaa/grc/rx_goes.grc b/gr-noaa/grc/rx_goes.grc new file mode 100755 index 000000000..ebd21da40 --- /dev/null +++ b/gr-noaa/grc/rx_goes.grc @@ -0,0 +1,1454 @@ + + + Sat Aug 1 22:58:41 2009 + + options + + id + rx_goes + + + _enabled + True + + + title + USRP GOES Receiver + + + author + + + + description + + + + window_size + 4095, 4095 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (10, 81) + + + _rotation + 0 + + + + variable + + id + symbol_rate + + + _enabled + True + + + value + 293e3 + + + _coordinate + (11, 148) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + samp_rate/symbol_rate + + + _coordinate + (12, 214) + + + _rotation + 0 + + + + variable_slider + + id + gain + + + _enabled + True + + + label + Gain + + + value + saved_gain + + + min + 0 + + + max + 115 + + + num_steps + 115 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (392, 12) + + + _rotation + 0 + + + + variable_config + + id + saved_gain + + + _enabled + True + + + value + 33 + + + type + real + + + config_file + rx_goes.cfg + + + section + main + + + option + gain + + + writeback + gain + + + _coordinate + (392, 163) + + + _rotation + 0 + + + + variable_config + + id + saved_gain_mu + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + rx_goes.cfg + + + section + main + + + option + gain_mu + + + writeback + gain_mu + + + _coordinate + (835, 162) + + + _rotation + 0 + + + + variable_config + + id + saved_costas_alpha + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + rx_goes.cfg + + + section + main + + + option + costas_alpha + + + writeback + costas_alpha + + + _coordinate + (688, 162) + + + _rotation + 0 + + + + variable_slider + + id + gain_mu + + + _enabled + True + + + label + Gain Mu + + + value + saved_gain_mu + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 1, 1, 1 + + + notebook + + + + _coordinate + (833, 14) + + + _rotation + 0 + + + + variable_slider + + id + costas_alpha + + + _enabled + True + + + label + Costas Alpha + + + value + saved_costas_alpha + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (688, 13) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency + + + value + saved_freq + + + min + 135e6 + + + max + 139e6 + + + num_steps + 400 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 2, 1, 1 + + + notebook + + + + _coordinate + (540, 13) + + + _rotation + 0 + + + + variable_config + + id + saved_freq + + + _enabled + True + + + value + 137e6 + + + type + real + + + config_file + rx_goes.cfg + + + section + main + + + option + freq + + + writeback + freq + + + _coordinate + (541, 162) + + + _rotation + 0 + + + + variable_config + + id + saved_decim + + + _enabled + True + + + value + 160 + + + type + int + + + config_file + rx_goes.cfg + + + section + main + + + option + decim + + + writeback + decim + + + _coordinate + (245, 161) + + + _rotation + 0 + + + + variable_text_box + + id + decim + + + _enabled + True + + + label + Decim + + + value + saved_decim + + + converver + int_converter + + + formatter + None + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (243, 13) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['USRP RX', 'Costas Output'] + + + grid_pos + 2, 0, 1, 3 + + + notebook + + + + _coordinate + (12, 287) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + Waveform + + + samp_rate + samp_rate + + + v_scale + 0.5 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 551) + + + _rotation + 0 + + + + gr_agc_xx + + id + gr_agc_xx_0 + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0/32767.0 + + + max_gain + 1.0 + + + _coordinate + (261, 493) + + + _rotation + 0 + + + + root_raised_cosine_filter + + id + root_raised_cosine_filter_0 + + + _enabled + False + + + type + fir_filter_ccf + + + decim + 1 + + + interp + 1 + + + gain + 1 + + + samp_rate + samp_rate + + + sym_rate + symbol_rate + + + alpha + 0.5 + + + ntaps + 50 + + + _coordinate + (618, 373) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_simple_source_x_0 + + + _enabled + False + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + + + lo_offset + float('inf') + + + gain + gain + + + side + B + + + rx_ant + RXA + + + hb_filters + + + + _coordinate + (11, 477) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2_0 + + + _enabled + True + + + type + complex + + + title + Spectrum + + + samp_rate + samp_rate + + + baseband_freq + freq + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 50 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 337) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle_0 + + + _enabled + True + + + type + complex + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (181, 663) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_1 + + + _enabled + True + + + type + complex + + + title + Scope Plot + + + samp_rate + samp_rate + + + v_scale + 0.4 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1126, 251) + + + _rotation + 0 + + + + gr_probe_mpsk_snr_c + + id + gr_probe_mpsk_snr_c_0 + + + _enabled + True + + + type + snr + + + alpha + 0.0001 + + + probe_rate + 10 + + + _coordinate + (1126, 723) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_0 + + + _enabled + True + + + type + float + + + title + SNR + + + units + dB + + + samp_rate + 10 + + + min_value + 0 + + + max_value + 30 + + + factor + 1.0 + + + decimal_places + 1 + + + ref_level + 0 + + + number_rate + 10 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + show_gauge + True + + + grid_pos + 2, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1335, 651) + + + _rotation + 0 + + + + gr_mpsk_receiver_cc + + id + gr_mpsk_receiver_cc_0 + + + _enabled + True + + + M + 2 + + + theta + 0 + + + alpha + costas_alpha + + + beta + costas_alpha*costas_alpha/4.0 + + + fmin + -0.05 + + + fmax + 0.05 + + + mu + 0.5 + + + gain_mu + gain_mu + + + omega + sps + + + gain_omega + gain_mu*gain_mu/4.0 + + + omega_relative_limit + 0.05 + + + _coordinate + (881, 437) + + + _rotation + 0 + + + + gr_complex_to_real + + id + gr_complex_to_real_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (1133, 521) + + + _rotation + 0 + + + + gr_char_to_float + + id + gr_char_to_float_0 + + + _enabled + True + + + _coordinate + (1523, 521) + + + _rotation + 0 + + + + gr_binary_slicer_fb + + id + gr_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (1343, 521) + + + _rotation + 0 + + + + gr_add_const_vxx + + id + gr_add_const_vxx_0 + + + _enabled + True + + + type + float + + + const + 48.0 + + + vlen + 1 + + + _coordinate + (1707, 517) + + + _rotation + 0 + + + + gr_float_to_char + + id + gr_float_to_char_0 + + + _enabled + True + + + _coordinate + (1878, 521) + + + _rotation + 0 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled + True + + + file + bits.dat + + + type + byte + + + vlen + 1 + + + _coordinate + (2059, 517) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + lrit.dat + + + type + complex + + + repeat + False + + + vlen + 1 + + + _coordinate + (11, 655) + + + _rotation + 0 + + + + usrp_simple_source_x_0 + gr_agc_xx_0 + 0 + 0 + + + gr_agc_xx_0 + wxgui_scopesink2_0 + 0 + 0 + + + gr_file_source_0 + gr_throttle_0 + 0 + 0 + + + gr_throttle_0 + gr_agc_xx_0 + 0 + 0 + + + gr_probe_mpsk_snr_c_0 + wxgui_numbersink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_probe_mpsk_snr_c_0 + 0 + 0 + + + gr_agc_xx_0 + gr_mpsk_receiver_cc_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + wxgui_scopesink2_1 + 0 + 0 + + + gr_agc_xx_0 + wxgui_fftsink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_complex_to_real_0 + 0 + 0 + + + gr_complex_to_real_0 + gr_binary_slicer_fb_0 + 0 + 0 + + + gr_binary_slicer_fb_0 + gr_char_to_float_0 + 0 + 0 + + + gr_char_to_float_0 + gr_add_const_vxx_0 + 0 + 0 + + + gr_add_const_vxx_0 + gr_float_to_char_0 + 0 + 0 + + + gr_float_to_char_0 + gr_file_sink_0 + 0 + 0 + + diff --git a/gr-noaa/grc/rx_poes.grc b/gr-noaa/grc/rx_poes.grc new file mode 100755 index 000000000..f3a483e66 --- /dev/null +++ b/gr-noaa/grc/rx_poes.grc @@ -0,0 +1,845 @@ + + + Sun Aug 9 17:39:05 2009 + + options + + id + rx_poes + + + _enabled + True + + + title + + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + decim + + + _enabled + True + + + value + 16 + + + _coordinate + (97, 10) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (286, 10) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (176, 12) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (382, 14) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (492, 16) + + + _rotation + 0 + + + + variable + + id + mf_taps + + + _enabled + True + + + value + [0.5/hs,]*hs+[-0.5/hs,]*hs + + + _coordinate + (573, 15) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['RX','Manchester'] + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (9, 99) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (79, 518) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 202) + + + _rotation + 0 + + + + gr_file_source + + id + src + + + _enabled + True + + + file + /home/jcorgan/test/poes/poes-d16.dat + + + type + complex + + + repeat + True + + + vlen + 1 + + + _coordinate + (34, 423) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + RX Waveform + + + samp_rate + sample_rate + + + v_scale + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (438, 612) + + + _rotation + 0 + + + + variable + + id + max_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (307, 93) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_fftsink + + + _enabled + True + + + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 1698e6 + + + y_per_div + 5 + + + y_divs + 8 + + + ref_level + 20 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (438, 244) + + + _rotation + 0 + + + + gr_agc_xx + + id + agr + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (270, 494) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_fftsink_0 + + + _enabled + True + + + type + float + + + title + Baseband Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 8 + + + ref_level + 10 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1069, 243) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0 + + + _enabled + True + + + type + float + + + title + Baseband Waveform + + + samp_rate + sample_rate + + + v_scale + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1069, 624) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + complex + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (437, 502) + + + _rotation + 0 + + + + gr_complex_to_imag + + id + gr_complex_to_imag_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (866, 522) + + + _rotation + 0 + + + + variable_slider + + id + pll_alpha + + + _enabled + True + + + label + PLL Alpha + + + value + 0.005 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (157, 94) + + + _rotation + 0 + + + + noaa_carrier_pll_cc + + id + noaa_carrier_pll_cc_0 + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_offset + + + _coordinate + (645, 502) + + + _rotation + 0 + + + + agr + wxgui_scopesink2_0 + 0 + 0 + + + agr + rx_fftsink + 0 + 0 + + + throttle + agr + 0 + 0 + + + src + throttle + 0 + 0 + + + agr + gr_moving_average_xx_0 + 0 + 0 + + + gr_complex_to_imag_0 + rx_fftsink_0 + 0 + 0 + + + gr_complex_to_imag_0 + wxgui_scopesink2_0_0 + 0 + 0 + + + gr_moving_average_xx_0 + noaa_carrier_pll_cc_0 + 0 + 0 + + + noaa_carrier_pll_cc_0 + gr_complex_to_imag_0 + 0 + 0 + + diff --git a/gr-noaa/lib/.gitignore b/gr-noaa/lib/.gitignore new file mode 100644 index 000000000..02b052397 --- /dev/null +++ b/gr-noaa/lib/.gitignore @@ -0,0 +1,4 @@ +Makefile +Makefile.in +.deps +.libs diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am new file mode 100644 index 000000000..39a4f1155 --- /dev/null +++ b/gr-noaa/lib/Makefile.am @@ -0,0 +1,40 @@ +# +# Copyright 2009 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 $(top_srcdir)/Makefile.common + +AM_CPPFLAGS = \ + $(STD_DEFINES_AND_INCLUDES) \ + $(WITH_INCLUDES) + +lib_LTLIBRARIES = \ + libgnuradio-noaa.la + +libgnuradio_noaa_la_SOURCES = \ + noaa_carrier_pll_cc.cc + +libgnuradio_noaa_la_LIBADD = \ + $(GNURADIO_CORE_LA) + +libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 + +grinclude_HEADERS = \ + noaa_carrier_pll_cc.h diff --git a/gr-noaa/lib/noaa_carrier_pll_cc.cc b/gr-noaa/lib/noaa_carrier_pll_cc.cc new file mode 100644 index 000000000..d6a86faa1 --- /dev/null +++ b/gr-noaa/lib/noaa_carrier_pll_cc.cc @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define M_TWOPI (2*M_PI) + +noaa_carrier_pll_cc_sptr +noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_carrier_pll_cc(alpha, beta, max_offset)); +} + +noaa_carrier_pll_cc::noaa_carrier_pll_cc(float alpha, float beta, float max_offset) + : gr_sync_block("noaa_carrier_pll_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), + d_phase(0.0), d_freq(0.0) +{ +} + +float +phase_wrap(float phase) +{ + while (phase < -M_PI) + phase += M_TWOPI; + while (phase > M_PI) + phase -= M_TWOPI; + + return phase; +} + +int +noaa_carrier_pll_cc::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const gr_complex *in = (const gr_complex *) input_items[0]; + gr_complex *out = (gr_complex *) output_items[0]; + + for (int i = 0; i < noutput_items; i++) { + + // Adjust PLL phase/frequency + float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); + d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); + d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); + + // Generate and mix out carrier + float re, im; + gr_sincosf(d_phase, &im, &re); + out[i] = in[i]*gr_complex(re, -im); + } + + return noutput_items; +} diff --git a/gr-noaa/lib/noaa_carrier_pll_cc.h b/gr-noaa/lib/noaa_carrier_pll_cc.h new file mode 100644 index 000000000..8e6de866e --- /dev/null +++ b/gr-noaa/lib/noaa_carrier_pll_cc.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_CARRIER_PLL_CC_H +#define INCLUDED_NOAA_CARRIER_PLL_CC_H + +#include + +class noaa_carrier_pll_cc; +typedef boost::shared_ptr noaa_carrier_pll_cc_sptr; + +noaa_carrier_pll_cc_sptr +noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); + +class noaa_carrier_pll_cc : public gr_sync_block +{ + friend noaa_carrier_pll_cc_sptr noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); + noaa_carrier_pll_cc(float alpha, float beta, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_max_offset; // Maximum frequency offset, radians/sample + float d_phase; // Instantaneous carrier phase + float d_freq; // Instantaneous carrier frequency, radians/sample + + public: + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_CARRIER_PLL_CC_H */ diff --git a/gr-noaa/swig/.gitignore b/gr-noaa/swig/.gitignore new file mode 100644 index 000000000..d18a966df --- /dev/null +++ b/gr-noaa/swig/.gitignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +noaa_swig.cc +noaa_swig.py diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am new file mode 100644 index 000000000..927c6cfb2 --- /dev/null +++ b/gr-noaa/swig/Makefile.am @@ -0,0 +1,65 @@ +# +# Copyright 2004,2005,2006,2008,2009 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 $(top_srcdir)/Makefile.common + +AM_CPPFLAGS = \ + $(STD_DEFINES_AND_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + $(WITH_INCLUDES) \ + -I$(top_srcdir)/gr-noaa/lib + +if PYTHON +# ---------------------------------------------------------------- +# The SWIG library +# TESTS = run_tests + +TOP_SWIG_IFILES = \ + noaa_swig.i + +# Install so that they end up available as: +# import gnuradio.noaa +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/noaa +noaa_swig_pythondir_category = \ + gnuradio/noaa + +# additional libraries for linking with the SWIG-generated library +noaa_swig_la_swig_libadd = \ + $(top_builddir)/gr-noaa/lib/libgnuradio-noaa.la + +# additional Python files to be installed along with the SWIG-generated one +noaa_swig_python = \ + __init__.py + +# additional SWIG files to be installed +noaa_swig_swiginclude_headers = \ + noaa_swig.i \ + noaa_carrier_pll_cc.i + +include $(top_srcdir)/Makefile.swig + +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) + +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) +endif diff --git a/gr-noaa/swig/Makefile.swig.gen b/gr-noaa/swig/Makefile.swig.gen new file mode 100644 index 000000000..3d7102fe3 --- /dev/null +++ b/gr-noaa/swig/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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. +# + +# Makefile.swig.gen for noaa_swig.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/noaa_swig +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/noaa_swig +## +## The following can be overloaded to change the install location, but +## this has to be done in the including Makefile.am -before- +## Makefile.swig is included. + +noaa_swig_pythondir_category ?= gnuradio/noaa_swig +noaa_swig_pylibdir_category ?= $(noaa_swig_pythondir_category) +noaa_swig_pythondir = $(pythondir)/$(noaa_swig_pythondir_category) +noaa_swig_pylibdir = $(pyexecdir)/$(noaa_swig_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +noaa_swig_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## right thing. For more info, see < +## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > + +## Stamps used to ensure parallel make does the right thing. These +## are removed by "make clean", but otherwise unused except during the +## parallel built. These will not be included in a tarball, because +## the SWIG-generated files will be removed from the distribution. + +STAMPS += $(DEPDIR)/noaa_swig-generate-* + +## Other cleaned files: dependency files generated by SWIG or this Makefile + +MOSTLYCLEANFILES += $(DEPDIR)/*.S* + +## Add the .py and .cc files to the list of SWIG built sources. The +## .h file is sometimes built, but not always ... so that one has to +## be added manually by the including Makefile.am . + +swig_built_sources += noaa_swig.py noaa_swig.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +noaa_swig_swiginclude_HEADERS = \ + noaa_swig.i \ + $(noaa_swig_swiginclude_headers) + +noaa_swig_pylib_LTLIBRARIES = \ + _noaa_swig.la + +_noaa_swig_la_SOURCES = \ + noaa_swig.cc \ + $(noaa_swig_la_swig_sources) + +_noaa_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(noaa_swig_la_swig_libadd) + +_noaa_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(noaa_swig_la_swig_ldflags) + +_noaa_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(noaa_swig_la_swig_cxxflags) + +noaa_swig_python_PYTHON = \ + noaa_swig.py \ + $(noaa_swig_python) + +## Entry rule for running SWIG + +noaa_swig.h noaa_swig.py noaa_swig.cc: noaa_swig.i +## This rule will get called only when MAKE decides that one of the +## targets needs to be created or re-created, because: +## +## * The .i file is newer than any or all of the generated files; +## +## * Any or all of the .cc, .h, or .py files does not exist and is +## needed (in the case this file is not needed, the rule for it is +## ignored); or +## +## * Some SWIG-based dependecy of the .cc file isn't met and hence the +## .cc file needs be be regenerated. Explanation: Because MAKE +## knows how to handle dependencies for .cc files (regardless of +## their name or extension), then the .cc file is used as a target +## instead of the .i file -- but with the dependencies of the .i +## file. It is this last reason why the line: +## +## if test -f $@; then :; else +## +## cannot be used in this case: If a .i file dependecy is not met, +## then the .cc file needs to be rebuilt. But if the stamp is newer +## than the .cc file, and the .cc file exists, then in the original +## version (with the 'test' above) the internal MAKE call will not +## be issued and hence the .cc file will not be rebuilt. +## +## Once execution gets to here, it should always proceed no matter the +## state of a stamp (as discussed in link above). The +## $(DEPDIR)/noaa_swig-generate stuff is used to allow for parallel +## builds to "do the right thing". The stamp has no relationship with +## either the target files or dependency file; it is used solely for +## the protection of multiple builds during a given call to MAKE. +## +## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM +## (15). At a caught signal, the quoted command will be issued before +## exiting. In this case, remove any stamp, whether temporary of not. +## The trap is valid until the process exits; the process includes all +## commands appended via "\"s. +## + trap 'rm -rf $(DEPDIR)/noaa_swig-generate-*' 1 2 13 15; \ +## +## Create a temporary directory, which acts as a lock. The first +## process to create the directory will succeed and issue the MAKE +## command to do the actual work, while all subsequent processes will +## fail -- leading them to wait for the first process to finish. +## + if mkdir $(DEPDIR)/noaa_swig-generate-lock 2>/dev/null; then \ +## +## This code is being executed by the first process to succeed in +## creating the directory lock. +## +## Remove the stamp associated with this filename. +## + rm -f $(DEPDIR)/noaa_swig-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/noaa_swig-generate-stamp WHAT=$<; \ +## +## Now that the .cc, .h, and .py files have been (re)created from the +## .i file, future checking of this rule during the same MAKE +## execution will come back that the rule doesn't need to be executed +## because none of the conditions mentioned at the start of this rule +## will be positive. Remove the the directory lock, which frees up +## any waiting process(es) to continue. +## + rmdir $(DEPDIR)/noaa_swig-generate-lock; \ + else \ +## +## This code is being executed by any follower processes while the +## directory lock is in place. +## +## Wait until the first process is done, testing once per second. +## + while test -d $(DEPDIR)/noaa_swig-generate-lock; do \ + sleep 1; \ + done; \ +## +## Succeed if and only if the first process succeeded; exit this +## process returning the status of the generated stamp. +## + test -f $(DEPDIR)/noaa_swig-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/noaa_swig-generate-stamp: +## This rule will be called only by the first process issuing the +## above rule to succeed in creating the lock directory, after +## removing the actual stamp file in order to guarantee that MAKE will +## execute this rule. +## +## Call SWIG to generate the various output files; special +## post-processing on 'mingw32' host OS for the dependency file. +## + if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(noaa_swig_swig_args) \ + -MD -MF $(DEPDIR)/noaa_swig.Std \ + -module noaa_swig -o noaa_swig.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/noaa_swig.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/noaa_swig.Std \ + > $(DEPDIR)/noaa_swig.Sd; \ + $(RM) $(DEPDIR)/noaa_swig.Std; \ + $(MV) $(DEPDIR)/noaa_swig.Sd $(DEPDIR)/noaa_swig.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/noaa_swig.S*; exit 1; \ + fi; +## +## Mess with the SWIG output .Std dependency file, to create a +## dependecy file valid for the input .i file: Basically, simulate the +## dependency file created for libraries by GNU's libtool for C++, +## where all of the dependencies for the target are first listed, then +## each individual dependency is listed as a target with no further +## dependencies. +## +## (1) remove the current dependency file +## + $(RM) $(DEPDIR)/noaa_swig.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/noaa_swig.Std $(DEPDIR)/noaa_swig.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/noaa_swig.d +## +## (4) from the SWIG file, remove the first line (the target); remove +## trailing " \" and " " from each line. Append ":" to each line, +## followed by 2 carriage returns, then append this to the end of +## the dependency file. +## + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/noaa_swig.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/noaa_swig.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/noaa_swig.Std +## +## Create the stamp for this filename generation, to signal success in +## executing this rule; allows other threads waiting on this process +## to continue. +## + touch $(DEPDIR)/noaa_swig-generate-stamp + +# KLUDGE: Force runtime include of a SWIG dependency file. This is +# not guaranteed to be portable, but will probably work. If it works, +# we have accurate dependencies for our swig stuff, which is good. + +@am__include@ @am__quote@./$(DEPDIR)/noaa_swig.d@am__quote@ + diff --git a/gr-noaa/swig/__init__.py b/gr-noaa/swig/__init__.py new file mode 100644 index 000000000..d8d337e65 --- /dev/null +++ b/gr-noaa/swig/__init__.py @@ -0,0 +1,28 @@ +# +# Copyright 2009 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. +# + +# The presence of this file turns this directory into a Python package + +# Add SWIG generated code to this namespace +from noaa_swig import * + +# Add other content from pure-Python modules here + diff --git a/gr-noaa/swig/noaa_carrier_pll_cc.i b/gr-noaa/swig/noaa_carrier_pll_cc.i new file mode 100644 index 000000000..4d61f393c --- /dev/null +++ b/gr-noaa/swig/noaa_carrier_pll_cc.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,carrier_pll_cc) + +noaa_carrier_pll_cc_sptr +noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); + +class noaa_carrier_pll_cc : public gr_sync_block +{ +private: + noaa_carrier_pll_cc(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i new file mode 100644 index 000000000..384f4e6a2 --- /dev/null +++ b/gr-noaa/swig/noaa_swig.i @@ -0,0 +1,29 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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 "gnuradio.i" + +%{ +#include +%} + +%include "noaa_carrier_pll_cc.i" -- cgit From a02a0e43d49d3bbb9a76ab8333f1bf8e25c48556 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 22 Aug 2009 13:10:08 -0700 Subject: Update rx_poes script to filter prior to PLL. --- gr-noaa/grc/rx_poes.grc | 407 ++++++++++++++++++++++-------------------------- 1 file changed, 184 insertions(+), 223 deletions(-) (limited to 'gr-noaa') diff --git a/gr-noaa/grc/rx_poes.grc b/gr-noaa/grc/rx_poes.grc index f3a483e66..1001049a2 100755 --- a/gr-noaa/grc/rx_poes.grc +++ b/gr-noaa/grc/rx_poes.grc @@ -1,6 +1,6 @@ - Sun Aug 9 17:39:05 2009 + Sat Aug 22 13:06:22 2009 options @@ -167,11 +167,34 @@ 0 + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 202) + + + _rotation + 0 + + variable id - mf_taps + max_offset _enabled @@ -179,11 +202,11 @@ value - [0.5/hs,]*hs+[-0.5/hs,]*hs + 2*math.pi*100e3/sample_rate _coordinate - (573, 15) + (342, 95) _rotation @@ -191,26 +214,46 @@ - notebook + variable_slider id - displays + pll_alpha _enabled True + + label + PLL Alpha + + + value + 0.005 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + style - wx.NB_TOP + wx.SL_HORIZONTAL - labels - ['RX','Manchester'] + converver + float_converter grid_pos - 1, 0, 1, 1 + 0, 0, 1, 1 notebook @@ -218,7 +261,7 @@ _coordinate - (9, 99) + (192, 100) _rotation @@ -257,22 +300,38 @@ - import + gr_agc_xx id - import_0 + agr _enabled True - import - import math + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 _coordinate - (9, 202) + (261, 494) _rotation @@ -280,34 +339,65 @@ - gr_file_source + gr_moving_average_xx id - src + gr_moving_average_xx_0 _enabled True - - file - /home/jcorgan/test/poes/poes-d16.dat - type complex - repeat + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (429, 502) + + + _rotation + 0 + + + + noaa_carrier_pll_cc + + id + noaa_carrier_pll_cc_0 + + + _enabled True - vlen - 1 + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_offset _coordinate - (34, 423) + (636, 502) _rotation @@ -366,30 +456,7 @@ _coordinate - (438, 612) - - - _rotation - 0 - - - - variable - - id - max_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (307, 93) + (433, 612) _rotation @@ -464,7 +531,7 @@ _coordinate - (438, 244) + (433, 241) _rotation @@ -472,38 +539,22 @@ - gr_agc_xx + gr_complex_to_imag id - agr + gr_complex_to_imag_0 _enabled True - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 + vlen + 1 _coordinate - (270, 494) + (877, 522) _rotation @@ -511,74 +562,34 @@ - wxgui_fftsink2 + notebook id - rx_fftsink_0 + displays _enabled True - type - float - - - title - Baseband Spectrum - - - samp_rate - sample_rate - - - baseband_freq - 0 - - - y_per_div - 10 - - - y_divs - 8 - - - ref_level - 10 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - True + style + wx.NB_TOP - avg_alpha - 0.1 + labels + ['RX','Baseband'] grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - displays, 1 + _coordinate - (1069, 243) + (9, 99) _rotation @@ -589,7 +600,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0 + wxgui_scopesink2_0_1_0_1 _enabled @@ -601,7 +612,7 @@ title - Baseband Waveform + Manchester Symbols samp_rate @@ -609,11 +620,11 @@ v_scale - 0 + 0.5 t_scale - 20.0/sample_rate + 5.0/sym_rate ac_couple @@ -637,18 +648,18 @@ _coordinate - (1069, 624) + (856, 343) _rotation - 0 + 180 - gr_moving_average_xx + wxgui_scopesink2 id - gr_moving_average_xx_0 + wxgui_scopesink2_0_0 _enabled @@ -659,129 +670,79 @@ complex - length - hs - - - scale - 1.0/hs + title + Post-Filter/PLL - max_iter - 4000 + samp_rate + sample_rate - _coordinate - (437, 502) + v_scale + 0.5 - _rotation - 0 + t_scale + 20.0/sample_rate - - - gr_complex_to_imag - id - gr_complex_to_imag_0 + ac_couple + False - _enabled - True + xy_mode + False - vlen + num_inputs 1 - - _coordinate - (866, 522) - - - _rotation - 0 - - - - variable_slider - - id - pll_alpha - - - _enabled - True - - - label - PLL Alpha - - - value - 0.005 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - grid_pos 0, 0, 1, 1 notebook - + displays, 1 _coordinate - (157, 94) + (634, 335) _rotation - 0 + 180 - noaa_carrier_pll_cc + gr_file_source id - noaa_carrier_pll_cc_0 + src _enabled True - alpha - pll_alpha + file + poes-d16.dat - beta - pll_alpha**2/4.0 + type + complex - max_offset - max_offset + repeat + True + + + vlen + 1 _coordinate - (645, 502) + (34, 423) _rotation @@ -789,14 +750,14 @@ - agr - wxgui_scopesink2_0 + src + throttle 0 0 - agr - rx_fftsink + noaa_carrier_pll_cc_0 + gr_complex_to_imag_0 0 0 @@ -806,12 +767,6 @@ 0 0 - - src - throttle - 0 - 0 - agr gr_moving_average_xx_0 @@ -819,14 +774,14 @@ 0 - gr_complex_to_imag_0 - rx_fftsink_0 + agr + rx_fftsink 0 0 - gr_complex_to_imag_0 - wxgui_scopesink2_0_0 + agr + wxgui_scopesink2_0 0 0 @@ -838,7 +793,13 @@ noaa_carrier_pll_cc_0 - gr_complex_to_imag_0 + wxgui_scopesink2_0_0 + 0 + 0 + + + gr_complex_to_imag_0 + wxgui_scopesink2_0_1_0_1 0 0 -- cgit From 6b6a5522e0b1d12ef5d697b1067a87dfe584cec6 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 29 Aug 2009 11:12:37 -0700 Subject: Work in progress, incomplete * Renamed noaa.carrier_pll_cc to noaa.hrpt_pll_cc * Added nop noaa.hrpt_sync_cc * Renamed grc apps to use usrp_ prefix and protocol name * Installed grc generated scripts to path --- gr-noaa/grc/Makefile.am | 12 +- gr-noaa/grc/noaa_carrier_pll_cc.xml | 34 - gr-noaa/grc/noaa_hrpt_pll_cc.xml | 34 + gr-noaa/grc/noaa_hrpt_sync_cc.xml | 39 + gr-noaa/grc/rx_goes.grc | 1454 ---------------------------------- gr-noaa/grc/rx_poes.grc | 806 ------------------- gr-noaa/grc/usrp_rx_hrpt.grc | 1026 ++++++++++++++++++++++++ gr-noaa/grc/usrp_rx_hrpt.py | 245 ++++++ gr-noaa/grc/usrp_rx_lrit.grc | 1477 +++++++++++++++++++++++++++++++++++ gr-noaa/grc/usrp_rx_lrit.py | 399 ++++++++++ gr-noaa/lib/Makefile.am | 6 +- gr-noaa/lib/noaa_carrier_pll_cc.cc | 82 -- gr-noaa/lib/noaa_carrier_pll_cc.h | 55 -- gr-noaa/lib/noaa_hrpt_pll_cc.cc | 82 ++ gr-noaa/lib/noaa_hrpt_pll_cc.h | 55 ++ gr-noaa/lib/noaa_hrpt_sync_cc.cc | 62 ++ gr-noaa/lib/noaa_hrpt_sync_cc.h | 57 ++ gr-noaa/swig/Makefile.am | 3 +- gr-noaa/swig/noaa_carrier_pll_cc.i | 37 - gr-noaa/swig/noaa_hrpt_pll_cc.i | 37 + gr-noaa/swig/noaa_hrpt_sync_cc.i | 37 + gr-noaa/swig/noaa_swig.i | 6 +- 22 files changed, 3569 insertions(+), 2476 deletions(-) delete mode 100644 gr-noaa/grc/noaa_carrier_pll_cc.xml create mode 100644 gr-noaa/grc/noaa_hrpt_pll_cc.xml create mode 100644 gr-noaa/grc/noaa_hrpt_sync_cc.xml delete mode 100755 gr-noaa/grc/rx_goes.grc delete mode 100755 gr-noaa/grc/rx_poes.grc create mode 100644 gr-noaa/grc/usrp_rx_hrpt.grc create mode 100755 gr-noaa/grc/usrp_rx_hrpt.py create mode 100644 gr-noaa/grc/usrp_rx_lrit.grc create mode 100755 gr-noaa/grc/usrp_rx_lrit.py delete mode 100644 gr-noaa/lib/noaa_carrier_pll_cc.cc delete mode 100644 gr-noaa/lib/noaa_carrier_pll_cc.h create mode 100644 gr-noaa/lib/noaa_hrpt_pll_cc.cc create mode 100644 gr-noaa/lib/noaa_hrpt_pll_cc.h create mode 100644 gr-noaa/lib/noaa_hrpt_sync_cc.cc create mode 100644 gr-noaa/lib/noaa_hrpt_sync_cc.h delete mode 100644 gr-noaa/swig/noaa_carrier_pll_cc.i create mode 100644 gr-noaa/swig/noaa_hrpt_pll_cc.i create mode 100644 gr-noaa/swig/noaa_hrpt_sync_cc.i (limited to 'gr-noaa') diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index 18144040d..c75529778 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -22,9 +22,15 @@ include $(top_srcdir)/Makefile.common grcblocksdir = $(prefix)/share/gnuradio/grc/blocks + +dist_bin_SCRIPTS = \ + usrp_rx_hrpt.py \ + usrp_rx_lrit.py + dist_grcblocks_DATA = \ - noaa_carrier_pll_cc.xml + noaa_hrpt_pll_cc.xml \ + noaa_hrpt_sync_cc.xml EXTRA_DIST = \ - rx_goes.grc \ - rx_poes.grc + usrp_rx_hrpt.grc \ + usrp_rx_lrit.grc diff --git a/gr-noaa/grc/noaa_carrier_pll_cc.xml b/gr-noaa/grc/noaa_carrier_pll_cc.xml deleted file mode 100644 index 7b1fdc8f2..000000000 --- a/gr-noaa/grc/noaa_carrier_pll_cc.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - Carrier PLL - noaa_carrier_pll_cc - NOAA - from gnuradio import noaa - noaa.carrier_pll_cc($alpha, $beta, $max_offset) - set_alpha($alpha) - set_beta($beta) - set_max_offset($max_offset) - - Alpha - alpha - real - - - Beta - beta - real - - - Max Offset - max_offset - real - - - in - complex - - - out - complex - - diff --git a/gr-noaa/grc/noaa_hrpt_pll_cc.xml b/gr-noaa/grc/noaa_hrpt_pll_cc.xml new file mode 100644 index 000000000..e56e0b056 --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_pll_cc.xml @@ -0,0 +1,34 @@ + + + HRPT PLL + noaa_hrpt_pll_cc + NOAA + from gnuradio import noaa + noaa.hrpt_pll_cc($alpha, $beta, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Max Offset + max_offset + real + + + in + complex + + + out + complex + + diff --git a/gr-noaa/grc/noaa_hrpt_sync_cc.xml b/gr-noaa/grc/noaa_hrpt_sync_cc.xml new file mode 100644 index 000000000..d311aa946 --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_sync_cc.xml @@ -0,0 +1,39 @@ + + + HRPT SYNC + noaa_hrpt_sync_cc + NOAA + from gnuradio import noaa + noaa.hrpt_sync_cc($alpha, $beta, $sps, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Samples/Symbol + sps + real + + + Max Offset + max_offset + real + + + in + complex + + + out + complex + + diff --git a/gr-noaa/grc/rx_goes.grc b/gr-noaa/grc/rx_goes.grc deleted file mode 100755 index ebd21da40..000000000 --- a/gr-noaa/grc/rx_goes.grc +++ /dev/null @@ -1,1454 +0,0 @@ - - - Sat Aug 1 22:58:41 2009 - - options - - id - rx_goes - - - _enabled - True - - - title - USRP GOES Receiver - - - author - - - - description - - - - window_size - 4095, 4095 - - - generate_options - wx_gui - - - category - Custom - - - run - True - - - realtime_scheduling - - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - variable - - id - samp_rate - - - _enabled - True - - - value - 64e6/decim - - - _coordinate - (10, 81) - - - _rotation - 0 - - - - variable - - id - symbol_rate - - - _enabled - True - - - value - 293e3 - - - _coordinate - (11, 148) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - samp_rate/symbol_rate - - - _coordinate - (12, 214) - - - _rotation - 0 - - - - variable_slider - - id - gain - - - _enabled - True - - - label - Gain - - - value - saved_gain - - - min - 0 - - - max - 115 - - - num_steps - 115 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 1, 1, 1 - - - notebook - - - - _coordinate - (392, 12) - - - _rotation - 0 - - - - variable_config - - id - saved_gain - - - _enabled - True - - - value - 33 - - - type - real - - - config_file - rx_goes.cfg - - - section - main - - - option - gain - - - writeback - gain - - - _coordinate - (392, 163) - - - _rotation - 0 - - - - variable_config - - id - saved_gain_mu - - - _enabled - True - - - value - 0.005 - - - type - real - - - config_file - rx_goes.cfg - - - section - main - - - option - gain_mu - - - writeback - gain_mu - - - _coordinate - (835, 162) - - - _rotation - 0 - - - - variable_config - - id - saved_costas_alpha - - - _enabled - True - - - value - 0.005 - - - type - real - - - config_file - rx_goes.cfg - - - section - main - - - option - costas_alpha - - - writeback - costas_alpha - - - _coordinate - (688, 162) - - - _rotation - 0 - - - - variable_slider - - id - gain_mu - - - _enabled - True - - - label - Gain Mu - - - value - saved_gain_mu - - - min - 0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 1, 1, 1, 1 - - - notebook - - - - _coordinate - (833, 14) - - - _rotation - 0 - - - - variable_slider - - id - costas_alpha - - - _enabled - True - - - label - Costas Alpha - - - value - saved_costas_alpha - - - min - 0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 1, 0, 1, 1 - - - notebook - - - - _coordinate - (688, 13) - - - _rotation - 0 - - - - variable_slider - - id - freq - - - _enabled - True - - - label - Frequency - - - value - saved_freq - - - min - 135e6 - - - max - 139e6 - - - num_steps - 400 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 2, 1, 1 - - - notebook - - - - _coordinate - (540, 13) - - - _rotation - 0 - - - - variable_config - - id - saved_freq - - - _enabled - True - - - value - 137e6 - - - type - real - - - config_file - rx_goes.cfg - - - section - main - - - option - freq - - - writeback - freq - - - _coordinate - (541, 162) - - - _rotation - 0 - - - - variable_config - - id - saved_decim - - - _enabled - True - - - value - 160 - - - type - int - - - config_file - rx_goes.cfg - - - section - main - - - option - decim - - - writeback - decim - - - _coordinate - (245, 161) - - - _rotation - 0 - - - - variable_text_box - - id - decim - - - _enabled - True - - - label - Decim - - - value - saved_decim - - - converver - int_converter - - - formatter - None - - - grid_pos - 0, 0, 1, 1 - - - notebook - - - - _coordinate - (243, 13) - - - _rotation - 0 - - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - - labels - ['USRP RX', 'Costas Output'] - - - grid_pos - 2, 0, 1, 3 - - - notebook - - - - _coordinate - (12, 287) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0 - - - _enabled - True - - - type - complex - - - title - Waveform - - - samp_rate - samp_rate - - - v_scale - 0.5 - - - t_scale - 20.0/samp_rate - - - ac_couple - False - - - xy_mode - True - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 551) - - - _rotation - 0 - - - - gr_agc_xx - - id - gr_agc_xx_0 - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0/32767.0 - - - max_gain - 1.0 - - - _coordinate - (261, 493) - - - _rotation - 0 - - - - root_raised_cosine_filter - - id - root_raised_cosine_filter_0 - - - _enabled - False - - - type - fir_filter_ccf - - - decim - 1 - - - interp - 1 - - - gain - 1 - - - samp_rate - samp_rate - - - sym_rate - symbol_rate - - - alpha - 0.5 - - - ntaps - 50 - - - _coordinate - (618, 373) - - - _rotation - 0 - - - - usrp_simple_source_x - - id - usrp_simple_source_x_0 - - - _enabled - False - - - type - complex - - - format - - - - which - 0 - - - decimation - decim - - - frequency - freq - - - lo_offset - float('inf') - - - gain - gain - - - side - B - - - rx_ant - RXA - - - hb_filters - - - - _coordinate - (11, 477) - - - _rotation - 0 - - - - wxgui_fftsink2 - - id - wxgui_fftsink2_0 - - - _enabled - True - - - type - complex - - - title - Spectrum - - - samp_rate - samp_rate - - - baseband_freq - freq - - - y_per_div - 10 - - - y_divs - 10 - - - ref_level - 50 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - False - - - avg_alpha - 0 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 337) - - - _rotation - 0 - - - - gr_throttle - - id - gr_throttle_0 - - - _enabled - True - - - type - complex - - - samples_per_second - samp_rate - - - vlen - 1 - - - _coordinate - (181, 663) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_1 - - - _enabled - True - - - type - complex - - - title - Scope Plot - - - samp_rate - samp_rate - - - v_scale - 0.4 - - - t_scale - 20.0/samp_rate - - - ac_couple - False - - - xy_mode - True - - - num_inputs - 1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (1126, 251) - - - _rotation - 0 - - - - gr_probe_mpsk_snr_c - - id - gr_probe_mpsk_snr_c_0 - - - _enabled - True - - - type - snr - - - alpha - 0.0001 - - - probe_rate - 10 - - - _coordinate - (1126, 723) - - - _rotation - 0 - - - - wxgui_numbersink2 - - id - wxgui_numbersink2_0 - - - _enabled - True - - - type - float - - - title - SNR - - - units - dB - - - samp_rate - 10 - - - min_value - 0 - - - max_value - 30 - - - factor - 1.0 - - - decimal_places - 1 - - - ref_level - 0 - - - number_rate - 10 - - - peak_hold - False - - - average - False - - - avg_alpha - 0 - - - show_gauge - True - - - grid_pos - 2, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (1335, 651) - - - _rotation - 0 - - - - gr_mpsk_receiver_cc - - id - gr_mpsk_receiver_cc_0 - - - _enabled - True - - - M - 2 - - - theta - 0 - - - alpha - costas_alpha - - - beta - costas_alpha*costas_alpha/4.0 - - - fmin - -0.05 - - - fmax - 0.05 - - - mu - 0.5 - - - gain_mu - gain_mu - - - omega - sps - - - gain_omega - gain_mu*gain_mu/4.0 - - - omega_relative_limit - 0.05 - - - _coordinate - (881, 437) - - - _rotation - 0 - - - - gr_complex_to_real - - id - gr_complex_to_real_0 - - - _enabled - True - - - vlen - 1 - - - _coordinate - (1133, 521) - - - _rotation - 0 - - - - gr_char_to_float - - id - gr_char_to_float_0 - - - _enabled - True - - - _coordinate - (1523, 521) - - - _rotation - 0 - - - - gr_binary_slicer_fb - - id - gr_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (1343, 521) - - - _rotation - 0 - - - - gr_add_const_vxx - - id - gr_add_const_vxx_0 - - - _enabled - True - - - type - float - - - const - 48.0 - - - vlen - 1 - - - _coordinate - (1707, 517) - - - _rotation - 0 - - - - gr_float_to_char - - id - gr_float_to_char_0 - - - _enabled - True - - - _coordinate - (1878, 521) - - - _rotation - 0 - - - - gr_file_sink - - id - gr_file_sink_0 - - - _enabled - True - - - file - bits.dat - - - type - byte - - - vlen - 1 - - - _coordinate - (2059, 517) - - - _rotation - 0 - - - - gr_file_source - - id - gr_file_source_0 - - - _enabled - True - - - file - lrit.dat - - - type - complex - - - repeat - False - - - vlen - 1 - - - _coordinate - (11, 655) - - - _rotation - 0 - - - - usrp_simple_source_x_0 - gr_agc_xx_0 - 0 - 0 - - - gr_agc_xx_0 - wxgui_scopesink2_0 - 0 - 0 - - - gr_file_source_0 - gr_throttle_0 - 0 - 0 - - - gr_throttle_0 - gr_agc_xx_0 - 0 - 0 - - - gr_probe_mpsk_snr_c_0 - wxgui_numbersink2_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - gr_probe_mpsk_snr_c_0 - 0 - 0 - - - gr_agc_xx_0 - gr_mpsk_receiver_cc_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - wxgui_scopesink2_1 - 0 - 0 - - - gr_agc_xx_0 - wxgui_fftsink2_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - gr_complex_to_real_0 - 0 - 0 - - - gr_complex_to_real_0 - gr_binary_slicer_fb_0 - 0 - 0 - - - gr_binary_slicer_fb_0 - gr_char_to_float_0 - 0 - 0 - - - gr_char_to_float_0 - gr_add_const_vxx_0 - 0 - 0 - - - gr_add_const_vxx_0 - gr_float_to_char_0 - 0 - 0 - - - gr_float_to_char_0 - gr_file_sink_0 - 0 - 0 - - diff --git a/gr-noaa/grc/rx_poes.grc b/gr-noaa/grc/rx_poes.grc deleted file mode 100755 index 1001049a2..000000000 --- a/gr-noaa/grc/rx_poes.grc +++ /dev/null @@ -1,806 +0,0 @@ - - - Sat Aug 22 13:06:22 2009 - - options - - id - rx_poes - - - _enabled - True - - - title - - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - wx_gui - - - category - Custom - - - run - True - - - realtime_scheduling - - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - variable - - id - decim - - - _enabled - True - - - value - 16 - - - _coordinate - (97, 10) - - - _rotation - 0 - - - - variable - - id - sym_rate - - - _enabled - True - - - value - 600*1109 - - - _coordinate - (286, 10) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 64e6/decim - - - _coordinate - (176, 12) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - sample_rate/sym_rate - - - _coordinate - (382, 14) - - - _rotation - 0 - - - - variable - - id - hs - - - _enabled - True - - - value - int(sps/2.0) - - - _coordinate - (492, 16) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math - - - _coordinate - (9, 202) - - - _rotation - 0 - - - - variable - - id - max_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (342, 95) - - - _rotation - 0 - - - - variable_slider - - id - pll_alpha - - - _enabled - True - - - label - PLL Alpha - - - value - 0.005 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 0, 1, 1 - - - notebook - - - - _coordinate - (192, 100) - - - _rotation - 0 - - - - gr_throttle - - id - throttle - - - _enabled - True - - - type - complex - - - samples_per_second - sample_rate - - - vlen - 1 - - - _coordinate - (79, 518) - - - _rotation - 0 - - - - gr_agc_xx - - id - agr - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (261, 494) - - - _rotation - 0 - - - - gr_moving_average_xx - - id - gr_moving_average_xx_0 - - - _enabled - True - - - type - complex - - - length - hs - - - scale - 1.0/hs - - - max_iter - 4000 - - - _coordinate - (429, 502) - - - _rotation - 0 - - - - noaa_carrier_pll_cc - - id - noaa_carrier_pll_cc_0 - - - _enabled - True - - - alpha - pll_alpha - - - beta - pll_alpha**2/4.0 - - - max_offset - max_offset - - - _coordinate - (636, 502) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0 - - - _enabled - True - - - type - complex - - - title - RX Waveform - - - samp_rate - sample_rate - - - v_scale - 0 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (433, 612) - - - _rotation - 0 - - - - wxgui_fftsink2 - - id - rx_fftsink - - - _enabled - True - - - type - complex - - - title - RX Spectrum - - - samp_rate - sample_rate - - - baseband_freq - 1698e6 - - - y_per_div - 5 - - - y_divs - 8 - - - ref_level - 20 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - True - - - avg_alpha - 0.1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (433, 241) - - - _rotation - 0 - - - - gr_complex_to_imag - - id - gr_complex_to_imag_0 - - - _enabled - True - - - vlen - 1 - - - _coordinate - (877, 522) - - - _rotation - 0 - - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - - labels - ['RX','Baseband'] - - - grid_pos - 1, 0, 1, 1 - - - notebook - - - - _coordinate - (9, 99) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0_1_0_1 - - - _enabled - True - - - type - float - - - title - Manchester Symbols - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 5.0/sym_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (856, 343) - - - _rotation - 180 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0_0 - - - _enabled - True - - - type - complex - - - title - Post-Filter/PLL - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (634, 335) - - - _rotation - 180 - - - - gr_file_source - - id - src - - - _enabled - True - - - file - poes-d16.dat - - - type - complex - - - repeat - True - - - vlen - 1 - - - _coordinate - (34, 423) - - - _rotation - 0 - - - - src - throttle - 0 - 0 - - - noaa_carrier_pll_cc_0 - gr_complex_to_imag_0 - 0 - 0 - - - throttle - agr - 0 - 0 - - - agr - gr_moving_average_xx_0 - 0 - 0 - - - agr - rx_fftsink - 0 - 0 - - - agr - wxgui_scopesink2_0 - 0 - 0 - - - gr_moving_average_xx_0 - noaa_carrier_pll_cc_0 - 0 - 0 - - - noaa_carrier_pll_cc_0 - wxgui_scopesink2_0_0 - 0 - 0 - - - gr_complex_to_imag_0 - wxgui_scopesink2_0_1_0_1 - 0 - 0 - - diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc new file mode 100644 index 000000000..d3c6603ad --- /dev/null +++ b/gr-noaa/grc/usrp_rx_hrpt.grc @@ -0,0 +1,1026 @@ + + + Sat Aug 29 11:48:56 2009 + + options + + id + usrp_rx_hrpt + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 202) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (79, 518) + + + _rotation + 0 + + + + gr_file_source + + id + src + + + _enabled + True + + + file + poes-d16.dat + + + type + complex + + + repeat + True + + + vlen + 1 + + + _coordinate + (34, 423) + + + _rotation + 0 + + + + variable + + id + decim + + + _enabled + True + + + value + 16 + + + _coordinate + (186, 10) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (589, 13) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (383, 7) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (479, 11) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (273, 9) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_fftsink + + + _enabled + True + + + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 1698e6 + + + y_per_div + 5 + + + y_divs + 8 + + + ref_level + 20 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (194, 263) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + RX Waveform + + + samp_rate + sample_rate + + + v_scale + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (198, 609) + + + _rotation + 180 + + + + gr_agc_xx + + id + agr + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (261, 494) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + gr_moving_average_xx_0 + + + _enabled + True + + + type + complex + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (434, 502) + + + _rotation + 0 + + + + variable + + id + max_carrier_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (668, 107) + + + _rotation + 0 + + + + variable + + id + max_sync_offset + + + _enabled + True + + + value + 0.01 + + + _coordinate + (665, 173) + + + _rotation + 0 + + + + variable_slider + + id + pll_alpha + + + _enabled + True + + + label + PLL Alpha + + + value + 0.005 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (192, 100) + + + _rotation + 0 + + + + variable_slider + + id + sync_alpha + + + _enabled + True + + + label + SYNC Alpha + + + value + 0.005 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (344, 101) + + + _rotation + 0 + + + + noaa_hrpt_pll_cc + + id + noaa_hrpt_pll_cc_0 + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (628, 502) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0 + + + _enabled + True + + + type + complex + + + title + Post-PLL + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (618, 335) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0_1 + + + _enabled + True + + + type + complex + + + title + Post-SYNC + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (872, 341) + + + _rotation + 180 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['RX','PLL','SYNC'] + + + grid_pos + 1, 0, 1, 2 + + + notebook + + + + _coordinate + (9, 99) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0_0 + + + _enabled + True + + + type + complex + + + title + Post-PLL + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (618, 614) + + + _rotation + 180 + + + + noaa_hrpt_sync_cc + + id + sync + + + _enabled + True + + + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset + + + _coordinate + (865, 494) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0_0_0 + + + _enabled + True + + + type + complex + + + title + Post-SYNC + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (872, 607) + + + _rotation + 180 + + + + src + throttle + 0 + 0 + + + throttle + agr + 0 + 0 + + + agr + gr_moving_average_xx_0 + 0 + 0 + + + agr + rx_fftsink + 0 + 0 + + + agr + wxgui_scopesink2_0 + 0 + 0 + + + gr_moving_average_xx_0 + noaa_hrpt_pll_cc_0 + 0 + 0 + + + noaa_hrpt_pll_cc_0 + wxgui_scopesink2_0_0 + 0 + 0 + + + noaa_hrpt_pll_cc_0 + wxgui_scopesink2_0_0_0 + 0 + 0 + + + noaa_hrpt_pll_cc_0 + sync + 0 + 0 + + + sync + wxgui_scopesink2_0_0_1 + 0 + 0 + + + sync + wxgui_scopesink2_0_0_0_0 + 0 + 0 + + diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py new file mode 100755 index 000000000..ed6417335 --- /dev/null +++ b/gr-noaa/grc/usrp_rx_hrpt.py @@ -0,0 +1,245 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Sat Aug 29 11:48:57 2009 +################################################## + +from gnuradio import gr +from gnuradio import noaa +from gnuradio.eng_option import eng_option +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 math +import wx + +class usrp_rx_hrpt(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + + ################################################## + # Variables + ################################################## + self.decim = decim = 16 + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self.sync_alpha = sync_alpha = 0.005 + self.pll_alpha = pll_alpha = 0.005 + self.max_sync_offset = max_sync_offset = 0.01 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "SYNC") + self.GridAdd(self.displays, 1, 0, 1, 2) + + ################################################## + # Controls + ################################################## + _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._sync_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + label="SYNC Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._sync_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + minimum=0.0, + maximum=0.5, + num_steps=500, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_sync_alpha_sizer, 0, 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=500, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_pll_alpha_sizer, 0, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.gr_moving_average_xx_0 = gr.moving_average_cc(hs, 1.0/hs, 4000) + self.noaa_hrpt_pll_cc_0 = noaa.hrpt_pll_cc(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.rx_fftsink = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=1698e6, + y_per_div=5, + y_divs=8, + ref_level=20, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=0.1, + title="RX Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) + self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) + self.sync = noaa.hrpt_sync_cc(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="RX Waveform", + sample_rate=sample_rate, + v_scale=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="Post-PLL", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) + self.wxgui_scopesink2_0_0_0 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="Post-PLL", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="Post-SYNC", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_0_0_1 = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="Post-SYNC", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_1.win, 0, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.src, 0), (self.throttle, 0)) + self.connect((self.throttle, 0), (self.agr, 0)) + self.connect((self.agr, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.agr, 0), (self.rx_fftsink, 0)) + self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.noaa_hrpt_pll_cc_0, 0)) + self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0, 0)) + self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0_0, 0)) + self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.sync, 0)) + self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_1, 0)) + self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.sym_rate) + self.rx_fftsink.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0_0_1.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0_0_0.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sample_rate) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + + def set_sync_alpha(self, sync_alpha): + self.sync_alpha = sync_alpha + self._sync_alpha_slider.set_value(self.sync_alpha) + self._sync_alpha_text_box.set_value(self.sync_alpha) + self.sync.set_alpha(self.sync_alpha) + self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self._pll_alpha_slider.set_value(self.pll_alpha) + self._pll_alpha_text_box.set_value(self.pll_alpha) + self.noaa_hrpt_pll_cc_0.set_alpha(self.pll_alpha) + self.noaa_hrpt_pll_cc_0.set_beta(self.pll_alpha**2/4.0) + + def set_max_sync_offset(self, max_sync_offset): + self.max_sync_offset = max_sync_offset + self.sync.set_max_offset(self.max_sync_offset) + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + self.noaa_hrpt_pll_cc_0.set_max_offset(self.max_carrier_offset) + + 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]") + (options, args) = parser.parse_args() + tb = usrp_rx_hrpt() + tb.Run(True) + diff --git a/gr-noaa/grc/usrp_rx_lrit.grc b/gr-noaa/grc/usrp_rx_lrit.grc new file mode 100644 index 000000000..55fe39787 --- /dev/null +++ b/gr-noaa/grc/usrp_rx_lrit.grc @@ -0,0 +1,1477 @@ + + + Sat Aug 29 11:26:03 2009 + + options + + id + usrp_rx_lrit + + + _enabled + True + + + title + USRP LRIT Receiver + + + author + + + + description + + + + window_size + 4095, 4095 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (10, 81) + + + _rotation + 0 + + + + variable + + id + symbol_rate + + + _enabled + True + + + value + 293e3 + + + _coordinate + (11, 148) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + samp_rate/symbol_rate + + + _coordinate + (12, 214) + + + _rotation + 0 + + + + variable_text_box + + id + decim + + + _enabled + True + + + label + Decim + + + value + saved_decim + + + converver + int_converter + + + formatter + None + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (243, 13) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + Waveform + + + samp_rate + samp_rate + + + v_scale + 0.5 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 551) + + + _rotation + 0 + + + + gr_agc_xx + + id + gr_agc_xx_0 + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0/32767.0 + + + max_gain + 1.0 + + + _coordinate + (261, 493) + + + _rotation + 0 + + + + root_raised_cosine_filter + + id + root_raised_cosine_filter_0 + + + _enabled + False + + + type + fir_filter_ccf + + + decim + 1 + + + interp + 1 + + + gain + 1 + + + samp_rate + samp_rate + + + sym_rate + symbol_rate + + + alpha + 0.5 + + + ntaps + 50 + + + _coordinate + (618, 373) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_simple_source_x_0 + + + _enabled + False + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + + + lo_offset + float('inf') + + + gain + gain + + + side + B + + + rx_ant + RXA + + + hb_filters + + + + _coordinate + (11, 477) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2_0 + + + _enabled + True + + + type + complex + + + title + Spectrum + + + samp_rate + samp_rate + + + baseband_freq + freq + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 50 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 337) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle_0 + + + _enabled + True + + + type + complex + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (181, 663) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_1 + + + _enabled + True + + + type + complex + + + title + Scope Plot + + + samp_rate + samp_rate + + + v_scale + 0.4 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1126, 251) + + + _rotation + 0 + + + + gr_probe_mpsk_snr_c + + id + gr_probe_mpsk_snr_c_0 + + + _enabled + True + + + type + snr + + + alpha + 0.0001 + + + probe_rate + 10 + + + _coordinate + (1126, 723) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_0 + + + _enabled + True + + + type + float + + + title + SNR + + + units + dB + + + samp_rate + 10 + + + min_value + 0 + + + max_value + 30 + + + factor + 1.0 + + + decimal_places + 1 + + + ref_level + 0 + + + number_rate + 10 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + show_gauge + True + + + grid_pos + 2, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1335, 651) + + + _rotation + 0 + + + + gr_mpsk_receiver_cc + + id + gr_mpsk_receiver_cc_0 + + + _enabled + True + + + M + 2 + + + theta + 0 + + + alpha + costas_alpha + + + beta + costas_alpha*costas_alpha/4.0 + + + fmin + -0.05 + + + fmax + 0.05 + + + mu + 0.5 + + + gain_mu + gain_mu + + + omega + sps + + + gain_omega + gain_mu*gain_mu/4.0 + + + omega_relative_limit + 0.05 + + + _coordinate + (881, 437) + + + _rotation + 0 + + + + gr_complex_to_real + + id + gr_complex_to_real_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (1133, 521) + + + _rotation + 0 + + + + gr_char_to_float + + id + gr_char_to_float_0 + + + _enabled + True + + + _coordinate + (1523, 521) + + + _rotation + 0 + + + + gr_binary_slicer_fb + + id + gr_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (1343, 521) + + + _rotation + 0 + + + + gr_add_const_vxx + + id + gr_add_const_vxx_0 + + + _enabled + True + + + type + float + + + const + 48.0 + + + vlen + 1 + + + _coordinate + (1707, 517) + + + _rotation + 0 + + + + gr_float_to_char + + id + gr_float_to_char_0 + + + _enabled + True + + + _coordinate + (1878, 521) + + + _rotation + 0 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled + True + + + file + bits.dat + + + type + byte + + + vlen + 1 + + + _coordinate + (2059, 517) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + lrit.dat + + + type + complex + + + repeat + False + + + vlen + 1 + + + _coordinate + (11, 655) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['USRP RX', 'Costas Output'] + + + grid_pos + 2, 0, 1, 3 + + + notebook + + + + _coordinate + (14, 351) + + + _rotation + 0 + + + + variable_config + + id + saved_decim + + + _enabled + True + + + value + 160 + + + type + int + + + config_file + config_filename + + + section + main + + + option + decim + + + writeback + decim + + + _coordinate + (246, 172) + + + _rotation + 0 + + + + variable_slider + + id + gain + + + _enabled + True + + + label + Gain + + + value + saved_gain + + + min + 0 + + + max + 115 + + + num_steps + 115 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (411, 11) + + + _rotation + 0 + + + + variable_config + + id + saved_gain + + + _enabled + True + + + value + 33 + + + type + real + + + config_file + config_filename + + + section + main + + + option + gain + + + writeback + gain + + + _coordinate + (412, 172) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency + + + value + saved_freq + + + min + 135e6 + + + max + 139e6 + + + num_steps + 400 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 2, 1, 1 + + + notebook + + + + _coordinate + (574, 12) + + + _rotation + 0 + + + + variable_config + + id + saved_freq + + + _enabled + True + + + value + 137e6 + + + type + real + + + config_file + config_filename + + + section + main + + + option + freq + + + writeback + freq + + + _coordinate + (576, 170) + + + _rotation + 0 + + + + variable_slider + + id + costas_alpha + + + _enabled + True + + + label + Costas Alpha + + + value + saved_costas_alpha + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (738, 13) + + + _rotation + 0 + + + + variable_config + + id + saved_costas_alpha + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + main + + + option + costas_alpha + + + writeback + costas_alpha + + + _coordinate + (739, 170) + + + _rotation + 0 + + + + variable_config + + id + saved_gain_mu + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + main + + + option + gain_mu + + + writeback + gain_mu + + + _coordinate + (900, 170) + + + _rotation + 0 + + + + variable_slider + + id + gain_mu + + + _enabled + True + + + label + Gain Mu + + + value + saved_gain_mu + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 1, 1, 1 + + + notebook + + + + _coordinate + (902, 13) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + "usrp_rx_lrit.cfg" + + + _coordinate + (13, 283) + + + _rotation + 0 + + + + usrp_simple_source_x_0 + gr_agc_xx_0 + 0 + 0 + + + gr_agc_xx_0 + wxgui_scopesink2_0 + 0 + 0 + + + gr_file_source_0 + gr_throttle_0 + 0 + 0 + + + gr_throttle_0 + gr_agc_xx_0 + 0 + 0 + + + gr_probe_mpsk_snr_c_0 + wxgui_numbersink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_probe_mpsk_snr_c_0 + 0 + 0 + + + gr_agc_xx_0 + gr_mpsk_receiver_cc_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + wxgui_scopesink2_1 + 0 + 0 + + + gr_agc_xx_0 + wxgui_fftsink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_complex_to_real_0 + 0 + 0 + + + gr_complex_to_real_0 + gr_binary_slicer_fb_0 + 0 + 0 + + + gr_binary_slicer_fb_0 + gr_char_to_float_0 + 0 + 0 + + + gr_char_to_float_0 + gr_add_const_vxx_0 + 0 + 0 + + + gr_add_const_vxx_0 + gr_float_to_char_0 + 0 + 0 + + + gr_float_to_char_0 + gr_file_sink_0 + 0 + 0 + + diff --git a/gr-noaa/grc/usrp_rx_lrit.py b/gr-noaa/grc/usrp_rx_lrit.py new file mode 100755 index 000000000..bc313e3af --- /dev/null +++ b/gr-noaa/grc/usrp_rx_lrit.py @@ -0,0 +1,399 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP LRIT Receiver +# Generated: Sat Aug 29 11:26:03 2009 +################################################## + +from gnuradio import gr +from gnuradio.eng_option import eng_option +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import numbersink2 +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import wx + +class usrp_rx_lrit(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="USRP LRIT Receiver") + + ################################################## + # Variables + ################################################## + self.config_filename = config_filename = "usrp_rx_lrit.cfg" + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(config_filename) + try: saved_decim = self._saved_decim_config.getint("main", "decim") + except: saved_decim = 160 + self.saved_decim = saved_decim + self.decim = decim = saved_decim + self.symbol_rate = symbol_rate = 293e3 + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(config_filename) + try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu") + except: saved_gain_mu = 0.005 + self.saved_gain_mu = saved_gain_mu + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(config_filename) + try: saved_gain = self._saved_gain_config.getfloat("main", "gain") + except: saved_gain = 33 + 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("main", "freq") + except: saved_freq = 137e6 + self.saved_freq = saved_freq + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(config_filename) + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha") + except: saved_costas_alpha = 0.005 + self.saved_costas_alpha = saved_costas_alpha + self.samp_rate = samp_rate = 64e6/decim + self.sps = sps = samp_rate/symbol_rate + self.gain_mu = gain_mu = saved_gain_mu + self.gain = gain = saved_gain + self.freq = freq = saved_freq + self.costas_alpha = costas_alpha = saved_costas_alpha + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output") + self.GridAdd(self.displays, 2, 0, 1, 3) + + ################################################## + # Controls + ################################################## + self._decim_text_box = forms.text_box( + parent=self.GetWin(), + value=self.decim, + callback=self.set_decim, + label="Decim", + converter=forms.int_converter(), + ) + self.GridAdd(self._decim_text_box, 0, 0, 1, 1) + _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_mu_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + label="Gain Mu", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_mu_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1) + _gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + label="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=115, + num_steps=115, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_sizer, 0, 1, 1, 1) + _freq_sizer = wx.BoxSizer(wx.VERTICAL) + self._freq_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_freq_sizer, + value=self.freq, + callback=self.set_freq, + label="Frequency", + converter=forms.float_converter(), + proportion=0, + ) + self._freq_slider = forms.slider( + parent=self.GetWin(), + sizer=_freq_sizer, + value=self.freq, + callback=self.set_freq, + minimum=135e6, + maximum=139e6, + num_steps=400, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_freq_sizer, 0, 2, 1, 1) + _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._costas_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + label="Costas Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._costas_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) + self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_char_to_float_0 = gr.char_to_float() + self.gr_complex_to_real_0 = gr.complex_to_real(1) + self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) + self.gr_float_to_char_0 = gr.float_to_char() + self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05) + self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c( + type='snr', + alpha=0.0001, + probe_rate=10, + ) + self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) + self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=freq, + y_per_div=10, + y_divs=10, + ref_level=50, + sample_rate=samp_rate, + fft_size=1024, + fft_rate=30, + average=False, + avg_alpha=None, + title="Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) + self.wxgui_numbersink2_0 = numbersink2.number_sink_f( + self.displays.GetPage(1).GetWin(), + unit="dB", + minval=0, + maxval=30, + factor=1.0, + decimal_places=1, + ref_level=0, + sample_rate=10, + number_rate=10, + average=False, + avg_alpha=None, + label="SNR", + peak_hold=False, + show_gauge=True, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1) + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="Waveform", + sample_rate=samp_rate, + v_scale=0.5, + t_scale=20.0/samp_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_1 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="Scope Plot", + sample_rate=samp_rate, + v_scale=0.4, + t_scale=20.0/samp_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0)) + self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) + self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) + self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) + self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section("main"): + self._saved_decim_config.add_section("main") + self._saved_decim_config.set("main", "decim", str(self.decim)) + self._saved_decim_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("main"): + self._saved_gain_config.add_section("main") + self._saved_gain_config.set("main", "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("main"): + self._saved_freq_config.add_section("main") + self._saved_freq_config.set("main", "freq", str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section("main"): + self._saved_costas_alpha_config.add_section("main") + self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section("main"): + self._saved_gain_mu_config.add_section("main") + self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_saved_decim(self, saved_decim): + self.saved_decim = saved_decim + self.set_decim(self.saved_decim) + + def set_decim(self, decim): + self.decim = decim + self.set_samp_rate(64e6/self.decim) + self._decim_text_box.set_value(self.decim) + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section("main"): + self._saved_decim_config.add_section("main") + self._saved_decim_config.set("main", "decim", str(self.decim)) + self._saved_decim_config.write(open(self.config_filename, 'w')) + + def set_symbol_rate(self, symbol_rate): + self.symbol_rate = symbol_rate + self.set_sps(self.samp_rate/self.symbol_rate) + + def set_saved_gain_mu(self, saved_gain_mu): + self.saved_gain_mu = saved_gain_mu + self.set_gain_mu(self.saved_gain_mu) + + def set_saved_gain(self, saved_gain): + self.saved_gain = saved_gain + self.set_gain(self.saved_gain) + + def set_saved_freq(self, saved_freq): + self.saved_freq = saved_freq + self.set_freq(self.saved_freq) + + def set_saved_costas_alpha(self, saved_costas_alpha): + self.saved_costas_alpha = saved_costas_alpha + self.set_costas_alpha(self.saved_costas_alpha) + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.set_sps(self.samp_rate/self.symbol_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) + self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) + self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate) + + def set_sps(self, sps): + self.sps = sps + self.gr_mpsk_receiver_cc_0.set_omega(self.sps) + + def set_gain_mu(self, gain_mu): + self.gain_mu = gain_mu + self.gr_mpsk_receiver_cc_0.set_gain_mu(self.gain_mu) + self.gr_mpsk_receiver_cc_0.set_gain_omega(self.gain_mu*self.gain_mu/4.0) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section("main"): + self._saved_gain_mu_config.add_section("main") + self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) + + 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("main"): + self._saved_gain_config.add_section("main") + self._saved_gain_config.set("main", "gain", str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + + def set_freq(self, freq): + self.freq = freq + self.wxgui_fftsink2_0.set_baseband_freq(self.freq) + self._freq_slider.set_value(self.freq) + self._freq_text_box.set_value(self.freq) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section("main"): + self._saved_freq_config.add_section("main") + self._saved_freq_config.set("main", "freq", str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + + def set_costas_alpha(self, costas_alpha): + self.costas_alpha = costas_alpha + self.gr_mpsk_receiver_cc_0.set_alpha(self.costas_alpha) + self.gr_mpsk_receiver_cc_0.set_beta(self.costas_alpha*self.costas_alpha/4.0) + self._costas_alpha_slider.set_value(self.costas_alpha) + self._costas_alpha_text_box.set_value(self.costas_alpha) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section("main"): + self._saved_costas_alpha_config.add_section("main") + self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + self._saved_costas_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 = usrp_rx_lrit() + tb.Run(True) + diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 39a4f1155..2690ddb54 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -29,7 +29,8 @@ lib_LTLIBRARIES = \ libgnuradio-noaa.la libgnuradio_noaa_la_SOURCES = \ - noaa_carrier_pll_cc.cc + noaa_hrpt_pll_cc.cc \ + noaa_hrpt_sync_cc.cc libgnuradio_noaa_la_LIBADD = \ $(GNURADIO_CORE_LA) @@ -37,4 +38,5 @@ libgnuradio_noaa_la_LIBADD = \ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 grinclude_HEADERS = \ - noaa_carrier_pll_cc.h + noaa_hrpt_pll_cc.h \ + noaa_hrpt_sync_cc.h diff --git a/gr-noaa/lib/noaa_carrier_pll_cc.cc b/gr-noaa/lib/noaa_carrier_pll_cc.cc deleted file mode 100644 index d6a86faa1..000000000 --- a/gr-noaa/lib/noaa_carrier_pll_cc.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#define M_TWOPI (2*M_PI) - -noaa_carrier_pll_cc_sptr -noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset) -{ - return gnuradio::get_initial_sptr(new noaa_carrier_pll_cc(alpha, beta, max_offset)); -} - -noaa_carrier_pll_cc::noaa_carrier_pll_cc(float alpha, float beta, float max_offset) - : gr_sync_block("noaa_carrier_pll_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), - d_phase(0.0), d_freq(0.0) -{ -} - -float -phase_wrap(float phase) -{ - while (phase < -M_PI) - phase += M_TWOPI; - while (phase > M_PI) - phase -= M_TWOPI; - - return phase; -} - -int -noaa_carrier_pll_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - - // Adjust PLL phase/frequency - float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); - d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); - d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); - - // Generate and mix out carrier - float re, im; - gr_sincosf(d_phase, &im, &re); - out[i] = in[i]*gr_complex(re, -im); - } - - return noutput_items; -} diff --git a/gr-noaa/lib/noaa_carrier_pll_cc.h b/gr-noaa/lib/noaa_carrier_pll_cc.h deleted file mode 100644 index 8e6de866e..000000000 --- a/gr-noaa/lib/noaa_carrier_pll_cc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifndef INCLUDED_NOAA_CARRIER_PLL_CC_H -#define INCLUDED_NOAA_CARRIER_PLL_CC_H - -#include - -class noaa_carrier_pll_cc; -typedef boost::shared_ptr noaa_carrier_pll_cc_sptr; - -noaa_carrier_pll_cc_sptr -noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); - -class noaa_carrier_pll_cc : public gr_sync_block -{ - friend noaa_carrier_pll_cc_sptr noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); - noaa_carrier_pll_cc(float alpha, float beta, float max_offset); - - float d_alpha; // 1st order loop constant - float d_beta; // 2nd order loop constant - float d_max_offset; // Maximum frequency offset, radians/sample - float d_phase; // Instantaneous carrier phase - float d_freq; // Instantaneous carrier frequency, radians/sample - - public: - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_max_offset(float max_offset) { d_max_offset = max_offset; } -}; - -#endif /* INCLUDED_NOAA_CARRIER_PLL_CC_H */ diff --git a/gr-noaa/lib/noaa_hrpt_pll_cc.cc b/gr-noaa/lib/noaa_hrpt_pll_cc.cc new file mode 100644 index 000000000..46fe24da4 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_pll_cc.cc @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define M_TWOPI (2*M_PI) + +noaa_hrpt_pll_cc_sptr +noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_pll_cc(alpha, beta, max_offset)); +} + +noaa_hrpt_pll_cc::noaa_hrpt_pll_cc(float alpha, float beta, float max_offset) + : gr_sync_block("noaa_hrpt_pll_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), + d_phase(0.0), d_freq(0.0) +{ +} + +float +phase_wrap(float phase) +{ + while (phase < -M_PI) + phase += M_TWOPI; + while (phase > M_PI) + phase -= M_TWOPI; + + return phase; +} + +int +noaa_hrpt_pll_cc::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const gr_complex *in = (const gr_complex *) input_items[0]; + gr_complex *out = (gr_complex *) output_items[0]; + + for (int i = 0; i < noutput_items; i++) { + + // Adjust PLL phase/frequency + float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); + d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); + d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); + + // Generate and mix out carrier + float re, im; + gr_sincosf(d_phase, &im, &re); + out[i] = in[i]*gr_complex(re, -im); + } + + return noutput_items; +} diff --git a/gr-noaa/lib/noaa_hrpt_pll_cc.h b/gr-noaa/lib/noaa_hrpt_pll_cc.h new file mode 100644 index 000000000..810454406 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_pll_cc.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_PLL_CC_H +#define INCLUDED_NOAA_HRPT_PLL_CC_H + +#include + +class noaa_hrpt_pll_cc; +typedef boost::shared_ptr noaa_hrpt_pll_cc_sptr; + +noaa_hrpt_pll_cc_sptr +noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); + +class noaa_hrpt_pll_cc : public gr_sync_block +{ + friend noaa_hrpt_pll_cc_sptr noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); + noaa_hrpt_pll_cc(float alpha, float beta, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_max_offset; // Maximum frequency offset, radians/sample + float d_phase; // Instantaneous carrier phase + float d_freq; // Instantaneous carrier frequency, radians/sample + + public: + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_HRPT_PLL_CC_H */ diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.cc b/gr-noaa/lib/noaa_hrpt_sync_cc.cc new file mode 100644 index 000000000..47858d758 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_cc.cc @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +noaa_hrpt_sync_cc_sptr +noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_sync_cc(alpha, beta, sps, max_offset)); +} + +noaa_hrpt_sync_cc::noaa_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset) + : gr_block("noaa_hrpt_sync_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_alpha(alpha), d_beta(beta), d_sps(sps), d_max_offset(max_offset), + d_phase(0.0), d_freq(0.0) +{ +} + +int +noaa_hrpt_sync_cc::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + int ninputs = ninput_items[0]; + const gr_complex *in = (const gr_complex *) input_items[0]; + gr_complex *out = (gr_complex *) output_items[0]; + + int i = 0, j = 0; + while (i < ninputs && j < noutput_items) { + out[j++] = in[i++]; + } + + consume_each(i); + return j; +} diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.h b/gr-noaa/lib/noaa_hrpt_sync_cc.h new file mode 100644 index 000000000..f5b23ccaf --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_cc.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_SYNC_CC_H +#define INCLUDED_NOAA_HRPT_SYNC_CC_H + +#include + +class noaa_hrpt_sync_cc; +typedef boost::shared_ptr noaa_hrpt_sync_cc_sptr; + +noaa_hrpt_sync_cc_sptr +noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_cc : public gr_block +{ + friend noaa_hrpt_sync_cc_sptr noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); + noaa_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_sps; // samples per symbol + float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol + float d_phase; // Instantaneous symbol phase + float d_freq; // Instantaneous symbol frequency, samples/symbol + + public: + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_HRPT_SYNC_CC_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 927c6cfb2..18cb5920a 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -53,7 +53,8 @@ noaa_swig_python = \ # additional SWIG files to be installed noaa_swig_swiginclude_headers = \ noaa_swig.i \ - noaa_carrier_pll_cc.i + noaa_hrpt_pll_cc.i \ + noaa_hrpt_sync_cc.i include $(top_srcdir)/Makefile.swig diff --git a/gr-noaa/swig/noaa_carrier_pll_cc.i b/gr-noaa/swig/noaa_carrier_pll_cc.i deleted file mode 100644 index 4d61f393c..000000000 --- a/gr-noaa/swig/noaa_carrier_pll_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,carrier_pll_cc) - -noaa_carrier_pll_cc_sptr -noaa_make_carrier_pll_cc(float alpha, float beta, float max_offset); - -class noaa_carrier_pll_cc : public gr_sync_block -{ -private: - noaa_carrier_pll_cc(); - -public: - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_offset(float min_freq); -}; diff --git a/gr-noaa/swig/noaa_hrpt_pll_cc.i b/gr-noaa/swig/noaa_hrpt_pll_cc.i new file mode 100644 index 000000000..a29eaa38a --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_pll_cc.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_pll_cc) + +noaa_hrpt_pll_cc_sptr +noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); + +class noaa_hrpt_pll_cc : public gr_sync_block +{ +private: + noaa_hrpt_pll_cc(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_hrpt_sync_cc.i b/gr-noaa/swig/noaa_hrpt_sync_cc.i new file mode 100644 index 000000000..6dcfa57df --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_sync_cc.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_cc) + +noaa_hrpt_sync_cc_sptr +noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_cc : public gr_sync_block +{ +private: + noaa_hrpt_sync_cc(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index 384f4e6a2..470f5f960 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -23,7 +23,9 @@ %include "gnuradio.i" %{ -#include +#include +#include %} -%include "noaa_carrier_pll_cc.i" +%include "noaa_hrpt_pll_cc.i" +%include "noaa_hrpt_sync_cc.i" -- cgit From 225d3141a7f4754eae5a1a041e1d18dc38131772 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 29 Aug 2009 13:24:58 -0700 Subject: Implemented crude timing recovery using zero crossings but no resampling --- gr-noaa/grc/usrp_rx_hrpt.grc | 513 ++++++++++++++++++--------------------- gr-noaa/grc/usrp_rx_hrpt.py | 35 ++- gr-noaa/lib/noaa_hrpt_sync_cc.cc | 31 ++- gr-noaa/lib/noaa_hrpt_sync_cc.h | 1 + 4 files changed, 281 insertions(+), 299 deletions(-) (limited to 'gr-noaa') diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc index d3c6603ad..b304bd359 100644 --- a/gr-noaa/grc/usrp_rx_hrpt.grc +++ b/gr-noaa/grc/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sat Aug 29 11:48:56 2009 + Sat Aug 29 13:16:19 2009 options @@ -257,85 +257,56 @@ - wxgui_fftsink2 + variable id - rx_fftsink + max_carrier_offset _enabled True - type - complex - - - title - RX Spectrum - - - samp_rate - sample_rate - - - baseband_freq - 1698e6 - - - y_per_div - 5 - - - y_divs - 8 - - - ref_level - 20 + value + 2*math.pi*100e3/sample_rate - fft_size - 1024 + _coordinate + (668, 107) - fft_rate - 30 + _rotation + 0 + + + variable - peak_hold - False + id + max_sync_offset - average + _enabled True - avg_alpha - 0.1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 + value + 0.01 _coordinate - (194, 263) + (665, 173) _rotation - 180 + 0 wxgui_scopesink2 id - wxgui_scopesink2_0 + wxgui_scopesink2_0_0 _enabled @@ -347,7 +318,7 @@ title - RX Waveform + Post-PLL samp_rate @@ -355,7 +326,7 @@ v_scale - 0 + 0.5 t_scale @@ -375,15 +346,15 @@ grid_pos - 1, 0, 1, 1 + 0, 0, 1, 1 notebook - displays, 0 + displays, 1 _coordinate - (198, 609) + (618, 335) _rotation @@ -391,38 +362,34 @@ - gr_agc_xx + notebook id - agr + displays _enabled True - type - complex - - - rate - 1e-6 + style + wx.NB_TOP - reference - 1.0 + labels + ['RX','PLL','SYNC'] - gain - 1.0 + grid_pos + 1, 0, 1, 2 - max_gain - 1.0 + notebook + _coordinate - (261, 494) + (9, 99) _rotation @@ -430,10 +397,10 @@ - gr_moving_average_xx + wxgui_scopesink2 id - gr_moving_average_xx_0 + wxgui_scopesink2_0_0_0 _enabled @@ -444,66 +411,79 @@ complex - length - hs + title + Post-PLL - scale - 1.0/hs + samp_rate + sample_rate - max_iter - 4000 + v_scale + 0.5 - _coordinate - (434, 502) + t_scale + 20.0/sample_rate - _rotation - 0 + ac_couple + False - - - variable - id - max_carrier_offset + xy_mode + True - _enabled - True + num_inputs + 1 - value - 2*math.pi*100e3/sample_rate + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 _coordinate - (668, 107) + (618, 614) _rotation - 0 + 180 - variable + noaa_hrpt_sync_cc id - max_sync_offset + sync _enabled True - value - 0.01 + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset _coordinate - (665, 173) + (865, 494) _rotation @@ -511,140 +491,156 @@ - variable_slider + wxgui_scopesink2 id - pll_alpha + wxgui_scopesink2_0_0_0_0 _enabled True - label - PLL Alpha + type + complex - value - 0.005 + title + Post-SYNC - min - 0.0 + samp_rate + sym_rate - max + v_scale 0.5 - num_steps - 500 + t_scale + 20.0/sym_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + True + + + num_inputs + 1 grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - + displays, 2 _coordinate - (192, 100) + (872, 607) _rotation - 0 + 180 - variable_slider + wxgui_scopesink2 id - sync_alpha + wxgui_scopesink2_0_0_1 _enabled True - label - SYNC Alpha + type + complex - value - 0.005 + title + Post-SYNC - min - 0.0 + samp_rate + sym_rate - max + v_scale 0.5 - num_steps - 500 + t_scale + 20.0/sym_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + False + + + num_inputs + 1 grid_pos - 0, 1, 1, 1 + 0, 0, 1, 1 notebook - + displays, 2 _coordinate - (344, 101) + (872, 341) _rotation - 0 + 180 - noaa_hrpt_pll_cc + gr_agc_xx id - noaa_hrpt_pll_cc_0 + agr _enabled True - alpha - pll_alpha + type + complex - beta - pll_alpha**2/4.0 + rate + 1e-6 - max_offset - max_carrier_offset + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 _coordinate - (628, 502) + (261, 494) _rotation @@ -652,69 +648,41 @@ - wxgui_scopesink2 + noaa_hrpt_pll_cc id - wxgui_scopesink2_0_0 + noaa_hrpt_pll_cc_0 _enabled True - type - complex - - - title - Post-PLL - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 + alpha + pll_alpha - grid_pos - 0, 0, 1, 1 + beta + pll_alpha**2/4.0 - notebook - displays, 1 + max_offset + max_carrier_offset _coordinate - (618, 335) + (628, 502) _rotation - 180 + 0 - wxgui_scopesink2 + wxgui_fftsink2 id - wxgui_scopesink2_0_0_1 + rx_fftsink _enabled @@ -726,78 +694,59 @@ title - Post-SYNC + RX Spectrum samp_rate sample_rate - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False + baseband_freq + 1698e6 - num_inputs - 1 + y_per_div + 5 - grid_pos - 0, 0, 1, 1 + y_divs + 8 - notebook - displays, 2 + ref_level + 20 - _coordinate - (872, 341) + fft_size + 1024 - _rotation - 180 + fft_rate + 30 - - - notebook - id - displays + peak_hold + False - _enabled + average True - style - wx.NB_TOP - - - labels - ['RX','PLL','SYNC'] + avg_alpha + 0.1 grid_pos - 1, 0, 1, 2 + 0, 0, 1, 1 notebook - + displays, 0 _coordinate - (9, 99) + (433, 297) _rotation @@ -808,7 +757,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0_0 + wxgui_scopesink2_0 _enabled @@ -820,7 +769,7 @@ title - Post-PLL + RX Waveform samp_rate @@ -828,7 +777,7 @@ v_scale - 0.5 + 0 t_scale @@ -840,7 +789,7 @@ xy_mode - True + False num_inputs @@ -852,46 +801,66 @@ notebook - displays, 1 + displays, 0 _coordinate - (618, 614) + (434, 603) _rotation - 180 + 0 - noaa_hrpt_sync_cc + variable_slider id - sync + pll_alpha _enabled True - alpha - sync_alpha + label + PLL Alpha - beta - sync_alpha**2/4.0 + value + 0.001 - sps - sps + min + 0.0 - max_offset - max_sync_offset + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + _coordinate - (865, 494) + (192, 100) _rotation @@ -899,62 +868,58 @@ - wxgui_scopesink2 + variable_slider id - wxgui_scopesink2_0_0_0_0 + sync_alpha _enabled True - type - complex + label + SYNC Alpha - title - Post-SYNC + value + 0.001 - samp_rate - sample_rate + min + 0.0 - v_scale + max 0.5 - t_scale - 20.0/sample_rate - - - ac_couple - False + num_steps + 500 - xy_mode - True + style + wx.SL_HORIZONTAL - num_inputs - 1 + converver + float_converter grid_pos - 1, 0, 1, 1 + 0, 1, 1, 1 notebook - displays, 2 + _coordinate - (872, 607) + (344, 101) _rotation - 180 + 0 @@ -969,12 +934,6 @@ 0 0 - - agr - gr_moving_average_xx_0 - 0 - 0 - agr rx_fftsink @@ -987,12 +946,6 @@ 0 0 - - gr_moving_average_xx_0 - noaa_hrpt_pll_cc_0 - 0 - 0 - noaa_hrpt_pll_cc_0 wxgui_scopesink2_0_0 @@ -1023,4 +976,10 @@ 0 0 + + agr + noaa_hrpt_pll_cc_0 + 0 + 0 + diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py index ed6417335..5cfaf7842 100755 --- a/gr-noaa/grc/usrp_rx_hrpt.py +++ b/gr-noaa/grc/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sat Aug 29 11:48:57 2009 +# Generated: Sat Aug 29 13:16:19 2009 ################################################## from gnuradio import gr @@ -28,8 +28,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.sync_alpha = sync_alpha = 0.005 - self.pll_alpha = pll_alpha = 0.005 + self.sync_alpha = sync_alpha = 0.001 + self.pll_alpha = pll_alpha = 0.001 self.max_sync_offset = max_sync_offset = 0.01 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate self.hs = hs = int(sps/2.0) @@ -97,7 +97,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # Blocks ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_moving_average_xx_0 = gr.moving_average_cc(hs, 1.0/hs, 4000) self.noaa_hrpt_pll_cc_0 = noaa.hrpt_pll_cc(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) self.rx_fftsink = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), @@ -153,9 +152,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_c( self.displays.GetPage(2).GetWin(), title="Post-SYNC", - sample_rate=sample_rate, + sample_rate=sym_rate, v_scale=0.5, - t_scale=20.0/sample_rate, + t_scale=20.0/sym_rate, ac_couple=False, xy_mode=True, num_inputs=1, @@ -164,9 +163,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.wxgui_scopesink2_0_0_1 = scopesink2.scope_sink_c( self.displays.GetPage(2).GetWin(), title="Post-SYNC", - sample_rate=sample_rate, + sample_rate=sym_rate, v_scale=0.5, - t_scale=20.0/sample_rate, + t_scale=20.0/sym_rate, ac_couple=False, xy_mode=False, num_inputs=1, @@ -178,15 +177,14 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## self.connect((self.src, 0), (self.throttle, 0)) self.connect((self.throttle, 0), (self.agr, 0)) - self.connect((self.agr, 0), (self.gr_moving_average_xx_0, 0)) self.connect((self.agr, 0), (self.rx_fftsink, 0)) self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.gr_moving_average_xx_0, 0), (self.noaa_hrpt_pll_cc_0, 0)) self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0, 0)) self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0_0, 0)) self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.sync, 0)) self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_1, 0)) self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) + self.connect((self.agr, 0), (self.noaa_hrpt_pll_cc_0, 0)) def set_decim(self, decim): self.decim = decim @@ -195,17 +193,17 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate self.set_sps(self.sample_rate/self.sym_rate) + self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sym_rate) + self.wxgui_scopesink2_0_0_1.set_sample_rate(self.sym_rate) def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate self.set_sps(self.sample_rate/self.sym_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0_0_1.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0_0_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sample_rate) + self.rx_fftsink.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps @@ -213,17 +211,17 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha - self._sync_alpha_slider.set_value(self.sync_alpha) - self._sync_alpha_text_box.set_value(self.sync_alpha) self.sync.set_alpha(self.sync_alpha) self.sync.set_beta(self.sync_alpha**2/4.0) + self._sync_alpha_slider.set_value(self.sync_alpha) + self._sync_alpha_text_box.set_value(self.sync_alpha) def set_pll_alpha(self, pll_alpha): self.pll_alpha = pll_alpha - self._pll_alpha_slider.set_value(self.pll_alpha) - self._pll_alpha_text_box.set_value(self.pll_alpha) self.noaa_hrpt_pll_cc_0.set_alpha(self.pll_alpha) self.noaa_hrpt_pll_cc_0.set_beta(self.pll_alpha**2/4.0) + self._pll_alpha_slider.set_value(self.pll_alpha) + self._pll_alpha_text_box.set_value(self.pll_alpha) def set_max_sync_offset(self, max_sync_offset): self.max_sync_offset = max_sync_offset @@ -235,7 +233,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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]") diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.cc b/gr-noaa/lib/noaa_hrpt_sync_cc.cc index 47858d758..46cc277bd 100644 --- a/gr-noaa/lib/noaa_hrpt_sync_cc.cc +++ b/gr-noaa/lib/noaa_hrpt_sync_cc.cc @@ -27,6 +27,11 @@ #include #include +inline int signum(float f) +{ + return f >= 0.0 ? 1 : -1; +} + noaa_hrpt_sync_cc_sptr noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset) { @@ -37,8 +42,10 @@ noaa_hrpt_sync_cc::noaa_hrpt_sync_cc(float alpha, float beta, float sps, float m : gr_block("noaa_hrpt_sync_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_alpha(alpha), d_beta(beta), d_sps(sps), d_max_offset(max_offset), - d_phase(0.0), d_freq(0.0) + d_alpha(alpha), d_beta(beta), + d_sps(sps), d_max_offset(max_offset), + d_phase(0.0), d_freq(1.0/sps), + d_last_sign(1) { } @@ -54,7 +61,25 @@ noaa_hrpt_sync_cc::general_work(int noutput_items, int i = 0, j = 0; while (i < ninputs && j < noutput_items) { - out[j++] = in[i++]; + float sample = in[i++].imag(); + int sign = signum(sample); + d_phase += d_freq; + + // Train on zero crossings in center region of symbol + if (sign != d_last_sign) { + if (d_phase > 0.25 && d_phase < 0.75) { + float phase_err = d_phase-0.5; + d_phase -= phase_err*d_alpha; // 1st order phase adjustment + d_freq -= phase_err*d_beta; // 2nd order frequency adjustment + } + + d_last_sign = sign; + } + + if (d_phase > 1.0) { + out[j++] = in[i]; + d_phase -= 1.0; + } } consume_each(i); diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.h b/gr-noaa/lib/noaa_hrpt_sync_cc.h index f5b23ccaf..6abbcad48 100644 --- a/gr-noaa/lib/noaa_hrpt_sync_cc.h +++ b/gr-noaa/lib/noaa_hrpt_sync_cc.h @@ -42,6 +42,7 @@ class noaa_hrpt_sync_cc : public gr_block float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol float d_phase; // Instantaneous symbol phase float d_freq; // Instantaneous symbol frequency, samples/symbol + int d_last_sign; // Tracks zero crossings public: int general_work(int noutput_items, -- cgit From 65bcd58b65219408268e5db1b8fbafb2d3ccc215 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Mon, 7 Sep 2009 13:22:16 -0700 Subject: Updated HRPT blocks/scripts for testing. Seeing good minor frame sync's. * Change PLL and SYNC blocks to output floats * Correct bit sense * Update RX script to record ascii bits --- gr-noaa/grc/Makefile.am | 4 +- gr-noaa/grc/noaa_hrpt_pll_cc.xml | 34 --- gr-noaa/grc/noaa_hrpt_pll_cf.xml | 34 +++ gr-noaa/grc/noaa_hrpt_sync_cc.xml | 39 --- gr-noaa/grc/noaa_hrpt_sync_ff.xml | 39 +++ gr-noaa/grc/usrp_rx_hrpt.grc | 599 +++++++++++++++++++++----------------- gr-noaa/grc/usrp_rx_hrpt.py | 78 ++--- gr-noaa/lib/Makefile.am | 8 +- gr-noaa/lib/noaa_hrpt_pll_cc.cc | 82 ------ gr-noaa/lib/noaa_hrpt_pll_cc.h | 55 ---- gr-noaa/lib/noaa_hrpt_pll_cf.cc | 82 ++++++ gr-noaa/lib/noaa_hrpt_pll_cf.h | 55 ++++ gr-noaa/lib/noaa_hrpt_sync_cc.cc | 87 ------ gr-noaa/lib/noaa_hrpt_sync_cc.h | 58 ---- gr-noaa/lib/noaa_hrpt_sync_ff.cc | 87 ++++++ gr-noaa/lib/noaa_hrpt_sync_ff.h | 58 ++++ gr-noaa/swig/Makefile.am | 4 +- gr-noaa/swig/noaa_hrpt_pll_cc.i | 37 --- gr-noaa/swig/noaa_hrpt_pll_cf.i | 37 +++ gr-noaa/swig/noaa_hrpt_sync_cc.i | 37 --- gr-noaa/swig/noaa_hrpt_sync_ff.i | 37 +++ gr-noaa/swig/noaa_swig.i | 8 +- 22 files changed, 809 insertions(+), 750 deletions(-) delete mode 100644 gr-noaa/grc/noaa_hrpt_pll_cc.xml create mode 100644 gr-noaa/grc/noaa_hrpt_pll_cf.xml delete mode 100644 gr-noaa/grc/noaa_hrpt_sync_cc.xml create mode 100644 gr-noaa/grc/noaa_hrpt_sync_ff.xml delete mode 100644 gr-noaa/lib/noaa_hrpt_pll_cc.cc delete mode 100644 gr-noaa/lib/noaa_hrpt_pll_cc.h create mode 100644 gr-noaa/lib/noaa_hrpt_pll_cf.cc create mode 100644 gr-noaa/lib/noaa_hrpt_pll_cf.h delete mode 100644 gr-noaa/lib/noaa_hrpt_sync_cc.cc delete mode 100644 gr-noaa/lib/noaa_hrpt_sync_cc.h create mode 100644 gr-noaa/lib/noaa_hrpt_sync_ff.cc create mode 100644 gr-noaa/lib/noaa_hrpt_sync_ff.h delete mode 100644 gr-noaa/swig/noaa_hrpt_pll_cc.i create mode 100644 gr-noaa/swig/noaa_hrpt_pll_cf.i delete mode 100644 gr-noaa/swig/noaa_hrpt_sync_cc.i create mode 100644 gr-noaa/swig/noaa_hrpt_sync_ff.i (limited to 'gr-noaa') diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index c75529778..fa2c40c88 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -28,8 +28,8 @@ dist_bin_SCRIPTS = \ usrp_rx_lrit.py dist_grcblocks_DATA = \ - noaa_hrpt_pll_cc.xml \ - noaa_hrpt_sync_cc.xml + noaa_hrpt_pll_cf.xml \ + noaa_hrpt_sync_ff.xml EXTRA_DIST = \ usrp_rx_hrpt.grc \ diff --git a/gr-noaa/grc/noaa_hrpt_pll_cc.xml b/gr-noaa/grc/noaa_hrpt_pll_cc.xml deleted file mode 100644 index e56e0b056..000000000 --- a/gr-noaa/grc/noaa_hrpt_pll_cc.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - HRPT PLL - noaa_hrpt_pll_cc - NOAA - from gnuradio import noaa - noaa.hrpt_pll_cc($alpha, $beta, $max_offset) - set_alpha($alpha) - set_beta($beta) - set_max_offset($max_offset) - - Alpha - alpha - real - - - Beta - beta - real - - - Max Offset - max_offset - real - - - in - complex - - - out - complex - - diff --git a/gr-noaa/grc/noaa_hrpt_pll_cf.xml b/gr-noaa/grc/noaa_hrpt_pll_cf.xml new file mode 100644 index 000000000..bbe15e8c3 --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_pll_cf.xml @@ -0,0 +1,34 @@ + + + HRPT PLL + noaa_hrpt_pll_cf + NOAA + from gnuradio import noaa + noaa.hrpt_pll_cf($alpha, $beta, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Max Offset + max_offset + real + + + in + complex + + + out + float + + diff --git a/gr-noaa/grc/noaa_hrpt_sync_cc.xml b/gr-noaa/grc/noaa_hrpt_sync_cc.xml deleted file mode 100644 index d311aa946..000000000 --- a/gr-noaa/grc/noaa_hrpt_sync_cc.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - HRPT SYNC - noaa_hrpt_sync_cc - NOAA - from gnuradio import noaa - noaa.hrpt_sync_cc($alpha, $beta, $sps, $max_offset) - set_alpha($alpha) - set_beta($beta) - set_max_offset($max_offset) - - Alpha - alpha - real - - - Beta - beta - real - - - Samples/Symbol - sps - real - - - Max Offset - max_offset - real - - - in - complex - - - out - complex - - diff --git a/gr-noaa/grc/noaa_hrpt_sync_ff.xml b/gr-noaa/grc/noaa_hrpt_sync_ff.xml new file mode 100644 index 000000000..91b83ad5d --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_sync_ff.xml @@ -0,0 +1,39 @@ + + + HRPT SYNC + noaa_hrpt_sync_ff + NOAA + from gnuradio import noaa + noaa.hrpt_sync_ff($alpha, $beta, $sps, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Samples/Symbol + sps + real + + + Max Offset + max_offset + real + + + in + float + + + out + float + + diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc index b304bd359..41aa1958e 100644 --- a/gr-noaa/grc/usrp_rx_hrpt.grc +++ b/gr-noaa/grc/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sat Aug 29 13:16:19 2009 + Mon Sep 7 13:05:09 2009 options @@ -106,41 +106,6 @@ 0 - - gr_file_source - - id - src - - - _enabled - True - - - file - poes-d16.dat - - - type - complex - - - repeat - True - - - vlen - 1 - - - _coordinate - (34, 423) - - - _rotation - 0 - - variable @@ -257,45 +222,78 @@ - variable + wxgui_fftsink2 id - max_carrier_offset + rx_fftsink _enabled True - value - 2*math.pi*100e3/sample_rate + type + complex - _coordinate - (668, 107) + title + RX Spectrum - _rotation - 0 + samp_rate + sample_rate - - - variable - id - max_sync_offset + baseband_freq + 1698e6 - _enabled + y_per_div + 5 + + + y_divs + 8 + + + ref_level + 20 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average True - value - 0.01 + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 _coordinate - (665, 173) + (433, 297) _rotation @@ -306,7 +304,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0 + wxgui_scopesink2_0 _enabled @@ -318,7 +316,7 @@ title - Post-PLL + RX Waveform samp_rate @@ -326,7 +324,7 @@ v_scale - 0.5 + 0 t_scale @@ -346,42 +344,62 @@ grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - displays, 1 + displays, 0 _coordinate - (618, 335) + (434, 603) _rotation - 180 + 0 - notebook + variable_slider id - displays + pll_alpha _enabled True + + label + PLL Alpha + + + value + 0.001 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + style - wx.NB_TOP + wx.SL_HORIZONTAL - labels - ['RX','PLL','SYNC'] + converver + float_converter grid_pos - 1, 0, 1, 2 + 0, 0, 1, 1 notebook @@ -389,7 +407,7 @@ _coordinate - (9, 99) + (192, 100) _rotation @@ -397,93 +415,100 @@ - wxgui_scopesink2 + variable_slider id - wxgui_scopesink2_0_0_0 + sync_alpha _enabled True - type - complex + label + SYNC Alpha - title - Post-PLL + value + 0.001 - samp_rate - sample_rate + min + 0.0 - v_scale + max 0.5 - t_scale - 20.0/sample_rate - - - ac_couple - False + num_steps + 500 - xy_mode - True + style + wx.SL_HORIZONTAL - num_inputs - 1 + converver + float_converter grid_pos - 1, 0, 1, 1 + 0, 1, 1, 1 notebook - displays, 1 + _coordinate - (618, 614) + (344, 101) _rotation - 180 + 0 - noaa_hrpt_sync_cc + variable id - sync + max_carrier_offset _enabled True - alpha - sync_alpha + value + 2*math.pi*100e3/sample_rate - beta - sync_alpha**2/4.0 + _coordinate + (671, 14) - sps - sps + _rotation + 0 + + + variable - max_offset + id max_sync_offset + + _enabled + True + + + value + 0.01 + _coordinate - (865, 494) + (805, 13) _rotation @@ -491,69 +516,84 @@ - wxgui_scopesink2 + gr_file_source id - wxgui_scopesink2_0_0_0_0 + src _enabled True + + file + poes-d16.dat + type complex - title - Post-SYNC + repeat + False - samp_rate - sym_rate + vlen + 1 - v_scale - 0.5 + _coordinate + (34, 423) - t_scale - 20.0/sym_rate + _rotation + 0 + + + gr_agc_xx - ac_couple - False + id + agr - xy_mode + _enabled True - num_inputs - 1 + type + complex - grid_pos - 1, 0, 1, 1 + rate + 1e-6 - notebook - displays, 2 + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 _coordinate - (872, 607) + (261, 494) _rotation - 180 + 0 wxgui_scopesink2 id - wxgui_scopesink2_0_0_1 + wxgui_scopesink2_0_0 _enabled @@ -561,15 +601,15 @@ type - complex + float title - Post-SYNC + Post-PLL samp_rate - sym_rate + sample_rate v_scale @@ -577,7 +617,7 @@ t_scale - 20.0/sym_rate + 20.0/sample_rate ac_couple @@ -597,11 +637,11 @@ notebook - displays, 2 + displays, 1 _coordinate - (872, 341) + (618, 335) _rotation @@ -609,38 +649,30 @@ - gr_agc_xx + noaa_hrpt_pll_cf id - agr + noaa_hrpt_pll_cf_0 _enabled True - type - complex - - - rate - 1e-6 - - - reference - 1.0 + alpha + pll_alpha - gain - 1.0 + beta + pll_alpha**2/4.0 - max_gain - 1.0 + max_offset + max_carrier_offset _coordinate - (261, 494) + (639, 502) _rotation @@ -648,10 +680,10 @@ - noaa_hrpt_pll_cc + noaa_hrpt_sync_ff id - noaa_hrpt_pll_cc_0 + noaa_hrpt_sync_ff_0 _enabled @@ -659,19 +691,23 @@ alpha - pll_alpha + .005 beta - pll_alpha**2/4.0 + .005*.005/4.0 + + + sps + sps max_offset - max_carrier_offset + max_sync_offset _coordinate - (628, 502) + (876, 494) _rotation @@ -679,74 +715,91 @@ - wxgui_fftsink2 + gr_binary_slicer_fb id - rx_fftsink + gr_binary_slicer_fb_0 _enabled True - type - complex + _coordinate + (1108, 522) - title - RX Spectrum + _rotation + 0 + + + virtual_sink - samp_rate - sample_rate + id + virtual_sink_1 - baseband_freq - 1698e6 + _enabled + True - y_per_div - 5 + stream_id + bits - y_divs - 8 + _coordinate + (1289, 518) - ref_level - 20 + _rotation + 0 + + + gr_file_sink - fft_size - 1024 + id + gr_file_sink_0 - fft_rate - 30 + _enabled + True - peak_hold - False + file + bits.dat - average - True + type + byte - avg_alpha - 0.1 + vlen + 1 - grid_pos - 0, 0, 1, 1 + _coordinate + (981, 919) - notebook - displays, 0 + _rotation + 0 + + + + gr_char_to_float + + id + gr_char_to_float_0 + + + _enabled + True _coordinate - (433, 297) + (477, 923) _rotation @@ -754,58 +807,72 @@ - wxgui_scopesink2 + gr_float_to_char id - wxgui_scopesink2_0 + gr_float_to_char_0 _enabled True - type - complex + _coordinate + (809, 923) - title - RX Waveform + _rotation + 0 + + + gr_add_const_vxx - samp_rate - sample_rate + id + gr_add_const_vxx_0 - v_scale - 0 + _enabled + True - t_scale - 20.0/sample_rate + type + float - ac_couple - False + const + 48.0 - xy_mode - False + vlen + 1 - num_inputs - 1 + _coordinate + (653, 919) - grid_pos - 1, 0, 1, 1 + _rotation + 0 + + + virtual_source - notebook - displays, 0 + id + virtual_source_0 + + + _enabled + True + + + stream_id + bits _coordinate - (434, 603) + (283, 919) _rotation @@ -813,101 +880,85 @@ - variable_slider + wxgui_scopesink2 id - pll_alpha + wxgui_scopesink2_0_0_0_0 _enabled True - label - PLL Alpha + type + float - value - 0.001 + title + Post-SYNC - min - 0.0 + samp_rate + sym_rate - max + v_scale 0.5 - num_steps - 500 + t_scale + 20.0/sym_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + False + + + num_inputs + 1 grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - + displays, 1 _coordinate - (192, 100) + (872, 607) _rotation - 0 + 180 - variable_slider + notebook id - sync_alpha + displays _enabled True - - label - SYNC Alpha - - - value - 0.001 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - style - wx.SL_HORIZONTAL + wx.NB_TOP - converver - float_converter + labels + ['RX','PLL/SYNC'] grid_pos - 0, 1, 1, 1 + 1, 0, 1, 2 notebook @@ -915,7 +966,7 @@ _coordinate - (344, 101) + (9, 99) _rotation @@ -947,38 +998,62 @@ 0 - noaa_hrpt_pll_cc_0 - wxgui_scopesink2_0_0 + gr_binary_slicer_fb_0 + virtual_sink_1 0 0 - noaa_hrpt_pll_cc_0 - wxgui_scopesink2_0_0_0 + agr + noaa_hrpt_pll_cf_0 0 0 - noaa_hrpt_pll_cc_0 - sync + noaa_hrpt_pll_cf_0 + wxgui_scopesink2_0_0 0 0 - sync - wxgui_scopesink2_0_0_1 + noaa_hrpt_pll_cf_0 + noaa_hrpt_sync_ff_0 0 0 - sync + noaa_hrpt_sync_ff_0 + gr_binary_slicer_fb_0 + 0 + 0 + + + noaa_hrpt_sync_ff_0 wxgui_scopesink2_0_0_0_0 0 0 - agr - noaa_hrpt_pll_cc_0 + virtual_source_0 + gr_char_to_float_0 + 0 + 0 + + + gr_float_to_char_0 + gr_file_sink_0 + 0 + 0 + + + gr_add_const_vxx_0 + gr_float_to_char_0 + 0 + 0 + + + gr_char_to_float_0 + gr_add_const_vxx_0 0 0 diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py index 5cfaf7842..74e352670 100755 --- a/gr-noaa/grc/usrp_rx_hrpt.py +++ b/gr-noaa/grc/usrp_rx_hrpt.py @@ -2,12 +2,14 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sat Aug 29 13:16:19 2009 +# Generated: Mon Sep 7 13:05:09 2009 ################################################## +from gnuradio import eng_notation from gnuradio import gr from gnuradio import noaa from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import forms from gnuradio.wxgui import scopesink2 @@ -39,8 +41,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "SYNC") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL/SYNC") self.GridAdd(self.displays, 1, 0, 1, 2) ################################################## @@ -97,13 +98,20 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # Blocks ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.noaa_hrpt_pll_cc_0 = noaa.hrpt_pll_cc(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_char_to_float_0 = gr.char_to_float() + self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") + self.gr_float_to_char_0 = gr.float_to_char() + self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.noaa_hrpt_sync_ff_0 = noaa.hrpt_sync_ff(.005, .005*.005/4.0, sps, max_sync_offset) self.rx_fftsink = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), baseband_freq=1698e6, y_per_div=5, y_divs=8, ref_level=20, + ref_scale=2.0, sample_rate=sample_rate, fft_size=1024, fft_rate=30, @@ -113,8 +121,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): peak_hold=False, ) self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) - self.sync = noaa.hrpt_sync_cc(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", False) self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), @@ -127,7 +134,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): num_inputs=1, ) self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( + self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( self.displays.GetPage(1).GetWin(), title="Post-PLL", sample_rate=sample_rate, @@ -138,30 +145,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): num_inputs=1, ) self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) - self.wxgui_scopesink2_0_0_0 = scopesink2.scope_sink_c( + self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_f( self.displays.GetPage(1).GetWin(), - title="Post-PLL", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=True, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_c( - self.displays.GetPage(2).GetWin(), - title="Post-SYNC", - sample_rate=sym_rate, - v_scale=0.5, - t_scale=20.0/sym_rate, - ac_couple=False, - xy_mode=True, - num_inputs=1, - ) - self.displays.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0_1 = scopesink2.scope_sink_c( - self.displays.GetPage(2).GetWin(), title="Post-SYNC", sample_rate=sym_rate, v_scale=0.5, @@ -170,7 +155,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): xy_mode=False, num_inputs=1, ) - self.displays.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_1.win, 0, 0, 1, 1) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) ################################################## # Connections @@ -179,12 +164,15 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.connect((self.throttle, 0), (self.agr, 0)) self.connect((self.agr, 0), (self.rx_fftsink, 0)) self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.wxgui_scopesink2_0_0_0, 0)) - self.connect((self.noaa_hrpt_pll_cc_0, 0), (self.sync, 0)) - self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_1, 0)) - self.connect((self.sync, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) - self.connect((self.agr, 0), (self.noaa_hrpt_pll_cc_0, 0)) + self.connect((self.agr, 0), (self.noaa_hrpt_pll_cf_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_ff_0, 0)) + self.connect((self.noaa_hrpt_sync_ff_0, 0), (self.gr_binary_slicer_fb_0, 0)) + self.connect((self.noaa_hrpt_sync_ff_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) + self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) + self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) def set_decim(self, decim): self.decim = decim @@ -194,16 +182,14 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.sym_rate = sym_rate self.set_sps(self.sample_rate/self.sym_rate) self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sym_rate) - self.wxgui_scopesink2_0_0_1.set_sample_rate(self.sym_rate) def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate self.set_sps(self.sample_rate/self.sym_rate) - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0_0_0.set_sample_rate(self.sample_rate) self.rx_fftsink.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps @@ -211,25 +197,23 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) self._sync_alpha_slider.set_value(self.sync_alpha) self._sync_alpha_text_box.set_value(self.sync_alpha) def set_pll_alpha(self, pll_alpha): self.pll_alpha = pll_alpha - self.noaa_hrpt_pll_cc_0.set_alpha(self.pll_alpha) - self.noaa_hrpt_pll_cc_0.set_beta(self.pll_alpha**2/4.0) self._pll_alpha_slider.set_value(self.pll_alpha) self._pll_alpha_text_box.set_value(self.pll_alpha) + self.noaa_hrpt_pll_cf_0.set_alpha(self.pll_alpha) + self.noaa_hrpt_pll_cf_0.set_beta(self.pll_alpha**2/4.0) def set_max_sync_offset(self, max_sync_offset): self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) + self.noaa_hrpt_sync_ff_0.set_max_offset(self.max_sync_offset) def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset - self.noaa_hrpt_pll_cc_0.set_max_offset(self.max_carrier_offset) + self.noaa_hrpt_pll_cf_0.set_max_offset(self.max_carrier_offset) def set_hs(self, hs): self.hs = hs diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 2690ddb54..913638783 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -29,8 +29,8 @@ lib_LTLIBRARIES = \ libgnuradio-noaa.la libgnuradio_noaa_la_SOURCES = \ - noaa_hrpt_pll_cc.cc \ - noaa_hrpt_sync_cc.cc + noaa_hrpt_pll_cf.cc \ + noaa_hrpt_sync_ff.cc libgnuradio_noaa_la_LIBADD = \ $(GNURADIO_CORE_LA) @@ -38,5 +38,5 @@ libgnuradio_noaa_la_LIBADD = \ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 grinclude_HEADERS = \ - noaa_hrpt_pll_cc.h \ - noaa_hrpt_sync_cc.h + noaa_hrpt_pll_cf.h \ + noaa_hrpt_sync_ff.h diff --git a/gr-noaa/lib/noaa_hrpt_pll_cc.cc b/gr-noaa/lib/noaa_hrpt_pll_cc.cc deleted file mode 100644 index 46fe24da4..000000000 --- a/gr-noaa/lib/noaa_hrpt_pll_cc.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#define M_TWOPI (2*M_PI) - -noaa_hrpt_pll_cc_sptr -noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset) -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_pll_cc(alpha, beta, max_offset)); -} - -noaa_hrpt_pll_cc::noaa_hrpt_pll_cc(float alpha, float beta, float max_offset) - : gr_sync_block("noaa_hrpt_pll_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), - d_phase(0.0), d_freq(0.0) -{ -} - -float -phase_wrap(float phase) -{ - while (phase < -M_PI) - phase += M_TWOPI; - while (phase > M_PI) - phase -= M_TWOPI; - - return phase; -} - -int -noaa_hrpt_pll_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - - // Adjust PLL phase/frequency - float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); - d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); - d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); - - // Generate and mix out carrier - float re, im; - gr_sincosf(d_phase, &im, &re); - out[i] = in[i]*gr_complex(re, -im); - } - - return noutput_items; -} diff --git a/gr-noaa/lib/noaa_hrpt_pll_cc.h b/gr-noaa/lib/noaa_hrpt_pll_cc.h deleted file mode 100644 index 810454406..000000000 --- a/gr-noaa/lib/noaa_hrpt_pll_cc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifndef INCLUDED_NOAA_HRPT_PLL_CC_H -#define INCLUDED_NOAA_HRPT_PLL_CC_H - -#include - -class noaa_hrpt_pll_cc; -typedef boost::shared_ptr noaa_hrpt_pll_cc_sptr; - -noaa_hrpt_pll_cc_sptr -noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); - -class noaa_hrpt_pll_cc : public gr_sync_block -{ - friend noaa_hrpt_pll_cc_sptr noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); - noaa_hrpt_pll_cc(float alpha, float beta, float max_offset); - - float d_alpha; // 1st order loop constant - float d_beta; // 2nd order loop constant - float d_max_offset; // Maximum frequency offset, radians/sample - float d_phase; // Instantaneous carrier phase - float d_freq; // Instantaneous carrier frequency, radians/sample - - public: - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_max_offset(float max_offset) { d_max_offset = max_offset; } -}; - -#endif /* INCLUDED_NOAA_HRPT_PLL_CC_H */ diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.cc b/gr-noaa/lib/noaa_hrpt_pll_cf.cc new file mode 100644 index 000000000..08ab1d15f --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_pll_cf.cc @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define M_TWOPI (2*M_PI) + +noaa_hrpt_pll_cf_sptr +noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_pll_cf(alpha, beta, max_offset)); +} + +noaa_hrpt_pll_cf::noaa_hrpt_pll_cf(float alpha, float beta, float max_offset) + : gr_sync_block("noaa_hrpt_pll_cf", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(float))), + d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), + d_phase(0.0), d_freq(0.0) +{ +} + +float +phase_wrap(float phase) +{ + while (phase < -M_PI) + phase += M_TWOPI; + while (phase > M_PI) + phase -= M_TWOPI; + + return phase; +} + +int +noaa_hrpt_pll_cf::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const gr_complex *in = (const gr_complex *) input_items[0]; + float *out = (float *) output_items[0]; + + for (int i = 0; i < noutput_items; i++) { + + // Adjust PLL phase/frequency + float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); + d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); + d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); + + // Generate and mix out carrier + float re, im; + gr_sincosf(d_phase, &im, &re); + out[i] = (in[i]*gr_complex(re, -im)).imag(); + } + + return noutput_items; +} diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.h b/gr-noaa/lib/noaa_hrpt_pll_cf.h new file mode 100644 index 000000000..507d47fe7 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_pll_cf.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_PLL_CF_H +#define INCLUDED_NOAA_HRPT_PLL_CF_H + +#include + +class noaa_hrpt_pll_cf; +typedef boost::shared_ptr noaa_hrpt_pll_cf_sptr; + +noaa_hrpt_pll_cf_sptr +noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); + +class noaa_hrpt_pll_cf : public gr_sync_block +{ + friend noaa_hrpt_pll_cf_sptr noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); + noaa_hrpt_pll_cf(float alpha, float beta, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_max_offset; // Maximum frequency offset, radians/sample + float d_phase; // Instantaneous carrier phase + float d_freq; // Instantaneous carrier frequency, radians/sample + + public: + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_HRPT_PLL_CF_H */ diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.cc b/gr-noaa/lib/noaa_hrpt_sync_cc.cc deleted file mode 100644 index 46cc277bd..000000000 --- a/gr-noaa/lib/noaa_hrpt_sync_cc.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -inline int signum(float f) -{ - return f >= 0.0 ? 1 : -1; -} - -noaa_hrpt_sync_cc_sptr -noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset) -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_sync_cc(alpha, beta, sps, max_offset)); -} - -noaa_hrpt_sync_cc::noaa_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset) - : gr_block("noaa_hrpt_sync_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_alpha(alpha), d_beta(beta), - d_sps(sps), d_max_offset(max_offset), - d_phase(0.0), d_freq(1.0/sps), - d_last_sign(1) -{ -} - -int -noaa_hrpt_sync_cc::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ninputs = ninput_items[0]; - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - int i = 0, j = 0; - while (i < ninputs && j < noutput_items) { - float sample = in[i++].imag(); - int sign = signum(sample); - d_phase += d_freq; - - // Train on zero crossings in center region of symbol - if (sign != d_last_sign) { - if (d_phase > 0.25 && d_phase < 0.75) { - float phase_err = d_phase-0.5; - d_phase -= phase_err*d_alpha; // 1st order phase adjustment - d_freq -= phase_err*d_beta; // 2nd order frequency adjustment - } - - d_last_sign = sign; - } - - if (d_phase > 1.0) { - out[j++] = in[i]; - d_phase -= 1.0; - } - } - - consume_each(i); - return j; -} diff --git a/gr-noaa/lib/noaa_hrpt_sync_cc.h b/gr-noaa/lib/noaa_hrpt_sync_cc.h deleted file mode 100644 index 6abbcad48..000000000 --- a/gr-noaa/lib/noaa_hrpt_sync_cc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifndef INCLUDED_NOAA_HRPT_SYNC_CC_H -#define INCLUDED_NOAA_HRPT_SYNC_CC_H - -#include - -class noaa_hrpt_sync_cc; -typedef boost::shared_ptr noaa_hrpt_sync_cc_sptr; - -noaa_hrpt_sync_cc_sptr -noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); - -class noaa_hrpt_sync_cc : public gr_block -{ - friend noaa_hrpt_sync_cc_sptr noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); - noaa_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); - - float d_alpha; // 1st order loop constant - float d_beta; // 2nd order loop constant - float d_sps; // samples per symbol - float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol - float d_phase; // Instantaneous symbol phase - float d_freq; // Instantaneous symbol frequency, samples/symbol - int d_last_sign; // Tracks zero crossings - - public: - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_max_offset(float max_offset) { d_max_offset = max_offset; } -}; - -#endif /* INCLUDED_NOAA_HRPT_SYNC_CC_H */ diff --git a/gr-noaa/lib/noaa_hrpt_sync_ff.cc b/gr-noaa/lib/noaa_hrpt_sync_ff.cc new file mode 100644 index 000000000..f17ad54dc --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_ff.cc @@ -0,0 +1,87 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +inline int signum(float f) +{ + return f >= 0.0 ? 1 : -1; +} + +noaa_hrpt_sync_ff_sptr +noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_sync_ff(alpha, beta, sps, max_offset)); +} + +noaa_hrpt_sync_ff::noaa_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset) + : gr_block("noaa_hrpt_sync_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))), + d_alpha(alpha), d_beta(beta), + d_sps(sps), d_max_offset(max_offset), + d_phase(0.0), d_freq(1.0/sps), + d_last_sign(1) +{ +} + +int +noaa_hrpt_sync_ff::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + int ninputs = ninput_items[0]; + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; + + int i = 0, j = 0; + while (i < ninputs && j < noutput_items) { + float sample = in[i++]; + int sign = signum(sample); + d_phase += d_freq; + + // Train on zero crossings in center region of symbol + if (sign != d_last_sign) { + if (d_phase > 0.25 && d_phase < 0.75) { + float phase_err = d_phase-0.5; + d_phase -= phase_err*d_alpha; // 1st order phase adjustment + d_freq -= phase_err*d_beta; // 2nd order frequency adjustment + } + + d_last_sign = sign; + } + + if (d_phase > 1.0) { + out[j++] = -sample; // Invert sense, -68 degrees=1 + d_phase -= 1.0; + } + } + + consume_each(i); + return j; +} diff --git a/gr-noaa/lib/noaa_hrpt_sync_ff.h b/gr-noaa/lib/noaa_hrpt_sync_ff.h new file mode 100644 index 000000000..51502698b --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_ff.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_SYNC_FF_H +#define INCLUDED_NOAA_HRPT_SYNC_FF_H + +#include + +class noaa_hrpt_sync_ff; +typedef boost::shared_ptr noaa_hrpt_sync_ff_sptr; + +noaa_hrpt_sync_ff_sptr +noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_ff : public gr_block +{ + friend noaa_hrpt_sync_ff_sptr noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); + noaa_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_sps; // samples per symbol + float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol + float d_phase; // Instantaneous symbol phase + float d_freq; // Instantaneous symbol frequency, samples/symbol + int d_last_sign; // Tracks zero crossings + + public: + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_HRPT_SYNC_FF_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 18cb5920a..2f98738ca 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -53,8 +53,8 @@ noaa_swig_python = \ # additional SWIG files to be installed noaa_swig_swiginclude_headers = \ noaa_swig.i \ - noaa_hrpt_pll_cc.i \ - noaa_hrpt_sync_cc.i + noaa_hrpt_pll_cf.i \ + noaa_hrpt_sync_ff.i include $(top_srcdir)/Makefile.swig diff --git a/gr-noaa/swig/noaa_hrpt_pll_cc.i b/gr-noaa/swig/noaa_hrpt_pll_cc.i deleted file mode 100644 index a29eaa38a..000000000 --- a/gr-noaa/swig/noaa_hrpt_pll_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_pll_cc) - -noaa_hrpt_pll_cc_sptr -noaa_make_hrpt_pll_cc(float alpha, float beta, float max_offset); - -class noaa_hrpt_pll_cc : public gr_sync_block -{ -private: - noaa_hrpt_pll_cc(); - -public: - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_offset(float min_freq); -}; diff --git a/gr-noaa/swig/noaa_hrpt_pll_cf.i b/gr-noaa/swig/noaa_hrpt_pll_cf.i new file mode 100644 index 000000000..859548a2d --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_pll_cf.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_pll_cf) + +noaa_hrpt_pll_cf_sptr +noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); + +class noaa_hrpt_pll_cf : public gr_sync_block +{ +private: + noaa_hrpt_pll_cf(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_hrpt_sync_cc.i b/gr-noaa/swig/noaa_hrpt_sync_cc.i deleted file mode 100644 index 6dcfa57df..000000000 --- a/gr-noaa/swig/noaa_hrpt_sync_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_cc) - -noaa_hrpt_sync_cc_sptr -noaa_make_hrpt_sync_cc(float alpha, float beta, float sps, float max_offset); - -class noaa_hrpt_sync_cc : public gr_sync_block -{ -private: - noaa_hrpt_sync_cc(); - -public: - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_offset(float min_freq); -}; diff --git a/gr-noaa/swig/noaa_hrpt_sync_ff.i b/gr-noaa/swig/noaa_hrpt_sync_ff.i new file mode 100644 index 000000000..f3b1594ba --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_sync_ff.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_ff) + +noaa_hrpt_sync_ff_sptr +noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_ff : public gr_sync_block +{ +private: + noaa_hrpt_sync_ff(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index 470f5f960..a3e5dd783 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -23,9 +23,9 @@ %include "gnuradio.i" %{ -#include -#include +#include +#include %} -%include "noaa_hrpt_pll_cc.i" -%include "noaa_hrpt_sync_cc.i" +%include "noaa_hrpt_pll_cf.i" +%include "noaa_hrpt_sync_ff.i" -- cgit From b7d1c551fb374a0e5219fbb4d118f3f19f448393 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 8 Sep 2009 16:52:37 -0700 Subject: Changed synchronizer to output sliced bits. --- gr-noaa/grc/Makefile.am | 2 +- gr-noaa/grc/noaa_hrpt_sync_fb.xml | 39 ++++ gr-noaa/grc/noaa_hrpt_sync_ff.xml | 39 ---- gr-noaa/grc/usrp_rx_hrpt.grc | 455 ++++++++++++++++++-------------------- gr-noaa/grc/usrp_rx_hrpt.py | 20 +- gr-noaa/lib/Makefile.am | 4 +- gr-noaa/lib/noaa_hrpt_sync_fb.cc | 90 ++++++++ gr-noaa/lib/noaa_hrpt_sync_fb.h | 58 +++++ gr-noaa/lib/noaa_hrpt_sync_ff.cc | 87 -------- gr-noaa/lib/noaa_hrpt_sync_ff.h | 58 ----- gr-noaa/swig/Makefile.am | 2 +- gr-noaa/swig/noaa_hrpt_sync_fb.i | 37 ++++ gr-noaa/swig/noaa_hrpt_sync_ff.i | 37 ---- gr-noaa/swig/noaa_swig.i | 4 +- 14 files changed, 454 insertions(+), 478 deletions(-) create mode 100644 gr-noaa/grc/noaa_hrpt_sync_fb.xml delete mode 100644 gr-noaa/grc/noaa_hrpt_sync_ff.xml create mode 100644 gr-noaa/lib/noaa_hrpt_sync_fb.cc create mode 100644 gr-noaa/lib/noaa_hrpt_sync_fb.h delete mode 100644 gr-noaa/lib/noaa_hrpt_sync_ff.cc delete mode 100644 gr-noaa/lib/noaa_hrpt_sync_ff.h create mode 100644 gr-noaa/swig/noaa_hrpt_sync_fb.i delete mode 100644 gr-noaa/swig/noaa_hrpt_sync_ff.i (limited to 'gr-noaa') diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index fa2c40c88..e56bd354d 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -29,7 +29,7 @@ dist_bin_SCRIPTS = \ dist_grcblocks_DATA = \ noaa_hrpt_pll_cf.xml \ - noaa_hrpt_sync_ff.xml + noaa_hrpt_sync_fb.xml EXTRA_DIST = \ usrp_rx_hrpt.grc \ diff --git a/gr-noaa/grc/noaa_hrpt_sync_fb.xml b/gr-noaa/grc/noaa_hrpt_sync_fb.xml new file mode 100644 index 000000000..e066e3489 --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_sync_fb.xml @@ -0,0 +1,39 @@ + + + HRPT SYNC + noaa_hrpt_sync_fb + NOAA + from gnuradio import noaa + noaa.hrpt_sync_fb($alpha, $beta, $sps, $max_offset) + set_alpha($alpha) + set_beta($beta) + set_max_offset($max_offset) + + Alpha + alpha + real + + + Beta + beta + real + + + Samples/Symbol + sps + real + + + Max Offset + max_offset + real + + + in + float + + + out + byte + + diff --git a/gr-noaa/grc/noaa_hrpt_sync_ff.xml b/gr-noaa/grc/noaa_hrpt_sync_ff.xml deleted file mode 100644 index 91b83ad5d..000000000 --- a/gr-noaa/grc/noaa_hrpt_sync_ff.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - HRPT SYNC - noaa_hrpt_sync_ff - NOAA - from gnuradio import noaa - noaa.hrpt_sync_ff($alpha, $beta, $sps, $max_offset) - set_alpha($alpha) - set_beta($beta) - set_max_offset($max_offset) - - Alpha - alpha - real - - - Beta - beta - real - - - Samples/Symbol - sps - real - - - Max Offset - max_offset - real - - - in - float - - - out - float - - diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc index 41aa1958e..25b133532 100644 --- a/gr-noaa/grc/usrp_rx_hrpt.grc +++ b/gr-noaa/grc/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Mon Sep 7 13:05:09 2009 + Tue Sep 8 14:57:48 2009 options @@ -221,144 +221,6 @@ 0 - - wxgui_fftsink2 - - id - rx_fftsink - - - _enabled - True - - - type - complex - - - title - RX Spectrum - - - samp_rate - sample_rate - - - baseband_freq - 1698e6 - - - y_per_div - 5 - - - y_divs - 8 - - - ref_level - 20 - - - ref_scale - 2.0 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - True - - - avg_alpha - 0.1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (433, 297) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0 - - - _enabled - True - - - type - complex - - - title - RX Waveform - - - samp_rate - sample_rate - - - v_scale - 0 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 603) - - - _rotation - 0 - - variable_slider @@ -590,62 +452,61 @@ - wxgui_scopesink2 + virtual_source id - wxgui_scopesink2_0_0 + virtual_source_0 _enabled True - type - float - - - title - Post-PLL + stream_id + bits - samp_rate - sample_rate + _coordinate + (283, 919) - v_scale - 0.5 + _rotation + 0 + + + notebook - t_scale - 20.0/sample_rate + id + displays - ac_couple - False + _enabled + True - xy_mode - False + style + wx.NB_TOP - num_inputs - 1 + labels + ['RX','PLL/SYNC'] grid_pos - 0, 0, 1, 1 + 1, 0, 1, 2 notebook - displays, 1 + _coordinate - (618, 335) + (9, 99) _rotation - 180 + 0 @@ -680,10 +541,10 @@ - noaa_hrpt_sync_ff + noaa_hrpt_sync_fb id - noaa_hrpt_sync_ff_0 + noaa_hrpt_sync_fb_0 _enabled @@ -691,11 +552,11 @@ alpha - .005 + 0.001 beta - .005*.005/4.0 + 0.001**2/4.0 sps @@ -707,7 +568,7 @@ _coordinate - (876, 494) + (856, 494) _rotation @@ -715,18 +576,22 @@ - gr_binary_slicer_fb + virtual_sink id - gr_binary_slicer_fb_0 + virtual_sink_1 _enabled True + + stream_id + bits + _coordinate - (1108, 522) + (1126, 518) _rotation @@ -734,22 +599,18 @@ - virtual_sink + gr_char_to_float id - virtual_sink_1 + gr_char_to_float_0 _enabled True - - stream_id - bits - _coordinate - (1289, 518) + (477, 923) _rotation @@ -757,22 +618,22 @@ - gr_file_sink + gr_add_const_vxx id - gr_file_sink_0 + gr_add_const_vxx_0 _enabled True - file - bits.dat + type + float - type - byte + const + 48.0 vlen @@ -780,7 +641,7 @@ _coordinate - (981, 919) + (692, 919) _rotation @@ -788,10 +649,10 @@ - gr_char_to_float + gr_float_to_char id - gr_char_to_float_0 + gr_float_to_char_0 _enabled @@ -799,7 +660,7 @@ _coordinate - (477, 923) + (848, 923) _rotation @@ -807,18 +668,30 @@ - gr_float_to_char + gr_file_sink id - gr_float_to_char_0 + gr_file_sink_0 _enabled True + + file + bits.dat + + + type + byte + + + vlen + 1 + _coordinate - (809, 923) + (1020, 919) _rotation @@ -826,10 +699,10 @@ - gr_add_const_vxx + wxgui_scopesink2 id - gr_add_const_vxx_0 + wxgui_scopesink2_0_0_0_0 _enabled @@ -840,39 +713,123 @@ float - const - 48.0 + title + Post-SYNC - vlen + samp_rate + sym_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sym_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs 1 + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + _coordinate - (653, 919) + (452, 990) _rotation - 0 + 180 - virtual_source + wxgui_fftsink2 id - virtual_source_0 + rx_fftsink _enabled True - stream_id - bits + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 1698e6 + + + y_per_div + 5 + + + y_divs + 8 + + + ref_level + 20 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 _coordinate - (283, 919) + (434, 269) _rotation @@ -883,7 +840,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0_0_0 + wxgui_scopesink2_0 _enabled @@ -891,23 +848,23 @@ type - float + complex title - Post-SYNC + RX Waveform samp_rate - sym_rate + sample_rate v_scale - 0.5 + 0 t_scale - 20.0/sym_rate + 20.0/sample_rate ac_couple @@ -927,50 +884,74 @@ notebook - displays, 1 + displays, 0 _coordinate - (872, 607) + (433, 570) _rotation - 180 + 0 - notebook + wxgui_scopesink2 id - displays + wxgui_scopesink2_0_0 _enabled True - style - wx.NB_TOP + type + float - labels - ['RX','PLL/SYNC'] + title + Post-PLL + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 grid_pos - 1, 0, 1, 2 + 0, 0, 1, 1 notebook - + displays, 1 _coordinate - (9, 99) + (618, 335) _rotation - 0 + 180 @@ -997,12 +978,6 @@ 0 0 - - gr_binary_slicer_fb_0 - virtual_sink_1 - 0 - 0 - agr noaa_hrpt_pll_cf_0 @@ -1016,32 +991,32 @@ 0 - noaa_hrpt_pll_cf_0 - noaa_hrpt_sync_ff_0 + virtual_source_0 + gr_char_to_float_0 0 0 - noaa_hrpt_sync_ff_0 - gr_binary_slicer_fb_0 + noaa_hrpt_pll_cf_0 + noaa_hrpt_sync_fb_0 0 0 - noaa_hrpt_sync_ff_0 - wxgui_scopesink2_0_0_0_0 + noaa_hrpt_sync_fb_0 + virtual_sink_1 0 0 - virtual_source_0 - gr_char_to_float_0 + gr_char_to_float_0 + wxgui_scopesink2_0_0_0_0 0 0 - gr_float_to_char_0 - gr_file_sink_0 + gr_char_to_float_0 + gr_add_const_vxx_0 0 0 @@ -1052,8 +1027,8 @@ 0 - gr_char_to_float_0 - gr_add_const_vxx_0 + gr_float_to_char_0 + gr_file_sink_0 0 0 diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py index 74e352670..10e2f31c0 100755 --- a/gr-noaa/grc/usrp_rx_hrpt.py +++ b/gr-noaa/grc/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Mon Sep 7 13:05:09 2009 +# Generated: Tue Sep 8 14:58:57 2009 ################################################## from gnuradio import eng_notation @@ -99,12 +99,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) - self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() self.gr_char_to_float_0 = gr.char_to_float() self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") self.gr_float_to_char_0 = gr.float_to_char() self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_sync_ff_0 = noaa.hrpt_sync_ff(.005, .005*.005/4.0, sps, max_sync_offset) + self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(0.001, 0.001**2/4.0, sps, max_sync_offset) self.rx_fftsink = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), baseband_freq=1698e6, @@ -166,13 +165,12 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.agr, 0), (self.noaa_hrpt_pll_cf_0, 0)) self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_ff_0, 0)) - self.connect((self.noaa_hrpt_sync_ff_0, 0), (self.gr_binary_slicer_fb_0, 0)) - self.connect((self.noaa_hrpt_sync_ff_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) - self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) - self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) + self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.gr_char_to_float_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) + self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) + self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) + self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) def set_decim(self, decim): self.decim = decim @@ -186,9 +184,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate self.set_sps(self.sample_rate/self.sym_rate) + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.rx_fftsink.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) def set_sps(self, sps): @@ -209,7 +207,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_max_sync_offset(self, max_sync_offset): self.max_sync_offset = max_sync_offset - self.noaa_hrpt_sync_ff_0.set_max_offset(self.max_sync_offset) + self.noaa_hrpt_sync_fb_0.set_max_offset(self.max_sync_offset) def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 913638783..1b758871a 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -30,7 +30,7 @@ lib_LTLIBRARIES = \ libgnuradio_noaa_la_SOURCES = \ noaa_hrpt_pll_cf.cc \ - noaa_hrpt_sync_ff.cc + noaa_hrpt_sync_fb.cc libgnuradio_noaa_la_LIBADD = \ $(GNURADIO_CORE_LA) @@ -39,4 +39,4 @@ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 grinclude_HEADERS = \ noaa_hrpt_pll_cf.h \ - noaa_hrpt_sync_ff.h + noaa_hrpt_sync_fb.h diff --git a/gr-noaa/lib/noaa_hrpt_sync_fb.cc b/gr-noaa/lib/noaa_hrpt_sync_fb.cc new file mode 100644 index 000000000..f99947f82 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_fb.cc @@ -0,0 +1,90 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +inline int signum(float f) +{ + return f >= 0.0 ? 1 : -1; +} + +noaa_hrpt_sync_fb_sptr +noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset) +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_sync_fb(alpha, beta, sps, max_offset)); +} + +noaa_hrpt_sync_fb::noaa_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset) + : gr_block("noaa_hrpt_sync_fb", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(char))), + d_alpha(alpha), d_beta(beta), + d_sps(sps), d_max_offset(max_offset), + d_phase(0.0), d_freq(1.0/sps), + d_last_sign(1) +{ +} + +int +noaa_hrpt_sync_fb::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + int ninputs = ninput_items[0]; + const float *in = (const float *)input_items[0]; + char *out = (char *)output_items[0]; + + int i = 0, j = 0; + while (i < ninputs && j < noutput_items) { + float sample = in[i++]; + int sign = signum(sample); + d_phase += d_freq; + + // Train on zero crossings in center region of symbol + if (sign != d_last_sign) { + if (d_phase > 0.25 && d_phase < 0.75) { + float phase_err = d_phase-0.5; + d_phase -= phase_err*d_alpha; // 1st order phase adjustment + d_freq -= phase_err*d_beta; // 2nd order frequency adjustment + } + + d_last_sign = sign; + } + + if (d_phase > 1.0) { + if (sample < 0.0) + out[j++] = 1; + else + out[j++] = 0; + d_phase -= 1.0; + } + } + + consume_each(i); + return j; +} diff --git a/gr-noaa/lib/noaa_hrpt_sync_fb.h b/gr-noaa/lib/noaa_hrpt_sync_fb.h new file mode 100644 index 000000000..a9416b9ea --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_sync_fb.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_SYNC_FB_H +#define INCLUDED_NOAA_HRPT_SYNC_FB_H + +#include + +class noaa_hrpt_sync_fb; +typedef boost::shared_ptr noaa_hrpt_sync_fb_sptr; + +noaa_hrpt_sync_fb_sptr +noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_fb : public gr_block +{ + friend noaa_hrpt_sync_fb_sptr noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); + noaa_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); + + float d_alpha; // 1st order loop constant + float d_beta; // 2nd order loop constant + float d_sps; // samples per symbol + float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol + float d_phase; // Instantaneous symbol phase + float d_freq; // Instantaneous symbol frequency, samples/symbol + int d_last_sign; // Tracks zero crossings + + public: + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_alpha(float alpha) { d_alpha = alpha; } + void set_beta(float beta) { d_beta = beta; } + void set_max_offset(float max_offset) { d_max_offset = max_offset; } +}; + +#endif /* INCLUDED_NOAA_HRPT_SYNC_FB_H */ diff --git a/gr-noaa/lib/noaa_hrpt_sync_ff.cc b/gr-noaa/lib/noaa_hrpt_sync_ff.cc deleted file mode 100644 index f17ad54dc..000000000 --- a/gr-noaa/lib/noaa_hrpt_sync_ff.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -inline int signum(float f) -{ - return f >= 0.0 ? 1 : -1; -} - -noaa_hrpt_sync_ff_sptr -noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset) -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_sync_ff(alpha, beta, sps, max_offset)); -} - -noaa_hrpt_sync_ff::noaa_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset) - : gr_block("noaa_hrpt_sync_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - d_alpha(alpha), d_beta(beta), - d_sps(sps), d_max_offset(max_offset), - d_phase(0.0), d_freq(1.0/sps), - d_last_sign(1) -{ -} - -int -noaa_hrpt_sync_ff::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ninputs = ninput_items[0]; - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - int i = 0, j = 0; - while (i < ninputs && j < noutput_items) { - float sample = in[i++]; - int sign = signum(sample); - d_phase += d_freq; - - // Train on zero crossings in center region of symbol - if (sign != d_last_sign) { - if (d_phase > 0.25 && d_phase < 0.75) { - float phase_err = d_phase-0.5; - d_phase -= phase_err*d_alpha; // 1st order phase adjustment - d_freq -= phase_err*d_beta; // 2nd order frequency adjustment - } - - d_last_sign = sign; - } - - if (d_phase > 1.0) { - out[j++] = -sample; // Invert sense, -68 degrees=1 - d_phase -= 1.0; - } - } - - consume_each(i); - return j; -} diff --git a/gr-noaa/lib/noaa_hrpt_sync_ff.h b/gr-noaa/lib/noaa_hrpt_sync_ff.h deleted file mode 100644 index 51502698b..000000000 --- a/gr-noaa/lib/noaa_hrpt_sync_ff.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifndef INCLUDED_NOAA_HRPT_SYNC_FF_H -#define INCLUDED_NOAA_HRPT_SYNC_FF_H - -#include - -class noaa_hrpt_sync_ff; -typedef boost::shared_ptr noaa_hrpt_sync_ff_sptr; - -noaa_hrpt_sync_ff_sptr -noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); - -class noaa_hrpt_sync_ff : public gr_block -{ - friend noaa_hrpt_sync_ff_sptr noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); - noaa_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); - - float d_alpha; // 1st order loop constant - float d_beta; // 2nd order loop constant - float d_sps; // samples per symbol - float d_max_offset; // Maximum frequency offset for d_sps, samples/symbol - float d_phase; // Instantaneous symbol phase - float d_freq; // Instantaneous symbol frequency, samples/symbol - int d_last_sign; // Tracks zero crossings - - public: - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_max_offset(float max_offset) { d_max_offset = max_offset; } -}; - -#endif /* INCLUDED_NOAA_HRPT_SYNC_FF_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 2f98738ca..e1584227f 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -54,7 +54,7 @@ noaa_swig_python = \ noaa_swig_swiginclude_headers = \ noaa_swig.i \ noaa_hrpt_pll_cf.i \ - noaa_hrpt_sync_ff.i + noaa_hrpt_sync_fb.i include $(top_srcdir)/Makefile.swig diff --git a/gr-noaa/swig/noaa_hrpt_sync_fb.i b/gr-noaa/swig/noaa_hrpt_sync_fb.i new file mode 100644 index 000000000..a8e5b21dd --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_sync_fb.i @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_fb) + +noaa_hrpt_sync_fb_sptr +noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); + +class noaa_hrpt_sync_fb : public gr_sync_block +{ +private: + noaa_hrpt_sync_fb(); + +public: + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_offset(float min_freq); +}; diff --git a/gr-noaa/swig/noaa_hrpt_sync_ff.i b/gr-noaa/swig/noaa_hrpt_sync_ff.i deleted file mode 100644 index f3b1594ba..000000000 --- a/gr-noaa/swig/noaa_hrpt_sync_ff.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_ff) - -noaa_hrpt_sync_ff_sptr -noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); - -class noaa_hrpt_sync_ff : public gr_sync_block -{ -private: - noaa_hrpt_sync_ff(); - -public: - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_offset(float min_freq); -}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index a3e5dd783..8223eedb9 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -24,8 +24,8 @@ %{ #include -#include +#include %} %include "noaa_hrpt_pll_cf.i" -%include "noaa_hrpt_sync_ff.i" +%include "noaa_hrpt_sync_fb.i" -- cgit From ce9a41e69f5e3b9e0280d22fa778d167c3982db7 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 8 Sep 2009 21:08:29 -0700 Subject: Added HRPT deframer block --- gr-noaa/grc/Makefile.am | 1 + gr-noaa/grc/noaa_hrpt_deframer.xml | 12 ++ gr-noaa/grc/usrp_rx_hrpt.grc | 367 ++++++++++++++++++++----------------- gr-noaa/grc/usrp_rx_hrpt.py | 16 +- gr-noaa/lib/Makefile.am | 2 + gr-noaa/lib/noaa_hrpt_deframer.cc | 102 +++++++++++ gr-noaa/lib/noaa_hrpt_deframer.h | 52 ++++++ gr-noaa/swig/Makefile.am | 1 + gr-noaa/swig/noaa_hrpt_deframer.i | 32 ++++ gr-noaa/swig/noaa_swig.i | 2 + 10 files changed, 406 insertions(+), 181 deletions(-) create mode 100644 gr-noaa/grc/noaa_hrpt_deframer.xml create mode 100644 gr-noaa/lib/noaa_hrpt_deframer.cc create mode 100644 gr-noaa/lib/noaa_hrpt_deframer.h create mode 100644 gr-noaa/swig/noaa_hrpt_deframer.i (limited to 'gr-noaa') diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index e56bd354d..4e4c0bae0 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -28,6 +28,7 @@ dist_bin_SCRIPTS = \ usrp_rx_lrit.py dist_grcblocks_DATA = \ + noaa_hrpt_deframer.xml \ noaa_hrpt_pll_cf.xml \ noaa_hrpt_sync_fb.xml diff --git a/gr-noaa/grc/noaa_hrpt_deframer.xml b/gr-noaa/grc/noaa_hrpt_deframer.xml new file mode 100644 index 000000000..bc68f71d3 --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_deframer.xml @@ -0,0 +1,12 @@ + + + HRPT Deframer + noaa_hrpt_deframer + NOAA + from gnuradio import noaa + noaa.hrpt_deframer() + + in + byte + + diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc index 25b133532..715846743 100644 --- a/gr-noaa/grc/usrp_rx_hrpt.grc +++ b/gr-noaa/grc/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Tue Sep 8 14:57:48 2009 + Tue Sep 8 21:03:12 2009 options @@ -377,41 +377,6 @@ 0 - - gr_file_source - - id - src - - - _enabled - True - - - file - poes-d16.dat - - - type - complex - - - repeat - False - - - vlen - 1 - - - _coordinate - (34, 423) - - - _rotation - 0 - - gr_agc_xx @@ -540,41 +505,6 @@ 0 - - noaa_hrpt_sync_fb - - id - noaa_hrpt_sync_fb_0 - - - _enabled - True - - - alpha - 0.001 - - - beta - 0.001**2/4.0 - - - sps - sps - - - max_offset - max_sync_offset - - - _coordinate - (856, 494) - - - _rotation - 0 - - virtual_sink @@ -618,10 +548,10 @@ - gr_add_const_vxx + wxgui_scopesink2 id - gr_add_const_vxx_0 + wxgui_scopesink2_0_0_0_0 _enabled @@ -632,66 +562,103 @@ float - const - 48.0 + title + Post-SYNC - vlen + samp_rate + sym_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sym_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs 1 + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + _coordinate - (692, 919) + (452, 990) _rotation - 0 + 180 - gr_float_to_char + wxgui_scopesink2 id - gr_float_to_char_0 + wxgui_scopesink2_0 _enabled True - _coordinate - (848, 923) + type + complex - _rotation - 0 + title + RX Waveform - - - gr_file_sink - id - gr_file_sink_0 + samp_rate + sample_rate - _enabled - True + v_scale + 0 - file - bits.dat + t_scale + 20.0/sample_rate - type - byte + ac_couple + False - vlen + xy_mode + False + + + num_inputs 1 + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + _coordinate - (1020, 919) + (433, 570) _rotation @@ -702,7 +669,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0_0_0 + wxgui_scopesink2_0_0 _enabled @@ -714,11 +681,11 @@ title - Post-SYNC + Post-PLL samp_rate - sym_rate + sample_rate v_scale @@ -726,7 +693,7 @@ t_scale - 20.0/sym_rate + 20.0/sample_rate ac_couple @@ -742,7 +709,7 @@ grid_pos - 1, 0, 1, 1 + 0, 0, 1, 1 notebook @@ -750,7 +717,7 @@ _coordinate - (452, 990) + (618, 335) _rotation @@ -758,78 +725,88 @@ - wxgui_fftsink2 + noaa_hrpt_sync_fb id - rx_fftsink + noaa_hrpt_sync_fb_0 _enabled True - type - complex + alpha + 0.001 - title - RX Spectrum + beta + 0.001**2/4.0 - samp_rate - sample_rate + sps + sps - baseband_freq - 1698e6 + max_offset + max_sync_offset - y_per_div - 5 + _coordinate + (856, 494) - y_divs - 8 + _rotation + 0 + + + noaa_hrpt_deframer - ref_level - 20 + id + noaa_hrpt_deframer_0 - ref_scale - 2.0 + _enabled + True - fft_size - 1024 + _coordinate + (1110, 631) - fft_rate - 30 + _rotation + 0 + + + gr_file_source - peak_hold - False + id + src - average + _enabled True - avg_alpha - 0.1 + file + poes-d16.dat - grid_pos - 0, 0, 1, 1 + type + complex - notebook - displays, 0 + repeat + True + + + vlen + 1 _coordinate - (434, 269) + (34, 423) _rotation @@ -837,58 +814,80 @@ - wxgui_scopesink2 + gr_add_const_vxx id - wxgui_scopesink2_0 + gr_add_const_vxx_0 _enabled - True + False type - complex + float - title - RX Waveform + const + 48.0 - samp_rate - sample_rate + vlen + 1 - v_scale + _coordinate + (692, 919) + + + _rotation 0 + + + gr_float_to_char - t_scale - 20.0/sample_rate + id + gr_float_to_char_0 - ac_couple + _enabled False - xy_mode + _coordinate + (848, 923) + + + _rotation + 0 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled False - num_inputs - 1 + file + bits.dat - grid_pos - 1, 0, 1, 1 + type + byte - notebook - displays, 0 + vlen + 1 _coordinate - (433, 570) + (1020, 919) _rotation @@ -896,10 +895,10 @@ - wxgui_scopesink2 + wxgui_fftsink2 id - wxgui_scopesink2_0_0 + rx_fftsink _enabled @@ -907,35 +906,55 @@ type - float + complex title - Post-PLL + RX Spectrum samp_rate sample_rate - v_scale - 0.5 + baseband_freq + 1698e6 - t_scale - 20.0/sample_rate + y_per_div + 5 - ac_couple - False + y_divs + 8 - xy_mode + ref_level + -5 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold False - num_inputs - 1 + average + True + + + avg_alpha + 0.1 grid_pos @@ -943,15 +962,15 @@ notebook - displays, 1 + displays, 0 _coordinate - (618, 335) + (434, 269) _rotation - 180 + 0 @@ -1032,4 +1051,10 @@ 0 0 + + noaa_hrpt_sync_fb_0 + noaa_hrpt_deframer_0 + 0 + 0 + diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py index 10e2f31c0..40cc517fc 100755 --- a/gr-noaa/grc/usrp_rx_hrpt.py +++ b/gr-noaa/grc/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Tue Sep 8 14:58:57 2009 +# Generated: Tue Sep 8 21:03:12 2009 ################################################## from gnuradio import eng_notation @@ -98,10 +98,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # Blocks ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) self.gr_char_to_float_0 = gr.char_to_float() - self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") - self.gr_float_to_char_0 = gr.float_to_char() + self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(0.001, 0.001**2/4.0, sps, max_sync_offset) self.rx_fftsink = fftsink2.fft_sink_c( @@ -109,7 +107,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): baseband_freq=1698e6, y_per_div=5, y_divs=8, - ref_level=20, + ref_level=-5, ref_scale=2.0, sample_rate=sample_rate, fft_size=1024, @@ -120,7 +118,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): peak_hold=False, ) self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", False) + self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), @@ -168,9 +166,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.gr_char_to_float_0, 0)) self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) - self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) - self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) def set_decim(self, decim): self.decim = decim @@ -185,9 +181,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.sample_rate = sample_rate self.set_sps(self.sample_rate/self.sym_rate) self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) + self.rx_fftsink.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 1b758871a..578c98ada 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -29,6 +29,7 @@ lib_LTLIBRARIES = \ libgnuradio-noaa.la libgnuradio_noaa_la_SOURCES = \ + noaa_hrpt_deframer.cc \ noaa_hrpt_pll_cf.cc \ noaa_hrpt_sync_fb.cc @@ -38,5 +39,6 @@ libgnuradio_noaa_la_LIBADD = \ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 grinclude_HEADERS = \ + noaa_hrpt_deframer.h \ noaa_hrpt_pll_cf.h \ noaa_hrpt_sync_fb.h diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc new file mode 100644 index 000000000..71712277b --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -0,0 +1,102 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#define ST_IDLE 0 +#define ST_SYNCED 1 + +#define HRPT_MINOR_FRAME_SYNC 0x0A116FD719D83C95LL +#define HRPT_BITS_PER_MINOR_FRAME 11090*10 +#define HRPT_SYNC_LENGTH 6*10 + +static int frames_seen = 0; + +noaa_hrpt_deframer_sptr +noaa_make_hrpt_deframer() +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_deframer()); +} + +noaa_hrpt_deframer::noaa_hrpt_deframer() + : gr_sync_block("noaa_hrpt_deframer", + gr_make_io_signature(1, 1, sizeof(char)), + gr_make_io_signature(0, 0, 0)) +{ + enter_idle(); +} + +void +noaa_hrpt_deframer::enter_idle() +{ + d_state = ST_IDLE; +} + +void +noaa_hrpt_deframer::enter_synced() +{ + d_state = ST_SYNCED; + d_count = HRPT_BITS_PER_MINOR_FRAME-HRPT_SYNC_LENGTH; +} + +int +noaa_hrpt_deframer::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const char *in = (const char *)input_items[0]; + + int i = 0; + while (i < noutput_items) { + char bit = in[i++]; + if (d_state != ST_SYNCED) + fprintf(stderr, "."); + + switch (d_state) { + case ST_IDLE: + d_shifter = (d_shifter << 1) | bit; // MSB transmitted first + + if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { + fprintf(stderr, "\nSYNC #%i...", frames_seen++); + enter_synced(); + } + break; + + case ST_SYNCED: + if (--d_count == 0) { + fprintf(stderr, "done."); + enter_idle(); + } + break; + + default: + throw std::runtime_error("noaa_hrpt_deframer: bad state\n"); + } + } + + return i; +} diff --git a/gr-noaa/lib/noaa_hrpt_deframer.h b/gr-noaa/lib/noaa_hrpt_deframer.h new file mode 100644 index 000000000..bc91bc89c --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_deframer.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_DEFRAMER_H +#define INCLUDED_NOAA_HRPT_DEFRAMER_H + +#include + +class noaa_hrpt_deframer; +typedef boost::shared_ptr noaa_hrpt_deframer_sptr; + +noaa_hrpt_deframer_sptr +noaa_make_hrpt_deframer(); + +class noaa_hrpt_deframer : public gr_sync_block +{ + friend noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); + noaa_hrpt_deframer(); + + unsigned int d_state; + unsigned int d_count; + unsigned long long d_shifter; // 60 bit sync word + + void enter_idle(); + void enter_synced(); + +public: + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_NOAA_HRPT_DEFRAMER_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index e1584227f..98311eb7b 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -53,6 +53,7 @@ noaa_swig_python = \ # additional SWIG files to be installed noaa_swig_swiginclude_headers = \ noaa_swig.i \ + noaa_hrpt_deframer.i \ noaa_hrpt_pll_cf.i \ noaa_hrpt_sync_fb.i diff --git a/gr-noaa/swig/noaa_hrpt_deframer.i b/gr-noaa/swig/noaa_hrpt_deframer.i new file mode 100644 index 000000000..73106d726 --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_deframer.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_deframer) + +noaa_hrpt_deframer_sptr +noaa_make_hrpt_deframer(); + +class noaa_hrpt_deframer : public gr_sync_block +{ +private: + noaa_hrpt_deframer(); +}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index 8223eedb9..44f2e4723 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -23,9 +23,11 @@ %include "gnuradio.i" %{ +#include #include #include %} +%include "noaa_hrpt_deframer.i" %include "noaa_hrpt_pll_cf.i" %include "noaa_hrpt_sync_fb.i" -- cgit From e2216220f85d3e9d93db3946aa0e68e59309d1c2 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 09:49:10 -0700 Subject: Reorganization of directories Moved apps into own directory Added (empty) python directory --- gr-noaa/Makefile.am | 6 +- gr-noaa/apps/Makefile.am | 33 + gr-noaa/apps/usrp_rx_hrpt.grc | 1060 +++++++++++++++++++++++++++++ gr-noaa/apps/usrp_rx_hrpt.py | 220 ++++++ gr-noaa/apps/usrp_rx_lrit.grc | 1477 +++++++++++++++++++++++++++++++++++++++++ gr-noaa/apps/usrp_rx_lrit.py | 399 +++++++++++ gr-noaa/grc/Makefile.am | 7 - gr-noaa/grc/usrp_rx_hrpt.grc | 1060 ----------------------------- gr-noaa/grc/usrp_rx_hrpt.py | 220 ------ gr-noaa/grc/usrp_rx_lrit.grc | 1477 ----------------------------------------- gr-noaa/grc/usrp_rx_lrit.py | 399 ----------- gr-noaa/python/Makefile.am | 27 + 12 files changed, 3218 insertions(+), 3167 deletions(-) create mode 100644 gr-noaa/apps/Makefile.am create mode 100644 gr-noaa/apps/usrp_rx_hrpt.grc create mode 100755 gr-noaa/apps/usrp_rx_hrpt.py create mode 100644 gr-noaa/apps/usrp_rx_lrit.grc create mode 100755 gr-noaa/apps/usrp_rx_lrit.py delete mode 100644 gr-noaa/grc/usrp_rx_hrpt.grc delete mode 100755 gr-noaa/grc/usrp_rx_hrpt.py delete mode 100644 gr-noaa/grc/usrp_rx_lrit.grc delete mode 100755 gr-noaa/grc/usrp_rx_lrit.py create mode 100644 gr-noaa/python/Makefile.am (limited to 'gr-noaa') diff --git a/gr-noaa/Makefile.am b/gr-noaa/Makefile.am index fa03f1088..f3f4f6a38 100644 --- a/gr-noaa/Makefile.am +++ b/gr-noaa/Makefile.am @@ -21,11 +21,9 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = lib +SUBDIRS = lib grc if PYTHON -SUBDIRS += swig +SUBDIRS += swig python apps endif -SUBDIRS += grc - diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am new file mode 100644 index 000000000..23b8240c1 --- /dev/null +++ b/gr-noaa/apps/Makefile.am @@ -0,0 +1,33 @@ +# +# Copyright 2009 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 $(top_srcdir)/Makefile.common + +if PYTHON + +dist_bin_SCRIPTS = \ + usrp_rx_hrpt.py \ + usrp_rx_lrit.py + +EXTRA_DIST = \ + usrp_rx_hrpt.grc \ + usrp_rx_lrit.grc +endif diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc new file mode 100644 index 000000000..715846743 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -0,0 +1,1060 @@ + + + Tue Sep 8 21:03:12 2009 + + options + + id + usrp_rx_hrpt + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 202) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (79, 518) + + + _rotation + 0 + + + + variable + + id + decim + + + _enabled + True + + + value + 16 + + + _coordinate + (186, 10) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (589, 13) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (383, 7) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (479, 11) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (273, 9) + + + _rotation + 0 + + + + variable_slider + + id + pll_alpha + + + _enabled + True + + + label + PLL Alpha + + + value + 0.001 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (192, 100) + + + _rotation + 0 + + + + variable_slider + + id + sync_alpha + + + _enabled + True + + + label + SYNC Alpha + + + value + 0.001 + + + min + 0.0 + + + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (344, 101) + + + _rotation + 0 + + + + variable + + id + max_carrier_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (671, 14) + + + _rotation + 0 + + + + variable + + id + max_sync_offset + + + _enabled + True + + + value + 0.01 + + + _coordinate + (805, 13) + + + _rotation + 0 + + + + gr_agc_xx + + id + agr + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0 + + + max_gain + 1.0 + + + _coordinate + (261, 494) + + + _rotation + 0 + + + + virtual_source + + id + virtual_source_0 + + + _enabled + True + + + stream_id + bits + + + _coordinate + (283, 919) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['RX','PLL/SYNC'] + + + grid_pos + 1, 0, 1, 2 + + + notebook + + + + _coordinate + (9, 99) + + + _rotation + 0 + + + + noaa_hrpt_pll_cf + + id + noaa_hrpt_pll_cf_0 + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (639, 502) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_1 + + + _enabled + True + + + stream_id + bits + + + _coordinate + (1126, 518) + + + _rotation + 0 + + + + gr_char_to_float + + id + gr_char_to_float_0 + + + _enabled + True + + + _coordinate + (477, 923) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0_0_0 + + + _enabled + True + + + type + float + + + title + Post-SYNC + + + samp_rate + sym_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sym_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (452, 990) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + RX Waveform + + + samp_rate + sample_rate + + + v_scale + 0 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (433, 570) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0_0 + + + _enabled + True + + + type + float + + + title + Post-PLL + + + samp_rate + sample_rate + + + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (618, 335) + + + _rotation + 180 + + + + noaa_hrpt_sync_fb + + id + noaa_hrpt_sync_fb_0 + + + _enabled + True + + + alpha + 0.001 + + + beta + 0.001**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset + + + _coordinate + (856, 494) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + noaa_hrpt_deframer_0 + + + _enabled + True + + + _coordinate + (1110, 631) + + + _rotation + 0 + + + + gr_file_source + + id + src + + + _enabled + True + + + file + poes-d16.dat + + + type + complex + + + repeat + True + + + vlen + 1 + + + _coordinate + (34, 423) + + + _rotation + 0 + + + + gr_add_const_vxx + + id + gr_add_const_vxx_0 + + + _enabled + False + + + type + float + + + const + 48.0 + + + vlen + 1 + + + _coordinate + (692, 919) + + + _rotation + 0 + + + + gr_float_to_char + + id + gr_float_to_char_0 + + + _enabled + False + + + _coordinate + (848, 923) + + + _rotation + 0 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled + False + + + file + bits.dat + + + type + byte + + + vlen + 1 + + + _coordinate + (1020, 919) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + rx_fftsink + + + _enabled + True + + + type + complex + + + title + RX Spectrum + + + samp_rate + sample_rate + + + baseband_freq + 1698e6 + + + y_per_div + 5 + + + y_divs + 8 + + + ref_level + -5 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + True + + + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 269) + + + _rotation + 0 + + + + src + throttle + 0 + 0 + + + throttle + agr + 0 + 0 + + + agr + rx_fftsink + 0 + 0 + + + agr + wxgui_scopesink2_0 + 0 + 0 + + + agr + noaa_hrpt_pll_cf_0 + 0 + 0 + + + noaa_hrpt_pll_cf_0 + wxgui_scopesink2_0_0 + 0 + 0 + + + virtual_source_0 + gr_char_to_float_0 + 0 + 0 + + + noaa_hrpt_pll_cf_0 + noaa_hrpt_sync_fb_0 + 0 + 0 + + + noaa_hrpt_sync_fb_0 + virtual_sink_1 + 0 + 0 + + + gr_char_to_float_0 + wxgui_scopesink2_0_0_0_0 + 0 + 0 + + + gr_char_to_float_0 + gr_add_const_vxx_0 + 0 + 0 + + + gr_add_const_vxx_0 + gr_float_to_char_0 + 0 + 0 + + + gr_float_to_char_0 + gr_file_sink_0 + 0 + 0 + + + noaa_hrpt_sync_fb_0 + noaa_hrpt_deframer_0 + 0 + 0 + + diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py new file mode 100755 index 000000000..40cc517fc --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Tue Sep 8 21:03:12 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import math +import wx + +class usrp_rx_hrpt(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + + ################################################## + # Variables + ################################################## + self.decim = decim = 16 + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self.sync_alpha = sync_alpha = 0.001 + self.pll_alpha = pll_alpha = 0.001 + self.max_sync_offset = max_sync_offset = 0.01 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL/SYNC") + self.GridAdd(self.displays, 1, 0, 1, 2) + + ################################################## + # Controls + ################################################## + _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._sync_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + label="SYNC Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._sync_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_sync_alpha_sizer, + value=self.sync_alpha, + callback=self.set_sync_alpha, + minimum=0.0, + maximum=0.5, + num_steps=500, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_sync_alpha_sizer, 0, 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=500, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_pll_alpha_sizer, 0, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.gr_char_to_float_0 = gr.char_to_float() + self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() + self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(0.001, 0.001**2/4.0, sps, max_sync_offset) + self.rx_fftsink = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=1698e6, + y_per_div=5, + y_divs=8, + ref_level=-5, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=0.1, + title="RX Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) + self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) + self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="RX Waveform", + sample_rate=sample_rate, + v_scale=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-PLL", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) + self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-SYNC", + sample_rate=sym_rate, + v_scale=0.5, + t_scale=20.0/sym_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.src, 0), (self.throttle, 0)) + self.connect((self.throttle, 0), (self.agr, 0)) + self.connect((self.agr, 0), (self.rx_fftsink, 0)) + self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.agr, 0), (self.noaa_hrpt_pll_cf_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) + self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.gr_char_to_float_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) + self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) + self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sym_rate) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.sym_rate) + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) + self.rx_fftsink.set_sample_rate(self.sample_rate) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + + def set_sync_alpha(self, sync_alpha): + self.sync_alpha = sync_alpha + self._sync_alpha_slider.set_value(self.sync_alpha) + self._sync_alpha_text_box.set_value(self.sync_alpha) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self._pll_alpha_slider.set_value(self.pll_alpha) + self._pll_alpha_text_box.set_value(self.pll_alpha) + self.noaa_hrpt_pll_cf_0.set_alpha(self.pll_alpha) + self.noaa_hrpt_pll_cf_0.set_beta(self.pll_alpha**2/4.0) + + def set_max_sync_offset(self, max_sync_offset): + self.max_sync_offset = max_sync_offset + self.noaa_hrpt_sync_fb_0.set_max_offset(self.max_sync_offset) + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + self.noaa_hrpt_pll_cf_0.set_max_offset(self.max_carrier_offset) + + def set_hs(self, hs): + self.hs = hs + +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_lrit.grc b/gr-noaa/apps/usrp_rx_lrit.grc new file mode 100644 index 000000000..55fe39787 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_lrit.grc @@ -0,0 +1,1477 @@ + + + Sat Aug 29 11:26:03 2009 + + options + + id + usrp_rx_lrit + + + _enabled + True + + + title + USRP LRIT Receiver + + + author + + + + description + + + + window_size + 4095, 4095 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (10, 81) + + + _rotation + 0 + + + + variable + + id + symbol_rate + + + _enabled + True + + + value + 293e3 + + + _coordinate + (11, 148) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + samp_rate/symbol_rate + + + _coordinate + (12, 214) + + + _rotation + 0 + + + + variable_text_box + + id + decim + + + _enabled + True + + + label + Decim + + + value + saved_decim + + + converver + int_converter + + + formatter + None + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (243, 13) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_0 + + + _enabled + True + + + type + complex + + + title + Waveform + + + samp_rate + samp_rate + + + v_scale + 0.5 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 551) + + + _rotation + 0 + + + + gr_agc_xx + + id + gr_agc_xx_0 + + + _enabled + True + + + type + complex + + + rate + 1e-6 + + + reference + 1.0 + + + gain + 1.0/32767.0 + + + max_gain + 1.0 + + + _coordinate + (261, 493) + + + _rotation + 0 + + + + root_raised_cosine_filter + + id + root_raised_cosine_filter_0 + + + _enabled + False + + + type + fir_filter_ccf + + + decim + 1 + + + interp + 1 + + + gain + 1 + + + samp_rate + samp_rate + + + sym_rate + symbol_rate + + + alpha + 0.5 + + + ntaps + 50 + + + _coordinate + (618, 373) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_simple_source_x_0 + + + _enabled + False + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + + + lo_offset + float('inf') + + + gain + gain + + + side + B + + + rx_ant + RXA + + + hb_filters + + + + _coordinate + (11, 477) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2_0 + + + _enabled + True + + + type + complex + + + title + Spectrum + + + samp_rate + samp_rate + + + baseband_freq + freq + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 50 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (434, 337) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle_0 + + + _enabled + True + + + type + complex + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (181, 663) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2_1 + + + _enabled + True + + + type + complex + + + title + Scope Plot + + + samp_rate + samp_rate + + + v_scale + 0.4 + + + t_scale + 20.0/samp_rate + + + ac_couple + False + + + xy_mode + True + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1126, 251) + + + _rotation + 0 + + + + gr_probe_mpsk_snr_c + + id + gr_probe_mpsk_snr_c_0 + + + _enabled + True + + + type + snr + + + alpha + 0.0001 + + + probe_rate + 10 + + + _coordinate + (1126, 723) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_0 + + + _enabled + True + + + type + float + + + title + SNR + + + units + dB + + + samp_rate + 10 + + + min_value + 0 + + + max_value + 30 + + + factor + 1.0 + + + decimal_places + 1 + + + ref_level + 0 + + + number_rate + 10 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + show_gauge + True + + + grid_pos + 2, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (1335, 651) + + + _rotation + 0 + + + + gr_mpsk_receiver_cc + + id + gr_mpsk_receiver_cc_0 + + + _enabled + True + + + M + 2 + + + theta + 0 + + + alpha + costas_alpha + + + beta + costas_alpha*costas_alpha/4.0 + + + fmin + -0.05 + + + fmax + 0.05 + + + mu + 0.5 + + + gain_mu + gain_mu + + + omega + sps + + + gain_omega + gain_mu*gain_mu/4.0 + + + omega_relative_limit + 0.05 + + + _coordinate + (881, 437) + + + _rotation + 0 + + + + gr_complex_to_real + + id + gr_complex_to_real_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (1133, 521) + + + _rotation + 0 + + + + gr_char_to_float + + id + gr_char_to_float_0 + + + _enabled + True + + + _coordinate + (1523, 521) + + + _rotation + 0 + + + + gr_binary_slicer_fb + + id + gr_binary_slicer_fb_0 + + + _enabled + True + + + _coordinate + (1343, 521) + + + _rotation + 0 + + + + gr_add_const_vxx + + id + gr_add_const_vxx_0 + + + _enabled + True + + + type + float + + + const + 48.0 + + + vlen + 1 + + + _coordinate + (1707, 517) + + + _rotation + 0 + + + + gr_float_to_char + + id + gr_float_to_char_0 + + + _enabled + True + + + _coordinate + (1878, 521) + + + _rotation + 0 + + + + gr_file_sink + + id + gr_file_sink_0 + + + _enabled + True + + + file + bits.dat + + + type + byte + + + vlen + 1 + + + _coordinate + (2059, 517) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + lrit.dat + + + type + complex + + + repeat + False + + + vlen + 1 + + + _coordinate + (11, 655) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['USRP RX', 'Costas Output'] + + + grid_pos + 2, 0, 1, 3 + + + notebook + + + + _coordinate + (14, 351) + + + _rotation + 0 + + + + variable_config + + id + saved_decim + + + _enabled + True + + + value + 160 + + + type + int + + + config_file + config_filename + + + section + main + + + option + decim + + + writeback + decim + + + _coordinate + (246, 172) + + + _rotation + 0 + + + + variable_slider + + id + gain + + + _enabled + True + + + label + Gain + + + value + saved_gain + + + min + 0 + + + max + 115 + + + num_steps + 115 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (411, 11) + + + _rotation + 0 + + + + variable_config + + id + saved_gain + + + _enabled + True + + + value + 33 + + + type + real + + + config_file + config_filename + + + section + main + + + option + gain + + + writeback + gain + + + _coordinate + (412, 172) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency + + + value + saved_freq + + + min + 135e6 + + + max + 139e6 + + + num_steps + 400 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 2, 1, 1 + + + notebook + + + + _coordinate + (574, 12) + + + _rotation + 0 + + + + variable_config + + id + saved_freq + + + _enabled + True + + + value + 137e6 + + + type + real + + + config_file + config_filename + + + section + main + + + option + freq + + + writeback + freq + + + _coordinate + (576, 170) + + + _rotation + 0 + + + + variable_slider + + id + costas_alpha + + + _enabled + True + + + label + Costas Alpha + + + value + saved_costas_alpha + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 0, 1, 1 + + + notebook + + + + _coordinate + (738, 13) + + + _rotation + 0 + + + + variable_config + + id + saved_costas_alpha + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + main + + + option + costas_alpha + + + writeback + costas_alpha + + + _coordinate + (739, 170) + + + _rotation + 0 + + + + variable_config + + id + saved_gain_mu + + + _enabled + True + + + value + 0.005 + + + type + real + + + config_file + config_filename + + + section + main + + + option + gain_mu + + + writeback + gain_mu + + + _coordinate + (900, 170) + + + _rotation + 0 + + + + variable_slider + + id + gain_mu + + + _enabled + True + + + label + Gain Mu + + + value + saved_gain_mu + + + min + 0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 1, 1, 1, 1 + + + notebook + + + + _coordinate + (902, 13) + + + _rotation + 0 + + + + variable + + id + config_filename + + + _enabled + True + + + value + "usrp_rx_lrit.cfg" + + + _coordinate + (13, 283) + + + _rotation + 0 + + + + usrp_simple_source_x_0 + gr_agc_xx_0 + 0 + 0 + + + gr_agc_xx_0 + wxgui_scopesink2_0 + 0 + 0 + + + gr_file_source_0 + gr_throttle_0 + 0 + 0 + + + gr_throttle_0 + gr_agc_xx_0 + 0 + 0 + + + gr_probe_mpsk_snr_c_0 + wxgui_numbersink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_probe_mpsk_snr_c_0 + 0 + 0 + + + gr_agc_xx_0 + gr_mpsk_receiver_cc_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + wxgui_scopesink2_1 + 0 + 0 + + + gr_agc_xx_0 + wxgui_fftsink2_0 + 0 + 0 + + + gr_mpsk_receiver_cc_0 + gr_complex_to_real_0 + 0 + 0 + + + gr_complex_to_real_0 + gr_binary_slicer_fb_0 + 0 + 0 + + + gr_binary_slicer_fb_0 + gr_char_to_float_0 + 0 + 0 + + + gr_char_to_float_0 + gr_add_const_vxx_0 + 0 + 0 + + + gr_add_const_vxx_0 + gr_float_to_char_0 + 0 + 0 + + + gr_float_to_char_0 + gr_file_sink_0 + 0 + 0 + + diff --git a/gr-noaa/apps/usrp_rx_lrit.py b/gr-noaa/apps/usrp_rx_lrit.py new file mode 100755 index 000000000..bc313e3af --- /dev/null +++ b/gr-noaa/apps/usrp_rx_lrit.py @@ -0,0 +1,399 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP LRIT Receiver +# Generated: Sat Aug 29 11:26:03 2009 +################################################## + +from gnuradio import gr +from gnuradio.eng_option import eng_option +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import numbersink2 +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import wx + +class usrp_rx_lrit(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="USRP LRIT Receiver") + + ################################################## + # Variables + ################################################## + self.config_filename = config_filename = "usrp_rx_lrit.cfg" + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(config_filename) + try: saved_decim = self._saved_decim_config.getint("main", "decim") + except: saved_decim = 160 + self.saved_decim = saved_decim + self.decim = decim = saved_decim + self.symbol_rate = symbol_rate = 293e3 + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(config_filename) + try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu") + except: saved_gain_mu = 0.005 + self.saved_gain_mu = saved_gain_mu + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(config_filename) + try: saved_gain = self._saved_gain_config.getfloat("main", "gain") + except: saved_gain = 33 + 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("main", "freq") + except: saved_freq = 137e6 + self.saved_freq = saved_freq + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(config_filename) + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha") + except: saved_costas_alpha = 0.005 + self.saved_costas_alpha = saved_costas_alpha + self.samp_rate = samp_rate = 64e6/decim + self.sps = sps = samp_rate/symbol_rate + self.gain_mu = gain_mu = saved_gain_mu + self.gain = gain = saved_gain + self.freq = freq = saved_freq + self.costas_alpha = costas_alpha = saved_costas_alpha + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output") + self.GridAdd(self.displays, 2, 0, 1, 3) + + ################################################## + # Controls + ################################################## + self._decim_text_box = forms.text_box( + parent=self.GetWin(), + value=self.decim, + callback=self.set_decim, + label="Decim", + converter=forms.int_converter(), + ) + self.GridAdd(self._decim_text_box, 0, 0, 1, 1) + _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_mu_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + label="Gain Mu", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_mu_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1) + _gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + label="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=115, + num_steps=115, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_sizer, 0, 1, 1, 1) + _freq_sizer = wx.BoxSizer(wx.VERTICAL) + self._freq_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_freq_sizer, + value=self.freq, + callback=self.set_freq, + label="Frequency", + converter=forms.float_converter(), + proportion=0, + ) + self._freq_slider = forms.slider( + parent=self.GetWin(), + sizer=_freq_sizer, + value=self.freq, + callback=self.set_freq, + minimum=135e6, + maximum=139e6, + num_steps=400, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_freq_sizer, 0, 2, 1, 1) + _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._costas_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + label="Costas Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._costas_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) + self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_char_to_float_0 = gr.char_to_float() + self.gr_complex_to_real_0 = gr.complex_to_real(1) + self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) + self.gr_float_to_char_0 = gr.float_to_char() + self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05) + self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c( + type='snr', + alpha=0.0001, + probe_rate=10, + ) + self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) + self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=freq, + y_per_div=10, + y_divs=10, + ref_level=50, + sample_rate=samp_rate, + fft_size=1024, + fft_rate=30, + average=False, + avg_alpha=None, + title="Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) + self.wxgui_numbersink2_0 = numbersink2.number_sink_f( + self.displays.GetPage(1).GetWin(), + unit="dB", + minval=0, + maxval=30, + factor=1.0, + decimal_places=1, + ref_level=0, + sample_rate=10, + number_rate=10, + average=False, + avg_alpha=None, + label="SNR", + peak_hold=False, + show_gauge=True, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1) + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="Waveform", + sample_rate=samp_rate, + v_scale=0.5, + t_scale=20.0/samp_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) + self.wxgui_scopesink2_1 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="Scope Plot", + sample_rate=samp_rate, + v_scale=0.4, + t_scale=20.0/samp_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0)) + self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0)) + self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) + self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) + self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) + self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section("main"): + self._saved_decim_config.add_section("main") + self._saved_decim_config.set("main", "decim", str(self.decim)) + self._saved_decim_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("main"): + self._saved_gain_config.add_section("main") + self._saved_gain_config.set("main", "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("main"): + self._saved_freq_config.add_section("main") + self._saved_freq_config.set("main", "freq", str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section("main"): + self._saved_costas_alpha_config.add_section("main") + self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section("main"): + self._saved_gain_mu_config.add_section("main") + self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_saved_decim(self, saved_decim): + self.saved_decim = saved_decim + self.set_decim(self.saved_decim) + + def set_decim(self, decim): + self.decim = decim + self.set_samp_rate(64e6/self.decim) + self._decim_text_box.set_value(self.decim) + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section("main"): + self._saved_decim_config.add_section("main") + self._saved_decim_config.set("main", "decim", str(self.decim)) + self._saved_decim_config.write(open(self.config_filename, 'w')) + + def set_symbol_rate(self, symbol_rate): + self.symbol_rate = symbol_rate + self.set_sps(self.samp_rate/self.symbol_rate) + + def set_saved_gain_mu(self, saved_gain_mu): + self.saved_gain_mu = saved_gain_mu + self.set_gain_mu(self.saved_gain_mu) + + def set_saved_gain(self, saved_gain): + self.saved_gain = saved_gain + self.set_gain(self.saved_gain) + + def set_saved_freq(self, saved_freq): + self.saved_freq = saved_freq + self.set_freq(self.saved_freq) + + def set_saved_costas_alpha(self, saved_costas_alpha): + self.saved_costas_alpha = saved_costas_alpha + self.set_costas_alpha(self.saved_costas_alpha) + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.set_sps(self.samp_rate/self.symbol_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) + self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) + self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate) + + def set_sps(self, sps): + self.sps = sps + self.gr_mpsk_receiver_cc_0.set_omega(self.sps) + + def set_gain_mu(self, gain_mu): + self.gain_mu = gain_mu + self.gr_mpsk_receiver_cc_0.set_gain_mu(self.gain_mu) + self.gr_mpsk_receiver_cc_0.set_gain_omega(self.gain_mu*self.gain_mu/4.0) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section("main"): + self._saved_gain_mu_config.add_section("main") + self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) + + 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("main"): + self._saved_gain_config.add_section("main") + self._saved_gain_config.set("main", "gain", str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + + def set_freq(self, freq): + self.freq = freq + self.wxgui_fftsink2_0.set_baseband_freq(self.freq) + self._freq_slider.set_value(self.freq) + self._freq_text_box.set_value(self.freq) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section("main"): + self._saved_freq_config.add_section("main") + self._saved_freq_config.set("main", "freq", str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + + def set_costas_alpha(self, costas_alpha): + self.costas_alpha = costas_alpha + self.gr_mpsk_receiver_cc_0.set_alpha(self.costas_alpha) + self.gr_mpsk_receiver_cc_0.set_beta(self.costas_alpha*self.costas_alpha/4.0) + self._costas_alpha_slider.set_value(self.costas_alpha) + self._costas_alpha_text_box.set_value(self.costas_alpha) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section("main"): + self._saved_costas_alpha_config.add_section("main") + self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + self._saved_costas_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 = usrp_rx_lrit() + tb.Run(True) + diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index 4e4c0bae0..9f1f88195 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -23,15 +23,8 @@ include $(top_srcdir)/Makefile.common grcblocksdir = $(prefix)/share/gnuradio/grc/blocks -dist_bin_SCRIPTS = \ - usrp_rx_hrpt.py \ - usrp_rx_lrit.py - dist_grcblocks_DATA = \ noaa_hrpt_deframer.xml \ noaa_hrpt_pll_cf.xml \ noaa_hrpt_sync_fb.xml -EXTRA_DIST = \ - usrp_rx_hrpt.grc \ - usrp_rx_lrit.grc diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc deleted file mode 100644 index 715846743..000000000 --- a/gr-noaa/grc/usrp_rx_hrpt.grc +++ /dev/null @@ -1,1060 +0,0 @@ - - - Tue Sep 8 21:03:12 2009 - - options - - id - usrp_rx_hrpt - - - _enabled - True - - - title - USRP HRPT Receiver - - - author - - - - description - - - - window_size - 4096,4096 - - - generate_options - wx_gui - - - category - Custom - - - run - True - - - realtime_scheduling - - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - import - - id - import_0 - - - _enabled - True - - - import - import math - - - _coordinate - (9, 202) - - - _rotation - 0 - - - - gr_throttle - - id - throttle - - - _enabled - True - - - type - complex - - - samples_per_second - sample_rate - - - vlen - 1 - - - _coordinate - (79, 518) - - - _rotation - 0 - - - - variable - - id - decim - - - _enabled - True - - - value - 16 - - - _coordinate - (186, 10) - - - _rotation - 0 - - - - variable - - id - hs - - - _enabled - True - - - value - int(sps/2.0) - - - _coordinate - (589, 13) - - - _rotation - 0 - - - - variable - - id - sym_rate - - - _enabled - True - - - value - 600*1109 - - - _coordinate - (383, 7) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - sample_rate/sym_rate - - - _coordinate - (479, 11) - - - _rotation - 0 - - - - variable - - id - sample_rate - - - _enabled - True - - - value - 64e6/decim - - - _coordinate - (273, 9) - - - _rotation - 0 - - - - variable_slider - - id - pll_alpha - - - _enabled - True - - - label - PLL Alpha - - - value - 0.001 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 0, 1, 1 - - - notebook - - - - _coordinate - (192, 100) - - - _rotation - 0 - - - - variable_slider - - id - sync_alpha - - - _enabled - True - - - label - SYNC Alpha - - - value - 0.001 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 1, 1, 1 - - - notebook - - - - _coordinate - (344, 101) - - - _rotation - 0 - - - - variable - - id - max_carrier_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (671, 14) - - - _rotation - 0 - - - - variable - - id - max_sync_offset - - - _enabled - True - - - value - 0.01 - - - _coordinate - (805, 13) - - - _rotation - 0 - - - - gr_agc_xx - - id - agr - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0 - - - max_gain - 1.0 - - - _coordinate - (261, 494) - - - _rotation - 0 - - - - virtual_source - - id - virtual_source_0 - - - _enabled - True - - - stream_id - bits - - - _coordinate - (283, 919) - - - _rotation - 0 - - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - - labels - ['RX','PLL/SYNC'] - - - grid_pos - 1, 0, 1, 2 - - - notebook - - - - _coordinate - (9, 99) - - - _rotation - 0 - - - - noaa_hrpt_pll_cf - - id - noaa_hrpt_pll_cf_0 - - - _enabled - True - - - alpha - pll_alpha - - - beta - pll_alpha**2/4.0 - - - max_offset - max_carrier_offset - - - _coordinate - (639, 502) - - - _rotation - 0 - - - - virtual_sink - - id - virtual_sink_1 - - - _enabled - True - - - stream_id - bits - - - _coordinate - (1126, 518) - - - _rotation - 0 - - - - gr_char_to_float - - id - gr_char_to_float_0 - - - _enabled - True - - - _coordinate - (477, 923) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0_0_0_0 - - - _enabled - True - - - type - float - - - title - Post-SYNC - - - samp_rate - sym_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sym_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (452, 990) - - - _rotation - 180 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0 - - - _enabled - True - - - type - complex - - - title - RX Waveform - - - samp_rate - sample_rate - - - v_scale - 0 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (433, 570) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0_0 - - - _enabled - True - - - type - float - - - title - Post-PLL - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False - - - xy_mode - False - - - num_inputs - 1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (618, 335) - - - _rotation - 180 - - - - noaa_hrpt_sync_fb - - id - noaa_hrpt_sync_fb_0 - - - _enabled - True - - - alpha - 0.001 - - - beta - 0.001**2/4.0 - - - sps - sps - - - max_offset - max_sync_offset - - - _coordinate - (856, 494) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - noaa_hrpt_deframer_0 - - - _enabled - True - - - _coordinate - (1110, 631) - - - _rotation - 0 - - - - gr_file_source - - id - src - - - _enabled - True - - - file - poes-d16.dat - - - type - complex - - - repeat - True - - - vlen - 1 - - - _coordinate - (34, 423) - - - _rotation - 0 - - - - gr_add_const_vxx - - id - gr_add_const_vxx_0 - - - _enabled - False - - - type - float - - - const - 48.0 - - - vlen - 1 - - - _coordinate - (692, 919) - - - _rotation - 0 - - - - gr_float_to_char - - id - gr_float_to_char_0 - - - _enabled - False - - - _coordinate - (848, 923) - - - _rotation - 0 - - - - gr_file_sink - - id - gr_file_sink_0 - - - _enabled - False - - - file - bits.dat - - - type - byte - - - vlen - 1 - - - _coordinate - (1020, 919) - - - _rotation - 0 - - - - wxgui_fftsink2 - - id - rx_fftsink - - - _enabled - True - - - type - complex - - - title - RX Spectrum - - - samp_rate - sample_rate - - - baseband_freq - 1698e6 - - - y_per_div - 5 - - - y_divs - 8 - - - ref_level - -5 - - - ref_scale - 2.0 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - True - - - avg_alpha - 0.1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 269) - - - _rotation - 0 - - - - src - throttle - 0 - 0 - - - throttle - agr - 0 - 0 - - - agr - rx_fftsink - 0 - 0 - - - agr - wxgui_scopesink2_0 - 0 - 0 - - - agr - noaa_hrpt_pll_cf_0 - 0 - 0 - - - noaa_hrpt_pll_cf_0 - wxgui_scopesink2_0_0 - 0 - 0 - - - virtual_source_0 - gr_char_to_float_0 - 0 - 0 - - - noaa_hrpt_pll_cf_0 - noaa_hrpt_sync_fb_0 - 0 - 0 - - - noaa_hrpt_sync_fb_0 - virtual_sink_1 - 0 - 0 - - - gr_char_to_float_0 - wxgui_scopesink2_0_0_0_0 - 0 - 0 - - - gr_char_to_float_0 - gr_add_const_vxx_0 - 0 - 0 - - - gr_add_const_vxx_0 - gr_float_to_char_0 - 0 - 0 - - - gr_float_to_char_0 - gr_file_sink_0 - 0 - 0 - - - noaa_hrpt_sync_fb_0 - noaa_hrpt_deframer_0 - 0 - 0 - - diff --git a/gr-noaa/grc/usrp_rx_hrpt.py b/gr-noaa/grc/usrp_rx_hrpt.py deleted file mode 100755 index 40cc517fc..000000000 --- a/gr-noaa/grc/usrp_rx_hrpt.py +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Tue Sep 8 21:03:12 2009 -################################################## - -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import noaa -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import forms -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import math -import wx - -class usrp_rx_hrpt(grc_wxgui.top_block_gui): - - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") - - ################################################## - # Variables - ################################################## - self.decim = decim = 16 - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 64e6/decim - self.sps = sps = sample_rate/sym_rate - self.sync_alpha = sync_alpha = 0.001 - self.pll_alpha = pll_alpha = 0.001 - self.max_sync_offset = max_sync_offset = 0.01 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.hs = hs = int(sps/2.0) - - ################################################## - # Notebooks - ################################################## - self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL/SYNC") - self.GridAdd(self.displays, 1, 0, 1, 2) - - ################################################## - # Controls - ################################################## - _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._sync_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - label="SYNC Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._sync_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - minimum=0.0, - maximum=0.5, - num_steps=500, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_sync_alpha_sizer, 0, 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=500, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_pll_alpha_sizer, 0, 0, 1, 1) - - ################################################## - # Blocks - ################################################## - self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_char_to_float_0 = gr.char_to_float() - self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() - self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(0.001, 0.001**2/4.0, sps, max_sync_offset) - self.rx_fftsink = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=1698e6, - y_per_div=5, - y_divs=8, - ref_level=-5, - ref_scale=2.0, - sample_rate=sample_rate, - fft_size=1024, - fft_rate=30, - average=True, - avg_alpha=0.1, - title="RX Spectrum", - peak_hold=False, - ) - self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) - self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( - self.displays.GetPage(0).GetWin(), - title="RX Waveform", - sample_rate=sample_rate, - v_scale=0, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-PLL", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) - self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-SYNC", - sample_rate=sym_rate, - v_scale=0.5, - t_scale=20.0/sym_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) - - ################################################## - # Connections - ################################################## - self.connect((self.src, 0), (self.throttle, 0)) - self.connect((self.throttle, 0), (self.agr, 0)) - self.connect((self.agr, 0), (self.rx_fftsink, 0)) - self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.agr, 0), (self.noaa_hrpt_pll_cf_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) - self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) - - def set_decim(self, decim): - self.decim = decim - self.set_sample_rate(64e6/self.decim) - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sym_rate) - - def set_sample_rate(self, sample_rate): - self.sample_rate = sample_rate - self.set_sps(self.sample_rate/self.sym_rate) - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - - def set_sync_alpha(self, sync_alpha): - self.sync_alpha = sync_alpha - self._sync_alpha_slider.set_value(self.sync_alpha) - self._sync_alpha_text_box.set_value(self.sync_alpha) - - def set_pll_alpha(self, pll_alpha): - self.pll_alpha = pll_alpha - self._pll_alpha_slider.set_value(self.pll_alpha) - self._pll_alpha_text_box.set_value(self.pll_alpha) - self.noaa_hrpt_pll_cf_0.set_alpha(self.pll_alpha) - self.noaa_hrpt_pll_cf_0.set_beta(self.pll_alpha**2/4.0) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.noaa_hrpt_sync_fb_0.set_max_offset(self.max_sync_offset) - - def set_max_carrier_offset(self, max_carrier_offset): - self.max_carrier_offset = max_carrier_offset - self.noaa_hrpt_pll_cf_0.set_max_offset(self.max_carrier_offset) - - def set_hs(self, hs): - self.hs = hs - -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/grc/usrp_rx_lrit.grc b/gr-noaa/grc/usrp_rx_lrit.grc deleted file mode 100644 index 55fe39787..000000000 --- a/gr-noaa/grc/usrp_rx_lrit.grc +++ /dev/null @@ -1,1477 +0,0 @@ - - - Sat Aug 29 11:26:03 2009 - - options - - id - usrp_rx_lrit - - - _enabled - True - - - title - USRP LRIT Receiver - - - author - - - - description - - - - window_size - 4095, 4095 - - - generate_options - wx_gui - - - category - Custom - - - run - True - - - realtime_scheduling - - - - _coordinate - (10, 10) - - - _rotation - 0 - - - - variable - - id - samp_rate - - - _enabled - True - - - value - 64e6/decim - - - _coordinate - (10, 81) - - - _rotation - 0 - - - - variable - - id - symbol_rate - - - _enabled - True - - - value - 293e3 - - - _coordinate - (11, 148) - - - _rotation - 0 - - - - variable - - id - sps - - - _enabled - True - - - value - samp_rate/symbol_rate - - - _coordinate - (12, 214) - - - _rotation - 0 - - - - variable_text_box - - id - decim - - - _enabled - True - - - label - Decim - - - value - saved_decim - - - converver - int_converter - - - formatter - None - - - grid_pos - 0, 0, 1, 1 - - - notebook - - - - _coordinate - (243, 13) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_0 - - - _enabled - True - - - type - complex - - - title - Waveform - - - samp_rate - samp_rate - - - v_scale - 0.5 - - - t_scale - 20.0/samp_rate - - - ac_couple - False - - - xy_mode - True - - - num_inputs - 1 - - - grid_pos - 1, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 551) - - - _rotation - 0 - - - - gr_agc_xx - - id - gr_agc_xx_0 - - - _enabled - True - - - type - complex - - - rate - 1e-6 - - - reference - 1.0 - - - gain - 1.0/32767.0 - - - max_gain - 1.0 - - - _coordinate - (261, 493) - - - _rotation - 0 - - - - root_raised_cosine_filter - - id - root_raised_cosine_filter_0 - - - _enabled - False - - - type - fir_filter_ccf - - - decim - 1 - - - interp - 1 - - - gain - 1 - - - samp_rate - samp_rate - - - sym_rate - symbol_rate - - - alpha - 0.5 - - - ntaps - 50 - - - _coordinate - (618, 373) - - - _rotation - 0 - - - - usrp_simple_source_x - - id - usrp_simple_source_x_0 - - - _enabled - False - - - type - complex - - - format - - - - which - 0 - - - decimation - decim - - - frequency - freq - - - lo_offset - float('inf') - - - gain - gain - - - side - B - - - rx_ant - RXA - - - hb_filters - - - - _coordinate - (11, 477) - - - _rotation - 0 - - - - wxgui_fftsink2 - - id - wxgui_fftsink2_0 - - - _enabled - True - - - type - complex - - - title - Spectrum - - - samp_rate - samp_rate - - - baseband_freq - freq - - - y_per_div - 10 - - - y_divs - 10 - - - ref_level - 50 - - - fft_size - 1024 - - - fft_rate - 30 - - - peak_hold - False - - - average - False - - - avg_alpha - 0 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 0 - - - _coordinate - (434, 337) - - - _rotation - 0 - - - - gr_throttle - - id - gr_throttle_0 - - - _enabled - True - - - type - complex - - - samples_per_second - samp_rate - - - vlen - 1 - - - _coordinate - (181, 663) - - - _rotation - 0 - - - - wxgui_scopesink2 - - id - wxgui_scopesink2_1 - - - _enabled - True - - - type - complex - - - title - Scope Plot - - - samp_rate - samp_rate - - - v_scale - 0.4 - - - t_scale - 20.0/samp_rate - - - ac_couple - False - - - xy_mode - True - - - num_inputs - 1 - - - grid_pos - 0, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (1126, 251) - - - _rotation - 0 - - - - gr_probe_mpsk_snr_c - - id - gr_probe_mpsk_snr_c_0 - - - _enabled - True - - - type - snr - - - alpha - 0.0001 - - - probe_rate - 10 - - - _coordinate - (1126, 723) - - - _rotation - 0 - - - - wxgui_numbersink2 - - id - wxgui_numbersink2_0 - - - _enabled - True - - - type - float - - - title - SNR - - - units - dB - - - samp_rate - 10 - - - min_value - 0 - - - max_value - 30 - - - factor - 1.0 - - - decimal_places - 1 - - - ref_level - 0 - - - number_rate - 10 - - - peak_hold - False - - - average - False - - - avg_alpha - 0 - - - show_gauge - True - - - grid_pos - 2, 0, 1, 1 - - - notebook - displays, 1 - - - _coordinate - (1335, 651) - - - _rotation - 0 - - - - gr_mpsk_receiver_cc - - id - gr_mpsk_receiver_cc_0 - - - _enabled - True - - - M - 2 - - - theta - 0 - - - alpha - costas_alpha - - - beta - costas_alpha*costas_alpha/4.0 - - - fmin - -0.05 - - - fmax - 0.05 - - - mu - 0.5 - - - gain_mu - gain_mu - - - omega - sps - - - gain_omega - gain_mu*gain_mu/4.0 - - - omega_relative_limit - 0.05 - - - _coordinate - (881, 437) - - - _rotation - 0 - - - - gr_complex_to_real - - id - gr_complex_to_real_0 - - - _enabled - True - - - vlen - 1 - - - _coordinate - (1133, 521) - - - _rotation - 0 - - - - gr_char_to_float - - id - gr_char_to_float_0 - - - _enabled - True - - - _coordinate - (1523, 521) - - - _rotation - 0 - - - - gr_binary_slicer_fb - - id - gr_binary_slicer_fb_0 - - - _enabled - True - - - _coordinate - (1343, 521) - - - _rotation - 0 - - - - gr_add_const_vxx - - id - gr_add_const_vxx_0 - - - _enabled - True - - - type - float - - - const - 48.0 - - - vlen - 1 - - - _coordinate - (1707, 517) - - - _rotation - 0 - - - - gr_float_to_char - - id - gr_float_to_char_0 - - - _enabled - True - - - _coordinate - (1878, 521) - - - _rotation - 0 - - - - gr_file_sink - - id - gr_file_sink_0 - - - _enabled - True - - - file - bits.dat - - - type - byte - - - vlen - 1 - - - _coordinate - (2059, 517) - - - _rotation - 0 - - - - gr_file_source - - id - gr_file_source_0 - - - _enabled - True - - - file - lrit.dat - - - type - complex - - - repeat - False - - - vlen - 1 - - - _coordinate - (11, 655) - - - _rotation - 0 - - - - notebook - - id - displays - - - _enabled - True - - - style - wx.NB_TOP - - - labels - ['USRP RX', 'Costas Output'] - - - grid_pos - 2, 0, 1, 3 - - - notebook - - - - _coordinate - (14, 351) - - - _rotation - 0 - - - - variable_config - - id - saved_decim - - - _enabled - True - - - value - 160 - - - type - int - - - config_file - config_filename - - - section - main - - - option - decim - - - writeback - decim - - - _coordinate - (246, 172) - - - _rotation - 0 - - - - variable_slider - - id - gain - - - _enabled - True - - - label - Gain - - - value - saved_gain - - - min - 0 - - - max - 115 - - - num_steps - 115 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 1, 1, 1 - - - notebook - - - - _coordinate - (411, 11) - - - _rotation - 0 - - - - variable_config - - id - saved_gain - - - _enabled - True - - - value - 33 - - - type - real - - - config_file - config_filename - - - section - main - - - option - gain - - - writeback - gain - - - _coordinate - (412, 172) - - - _rotation - 0 - - - - variable_slider - - id - freq - - - _enabled - True - - - label - Frequency - - - value - saved_freq - - - min - 135e6 - - - max - 139e6 - - - num_steps - 400 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 2, 1, 1 - - - notebook - - - - _coordinate - (574, 12) - - - _rotation - 0 - - - - variable_config - - id - saved_freq - - - _enabled - True - - - value - 137e6 - - - type - real - - - config_file - config_filename - - - section - main - - - option - freq - - - writeback - freq - - - _coordinate - (576, 170) - - - _rotation - 0 - - - - variable_slider - - id - costas_alpha - - - _enabled - True - - - label - Costas Alpha - - - value - saved_costas_alpha - - - min - 0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 1, 0, 1, 1 - - - notebook - - - - _coordinate - (738, 13) - - - _rotation - 0 - - - - variable_config - - id - saved_costas_alpha - - - _enabled - True - - - value - 0.005 - - - type - real - - - config_file - config_filename - - - section - main - - - option - costas_alpha - - - writeback - costas_alpha - - - _coordinate - (739, 170) - - - _rotation - 0 - - - - variable_config - - id - saved_gain_mu - - - _enabled - True - - - value - 0.005 - - - type - real - - - config_file - config_filename - - - section - main - - - option - gain_mu - - - writeback - gain_mu - - - _coordinate - (900, 170) - - - _rotation - 0 - - - - variable_slider - - id - gain_mu - - - _enabled - True - - - label - Gain Mu - - - value - saved_gain_mu - - - min - 0 - - - max - 0.5 - - - num_steps - 100 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 1, 1, 1, 1 - - - notebook - - - - _coordinate - (902, 13) - - - _rotation - 0 - - - - variable - - id - config_filename - - - _enabled - True - - - value - "usrp_rx_lrit.cfg" - - - _coordinate - (13, 283) - - - _rotation - 0 - - - - usrp_simple_source_x_0 - gr_agc_xx_0 - 0 - 0 - - - gr_agc_xx_0 - wxgui_scopesink2_0 - 0 - 0 - - - gr_file_source_0 - gr_throttle_0 - 0 - 0 - - - gr_throttle_0 - gr_agc_xx_0 - 0 - 0 - - - gr_probe_mpsk_snr_c_0 - wxgui_numbersink2_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - gr_probe_mpsk_snr_c_0 - 0 - 0 - - - gr_agc_xx_0 - gr_mpsk_receiver_cc_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - wxgui_scopesink2_1 - 0 - 0 - - - gr_agc_xx_0 - wxgui_fftsink2_0 - 0 - 0 - - - gr_mpsk_receiver_cc_0 - gr_complex_to_real_0 - 0 - 0 - - - gr_complex_to_real_0 - gr_binary_slicer_fb_0 - 0 - 0 - - - gr_binary_slicer_fb_0 - gr_char_to_float_0 - 0 - 0 - - - gr_char_to_float_0 - gr_add_const_vxx_0 - 0 - 0 - - - gr_add_const_vxx_0 - gr_float_to_char_0 - 0 - 0 - - - gr_float_to_char_0 - gr_file_sink_0 - 0 - 0 - - diff --git a/gr-noaa/grc/usrp_rx_lrit.py b/gr-noaa/grc/usrp_rx_lrit.py deleted file mode 100755 index bc313e3af..000000000 --- a/gr-noaa/grc/usrp_rx_lrit.py +++ /dev/null @@ -1,399 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP LRIT Receiver -# Generated: Sat Aug 29 11:26:03 2009 -################################################## - -from gnuradio import gr -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import forms -from gnuradio.wxgui import numbersink2 -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import blks2 as grc_blks2 -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import ConfigParser -import wx - -class usrp_rx_lrit(grc_wxgui.top_block_gui): - - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="USRP LRIT Receiver") - - ################################################## - # Variables - ################################################## - self.config_filename = config_filename = "usrp_rx_lrit.cfg" - self._saved_decim_config = ConfigParser.ConfigParser() - self._saved_decim_config.read(config_filename) - try: saved_decim = self._saved_decim_config.getint("main", "decim") - except: saved_decim = 160 - self.saved_decim = saved_decim - self.decim = decim = saved_decim - self.symbol_rate = symbol_rate = 293e3 - self._saved_gain_mu_config = ConfigParser.ConfigParser() - self._saved_gain_mu_config.read(config_filename) - try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu") - except: saved_gain_mu = 0.005 - self.saved_gain_mu = saved_gain_mu - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat("main", "gain") - except: saved_gain = 33 - 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("main", "freq") - except: saved_freq = 137e6 - self.saved_freq = saved_freq - self._saved_costas_alpha_config = ConfigParser.ConfigParser() - self._saved_costas_alpha_config.read(config_filename) - try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha") - except: saved_costas_alpha = 0.005 - self.saved_costas_alpha = saved_costas_alpha - self.samp_rate = samp_rate = 64e6/decim - self.sps = sps = samp_rate/symbol_rate - self.gain_mu = gain_mu = saved_gain_mu - self.gain = gain = saved_gain - self.freq = freq = saved_freq - self.costas_alpha = costas_alpha = saved_costas_alpha - - ################################################## - # Notebooks - ################################################## - self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output") - self.GridAdd(self.displays, 2, 0, 1, 3) - - ################################################## - # Controls - ################################################## - self._decim_text_box = forms.text_box( - parent=self.GetWin(), - value=self.decim, - callback=self.set_decim, - label="Decim", - converter=forms.int_converter(), - ) - self.GridAdd(self._decim_text_box, 0, 0, 1, 1) - _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) - self._gain_mu_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_gain_mu_sizer, - value=self.gain_mu, - callback=self.set_gain_mu, - label="Gain Mu", - converter=forms.float_converter(), - proportion=0, - ) - self._gain_mu_slider = forms.slider( - parent=self.GetWin(), - sizer=_gain_mu_sizer, - value=self.gain_mu, - callback=self.set_gain_mu, - minimum=0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1) - _gain_sizer = wx.BoxSizer(wx.VERTICAL) - self._gain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_gain_sizer, - value=self.gain, - callback=self.set_gain, - label="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=115, - num_steps=115, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_gain_sizer, 0, 1, 1, 1) - _freq_sizer = wx.BoxSizer(wx.VERTICAL) - self._freq_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_freq_sizer, - value=self.freq, - callback=self.set_freq, - label="Frequency", - converter=forms.float_converter(), - proportion=0, - ) - self._freq_slider = forms.slider( - parent=self.GetWin(), - sizer=_freq_sizer, - value=self.freq, - callback=self.set_freq, - minimum=135e6, - maximum=139e6, - num_steps=400, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_freq_sizer, 0, 2, 1, 1) - _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._costas_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_costas_alpha_sizer, - value=self.costas_alpha, - callback=self.set_costas_alpha, - label="Costas Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._costas_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_costas_alpha_sizer, - value=self.costas_alpha, - callback=self.set_costas_alpha, - minimum=0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1) - - ################################################## - # Blocks - ################################################## - self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) - self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) - self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() - self.gr_char_to_float_0 = gr.char_to_float() - self.gr_complex_to_real_0 = gr.complex_to_real(1) - self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) - self.gr_float_to_char_0 = gr.float_to_char() - self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05) - self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c( - type='snr', - alpha=0.0001, - probe_rate=10, - ) - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) - self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=freq, - y_per_div=10, - y_divs=10, - ref_level=50, - sample_rate=samp_rate, - fft_size=1024, - fft_rate=30, - average=False, - avg_alpha=None, - title="Spectrum", - peak_hold=False, - ) - self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) - self.wxgui_numbersink2_0 = numbersink2.number_sink_f( - self.displays.GetPage(1).GetWin(), - unit="dB", - minval=0, - maxval=30, - factor=1.0, - decimal_places=1, - ref_level=0, - sample_rate=10, - number_rate=10, - average=False, - avg_alpha=None, - label="SNR", - peak_hold=False, - show_gauge=True, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( - self.displays.GetPage(0).GetWin(), - title="Waveform", - sample_rate=samp_rate, - v_scale=0.5, - t_scale=20.0/samp_rate, - ac_couple=False, - xy_mode=True, - num_inputs=1, - ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_1 = scopesink2.scope_sink_c( - self.displays.GetPage(1).GetWin(), - title="Scope Plot", - sample_rate=samp_rate, - v_scale=0.4, - t_scale=20.0/samp_rate, - ac_couple=False, - xy_mode=True, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) - self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0)) - self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0)) - self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) - self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) - self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._saved_decim_config = ConfigParser.ConfigParser() - self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) - self._saved_decim_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("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "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("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - self._saved_costas_alpha_config = ConfigParser.ConfigParser() - self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) - self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) - self._saved_gain_mu_config = ConfigParser.ConfigParser() - self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) - self._saved_gain_mu_config.write(open(self.config_filename, 'w')) - - def set_saved_decim(self, saved_decim): - self.saved_decim = saved_decim - self.set_decim(self.saved_decim) - - def set_decim(self, decim): - self.decim = decim - self.set_samp_rate(64e6/self.decim) - self._decim_text_box.set_value(self.decim) - self._saved_decim_config = ConfigParser.ConfigParser() - self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) - self._saved_decim_config.write(open(self.config_filename, 'w')) - - def set_symbol_rate(self, symbol_rate): - self.symbol_rate = symbol_rate - self.set_sps(self.samp_rate/self.symbol_rate) - - def set_saved_gain_mu(self, saved_gain_mu): - self.saved_gain_mu = saved_gain_mu - self.set_gain_mu(self.saved_gain_mu) - - def set_saved_gain(self, saved_gain): - self.saved_gain = saved_gain - self.set_gain(self.saved_gain) - - def set_saved_freq(self, saved_freq): - self.saved_freq = saved_freq - self.set_freq(self.saved_freq) - - def set_saved_costas_alpha(self, saved_costas_alpha): - self.saved_costas_alpha = saved_costas_alpha - self.set_costas_alpha(self.saved_costas_alpha) - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.set_sps(self.samp_rate/self.symbol_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) - self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) - self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate) - - def set_sps(self, sps): - self.sps = sps - self.gr_mpsk_receiver_cc_0.set_omega(self.sps) - - def set_gain_mu(self, gain_mu): - self.gain_mu = gain_mu - self.gr_mpsk_receiver_cc_0.set_gain_mu(self.gain_mu) - self.gr_mpsk_receiver_cc_0.set_gain_omega(self.gain_mu*self.gain_mu/4.0) - self._saved_gain_mu_config = ConfigParser.ConfigParser() - self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) - self._saved_gain_mu_config.write(open(self.config_filename, 'w')) - self._gain_mu_slider.set_value(self.gain_mu) - self._gain_mu_text_box.set_value(self.gain_mu) - - 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("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "gain", str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - - def set_freq(self, freq): - self.freq = freq - self.wxgui_fftsink2_0.set_baseband_freq(self.freq) - self._freq_slider.set_value(self.freq) - self._freq_text_box.set_value(self.freq) - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - - def set_costas_alpha(self, costas_alpha): - self.costas_alpha = costas_alpha - self.gr_mpsk_receiver_cc_0.set_alpha(self.costas_alpha) - self.gr_mpsk_receiver_cc_0.set_beta(self.costas_alpha*self.costas_alpha/4.0) - self._costas_alpha_slider.set_value(self.costas_alpha) - self._costas_alpha_text_box.set_value(self.costas_alpha) - self._saved_costas_alpha_config = ConfigParser.ConfigParser() - self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) - self._saved_costas_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 = usrp_rx_lrit() - tb.Run(True) - diff --git a/gr-noaa/python/Makefile.am b/gr-noaa/python/Makefile.am new file mode 100644 index 000000000..869c5f353 --- /dev/null +++ b/gr-noaa/python/Makefile.am @@ -0,0 +1,27 @@ +# +# Copyright 2009 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 $(top_srcdir)/Makefile.common + +if PYTHON + +endif + -- cgit From 2628e9cddc43d57a3346e240c8f7e58722bc61f1 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 12:47:34 -0700 Subject: Add HRPT word output to deframer Put in half bit width matched filter Change default sync_alpha to 0.05 --- gr-noaa/apps/usrp_rx_hrpt.grc | 545 +++++++++++++------------------------ gr-noaa/apps/usrp_rx_hrpt.py | 46 ++-- gr-noaa/grc/noaa_hrpt_deframer.xml | 4 + gr-noaa/lib/noaa_hrpt_deframer.cc | 61 +++-- gr-noaa/lib/noaa_hrpt_deframer.h | 21 +- 5 files changed, 270 insertions(+), 407 deletions(-) (limited to 'gr-noaa') diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index 715846743..c8e099611 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Tue Sep 8 21:03:12 2009 + Sun Sep 20 12:45:30 2009 options @@ -75,37 +75,6 @@ 0 - - gr_throttle - - id - throttle - - - _enabled - True - - - type - complex - - - samples_per_second - sample_rate - - - vlen - 1 - - - _coordinate - (79, 518) - - - _rotation - 0 - - variable @@ -276,61 +245,6 @@ 0 - - variable_slider - - id - sync_alpha - - - _enabled - True - - - label - SYNC Alpha - - - value - 0.001 - - - min - 0.0 - - - max - 0.5 - - - num_steps - 500 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - 0, 1, 1, 1 - - - notebook - - - - _coordinate - (344, 101) - - - _rotation - 0 - - variable @@ -378,38 +292,34 @@ - gr_agc_xx + notebook id - agr + displays _enabled True - type - complex - - - rate - 1e-6 + style + wx.NB_TOP - reference - 1.0 + labels + ['RX','PLL/SYNC'] - gain - 1.0 + grid_pos + 1, 0, 1, 2 - max_gain - 1.0 + notebook + _coordinate - (261, 494) + (9, 99) _rotation @@ -417,22 +327,18 @@ - virtual_source + noaa_hrpt_deframer id - virtual_source_0 + noaa_hrpt_deframer_0 _enabled True - - stream_id - bits - _coordinate - (283, 919) + (1112, 649) _rotation @@ -440,88 +346,89 @@ - notebook + wxgui_scopesink2 id - displays + wxgui_scopesink2_0_0 _enabled True - style - wx.NB_TOP - - - labels - ['RX','PLL/SYNC'] + type + float - grid_pos - 1, 0, 1, 2 + title + Post-PLL - notebook - + samp_rate + sample_rate - _coordinate - (9, 99) + v_scale + 0.5 - _rotation - 0 + t_scale + 20.0/sample_rate - - - noaa_hrpt_pll_cf - id - noaa_hrpt_pll_cf_0 + ac_couple + False - _enabled - True + xy_mode + False - alpha - pll_alpha + num_inputs + 1 - beta - pll_alpha**2/4.0 + grid_pos + 0, 0, 1, 1 - max_offset - max_carrier_offset + notebook + displays, 1 _coordinate - (639, 502) + (624, 462) _rotation - 0 + 180 - virtual_sink + gr_throttle id - virtual_sink_1 + throttle _enabled True - stream_id - bits + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 _coordinate - (1126, 518) + (85, 645) _rotation @@ -529,81 +436,82 @@ - gr_char_to_float + wxgui_fftsink2 id - gr_char_to_float_0 + rx_fftsink _enabled True - _coordinate - (477, 923) + type + complex - _rotation - 0 + title + RX Spectrum - - - wxgui_scopesink2 - id - wxgui_scopesink2_0_0_0_0 + samp_rate + sample_rate - _enabled - True + baseband_freq + 1698e6 - type - float + y_per_div + 5 - title - Post-SYNC + y_divs + 8 - samp_rate - sym_rate + ref_level + -5 - v_scale - 0.5 + ref_scale + 2.0 - t_scale - 20.0/sym_rate + fft_size + 1024 - ac_couple - False + fft_rate + 30 - xy_mode + peak_hold False - num_inputs - 1 + average + True + + + avg_alpha + 0.1 grid_pos - 1, 0, 1, 1 + 0, 0, 1, 1 notebook - displays, 1 + displays, 0 _coordinate - (452, 990) + (439, 309) _rotation - 180 + 0 @@ -658,7 +566,7 @@ _coordinate - (433, 570) + (440, 783) _rotation @@ -666,10 +574,10 @@ - wxgui_scopesink2 + gr_agc_xx id - wxgui_scopesink2_0_0 + agr _enabled @@ -677,58 +585,38 @@ type - float - - - title - Post-PLL - - - samp_rate - sample_rate - - - v_scale - 0.5 - - - t_scale - 20.0/sample_rate - - - ac_couple - False + complex - xy_mode - False + rate + 1e-6 - num_inputs - 1 + reference + 1.0 - grid_pos - 0, 0, 1, 1 + gain + 1.0 - notebook - displays, 1 + max_gain + 1.0 _coordinate - (618, 335) + (267, 621) _rotation - 180 + 0 - noaa_hrpt_sync_fb + noaa_hrpt_pll_cf id - noaa_hrpt_sync_fb_0 + noaa_hrpt_pll_cf_0 _enabled @@ -736,42 +624,19 @@ alpha - 0.001 + pll_alpha beta - 0.001**2/4.0 - - - sps - sps + pll_alpha**2/4.0 max_offset - max_sync_offset - - - _coordinate - (856, 494) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - noaa_hrpt_deframer_0 - - - _enabled - True + max_carrier_offset _coordinate - (1110, 631) + (645, 629) _rotation @@ -779,10 +644,10 @@ - gr_file_source + gr_file_sink id - src + gr_file_sink_1 _enabled @@ -790,15 +655,11 @@ file - poes-d16.dat + frames.dat type - complex - - - repeat - True + short vlen @@ -806,7 +667,7 @@ _coordinate - (34, 423) + (1125, 758) _rotation @@ -814,49 +675,34 @@ - gr_add_const_vxx + gr_moving_average_xx id - gr_add_const_vxx_0 + matched_filter _enabled - False + True type - float + complex - const - 48.0 + length + hs - vlen - 1 + scale + 1.0/hs - _coordinate - (692, 919) - - - _rotation - 0 - - - - gr_float_to_char - - id - gr_float_to_char_0 - - - _enabled - False + max_iter + 4000 _coordinate - (848, 923) + (444, 629) _rotation @@ -864,22 +710,26 @@ - gr_file_sink + gr_file_source id - gr_file_sink_0 + src _enabled - False + True file - bits.dat + poes-d16.dat type - byte + complex + + + repeat + False vlen @@ -887,7 +737,7 @@ _coordinate - (1020, 919) + (79, 541) _rotation @@ -895,78 +745,89 @@ - wxgui_fftsink2 + noaa_hrpt_sync_fb id - rx_fftsink + noaa_hrpt_sync_fb_0 _enabled True - type - complex + alpha + sync_alpha - title - RX Spectrum + beta + sync_alpha**2/4.0 - samp_rate - sample_rate + sps + sps - baseband_freq - 1698e6 + max_offset + max_sync_offset - y_per_div - 5 + _coordinate + (862, 621) - y_divs - 8 + _rotation + 0 + + + variable_slider - ref_level - -5 + id + sync_alpha - ref_scale - 2.0 + _enabled + True - fft_size - 1024 + label + SYNC Alpha - fft_rate - 30 + value + 0.005 - peak_hold - False + min + 0.0 - average - True + max + 0.5 - avg_alpha - 0.1 + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter grid_pos - 0, 0, 1, 1 + 0, 1, 1, 1 notebook - displays, 0 + _coordinate - (434, 269) + (344, 101) _rotation @@ -974,86 +835,62 @@ - src - throttle - 0 - 0 - - - throttle - agr - 0 - 0 - - - agr - rx_fftsink - 0 - 0 - - - agr - wxgui_scopesink2_0 + noaa_hrpt_deframer_0 + gr_file_sink_1 0 0 - agr - noaa_hrpt_pll_cf_0 + noaa_hrpt_sync_fb_0 + noaa_hrpt_deframer_0 0 0 noaa_hrpt_pll_cf_0 - wxgui_scopesink2_0_0 - 0 - 0 - - - virtual_source_0 - gr_char_to_float_0 + noaa_hrpt_sync_fb_0 0 0 noaa_hrpt_pll_cf_0 - noaa_hrpt_sync_fb_0 + wxgui_scopesink2_0_0 0 0 - noaa_hrpt_sync_fb_0 - virtual_sink_1 + agr + wxgui_scopesink2_0 0 0 - gr_char_to_float_0 - wxgui_scopesink2_0_0_0_0 + agr + rx_fftsink 0 0 - gr_char_to_float_0 - gr_add_const_vxx_0 + throttle + agr 0 0 - gr_add_const_vxx_0 - gr_float_to_char_0 + src + throttle 0 0 - gr_float_to_char_0 - gr_file_sink_0 + agr + matched_filter 0 0 - noaa_hrpt_sync_fb_0 - noaa_hrpt_deframer_0 + matched_filter + noaa_hrpt_pll_cf_0 0 0 diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 40cc517fc..032db315d 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Tue Sep 8 21:03:12 2009 +# Generated: Sun Sep 20 12:45:30 2009 ################################################## from gnuradio import eng_notation @@ -30,7 +30,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.sync_alpha = sync_alpha = 0.001 + self.sync_alpha = sync_alpha = 0.005 self.pll_alpha = pll_alpha = 0.001 self.max_sync_offset = max_sync_offset = 0.01 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate @@ -98,10 +98,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # Blocks ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_char_to_float_0 = gr.char_to_float() + self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat") + self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(0.001, 0.001**2/4.0, sps, max_sync_offset) + self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) self.rx_fftsink = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), baseband_freq=1698e6, @@ -118,7 +119,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): peak_hold=False, ) self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", True) + self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", False) self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), @@ -142,31 +143,20 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): num_inputs=1, ) self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) - self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-SYNC", - sample_rate=sym_rate, - v_scale=0.5, - t_scale=20.0/sym_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 1, 0, 1, 1) ################################################## # Connections ################################################## - self.connect((self.src, 0), (self.throttle, 0)) - self.connect((self.throttle, 0), (self.agr, 0)) - self.connect((self.agr, 0), (self.rx_fftsink, 0)) - self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.agr, 0), (self.noaa_hrpt_pll_cf_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0_0_0_0, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_1, 0)) self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) + self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) + self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.agr, 0), (self.rx_fftsink, 0)) + self.connect((self.throttle, 0), (self.agr, 0)) + self.connect((self.src, 0), (self.throttle, 0)) + self.connect((self.agr, 0), (self.matched_filter, 0)) + self.connect((self.matched_filter, 0), (self.noaa_hrpt_pll_cf_0, 0)) def set_decim(self, decim): self.decim = decim @@ -175,15 +165,14 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate self.set_sps(self.sample_rate/self.sym_rate) - self.wxgui_scopesink2_0_0_0_0.set_sample_rate(self.sym_rate) def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate self.set_sps(self.sample_rate/self.sym_rate) self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) self.rx_fftsink.set_sample_rate(self.sample_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps @@ -191,6 +180,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha + self.noaa_hrpt_sync_fb_0.set_alpha(self.sync_alpha) + self.noaa_hrpt_sync_fb_0.set_beta(self.sync_alpha**2/4.0) self._sync_alpha_slider.set_value(self.sync_alpha) self._sync_alpha_text_box.set_value(self.sync_alpha) @@ -211,6 +202,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_hs(self, hs): self.hs = hs + self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") diff --git a/gr-noaa/grc/noaa_hrpt_deframer.xml b/gr-noaa/grc/noaa_hrpt_deframer.xml index bc68f71d3..af36abf2a 100644 --- a/gr-noaa/grc/noaa_hrpt_deframer.xml +++ b/gr-noaa/grc/noaa_hrpt_deframer.xml @@ -9,4 +9,8 @@ in byte + + out + short + diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc index 71712277b..b0de09c91 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -26,13 +26,19 @@ #include #include +#include #define ST_IDLE 0 #define ST_SYNCED 1 -#define HRPT_MINOR_FRAME_SYNC 0x0A116FD719D83C95LL -#define HRPT_BITS_PER_MINOR_FRAME 11090*10 -#define HRPT_SYNC_LENGTH 6*10 +#define SYNC1 0x0284 +#define SYNC2 0x016F +#define SYNC3 0x035C +#define SYNC4 0x019D +#define SYNC5 0x020F +#define SYNC6 0x0095 + +#define HRPT_MINOR_FRAME_SYNC 0x0A116FD719D83C95LL static int frames_seen = 0; @@ -43,10 +49,11 @@ noaa_make_hrpt_deframer() } noaa_hrpt_deframer::noaa_hrpt_deframer() - : gr_sync_block("noaa_hrpt_deframer", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(0, 0, 0)) + : gr_block("noaa_hrpt_deframer", + gr_make_io_signature(1, 1, sizeof(char)), + gr_make_io_signature(1, 1, sizeof(short))) { + set_output_multiple(6); // room for writing full sync when received enter_idle(); } @@ -60,36 +67,51 @@ void noaa_hrpt_deframer::enter_synced() { d_state = ST_SYNCED; - d_count = HRPT_BITS_PER_MINOR_FRAME-HRPT_SYNC_LENGTH; + d_bit_count = HRPT_BITS_PER_WORD; + d_word_count = HRPT_MINOR_FRAME_WORDS-HRPT_SYNC_WORDS; + d_word = 0; } int -noaa_hrpt_deframer::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +noaa_hrpt_deframer::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { + int ninputs = ninput_items[0]; const char *in = (const char *)input_items[0]; + unsigned short *out = (unsigned short *)output_items[0]; - int i = 0; - while (i < noutput_items) { + int i = 0, j = 0; + while (i < ninputs && j < noutput_items) { char bit = in[i++]; - if (d_state != ST_SYNCED) - fprintf(stderr, "."); switch (d_state) { case ST_IDLE: d_shifter = (d_shifter << 1) | bit; // MSB transmitted first if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { - fprintf(stderr, "\nSYNC #%i...", frames_seen++); + fprintf(stderr, "SYNC #%i", frames_seen++); + out[j++] = SYNC1; + out[j++] = SYNC2; + out[j++] = SYNC3; + out[j++] = SYNC4; + out[j++] = SYNC5; + out[j++] = SYNC6; enter_synced(); } break; case ST_SYNCED: - if (--d_count == 0) { - fprintf(stderr, "done."); - enter_idle(); + d_word = (d_word << 1) | bit; // MSB transmitted first + if (--d_bit_count == 0) { + out[j++] = d_word; + d_word = 0; + d_bit_count = HRPT_BITS_PER_WORD; + if (--d_word_count == 0) { + fprintf(stderr, "...done\n"); + enter_idle(); + } } break; @@ -98,5 +120,6 @@ noaa_hrpt_deframer::work(int noutput_items, } } - return i; + consume_each(i); + return j; } diff --git a/gr-noaa/lib/noaa_hrpt_deframer.h b/gr-noaa/lib/noaa_hrpt_deframer.h index bc91bc89c..0aeb16a2d 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.h +++ b/gr-noaa/lib/noaa_hrpt_deframer.h @@ -23,7 +23,11 @@ #ifndef INCLUDED_NOAA_HRPT_DEFRAMER_H #define INCLUDED_NOAA_HRPT_DEFRAMER_H -#include +#define HRPT_SYNC_WORDS 6 +#define HRPT_MINOR_FRAME_WORDS 11090 +#define HRPT_BITS_PER_WORD 10 + +#include class noaa_hrpt_deframer; typedef boost::shared_ptr noaa_hrpt_deframer_sptr; @@ -31,22 +35,25 @@ typedef boost::shared_ptr noaa_hrpt_deframer_sptr; noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); -class noaa_hrpt_deframer : public gr_sync_block +class noaa_hrpt_deframer : public gr_block { friend noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); noaa_hrpt_deframer(); unsigned int d_state; - unsigned int d_count; - unsigned long long d_shifter; // 60 bit sync word + unsigned int d_bit_count; + unsigned int d_word_count; + unsigned long long d_shifter; // 60 bit sync word + unsigned short d_word; // 10 bit HRPT word void enter_idle(); void enter_synced(); public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); }; #endif /* INCLUDED_NOAA_HRPT_DEFRAMER_H */ -- cgit From 789435387ab3a886cd33304f4f47d60456765b70 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:10:10 -0700 Subject: Updated HRPT receiver to read files recorded as shorts --- gr-noaa/apps/usrp_rx_hrpt.grc | 734 ++++++++++++++++++++++++++---------------- gr-noaa/apps/usrp_rx_hrpt.py | 43 ++- 2 files changed, 496 insertions(+), 281 deletions(-) (limited to 'gr-noaa') diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index c8e099611..8edc2b4ea 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 12:45:30 2009 + Sun Sep 20 19:09:57 2009 options @@ -76,45 +76,34 @@ - variable + notebook id - decim + displays _enabled True - value - 16 - - - _coordinate - (186, 10) - - - _rotation - 0 + style + wx.NB_TOP - - - variable - id - hs + labels + ['RX','PLL/SYNC'] - _enabled - True + grid_pos + 1, 0, 1, 2 - value - int(sps/2.0) + notebook + _coordinate - (589, 13) + (9, 99) _rotation @@ -122,45 +111,30 @@ - variable + gr_file_sink id - sym_rate + gr_file_sink_1 _enabled True - value - 600*1109 - - - _coordinate - (383, 7) - - - _rotation - 0 - - - - variable - - id - sps + file + frames.dat - _enabled - True + type + short - value - sample_rate/sym_rate + vlen + 1 _coordinate - (479, 11) + (1253, 805) _rotation @@ -168,22 +142,18 @@ - variable + noaa_hrpt_deframer id - sample_rate + noaa_hrpt_deframer_0 _enabled True - - value - 64e6/decim - _coordinate - (273, 9) + (1063, 809) _rotation @@ -191,42 +161,46 @@ - variable_slider + wxgui_scopesink2 id - pll_alpha + wxgui_scopesink2_0_0 _enabled True - label - PLL Alpha + type + float - value - 0.001 + title + Post-PLL - min - 0.0 + samp_rate + sample_rate - max + v_scale 0.5 - num_steps - 500 + t_scale + 20.0/sample_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + False + + + num_inputs + 1 grid_pos @@ -234,111 +208,46 @@ notebook - - - - _coordinate - (192, 100) - - - _rotation - 0 - - - - variable - - id - max_carrier_offset - - - _enabled - True - - - value - 2*math.pi*100e3/sample_rate - - - _coordinate - (671, 14) - - - _rotation - 0 - - - - variable - - id - max_sync_offset - - - _enabled - True - - - value - 0.01 + displays, 1 _coordinate - (805, 13) + (597, 618) _rotation - 0 + 180 - notebook + gr_moving_average_xx id - displays + matched_filter _enabled True - style - wx.NB_TOP - - - labels - ['RX','PLL/SYNC'] - - - grid_pos - 1, 0, 1, 2 - - - notebook - - - - _coordinate - (9, 99) + type + complex - _rotation - 0 + length + hs - - - noaa_hrpt_deframer - id - noaa_hrpt_deframer_0 + scale + 1.0/hs - _enabled - True + max_iter + 4000 _coordinate - (1112, 649) + (429, 789) _rotation @@ -349,7 +258,7 @@ wxgui_scopesink2 id - wxgui_scopesink2_0_0 + wxgui_scopesink2_0 _enabled @@ -357,11 +266,11 @@ type - float + complex title - Post-PLL + RX Waveform samp_rate @@ -369,7 +278,7 @@ v_scale - 0.5 + 0 t_scale @@ -389,46 +298,15 @@ grid_pos - 0, 0, 1, 1 + 1, 0, 1, 1 notebook - displays, 1 - - - _coordinate - (624, 462) - - - _rotation - 180 - - - - gr_throttle - - id - throttle - - - _enabled - True - - - type - complex - - - samples_per_second - sample_rate - - - vlen - 1 + displays, 0 _coordinate - (85, 645) + (430, 895) _rotation @@ -507,7 +385,7 @@ _coordinate - (439, 309) + (430, 531) _rotation @@ -515,10 +393,10 @@ - wxgui_scopesink2 + gr_agc_xx id - wxgui_scopesink2_0 + agr _enabled @@ -529,44 +407,47 @@ complex - title - RX Waveform + rate + 1e-6 - samp_rate - sample_rate + reference + 1.0 - v_scale - 0 + gain + 1.0 - t_scale - 20.0/sample_rate + max_gain + 1.0 - ac_couple - False + _coordinate + (258, 781) - xy_mode - False + _rotation + 0 + + + virtual_source - num_inputs - 1 + id + virtual_source_0 - grid_pos - 1, 0, 1, 1 + _enabled + True - notebook - displays, 0 + stream_id + samples _coordinate - (440, 783) + (62, 805) _rotation @@ -574,38 +455,69 @@ - gr_agc_xx + parameter id - agr + filename _enabled True + + label + Filename + + + value + "" + type - complex + string - rate - 1e-6 + short_id + f - reference - 1.0 + _coordinate + (200, 101) - gain - 1.0 + _rotation + 0 + + + parameter - max_gain - 1.0 + id + decim + + + _enabled + True + + + label + Decimation + + + value + 16 + + + type + intx + + + short_id + d _coordinate - (267, 621) + (304, 101) _rotation @@ -613,30 +525,45 @@ - noaa_hrpt_pll_cf + variable id - noaa_hrpt_pll_cf_0 + max_sync_offset _enabled True - alpha - pll_alpha + value + 0.01 - beta - pll_alpha**2/4.0 + _coordinate + (705, 19) - max_offset + _rotation + 0 + + + + variable + + id max_carrier_offset + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + _coordinate - (645, 629) + (575, 19) _rotation @@ -644,30 +571,45 @@ - gr_file_sink + variable id - gr_file_sink_1 + hs _enabled True - file - frames.dat + value + int(sps/2.0) - type - short + _coordinate + (499, 19) - vlen - 1 + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate _coordinate - (1125, 758) + (397, 19) _rotation @@ -675,34 +617,45 @@ - gr_moving_average_xx + variable id - matched_filter + sym_rate _enabled True - type - complex + value + 600*1109 - length - hs + _coordinate + (301, 19) - scale - 1.0/hs + _rotation + 0 + + + variable - max_iter - 4000 + id + sample_rate + + + _enabled + True + + + value + 64e6/decim _coordinate - (444, 629) + (198, 17) _rotation @@ -710,34 +663,85 @@ - gr_file_source + variable_slider id - src + pll_alpha _enabled True - file - poes-d16.dat + label + PLL Alpha - type - complex + value + 0.005 - repeat - False + min + 0.0 - vlen - 1 + max + 0.5 + + + num_steps + 500 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 0, 1, 1 + + + notebook + _coordinate - (79, 541) + (447, 99) + + + _rotation + 0 + + + + noaa_hrpt_pll_cf + + id + noaa_hrpt_pll_cf_0 + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (624, 789) _rotation @@ -772,7 +776,7 @@ _coordinate - (862, 621) + (832, 781) _rotation @@ -795,7 +799,7 @@ value - 0.005 + 0.1 min @@ -827,13 +831,181 @@ _coordinate - (344, 101) + (593, 98) + + + _rotation + 0 + + + + gr_file_source + + id + gr_file_source_0 + + + _enabled + True + + + file + filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (102, 368) + + + _rotation + 0 + + + + virtual_sink + + id + virtual_sink_0 + + + _enabled + True + + + stream_id + samples + + + _coordinate + (1076, 376) _rotation 0 + + gr_throttle + + id + throttle + + + _enabled + True + + + type + complex + + + samples_per_second + sample_rate + + + vlen + 1 + + + _coordinate + (877, 376) + + + _rotation + 0 + + + + gr_deinterleave + + id + gr_deinterleave_0 + + + _enabled + True + + + type + float + + + num_streams + 2 + + + vlen + 1 + + + _coordinate + (466, 363) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_0 + + + _enabled + True + + + _coordinate + (278, 380) + + + _rotation + 0 + + + + gr_float_to_complex + + id + gr_float_to_complex_0 + + + _enabled + True + + + vlen + 1 + + + _coordinate + (653, 363) + + + _rotation + 0 + + + + virtual_source_0 + agr + 0 + 0 + noaa_hrpt_deframer_0 gr_file_sink_1 @@ -871,26 +1043,50 @@ 0 - throttle - agr + agr + matched_filter + 0 + 0 + + + matched_filter + noaa_hrpt_pll_cf_0 0 0 - src + gr_float_to_complex_0 throttle 0 0 - agr - matched_filter + gr_short_to_float_0 + gr_deinterleave_0 0 0 - matched_filter - noaa_hrpt_pll_cf_0 + gr_deinterleave_0 + gr_float_to_complex_0 + 1 + 1 + + + gr_deinterleave_0 + gr_float_to_complex_0 + 0 + 0 + + + gr_file_source_0 + gr_short_to_float_0 + 0 + 0 + + + throttle + virtual_sink_0 0 0 diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 032db315d..6c50a348a 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 20 12:45:30 2009 +# Generated: Sun Sep 20 19:09:57 2009 ################################################## from gnuradio import eng_notation @@ -20,18 +20,23 @@ import wx class usrp_rx_hrpt(grc_wxgui.top_block_gui): - def __init__(self): + def __init__(self, filename="", decim=16): grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + ################################################## + # Parameters + ################################################## + self.filename = filename + self.decim = decim + ################################################## # Variables ################################################## - self.decim = decim = 16 self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.sync_alpha = sync_alpha = 0.005 - self.pll_alpha = pll_alpha = 0.001 + self.sync_alpha = sync_alpha = 0.1 + self.pll_alpha = pll_alpha = 0.005 self.max_sync_offset = max_sync_offset = 0.01 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate self.hs = hs = int(sps/2.0) @@ -98,7 +103,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): # Blocks ################################################## self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_float*1) self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat") + self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "filename", False) + self.gr_float_to_complex_0 = gr.float_to_complex(1) + self.gr_short_to_float_0 = gr.short_to_float() self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) @@ -119,7 +128,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): peak_hold=False, ) self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.src = gr.file_source(gr.sizeof_gr_complex*1, "poes-d16.dat", False) self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), @@ -147,16 +155,23 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## # Connections ################################################## + self.connect((self.throttle, 0), (self.agr, 0)) self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_1, 0)) self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.agr, 0), (self.rx_fftsink, 0)) - self.connect((self.throttle, 0), (self.agr, 0)) - self.connect((self.src, 0), (self.throttle, 0)) self.connect((self.agr, 0), (self.matched_filter, 0)) self.connect((self.matched_filter, 0), (self.noaa_hrpt_pll_cf_0, 0)) + self.connect((self.gr_float_to_complex_0, 0), (self.throttle, 0)) + self.connect((self.gr_short_to_float_0, 0), (self.gr_deinterleave_0, 0)) + self.connect((self.gr_deinterleave_0, 1), (self.gr_float_to_complex_0, 1)) + self.connect((self.gr_deinterleave_0, 0), (self.gr_float_to_complex_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0)) + + def set_filename(self, filename): + self.filename = filename def set_decim(self, decim): self.decim = decim @@ -168,11 +183,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate - self.set_sps(self.sample_rate/self.sym_rate) - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) + self.rx_fftsink.set_sample_rate(self.sample_rate) + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.set_sps(self.sample_rate/self.sym_rate) def set_sps(self, sps): self.sps = sps @@ -206,7 +221,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-f", "--filename", dest="filename", type="string", default="", + help="Set Filename [default=%default]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, + help="Set Decimation [default=%default]") (options, args) = parser.parse_args() - tb = usrp_rx_hrpt() + tb = usrp_rx_hrpt(filename=options.filename, decim=options.decim) tb.Run(True) -- cgit From f8fcb642dabca11870886c53dfdff66c86774db0 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:32:30 -0700 Subject: Added skeleton HRPT decoder block --- gr-noaa/apps/usrp_rx_hrpt.grc | 127 +++++++++++++++++++++++--------------- gr-noaa/apps/usrp_rx_hrpt.py | 6 +- gr-noaa/grc/Makefile.am | 1 + gr-noaa/grc/noaa_hrpt_decoder.xml | 12 ++++ gr-noaa/lib/Makefile.am | 2 + gr-noaa/lib/noaa_hrpt_decoder.cc | 64 +++++++++++++++++++ gr-noaa/lib/noaa_hrpt_decoder.h | 47 ++++++++++++++ gr-noaa/swig/Makefile.am | 1 + gr-noaa/swig/noaa_hrpt_decoder.i | 32 ++++++++++ gr-noaa/swig/noaa_hrpt_deframer.i | 2 +- gr-noaa/swig/noaa_swig.i | 2 + 11 files changed, 242 insertions(+), 54 deletions(-) create mode 100644 gr-noaa/grc/noaa_hrpt_decoder.xml create mode 100644 gr-noaa/lib/noaa_hrpt_decoder.cc create mode 100644 gr-noaa/lib/noaa_hrpt_decoder.h create mode 100644 gr-noaa/swig/noaa_hrpt_decoder.i (limited to 'gr-noaa') diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index 8edc2b4ea..f629ae8b7 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 19:09:57 2009 + Sun Sep 20 19:30:16 2009 options @@ -110,56 +110,6 @@ 0 - - gr_file_sink - - id - gr_file_sink_1 - - - _enabled - True - - - file - frames.dat - - - type - short - - - vlen - 1 - - - _coordinate - (1253, 805) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - noaa_hrpt_deframer_0 - - - _enabled - True - - - _coordinate - (1063, 809) - - - _rotation - 0 - - wxgui_scopesink2 @@ -1000,6 +950,75 @@ 0 + + gr_file_sink + + id + gr_file_sink_1 + + + _enabled + True + + + file + frames.dat + + + type + short + + + vlen + 1 + + + _coordinate + (1265, 917) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + noaa_hrpt_deframer_0 + + + _enabled + True + + + _coordinate + (1063, 809) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + noaa_hrpt_decoder_0 + + + _enabled + True + + + _coordinate + (1266, 809) + + + _rotation + 0 + + virtual_source_0 agr @@ -1090,4 +1109,10 @@ 0 0 + + noaa_hrpt_deframer_0 + noaa_hrpt_decoder_0 + 0 + 0 + diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 6c50a348a..b29af5654 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 20 19:09:57 2009 +# Generated: Sun Sep 20 19:30:17 2009 ################################################## from gnuradio import eng_notation @@ -105,10 +105,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_float*1) self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "filename", False) + self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, filename, False) self.gr_float_to_complex_0 = gr.float_to_complex(1) self.gr_short_to_float_0 = gr.short_to_float() self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) + self.noaa_hrpt_decoder_0 = noaa.hrpt_decoder() self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) @@ -169,6 +170,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.connect((self.gr_deinterleave_0, 1), (self.gr_float_to_complex_0, 1)) self.connect((self.gr_deinterleave_0, 0), (self.gr_float_to_complex_0, 0)) self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.noaa_hrpt_decoder_0, 0)) def set_filename(self, filename): self.filename = filename diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index 9f1f88195..1f056473c 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -24,6 +24,7 @@ include $(top_srcdir)/Makefile.common grcblocksdir = $(prefix)/share/gnuradio/grc/blocks dist_grcblocks_DATA = \ + noaa_hrpt_decoder.xml \ noaa_hrpt_deframer.xml \ noaa_hrpt_pll_cf.xml \ noaa_hrpt_sync_fb.xml diff --git a/gr-noaa/grc/noaa_hrpt_decoder.xml b/gr-noaa/grc/noaa_hrpt_decoder.xml new file mode 100644 index 000000000..183d72aba --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_decoder.xml @@ -0,0 +1,12 @@ + + + HRPT Decoder + noaa_hrpt_decoder + NOAA + from gnuradio import noaa + noaa.hrpt_decoder() + + in + short + + diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 578c98ada..6435d192e 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -29,6 +29,7 @@ lib_LTLIBRARIES = \ libgnuradio-noaa.la libgnuradio_noaa_la_SOURCES = \ + noaa_hrpt_decoder.cc \ noaa_hrpt_deframer.cc \ noaa_hrpt_pll_cf.cc \ noaa_hrpt_sync_fb.cc @@ -39,6 +40,7 @@ libgnuradio_noaa_la_LIBADD = \ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 grinclude_HEADERS = \ + noaa_hrpt_decoder.h \ noaa_hrpt_deframer.h \ noaa_hrpt_pll_cf.h \ noaa_hrpt_sync_fb.h diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc new file mode 100644 index 000000000..7aa815c5c --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#define SYNC1 0x0284 +#define SYNC2 0x016F +#define SYNC3 0x035C +#define SYNC4 0x019D +#define SYNC5 0x020F +#define SYNC6 0x0095 + +noaa_hrpt_decoder_sptr +noaa_make_hrpt_decoder() +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_decoder()); +} + +noaa_hrpt_decoder::noaa_hrpt_decoder() + : gr_sync_block("noaa_hrpt_decoder", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(0, 0, 0)) +{ + d_word_count = 0; +} + +int +noaa_hrpt_decoder::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned short *in = (const unsigned short*)input_items[0]; + + int i = 0; + while (i < noutput_items) { + unsigned short word = in[i++]; + } + + return i; +} diff --git a/gr-noaa/lib/noaa_hrpt_decoder.h b/gr-noaa/lib/noaa_hrpt_decoder.h new file mode 100644 index 000000000..305243b09 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_decoder.h @@ -0,0 +1,47 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +#ifndef INCLUDED_NOAA_HRPT_DECODER_H +#define INCLUDED_NOAA_HRPT_DECODER_H + +#include + +class noaa_hrpt_decoder; +typedef boost::shared_ptr noaa_hrpt_decoder_sptr; + +noaa_hrpt_decoder_sptr +noaa_make_hrpt_decoder(); + +class noaa_hrpt_decoder : public gr_sync_block +{ + friend noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder(); + noaa_hrpt_decoder(); + + unsigned int d_word_count; + +public: + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_NOAA_HRPT_DECODER_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 98311eb7b..cd7686e21 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -53,6 +53,7 @@ noaa_swig_python = \ # additional SWIG files to be installed noaa_swig_swiginclude_headers = \ noaa_swig.i \ + noaa_hrpt_decoder.i \ noaa_hrpt_deframer.i \ noaa_hrpt_pll_cf.i \ noaa_hrpt_sync_fb.i diff --git a/gr-noaa/swig/noaa_hrpt_decoder.i b/gr-noaa/swig/noaa_hrpt_decoder.i new file mode 100644 index 000000000..ddf181c28 --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_decoder.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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. + */ + +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_decoder) + +noaa_hrpt_decoder_sptr +noaa_make_hrpt_decoder(); + +class noaa_hrpt_decoder : public gr_sync_block +{ +private: + noaa_hrpt_decoder(); +}; diff --git a/gr-noaa/swig/noaa_hrpt_deframer.i b/gr-noaa/swig/noaa_hrpt_deframer.i index 73106d726..6914b93e6 100644 --- a/gr-noaa/swig/noaa_hrpt_deframer.i +++ b/gr-noaa/swig/noaa_hrpt_deframer.i @@ -25,7 +25,7 @@ GR_SWIG_BLOCK_MAGIC(noaa,hrpt_deframer) noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); -class noaa_hrpt_deframer : public gr_sync_block +class noaa_hrpt_deframer : public gr_block { private: noaa_hrpt_deframer(); diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index 44f2e4723..e6497bc46 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -23,11 +23,13 @@ %include "gnuradio.i" %{ +#include #include #include #include %} +%include "noaa_hrpt_decoder.i" %include "noaa_hrpt_deframer.i" %include "noaa_hrpt_pll_cf.i" %include "noaa_hrpt_sync_fb.i" -- cgit From 751e1a0608cb51525f78fe5476be46ef6e461774 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:57:30 -0700 Subject: Dumps HRPT frames to text file similar to specification document --- gr-noaa/lib/noaa_hrpt_decoder.cc | 13 +++++++++++++ gr-noaa/lib/noaa_hrpt_deframer.cc | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'gr-noaa') diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc index 7aa815c5c..4fae0173d 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -58,6 +58,19 @@ noaa_hrpt_decoder::work(int noutput_items, int i = 0; while (i < noutput_items) { unsigned short word = in[i++]; + d_word_count++; + fprintf(stderr, "%5u: ", d_word_count); + for (int pos = 0; pos < 10; pos++) { + char ch = (word & (1 << 9)) ? '1' : '0'; + word = word << 1; + fprintf(stderr, "%c ", ch); + } + fprintf(stderr, "\n"); + + if (d_word_count == 11090) { + d_word_count = 0; + fprintf(stderr, "\n"); + } } return i; diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc index b0de09c91..77a8e3263 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -91,7 +91,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_shifter = (d_shifter << 1) | bit; // MSB transmitted first if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { - fprintf(stderr, "SYNC #%i", frames_seen++); + //fprintf(stderr, "SYNC #%i", frames_seen++); out[j++] = SYNC1; out[j++] = SYNC2; out[j++] = SYNC3; @@ -109,7 +109,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_word = 0; d_bit_count = HRPT_BITS_PER_WORD; if (--d_word_count == 0) { - fprintf(stderr, "...done\n"); + //fprintf(stderr, "...done\n"); enter_idle(); } } -- cgit From 7c4b43a1a4b3ff6c99fe96805f8d4518a22eb0a5 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 23 Sep 2009 11:40:19 -0700 Subject: Split HRPT script into live receive and post-processing Cleanup debug info Created 'demod_hrpt_file.py' Updated 'usrp_rx_hrpt.py' with GUI, USRP, and config file --- gr-noaa/apps/.gitignore | 1 + gr-noaa/apps/Makefile.am | 2 + gr-noaa/apps/demod_hrpt_file.grc | 781 ++++++++++++++++++++++++++++++ gr-noaa/apps/demod_hrpt_file.py | 130 +++++ gr-noaa/apps/usrp_rx_hrpt.cfg | 13 + gr-noaa/apps/usrp_rx_hrpt.grc | 986 ++++++++++++++++++++++++-------------- gr-noaa/apps/usrp_rx_hrpt.py | 352 +++++++++++--- gr-noaa/lib/noaa_hrpt_decoder.cc | 8 +- gr-noaa/lib/noaa_hrpt_deframer.cc | 4 +- 9 files changed, 1841 insertions(+), 436 deletions(-) create mode 100644 gr-noaa/apps/.gitignore create mode 100644 gr-noaa/apps/demod_hrpt_file.grc create mode 100755 gr-noaa/apps/demod_hrpt_file.py create mode 100644 gr-noaa/apps/usrp_rx_hrpt.cfg (limited to 'gr-noaa') diff --git a/gr-noaa/apps/.gitignore b/gr-noaa/apps/.gitignore new file mode 100644 index 000000000..773a6df9b --- /dev/null +++ b/gr-noaa/apps/.gitignore @@ -0,0 +1 @@ +*.dat diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index 23b8240c1..906638ff1 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -24,10 +24,12 @@ include $(top_srcdir)/Makefile.common if PYTHON dist_bin_SCRIPTS = \ + demod_hrpt_file.py \ usrp_rx_hrpt.py \ usrp_rx_lrit.py EXTRA_DIST = \ + demod_hrpt_file.grc \ usrp_rx_hrpt.grc \ usrp_rx_lrit.grc endif diff --git a/gr-noaa/apps/demod_hrpt_file.grc b/gr-noaa/apps/demod_hrpt_file.grc new file mode 100644 index 000000000..4a5e87170 --- /dev/null +++ b/gr-noaa/apps/demod_hrpt_file.grc @@ -0,0 +1,781 @@ + + + Wed Sep 23 11:37:25 2009 + + options + + id + demod_hrpt_file + + + _enabled + True + + + title + USRP HRPT Receiver + + + author + + + + description + + + + window_size + 4096,4096 + + + generate_options + no_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + max_sync_offset + + + _enabled + True + + + value + 0.01 + + + _coordinate + (705, 19) + + + _rotation + 0 + + + + variable + + id + max_carrier_offset + + + _enabled + True + + + value + 2*math.pi*100e3/sample_rate + + + _coordinate + (575, 19) + + + _rotation + 0 + + + + variable + + id + hs + + + _enabled + True + + + value + int(sps/2.0) + + + _coordinate + (499, 19) + + + _rotation + 0 + + + + variable + + id + sps + + + _enabled + True + + + value + sample_rate/sym_rate + + + _coordinate + (397, 19) + + + _rotation + 0 + + + + variable + + id + sym_rate + + + _enabled + True + + + value + 600*1109 + + + _coordinate + (301, 19) + + + _rotation + 0 + + + + variable + + id + sample_rate + + + _enabled + True + + + value + 64e6/decim + + + _coordinate + (198, 17) + + + _rotation + 0 + + + + parameter + + id + decim + + + _enabled + True + + + label + Decimation + + + value + 16 + + + type + intx + + + short_id + d + + + _coordinate + (404, 102) + + + _rotation + 0 + + + + parameter + + id + pll_alpha + + + _enabled + True + + + label + + + + value + 0.05 + + + type + eng_float + + + short_id + p + + + _coordinate + (516, 102) + + + _rotation + 0 + + + + parameter + + id + sync_alpha + + + _enabled + True + + + label + + + + value + 0.05 + + + type + eng_float + + + short_id + s + + + _coordinate + (601, 103) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (9, 92) + + + _rotation + 0 + + + + parameter + + id + filename + + + _enabled + True + + + label + Filename + + + value + usrp.dat + + + type + string + + + short_id + F + + + _coordinate + (200, 101) + + + _rotation + 0 + + + + gr_file_source + + id + file_source + + + _enabled + True + + + file + filename + + + type + short + + + repeat + False + + + vlen + 1 + + + _coordinate + (102, 368) + + + _rotation + 0 + + + + gr_short_to_float + + id + s2f + + + _enabled + True + + + _coordinate + (305, 380) + + + _rotation + 0 + + + + gr_deinterleave + + id + deinterleave + + + _enabled + True + + + type + float + + + num_streams + 2 + + + vlen + 1 + + + _coordinate + (526, 363) + + + _rotation + 0 + + + + gr_float_to_complex + + id + f2c + + + _enabled + True + + + vlen + 1 + + + _coordinate + (730, 363) + + + _rotation + 0 + + + + virtual_sink + + id + samples_sink + + + _enabled + True + + + stream_id + samples + + + _coordinate + (968, 376) + + + _rotation + 0 + + + + virtual_source + + id + samples_source + + + _enabled + True + + + stream_id + samples + + + _coordinate + (104, 479) + + + _rotation + 0 + + + + gr_moving_average_xx + + id + matched_filter + + + _enabled + True + + + type + complex + + + length + hs + + + scale + 1.0/hs + + + max_iter + 4000 + + + _coordinate + (302, 463) + + + _rotation + 0 + + + + noaa_hrpt_pll_cf + + id + pll + + + _enabled + True + + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + + + _coordinate + (504, 463) + + + _rotation + 0 + + + + noaa_hrpt_sync_fb + + id + sync + + + _enabled + True + + + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset + + + _coordinate + (711, 455) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + deframer + + + _enabled + True + + + _coordinate + (935, 483) + + + _rotation + 0 + + + + gr_file_sink + + id + file_sink + + + _enabled + True + + + file + output + + + type + short + + + vlen + 1 + + + _coordinate + (1136, 479) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + decoder + + + _enabled + True + + + _coordinate + (1135, 542) + + + _rotation + 0 + + + + parameter + + id + output + + + _enabled + True + + + label + Output + + + value + frames.dat + + + type + string + + + short_id + o + + + _coordinate + (302, 101) + + + _rotation + 0 + + + + deframer + file_sink + 0 + 0 + + + sync + deframer + 0 + 0 + + + pll + sync + 0 + 0 + + + matched_filter + pll + 0 + 0 + + + s2f + deinterleave + 0 + 0 + + + deinterleave + f2c + 1 + 1 + + + deinterleave + f2c + 0 + 0 + + + file_source + s2f + 0 + 0 + + + deframer + decoder + 0 + 0 + + + f2c + samples_sink + 0 + 0 + + + samples_source + matched_filter + 0 + 0 + + diff --git a/gr-noaa/apps/demod_hrpt_file.py b/gr-noaa/apps/demod_hrpt_file.py new file mode 100755 index 000000000..a1469e9e0 --- /dev/null +++ b/gr-noaa/apps/demod_hrpt_file.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Wed Sep 23 11:37:25 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from optparse import OptionParser +import math + +class demod_hrpt_file(gr.top_block): + + def __init__(self, decim=16, pll_alpha=0.05, sync_alpha=0.05, filename="usrp.dat", output="frames.dat"): + gr.top_block.__init__(self, "USRP HRPT Receiver") + + ################################################## + # Parameters + ################################################## + self.decim = decim + self.pll_alpha = pll_alpha + self.sync_alpha = sync_alpha + self.filename = filename + self.output = output + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/sym_rate + self.max_sync_offset = max_sync_offset = 0.01 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + + ################################################## + # Blocks + ################################################## + self.decoder = noaa.hrpt_decoder() + self.deframer = noaa.hrpt_deframer() + self.deinterleave = gr.deinterleave(gr.sizeof_float*1) + self.f2c = gr.float_to_complex(1) + self.file_sink = gr.file_sink(gr.sizeof_short*1, output) + self.file_source = gr.file_source(gr.sizeof_short*1, filename, False) + self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.s2f = gr.short_to_float() + self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + + ################################################## + # Connections + ################################################## + self.connect((self.deframer, 0), (self.file_sink, 0)) + self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.pll, 0), (self.sync, 0)) + self.connect((self.matched_filter, 0), (self.pll, 0)) + self.connect((self.s2f, 0), (self.deinterleave, 0)) + self.connect((self.deinterleave, 1), (self.f2c, 1)) + self.connect((self.deinterleave, 0), (self.f2c, 0)) + self.connect((self.file_source, 0), (self.s2f, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.f2c, 0), (self.matched_filter, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self.pll.set_alpha(self.pll_alpha) + self.pll.set_beta(self.pll_alpha**2/4.0) + + def set_sync_alpha(self, sync_alpha): + self.sync_alpha = sync_alpha + self.sync.set_alpha(self.sync_alpha) + self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_filename(self, filename): + self.filename = filename + + def set_output(self, output): + self.output = output + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.set_sps(self.sample_rate/self.sym_rate) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + + def set_max_sync_offset(self, max_sync_offset): + self.max_sync_offset = max_sync_offset + self.sync.set_max_offset(self.max_sync_offset) + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + self.pll.set_max_offset(self.max_carrier_offset) + + def set_hs(self, hs): + self.hs = hs + self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, + help="Set Decimation [default=%default]") + parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), + help="Set pll_alpha [default=%default]") + parser.add_option("-s", "--sync-alpha", dest="sync_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), + help="Set sync_alpha [default=%default]") + parser.add_option("-F", "--filename", dest="filename", type="string", default="usrp.dat", + help="Set Filename [default=%default]") + parser.add_option("-o", "--output", dest="output", type="string", default="frames.dat", + help="Set Output [default=%default]") + (options, args) = parser.parse_args() + tb = demod_hrpt_file(decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha, filename=options.filename, output=options.output) + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() + diff --git a/gr-noaa/apps/usrp_rx_hrpt.cfg b/gr-noaa/apps/usrp_rx_hrpt.cfg new file mode 100644 index 000000000..69f3c0bf0 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt.cfg @@ -0,0 +1,13 @@ +[output] +filename = frames.dat + +[demod] +pll_alpha = 0.05 +sync_alpha = 0.05 + +[usrp] +freq = 1698000000.0 +decim = 16 +side = A +gain = 35.0 + diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index f629ae8b7..90d868769 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 19:30:16 2009 + Wed Sep 23 11:32:00 2009 options @@ -53,22 +53,22 @@ - import + variable id - import_0 + max_carrier_offset _enabled True - import - import math + value + 2*math.pi*100e3/sample_rate _coordinate - (9, 202) + (575, 19) _rotation @@ -76,34 +76,34 @@ - notebook + gr_moving_average_xx id - displays + matched_filter _enabled True - style - wx.NB_TOP + type + complex - labels - ['RX','PLL/SYNC'] + length + hs - grid_pos - 1, 0, 1, 2 + scale + 1.0/hs - notebook - + max_iter + 4000 _coordinate - (9, 99) + (441, 723) _rotation @@ -111,93 +111,114 @@ - wxgui_scopesink2 + import id - wxgui_scopesink2_0_0 + import_0 _enabled True - type - float + import + import math - title - Post-PLL + _coordinate + (11, 76) - samp_rate - sample_rate + _rotation + 0 + + + variable - v_scale - 0.5 + id + config_filename - t_scale - 20.0/sample_rate + _enabled + True - ac_couple - False + value + 'usrp_rx_hrpt.cfg' - xy_mode - False + _coordinate + (12, 129) - num_inputs - 1 + _rotation + 0 + + + variable - grid_pos - 0, 0, 1, 1 + id + sym_rate - notebook - displays, 1 + _enabled + True + + + value + 600*1109 _coordinate - (597, 618) + (301, 19) _rotation - 180 + 0 - gr_moving_average_xx + variable id - matched_filter + sps _enabled True - type - complex + value + sample_rate/sym_rate - length + _coordinate + (397, 19) + + + _rotation + 0 + + + + variable + + id hs - scale - 1.0/hs + _enabled + True - max_iter - 4000 + value + int(sps/2.0) _coordinate - (429, 789) + (499, 19) _rotation @@ -205,58 +226,77 @@ - wxgui_scopesink2 + variable id - wxgui_scopesink2_0 + sample_rate _enabled True - type - complex + value + 64e6/decim - title - RX Waveform + _coordinate + (198, 17) - samp_rate - sample_rate + _rotation + 0 + + + + variable_slider + + id + gain - v_scale + _enabled + True + + + label + RX Gain + + + value + saved_gain + + + min 0 - t_scale - 20.0/sample_rate + max + 100 - ac_couple - False + num_steps + 100 - xy_mode - False + style + wx.SL_HORIZONTAL - num_inputs - 1 + converver + float_converter grid_pos - 1, 0, 1, 1 + 0, 1, 1, 1 notebook - displays, 0 + _coordinate - (430, 895) + (340, 106) _rotation @@ -264,78 +304,97 @@ - wxgui_fftsink2 + variable_text_box id - rx_fftsink + freq _enabled True - type - complex + label + Frequency - title - RX Spectrum + value + saved_freq - samp_rate - sample_rate + converver + float_converter - baseband_freq - 1698e6 + formatter + None - y_per_div - 5 + grid_pos + 0, 0, 1, 1 - y_divs - 8 + notebook + - ref_level - -5 + _coordinate + (199, 106) - ref_scale - 2.0 + _rotation + 0 + + + variable_slider - fft_size - 1024 + id + pll_alpha - fft_rate - 30 + _enabled + True - peak_hold - False + label + PLL Alpha - average - True + value + saved_pll_alpha - avg_alpha - 0.1 + min + 0.0 + + + max + 0.5 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter grid_pos - 0, 0, 1, 1 + 0, 2, 1, 1 notebook - displays, 0 + _coordinate - (430, 531) + (479, 106) _rotation @@ -343,38 +402,54 @@ - gr_agc_xx + variable_slider id - agr + sync_alpha _enabled True - type - complex + label + SYNC Alpha - rate - 1e-6 + value + saved_sync_alpha - reference - 1.0 + min + 0.0 - gain - 1.0 + max + 0.5 - max_gain - 1.0 + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + 0, 3, 1, 1 + + + notebook + _coordinate - (258, 781) + (618, 106) _rotation @@ -382,22 +457,42 @@ - virtual_source + variable_static_text id - virtual_source_0 + side_text _enabled True - stream_id - samples + label + USRP Side + + + value + side + + + converver + str_converter + + + formatter + None + + + grid_pos + 1, 0, 1, 1 + + + notebook + _coordinate - (62, 805) + (828, 20) _rotation @@ -405,34 +500,42 @@ - parameter + variable_config id - filename + side _enabled True - - label - Filename - value - "" + 'A' type string - short_id - f + config_file + config_filename + + + section + 'usrp' + + + option + 'side' + + + writeback + side _coordinate - (200, 101) + (194, 253) _rotation @@ -440,7 +543,7 @@ - parameter + variable_config id decim @@ -449,25 +552,33 @@ _enabled True - - label - Decimation - value 16 type - intx + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'decim' - short_id - d + writeback + decim _coordinate - (304, 101) + (351, 255) _rotation @@ -475,10 +586,10 @@ - variable + variable_config id - max_sync_offset + saved_freq _enabled @@ -486,34 +597,31 @@ value - 0.01 + 1698e6 - _coordinate - (705, 19) + type + real - _rotation - 0 + config_file + config_filename - - - variable - id - max_carrier_offset + section + 'usrp' - _enabled - True + option + 'freq' - value - 2*math.pi*100e3/sample_rate + writeback + freq _coordinate - (575, 19) + (507, 258) _rotation @@ -521,10 +629,10 @@ - variable + variable_config id - hs + saved_gain _enabled @@ -532,11 +640,31 @@ value - int(sps/2.0) + 35 + + + type + real + + + config_file + config_filename + + + section + 'usrp' + + + option + 'gain' + + + writeback + gain _coordinate - (499, 19) + (664, 259) _rotation @@ -544,10 +672,10 @@ - variable + variable_config id - sps + saved_pll_alpha _enabled @@ -555,11 +683,31 @@ value - sample_rate/sym_rate + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'pll_alpha' + + + writeback + pll_alpha _coordinate - (397, 19) + (823, 258) _rotation @@ -567,10 +715,10 @@ - variable + variable_config id - sym_rate + saved_sync_alpha _enabled @@ -578,11 +726,31 @@ value - 600*1109 + 0.05 + + + type + real + + + config_file + config_filename + + + section + 'demod' + + + option + 'sync_alpha' + + + writeback + sync_alpha _coordinate - (301, 19) + (981, 258) _rotation @@ -590,10 +758,10 @@ - variable + variable_config id - sample_rate + output_filename _enabled @@ -601,11 +769,31 @@ value - 64e6/decim + 'frames.dat' + + + type + string + + + config_file + config_filename + + + section + 'output' + + + option + 'filename' + + + writeback + output_filename _coordinate - (198, 17) + (1139, 259) _rotation @@ -613,10 +801,10 @@ - variable_slider + variable_static_text id - pll_alpha + decim_text _enabled @@ -624,43 +812,54 @@ label - PLL Alpha + Decimation value - 0.005 + decim - min - 0.0 + converver + float_converter - max - 0.5 + formatter + None - num_steps - 500 + grid_pos + 1, 1, 1, 1 - style - wx.SL_HORIZONTAL + notebook + - converver - float_converter + _coordinate + (973, 20) - grid_pos - 0, 0, 1, 1 + _rotation + 0 + + + variable - notebook - + id + max_sync_offset + + + _enabled + True + + + value + 0.01 _coordinate - (447, 99) + (705, 19) _rotation @@ -668,30 +867,58 @@ - noaa_hrpt_pll_cf + usrp_simple_source_x + + id + usrp_source + + + _enabled + True + + + type + complex + + + format + + + + which + 0 + + + decimation + decim + + + frequency + freq + - id - noaa_hrpt_pll_cf_0 + lo_offset + float('inf') - _enabled - True + gain + gain - alpha - pll_alpha + side + side - beta - pll_alpha**2/4.0 + rx_ant + RXA - max_offset - max_carrier_offset + hb_filters + _coordinate - (624, 789) + (56, 699) _rotation @@ -699,34 +926,38 @@ - noaa_hrpt_sync_fb + gr_agc_xx id - noaa_hrpt_sync_fb_0 + agc _enabled True - alpha - sync_alpha + type + complex - beta - sync_alpha**2/4.0 + rate + 1e-6 - sps - sps + reference + 1.0 - max_offset - max_sync_offset + gain + 1.0 + + + max_gain + 1.0 _coordinate - (832, 781) + (273, 715) _rotation @@ -734,54 +965,58 @@ - variable_slider + wxgui_scopesink2 id - sync_alpha + rx_scope _enabled True - label - SYNC Alpha + type + complex - value - 0.1 + title + RX Waveform - min - 0.0 + samp_rate + sample_rate - max - 0.5 + v_scale + 0 - num_steps - 500 + t_scale + 20.0/sample_rate - style - wx.SL_HORIZONTAL + ac_couple + False - converver - float_converter + xy_mode + False + + + num_inputs + 1 grid_pos - 0, 1, 1, 1 + 1, 0, 1, 1 notebook - + displays, 0 _coordinate - (593, 98) + (439, 829) _rotation @@ -789,57 +1024,78 @@ - gr_file_source + wxgui_fftsink2 id - gr_file_source_0 + rx_fft _enabled True - file - filename + type + complex - type - short + title + RX Spectrum - repeat - False + samp_rate + sample_rate - vlen - 1 + baseband_freq + freq - _coordinate - (102, 368) + y_per_div + 5 - _rotation - 0 + y_divs + 8 - - - virtual_sink - id - virtual_sink_0 + ref_level + -5 - _enabled + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average True - stream_id - samples + avg_alpha + 0.1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 _coordinate - (1076, 376) + (439, 465) _rotation @@ -847,10 +1103,10 @@ - gr_throttle + wxgui_scopesink2 id - throttle + pll_scope _enabled @@ -858,50 +1114,82 @@ type - complex + float + + + title + Post-PLL - samples_per_second + samp_rate sample_rate - vlen + v_scale + 0.5 + + + t_scale + 20.0/sample_rate + + + ac_couple + False + + + xy_mode + False + + + num_inputs 1 + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + _coordinate - (877, 376) + (605, 552) _rotation - 0 + 180 - gr_deinterleave + notebook id - gr_deinterleave_0 + displays _enabled True - type - float + style + wx.NB_TOP - num_streams - 2 + labels + ['RX','Demod'] - vlen - 1 + grid_pos + 2, 0, 1, 4 + + + notebook + _coordinate - (466, 363) + (15, 237) _rotation @@ -909,18 +1197,30 @@ - gr_short_to_float + noaa_hrpt_pll_cf id - gr_short_to_float_0 + pll _enabled True + + alpha + pll_alpha + + + beta + pll_alpha**2/4.0 + + + max_offset + max_carrier_offset + _coordinate - (278, 380) + (632, 723) _rotation @@ -928,22 +1228,34 @@ - gr_float_to_complex + noaa_hrpt_sync_fb id - gr_float_to_complex_0 + sync _enabled True - vlen - 1 + alpha + sync_alpha + + + beta + sync_alpha**2/4.0 + + + sps + sps + + + max_offset + max_sync_offset _coordinate - (653, 363) + (840, 715) _rotation @@ -951,30 +1263,18 @@ - gr_file_sink + noaa_hrpt_deframer id - gr_file_sink_1 + deframer _enabled True - - file - frames.dat - - - type - short - - - vlen - 1 - _coordinate - (1265, 917) + (1071, 743) _rotation @@ -982,10 +1282,10 @@ - noaa_hrpt_deframer + noaa_hrpt_decoder id - noaa_hrpt_deframer_0 + decoder _enabled @@ -993,7 +1293,7 @@ _coordinate - (1063, 809) + (1274, 743) _rotation @@ -1001,18 +1301,30 @@ - noaa_hrpt_decoder + gr_file_sink id - noaa_hrpt_decoder_0 + frame_sink _enabled True + + file + output_filename + + + type + short + + + vlen + 1 + _coordinate - (1266, 809) + (1273, 851) _rotation @@ -1020,98 +1332,62 @@ - virtual_source_0 - agr - 0 - 0 - - - noaa_hrpt_deframer_0 - gr_file_sink_1 + deframer + frame_sink 0 0 - noaa_hrpt_sync_fb_0 - noaa_hrpt_deframer_0 + sync + deframer 0 0 - noaa_hrpt_pll_cf_0 - noaa_hrpt_sync_fb_0 + pll + sync 0 0 - noaa_hrpt_pll_cf_0 - wxgui_scopesink2_0_0 + pll + pll_scope 0 0 - agr - wxgui_scopesink2_0 + agc + rx_scope 0 0 - agr - rx_fftsink + agc + rx_fft 0 0 - agr + agc matched_filter 0 0 matched_filter - noaa_hrpt_pll_cf_0 - 0 - 0 - - - gr_float_to_complex_0 - throttle - 0 - 0 - - - gr_short_to_float_0 - gr_deinterleave_0 - 0 - 0 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 1 - 1 - - - gr_deinterleave_0 - gr_float_to_complex_0 - 0 - 0 - - - gr_file_source_0 - gr_short_to_float_0 + pll 0 0 - throttle - virtual_sink_0 + deframer + decoder 0 0 - noaa_hrpt_deframer_0 - noaa_hrpt_decoder_0 + usrp_source + agc 0 0 diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index b29af5654..7efbecd3a 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 20 19:30:17 2009 +# Generated: Wed Sep 23 11:32:04 2009 ################################################## from gnuradio import eng_notation @@ -13,41 +13,77 @@ from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import forms from gnuradio.wxgui import scopesink2 +from grc_gnuradio import usrp as grc_usrp from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser +import ConfigParser import math import wx class usrp_rx_hrpt(grc_wxgui.top_block_gui): - def __init__(self, filename="", decim=16): + def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") - ################################################## - # Parameters - ################################################## - self.filename = filename - self.decim = decim - ################################################## # Variables ################################################## + self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(config_filename) + try: decim = self._decim_config.getfloat('usrp', 'decim') + except: decim = 16 + self.decim = decim self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.sync_alpha = sync_alpha = 0.1 - self.pll_alpha = pll_alpha = 0.005 + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(config_filename) + try: side = self._side_config.get('usrp', 'side') + except: side = 'A' + self.side = side + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(config_filename) + try: saved_sync_alpha = self._saved_sync_alpha_config.getfloat('demod', 'sync_alpha') + except: saved_sync_alpha = 0.05 + self.saved_sync_alpha = saved_sync_alpha + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(config_filename) + try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('demod', 'pll_alpha') + except: saved_pll_alpha = 0.05 + self.saved_pll_alpha = saved_pll_alpha + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(config_filename) + try: saved_gain = self._saved_gain_config.getfloat('usrp', 'gain') + except: saved_gain = 35 + self.saved_gain = saved_gain + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(config_filename) + try: saved_freq = self._saved_freq_config.getfloat('usrp', 'freq') + except: saved_freq = 1698e6 + self.saved_freq = saved_freq + self.sync_alpha = sync_alpha = saved_sync_alpha + self.side_text = side_text = side + self.pll_alpha = pll_alpha = saved_pll_alpha + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(config_filename) + try: output_filename = self._output_filename_config.get('output', 'filename') + except: output_filename = 'frames.dat' + self.output_filename = output_filename self.max_sync_offset = max_sync_offset = 0.01 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate self.hs = hs = int(sps/2.0) + self.gain = gain = saved_gain + self.freq = freq = saved_freq + self.decim_text = decim_text = decim ################################################## # Notebooks ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL/SYNC") - self.GridAdd(self.displays, 1, 0, 1, 2) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") + self.GridAdd(self.displays, 2, 0, 1, 4) ################################################## # Controls @@ -69,12 +105,20 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): callback=self.set_sync_alpha, minimum=0.0, maximum=0.5, - num_steps=500, + num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) - self.GridAdd(_sync_alpha_sizer, 0, 1, 1, 1) + self.GridAdd(_sync_alpha_sizer, 0, 3, 1, 1) + self._side_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.side_text, + callback=self.set_side_text, + label="USRP Side", + converter=forms.str_converter(), + ) + self.GridAdd(self._side_text_static_text, 1, 0, 1, 1) _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL) self._pll_alpha_text_box = forms.text_box( parent=self.GetWin(), @@ -92,30 +136,75 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): callback=self.set_pll_alpha, minimum=0.0, maximum=0.5, - num_steps=500, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_pll_alpha_sizer, 0, 2, 1, 1) + _gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + label="RX Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_sizer, + value=self.gain, + callback=self.set_gain, + minimum=0, + maximum=100, + num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) - self.GridAdd(_pll_alpha_sizer, 0, 0, 1, 1) + self.GridAdd(_gain_sizer, 0, 1, 1, 1) + self._freq_text_box = forms.text_box( + parent=self.GetWin(), + value=self.freq, + callback=self.set_freq, + label="Frequency", + converter=forms.float_converter(), + ) + self.GridAdd(self._freq_text_box, 0, 0, 1, 1) + self._decim_text_static_text = forms.static_text( + parent=self.GetWin(), + value=self.decim_text, + callback=self.set_decim_text, + label="Decimation", + converter=forms.float_converter(), + ) + self.GridAdd(self._decim_text_static_text, 1, 1, 1, 1) ################################################## # Blocks ################################################## - self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_float*1) - self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, filename, False) - self.gr_float_to_complex_0 = gr.float_to_complex(1) - self.gr_short_to_float_0 = gr.short_to_float() + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.decoder = noaa.hrpt_decoder() + self.deframer = noaa.hrpt_deframer() + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) - self.noaa_hrpt_decoder_0 = noaa.hrpt_decoder() - self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() - self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) - self.rx_fftsink = fftsink2.fft_sink_c( + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.pll_scope = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-PLL", + sample_rate=sample_rate, + v_scale=0.5, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.pll_scope.win, 0, 0, 1, 1) + self.rx_fft = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), - baseband_freq=1698e6, + baseband_freq=freq, y_per_div=5, y_divs=8, ref_level=-5, @@ -128,9 +217,8 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): title="RX Spectrum", peak_hold=False, ) - self.displays.GetPage(0).GridAdd(self.rx_fftsink.win, 0, 0, 1, 1) - self.throttle = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) + self.rx_scope = scopesink2.scope_sink_c( self.displays.GetPage(0).GetWin(), title="RX Waveform", sample_rate=sample_rate, @@ -140,44 +228,83 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): xy_mode=False, num_inputs=1, ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Post-PLL", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) + self.displays.GetPage(0).GridAdd(self.rx_scope.win, 1, 0, 1, 1) + self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) + self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") + self.usrp_source.set_decim_rate(decim) + self.usrp_source.set_frequency(freq, verbose=True) + self.usrp_source.set_gain(gain) ################################################## # Connections ################################################## - self.connect((self.throttle, 0), (self.agr, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_1, 0)) - self.connect((self.noaa_hrpt_sync_fb_0, 0), (self.noaa_hrpt_deframer_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.noaa_hrpt_sync_fb_0, 0)) - self.connect((self.noaa_hrpt_pll_cf_0, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.agr, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.agr, 0), (self.rx_fftsink, 0)) - self.connect((self.agr, 0), (self.matched_filter, 0)) - self.connect((self.matched_filter, 0), (self.noaa_hrpt_pll_cf_0, 0)) - self.connect((self.gr_float_to_complex_0, 0), (self.throttle, 0)) - self.connect((self.gr_short_to_float_0, 0), (self.gr_deinterleave_0, 0)) - self.connect((self.gr_deinterleave_0, 1), (self.gr_float_to_complex_0, 1)) - self.connect((self.gr_deinterleave_0, 0), (self.gr_float_to_complex_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0)) - self.connect((self.noaa_hrpt_deframer_0, 0), (self.noaa_hrpt_decoder_0, 0)) - - def set_filename(self, filename): - self.filename = filename + self.connect((self.deframer, 0), (self.frame_sink, 0)) + self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.pll, 0), (self.sync, 0)) + self.connect((self.pll, 0), (self.pll_scope, 0)) + self.connect((self.agc, 0), (self.rx_scope, 0)) + self.connect((self.agc, 0), (self.rx_fft, 0)) + self.connect((self.agc, 0), (self.matched_filter, 0)) + self.connect((self.matched_filter, 0), (self.pll, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.usrp_source, 0), (self.agc, 0)) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp'): + self._side_config.add_section('usrp') + self._side_config.set('usrp', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(self.config_filename) + if not self._decim_config.has_section('usrp'): + self._decim_config.add_section('usrp') + self._decim_config.set('usrp', 'decim', str(self.decim)) + self._decim_config.write(open(self.config_filename, 'w')) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section('usrp'): + self._saved_freq_config.add_section('usrp') + self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(self.config_filename) + if not self._saved_gain_config.has_section('usrp'): + self._saved_gain_config.add_section('usrp') + self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('demod'): + self._saved_pll_alpha_config.add_section('demod') + self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(self.config_filename) + if not self._saved_sync_alpha_config.has_section('demod'): + self._saved_sync_alpha_config.add_section('demod') + self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) + self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('output'): + self._output_filename_config.add_section('output') + self._output_filename_config.set('output', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) def set_decim(self, decim): self.decim = decim self.set_sample_rate(64e6/self.decim) + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(self.config_filename) + if not self._decim_config.has_section('usrp'): + self._decim_config.add_section('usrp') + self._decim_config.set('usrp', 'decim', str(self.decim)) + self._decim_config.write(open(self.config_filename, 'w')) + self.set_decim_text(self.decim) + self.usrp_source.set_decim_rate(self.decim) def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate @@ -185,49 +312,124 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate - self.wxgui_scopesink2_0_0.set_sample_rate(self.sample_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.sample_rate) - self.rx_fftsink.set_sample_rate(self.sample_rate) self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.set_sps(self.sample_rate/self.sym_rate) + self.rx_scope.set_sample_rate(self.sample_rate) + self.rx_fft.set_sample_rate(self.sample_rate) + self.pll_scope.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps self.set_hs(int(self.sps/2.0)) + def set_side(self, side): + self.side = side + self.set_side_text(self.side) + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp'): + self._side_config.add_section('usrp') + self._side_config.set('usrp', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + + def set_saved_sync_alpha(self, saved_sync_alpha): + self.saved_sync_alpha = saved_sync_alpha + self.set_sync_alpha(self.saved_sync_alpha) + + def set_saved_pll_alpha(self, saved_pll_alpha): + self.saved_pll_alpha = saved_pll_alpha + self.set_pll_alpha(self.saved_pll_alpha) + + def set_saved_gain(self, saved_gain): + self.saved_gain = saved_gain + self.set_gain(self.saved_gain) + + def set_saved_freq(self, saved_freq): + self.saved_freq = saved_freq + self.set_freq(self.saved_freq) + def set_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha - self.noaa_hrpt_sync_fb_0.set_alpha(self.sync_alpha) - self.noaa_hrpt_sync_fb_0.set_beta(self.sync_alpha**2/4.0) self._sync_alpha_slider.set_value(self.sync_alpha) self._sync_alpha_text_box.set_value(self.sync_alpha) + self._saved_sync_alpha_config = ConfigParser.ConfigParser() + self._saved_sync_alpha_config.read(self.config_filename) + if not self._saved_sync_alpha_config.has_section('demod'): + self._saved_sync_alpha_config.add_section('demod') + self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) + self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) + self.sync.set_alpha(self.sync_alpha) + self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_side_text(self, side_text): + self.side_text = side_text + self._side_text_static_text.set_value(self.side_text) def set_pll_alpha(self, pll_alpha): self.pll_alpha = pll_alpha self._pll_alpha_slider.set_value(self.pll_alpha) self._pll_alpha_text_box.set_value(self.pll_alpha) - self.noaa_hrpt_pll_cf_0.set_alpha(self.pll_alpha) - self.noaa_hrpt_pll_cf_0.set_beta(self.pll_alpha**2/4.0) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('demod'): + self._saved_pll_alpha_config.add_section('demod') + self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self.pll.set_alpha(self.pll_alpha) + self.pll.set_beta(self.pll_alpha**2/4.0) + + def set_output_filename(self, output_filename): + self.output_filename = output_filename + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('output'): + self._output_filename_config.add_section('output') + self._output_filename_config.set('output', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) def set_max_sync_offset(self, max_sync_offset): self.max_sync_offset = max_sync_offset - self.noaa_hrpt_sync_fb_0.set_max_offset(self.max_sync_offset) + self.sync.set_max_offset(self.max_sync_offset) def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset - self.noaa_hrpt_pll_cf_0.set_max_offset(self.max_carrier_offset) + self.pll.set_max_offset(self.max_carrier_offset) def set_hs(self, hs): self.hs = hs self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs) + def set_gain(self, gain): + self.gain = gain + self._gain_slider.set_value(self.gain) + self._gain_text_box.set_value(self.gain) + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(self.config_filename) + if not self._saved_gain_config.has_section('usrp'): + self._saved_gain_config.add_section('usrp') + self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self.usrp_source.set_gain(self.gain) + + def set_freq(self, freq): + self.freq = freq + self._freq_text_box.set_value(self.freq) + self._saved_freq_config = ConfigParser.ConfigParser() + self._saved_freq_config.read(self.config_filename) + if not self._saved_freq_config.has_section('usrp'): + self._saved_freq_config.add_section('usrp') + self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + self._saved_freq_config.write(open(self.config_filename, 'w')) + self.usrp_source.set_frequency(self.freq) + self.rx_fft.set_baseband_freq(self.freq) + + def set_decim_text(self, decim_text): + self.decim_text = decim_text + self._decim_text_static_text.set_value(self.decim_text) + if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - parser.add_option("-f", "--filename", dest="filename", type="string", default="", - help="Set Filename [default=%default]") - parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, - help="Set Decimation [default=%default]") (options, args) = parser.parse_args() - tb = usrp_rx_hrpt(filename=options.filename, decim=options.decim) + tb = usrp_rx_hrpt() tb.Run(True) diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc index 4fae0173d..8cfaa913c 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -59,17 +59,17 @@ noaa_hrpt_decoder::work(int noutput_items, while (i < noutput_items) { unsigned short word = in[i++]; d_word_count++; - fprintf(stderr, "%5u: ", d_word_count); + //fprintf(stderr, "%5u: ", d_word_count); for (int pos = 0; pos < 10; pos++) { char ch = (word & (1 << 9)) ? '1' : '0'; word = word << 1; - fprintf(stderr, "%c ", ch); + //fprintf(stderr, "%c ", ch); } - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); if (d_word_count == 11090) { d_word_count = 0; - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); } } diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc index 77a8e3263..b0de09c91 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -91,7 +91,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_shifter = (d_shifter << 1) | bit; // MSB transmitted first if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { - //fprintf(stderr, "SYNC #%i", frames_seen++); + fprintf(stderr, "SYNC #%i", frames_seen++); out[j++] = SYNC1; out[j++] = SYNC2; out[j++] = SYNC3; @@ -109,7 +109,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, d_word = 0; d_bit_count = HRPT_BITS_PER_WORD; if (--d_word_count == 0) { - //fprintf(stderr, "...done\n"); + fprintf(stderr, "...done\n"); enter_idle(); } } -- cgit From 2afcae4f01e19d3973f3fc0eb6db50dc9dcb7098 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 23 Sep 2009 11:56:19 -0700 Subject: Added README and updated configuration requirements --- gr-noaa/README | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gr-noaa/README (limited to 'gr-noaa') diff --git a/gr-noaa/README b/gr-noaa/README new file mode 100644 index 000000000..d99c0d90a --- /dev/null +++ b/gr-noaa/README @@ -0,0 +1,53 @@ +This component implements an NOAA POES HRPT receiver. After installation, +the scripts described below will be install in the users PATH. + +As the scripts are generated using GRC, GRC must be installed at runtime +in order for them to operate. + + +HRPT Operation +-------------- + +usrp_rx_hrpt.py + +This GUI script will receive HRPT RF, demodulate, synchronize, and deframe +HRPT minor frames into a file. The file stores a series of 11090 word, +16-bits per word corresponding to the HRPT minor frame format (only the +lower 10-bits per word are significant.) + +The script file by default uses USRP side A, 1698 MHz, at decimation 16. A +configuration file 'usrp_rx_hrpt.cfg' in the current working directory will +allow changing this, as well as implementing persistent storage of GUI +entered parameters from invocation to invocation. + +The present HRPT demodulator is only tested at decimation 16. The only other +valid decimation rates are 24 and 32, which may word but with more bit +errors. No other decimation rates will work. + + +demod_hrpt_file.py + +This command-line only script will operate on a file generated with +usrp_rx_cfile.py and output frames in the same format as above. It does +*not* use the configuration file above. + +Usage: demod_hrpt_file.py: [options] + +Options: + -h, --help show this help message and exit + -d DECIM, --decim=DECIM + Set Decimation [default=16] + -p PLL_ALPHA, --pll-alpha=PLL_ALPHA + Set pll_alpha [default=50m] + -s SYNC_ALPHA, --sync-alpha=SYNC_ALPHA + Set sync_alpha [default=50m] + -F FILENAME, --filename=FILENAME + Set Filename [default=usrp.dat] + -o OUTPUT, --output=OUTPUT + Set Output [default=frames.dat] + + +LRIT Operation +-------------- + +The work-in-progress LRIT GRC script is not currently in a usable state. -- cgit From 4bb01619d8a082bcf412762f3ee147e8cd4b37dd Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 23 Sep 2009 19:11:36 -0700 Subject: Fix missing type specifier for mask --- gr-noaa/lib/noaa_hrpt_deframer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-noaa') diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc index b0de09c91..89486aa19 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ b/gr-noaa/lib/noaa_hrpt_deframer.cc @@ -90,7 +90,7 @@ noaa_hrpt_deframer::general_work(int noutput_items, case ST_IDLE: d_shifter = (d_shifter << 1) | bit; // MSB transmitted first - if ((d_shifter & 0x0FFFFFFFFFFFFFFF) == HRPT_MINOR_FRAME_SYNC) { + if ((d_shifter & 0x0FFFFFFFFFFFFFFFLL) == HRPT_MINOR_FRAME_SYNC) { fprintf(stderr, "SYNC #%i", frames_seen++); out[j++] = SYNC1; out[j++] = SYNC2; -- cgit