From b7d1c551fb374a0e5219fbb4d118f3f19f448393 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 8 Sep 2009 16:52:37 -0700 Subject: [PATCH] Changed synchronizer to output sliced bits. --- gr-noaa/grc/Makefile.am | 2 +- ...hrpt_sync_ff.xml => noaa_hrpt_sync_fb.xml} | 6 +- gr-noaa/grc/usrp_rx_hrpt.grc | 455 +++++++++--------- gr-noaa/grc/usrp_rx_hrpt.py | 20 +- gr-noaa/lib/Makefile.am | 4 +- ...a_hrpt_sync_ff.cc => noaa_hrpt_sync_fb.cc} | 25 +- ...oaa_hrpt_sync_ff.h => noaa_hrpt_sync_fb.h} | 22 +- gr-noaa/swig/Makefile.am | 2 +- ...oaa_hrpt_sync_ff.i => noaa_hrpt_sync_fb.i} | 10 +- gr-noaa/swig/noaa_swig.i | 4 +- 10 files changed, 263 insertions(+), 287 deletions(-) rename gr-noaa/grc/{noaa_hrpt_sync_ff.xml => noaa_hrpt_sync_fb.xml} (86%) rename gr-noaa/lib/{noaa_hrpt_sync_ff.cc => noaa_hrpt_sync_fb.cc} (78%) rename gr-noaa/lib/{noaa_hrpt_sync_ff.h => noaa_hrpt_sync_fb.h} (77%) rename gr-noaa/swig/{noaa_hrpt_sync_ff.i => noaa_hrpt_sync_fb.i} (83%) diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index fa2c40c8..e56bd354 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_ff.xml b/gr-noaa/grc/noaa_hrpt_sync_fb.xml similarity index 86% rename from gr-noaa/grc/noaa_hrpt_sync_ff.xml rename to gr-noaa/grc/noaa_hrpt_sync_fb.xml index 91b83ad5..e066e348 100644 --- a/gr-noaa/grc/noaa_hrpt_sync_ff.xml +++ b/gr-noaa/grc/noaa_hrpt_sync_fb.xml @@ -1,10 +1,10 @@ HRPT SYNC - noaa_hrpt_sync_ff + noaa_hrpt_sync_fb NOAA from gnuradio import noaa - noaa.hrpt_sync_ff($alpha, $beta, $sps, $max_offset) + noaa.hrpt_sync_fb($alpha, $beta, $sps, $max_offset) set_alpha($alpha) set_beta($beta) set_max_offset($max_offset) @@ -34,6 +34,6 @@ out - float + byte diff --git a/gr-noaa/grc/usrp_rx_hrpt.grc b/gr-noaa/grc/usrp_rx_hrpt.grc index 41aa1958..25b13353 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 74e35267..10e2f31c 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 91363878..1b758871 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_ff.cc b/gr-noaa/lib/noaa_hrpt_sync_fb.cc similarity index 78% rename from gr-noaa/lib/noaa_hrpt_sync_ff.cc rename to gr-noaa/lib/noaa_hrpt_sync_fb.cc index f17ad54d..f99947f8 100644 --- a/gr-noaa/lib/noaa_hrpt_sync_ff.cc +++ b/gr-noaa/lib/noaa_hrpt_sync_fb.cc @@ -24,7 +24,7 @@ #include "config.h" #endif -#include +#include #include inline int signum(float f) @@ -32,16 +32,16 @@ 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) +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_ff(alpha, beta, sps, max_offset)); + return gnuradio::get_initial_sptr(new noaa_hrpt_sync_fb(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", +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(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), @@ -50,14 +50,14 @@ noaa_hrpt_sync_ff::noaa_hrpt_sync_ff(float alpha, float beta, float sps, float m } int -noaa_hrpt_sync_ff::general_work(int noutput_items, +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]; - float *out = (float *) output_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) { @@ -77,7 +77,10 @@ noaa_hrpt_sync_ff::general_work(int noutput_items, } if (d_phase > 1.0) { - out[j++] = -sample; // Invert sense, -68 degrees=1 + if (sample < 0.0) + out[j++] = 1; + else + out[j++] = 0; d_phase -= 1.0; } } diff --git a/gr-noaa/lib/noaa_hrpt_sync_ff.h b/gr-noaa/lib/noaa_hrpt_sync_fb.h similarity index 77% rename from gr-noaa/lib/noaa_hrpt_sync_ff.h rename to gr-noaa/lib/noaa_hrpt_sync_fb.h index 51502698..a9416b9e 100644 --- a/gr-noaa/lib/noaa_hrpt_sync_ff.h +++ b/gr-noaa/lib/noaa_hrpt_sync_fb.h @@ -20,21 +20,21 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_NOAA_HRPT_SYNC_FF_H -#define INCLUDED_NOAA_HRPT_SYNC_FF_H +#ifndef INCLUDED_NOAA_HRPT_SYNC_FB_H +#define INCLUDED_NOAA_HRPT_SYNC_FB_H -#include +#include -class noaa_hrpt_sync_ff; -typedef boost::shared_ptr noaa_hrpt_sync_ff_sptr; +class noaa_hrpt_sync_fb; +typedef boost::shared_ptr noaa_hrpt_sync_fb_sptr; -noaa_hrpt_sync_ff_sptr -noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); +noaa_hrpt_sync_fb_sptr +noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); -class noaa_hrpt_sync_ff : public gr_block +class noaa_hrpt_sync_fb : 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); + 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 @@ -55,4 +55,4 @@ class noaa_hrpt_sync_ff : public gr_block void set_max_offset(float max_offset) { d_max_offset = max_offset; } }; -#endif /* INCLUDED_NOAA_HRPT_SYNC_FF_H */ +#endif /* INCLUDED_NOAA_HRPT_SYNC_FB_H */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 2f98738c..e1584227 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_ff.i b/gr-noaa/swig/noaa_hrpt_sync_fb.i similarity index 83% rename from gr-noaa/swig/noaa_hrpt_sync_ff.i rename to gr-noaa/swig/noaa_hrpt_sync_fb.i index f3b1594b..a8e5b21d 100644 --- a/gr-noaa/swig/noaa_hrpt_sync_ff.i +++ b/gr-noaa/swig/noaa_hrpt_sync_fb.i @@ -20,15 +20,15 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_ff) +GR_SWIG_BLOCK_MAGIC(noaa,hrpt_sync_fb) -noaa_hrpt_sync_ff_sptr -noaa_make_hrpt_sync_ff(float alpha, float beta, float sps, float max_offset); +noaa_hrpt_sync_fb_sptr +noaa_make_hrpt_sync_fb(float alpha, float beta, float sps, float max_offset); -class noaa_hrpt_sync_ff : public gr_sync_block +class noaa_hrpt_sync_fb : public gr_sync_block { private: - noaa_hrpt_sync_ff(); + noaa_hrpt_sync_fb(); public: void set_alpha(float alpha); diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index a3e5dd78..8223eedb 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" -- 2.47.2