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
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