summaryrefslogtreecommitdiff
path: root/gr-noaa
diff options
context:
space:
mode:
Diffstat (limited to 'gr-noaa')
-rw-r--r--gr-noaa/apps/usrp_rx_hrpt.grc545
-rwxr-xr-xgr-noaa/apps/usrp_rx_hrpt.py46
-rw-r--r--gr-noaa/grc/noaa_hrpt_deframer.xml4
-rw-r--r--gr-noaa/lib/noaa_hrpt_deframer.cc61
-rw-r--r--gr-noaa/lib/noaa_hrpt_deframer.h21
5 files changed, 270 insertions, 407 deletions
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 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Tue Sep 8 21:03:12 2009</timestamp>
+ <timestamp>Sun Sep 20 12:45:30 2009</timestamp>
<block>
<key>options</key>
<param>
@@ -76,37 +76,6 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
- <param>
- <key>id</key>
- <value>throttle</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>sample_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(79, 518)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable</key>
<param>
<key>id</key>
@@ -277,61 +246,6 @@
</param>
</block>
<block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>sync_alpha</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>SYNC Alpha</value>
- </param>
- <param>
- <key>value</key>
- <value>0.001</value>
- </param>
- <param>
- <key>min</key>
- <value>0.0</value>
- </param>
- <param>
- <key>max</key>
- <value>0.5</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>500</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value>0, 1, 1, 1</value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(344, 101)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable</key>
<param>
<key>id</key>
@@ -378,38 +292,34 @@
</param>
</block>
<block>
- <key>gr_agc_xx</key>
+ <key>notebook</key>
<param>
<key>id</key>
- <value>agr</value>
+ <value>displays</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>rate</key>
- <value>1e-6</value>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
</param>
<param>
- <key>reference</key>
- <value>1.0</value>
+ <key>labels</key>
+ <value>['RX','PLL/SYNC']</value>
</param>
<param>
- <key>gain</key>
- <value>1.0</value>
+ <key>grid_pos</key>
+ <value>1, 0, 1, 2</value>
</param>
<param>
- <key>max_gain</key>
- <value>1.0</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(261, 494)</value>
+ <value>(9, 99)</value>
</param>
<param>
<key>_rotation</key>
@@ -417,22 +327,18 @@
</param>
</block>
<block>
- <key>virtual_source</key>
+ <key>noaa_hrpt_deframer</key>
<param>
<key>id</key>
- <value>virtual_source_0</value>
+ <value>noaa_hrpt_deframer_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>stream_id</key>
- <value>bits</value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(283, 919)</value>
+ <value>(1112, 649)</value>
</param>
<param>
<key>_rotation</key>
@@ -440,88 +346,89 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>displays</value>
+ <value>wxgui_scopesink2_0_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.NB_TOP</value>
- </param>
- <param>
- <key>labels</key>
- <value>['RX','PLL/SYNC']</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>grid_pos</key>
- <value>1, 0, 1, 2</value>
+ <key>title</key>
+ <value>Post-PLL</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>samp_rate</key>
+ <value>sample_rate</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(9, 99)</value>
+ <key>v_scale</key>
+ <value>0.5</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>t_scale</key>
+ <value>20.0/sample_rate</value>
</param>
- </block>
- <block>
- <key>noaa_hrpt_pll_cf</key>
<param>
- <key>id</key>
- <value>noaa_hrpt_pll_cf_0</value>
+ <key>ac_couple</key>
+ <value>False</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>xy_mode</key>
+ <value>False</value>
</param>
<param>
- <key>alpha</key>
- <value>pll_alpha</value>
+ <key>num_inputs</key>
+ <value>1</value>
</param>
<param>
- <key>beta</key>
- <value>pll_alpha**2/4.0</value>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 1</value>
</param>
<param>
- <key>max_offset</key>
- <value>max_carrier_offset</value>
+ <key>notebook</key>
+ <value>displays, 1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(639, 502)</value>
+ <value>(624, 462)</value>
</param>
<param>
<key>_rotation</key>
- <value>0</value>
+ <value>180</value>
</param>
</block>
<block>
- <key>virtual_sink</key>
+ <key>gr_throttle</key>
<param>
<key>id</key>
- <value>virtual_sink_1</value>
+ <value>throttle</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>stream_id</key>
- <value>bits</value>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>sample_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(1126, 518)</value>
+ <value>(85, 645)</value>
</param>
<param>
<key>_rotation</key>
@@ -529,81 +436,82 @@
</param>
</block>
<block>
- <key>gr_char_to_float</key>
+ <key>wxgui_fftsink2</key>
<param>
<key>id</key>
- <value>gr_char_to_float_0</value>
+ <value>rx_fftsink</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(477, 923)</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>title</key>
+ <value>RX Spectrum</value>
</param>
- </block>
- <block>
- <key>wxgui_scopesink2</key>
<param>
- <key>id</key>
- <value>wxgui_scopesink2_0_0_0_0</value>
+ <key>samp_rate</key>
+ <value>sample_rate</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>baseband_freq</key>
+ <value>1698e6</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>y_per_div</key>
+ <value>5</value>
</param>
<param>
- <key>title</key>
- <value>Post-SYNC</value>
+ <key>y_divs</key>
+ <value>8</value>
</param>
<param>
- <key>samp_rate</key>
- <value>sym_rate</value>
+ <key>ref_level</key>
+ <value>-5</value>
</param>
<param>
- <key>v_scale</key>
- <value>0.5</value>
+ <key>ref_scale</key>
+ <value>2.0</value>
</param>
<param>
- <key>t_scale</key>
- <value>20.0/sym_rate</value>
+ <key>fft_size</key>
+ <value>1024</value>
</param>
<param>
- <key>ac_couple</key>
- <value>False</value>
+ <key>fft_rate</key>
+ <value>30</value>
</param>
<param>
- <key>xy_mode</key>
+ <key>peak_hold</key>
<value>False</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>average</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0.1</value>
</param>
<param>
<key>grid_pos</key>
- <value>1, 0, 1, 1</value>
+ <value>0, 0, 1, 1</value>
</param>
<param>
<key>notebook</key>
- <value>displays, 1</value>
+ <value>displays, 0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(452, 990)</value>
+ <value>(439, 309)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
@@ -658,7 +566,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(433, 570)</value>
+ <value>(440, 783)</value>
</param>
<param>
<key>_rotation</key>
@@ -666,10 +574,10 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>gr_agc_xx</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0</value>
+ <value>agr</value>
</param>
<param>
<key>_enabled</key>
@@ -677,58 +585,38 @@
</param>
<param>
<key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>title</key>
- <value>Post-PLL</value>
- </param>
- <param>
- <key>samp_rate</key>
- <value>sample_rate</value>
- </param>
- <param>
- <key>v_scale</key>
- <value>0.5</value>
- </param>
- <param>
- <key>t_scale</key>
- <value>20.0/sample_rate</value>
- </param>
- <param>
- <key>ac_couple</key>
- <value>False</value>
+ <value>complex</value>
</param>
<param>
- <key>xy_mode</key>
- <value>False</value>
+ <key>rate</key>
+ <value>1e-6</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>reference</key>
+ <value>1.0</value>
</param>
<param>
- <key>grid_pos</key>
- <value>0, 0, 1, 1</value>
+ <key>gain</key>
+ <value>1.0</value>
</param>
<param>
- <key>notebook</key>
- <value>displays, 1</value>
+ <key>max_gain</key>
+ <value>1.0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(618, 335)</value>
+ <value>(267, 621)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
- <key>noaa_hrpt_sync_fb</key>
+ <key>noaa_hrpt_pll_cf</key>
<param>
<key>id</key>
- <value>noaa_hrpt_sync_fb_0</value>
+ <value>noaa_hrpt_pll_cf_0</value>
</param>
<param>
<key>_enabled</key>
@@ -736,42 +624,19 @@
</param>
<param>
<key>alpha</key>
- <value>0.001</value>
+ <value>pll_alpha</value>
</param>
<param>
<key>beta</key>
- <value>0.001**2/4.0</value>
- </param>
- <param>
- <key>sps</key>
- <value>sps</value>
+ <value>pll_alpha**2/4.0</value>
</param>
<param>
<key>max_offset</key>
- <value>max_sync_offset</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(856, 494)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>noaa_hrpt_deframer</key>
- <param>
- <key>id</key>
- <value>noaa_hrpt_deframer_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
+ <value>max_carrier_offset</value>
</param>
<param>
<key>_coordinate</key>
- <value>(1110, 631)</value>
+ <value>(645, 629)</value>
</param>
<param>
<key>_rotation</key>
@@ -779,10 +644,10 @@
</param>
</block>
<block>
- <key>gr_file_source</key>
+ <key>gr_file_sink</key>
<param>
<key>id</key>
- <value>src</value>
+ <value>gr_file_sink_1</value>
</param>
<param>
<key>_enabled</key>
@@ -790,15 +655,11 @@
</param>
<param>
<key>file</key>
- <value>poes-d16.dat</value>
+ <value>frames.dat</value>
</param>
<param>
<key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>repeat</key>
- <value>True</value>
+ <value>short</value>
</param>
<param>
<key>vlen</key>
@@ -806,7 +667,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(34, 423)</value>
+ <value>(1125, 758)</value>
</param>
<param>
<key>_rotation</key>
@@ -814,49 +675,34 @@
</param>
</block>
<block>
- <key>gr_add_const_vxx</key>
+ <key>gr_moving_average_xx</key>
<param>
<key>id</key>
- <value>gr_add_const_vxx_0</value>
+ <value>matched_filter</value>
</param>
<param>
<key>_enabled</key>
- <value>False</value>
+ <value>True</value>
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
- <key>const</key>
- <value>48.0</value>
+ <key>length</key>
+ <value>hs</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>scale</key>
+ <value>1.0/hs</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(692, 919)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>gr_float_to_char</key>
- <param>
- <key>id</key>
- <value>gr_float_to_char_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>False</value>
+ <key>max_iter</key>
+ <value>4000</value>
</param>
<param>
<key>_coordinate</key>
- <value>(848, 923)</value>
+ <value>(444, 629)</value>
</param>
<param>
<key>_rotation</key>
@@ -864,22 +710,26 @@
</param>
</block>
<block>
- <key>gr_file_sink</key>
+ <key>gr_file_source</key>
<param>
<key>id</key>
- <value>gr_file_sink_0</value>
+ <value>src</value>
</param>
<param>
<key>_enabled</key>
- <value>False</value>
+ <value>True</value>
</param>
<param>
<key>file</key>
- <value>bits.dat</value>
+ <value>poes-d16.dat</value>
</param>
<param>
<key>type</key>
- <value>byte</value>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>False</value>
</param>
<param>
<key>vlen</key>
@@ -887,7 +737,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(1020, 919)</value>
+ <value>(79, 541)</value>
</param>
<param>
<key>_rotation</key>
@@ -895,78 +745,89 @@
</param>
</block>
<block>
- <key>wxgui_fftsink2</key>
+ <key>noaa_hrpt_sync_fb</key>
<param>
<key>id</key>
- <value>rx_fftsink</value>
+ <value>noaa_hrpt_sync_fb_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>alpha</key>
+ <value>sync_alpha</value>
</param>
<param>
- <key>title</key>
- <value>RX Spectrum</value>
+ <key>beta</key>
+ <value>sync_alpha**2/4.0</value>
</param>
<param>
- <key>samp_rate</key>
- <value>sample_rate</value>
+ <key>sps</key>
+ <value>sps</value>
</param>
<param>
- <key>baseband_freq</key>
- <value>1698e6</value>
+ <key>max_offset</key>
+ <value>max_sync_offset</value>
</param>
<param>
- <key>y_per_div</key>
- <value>5</value>
+ <key>_coordinate</key>
+ <value>(862, 621)</value>
</param>
<param>
- <key>y_divs</key>
- <value>8</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable_slider</key>
<param>
- <key>ref_level</key>
- <value>-5</value>
+ <key>id</key>
+ <value>sync_alpha</value>
</param>
<param>
- <key>ref_scale</key>
- <value>2.0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>fft_size</key>
- <value>1024</value>
+ <key>label</key>
+ <value>SYNC Alpha</value>
</param>
<param>
- <key>fft_rate</key>
- <value>30</value>
+ <key>value</key>
+ <value>0.005</value>
</param>
<param>
- <key>peak_hold</key>
- <value>False</value>
+ <key>min</key>
+ <value>0.0</value>
</param>
<param>
- <key>average</key>
- <value>True</value>
+ <key>max</key>
+ <value>0.5</value>
</param>
<param>
- <key>avg_alpha</key>
- <value>0.1</value>
+ <key>num_steps</key>
+ <value>500</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
<key>grid_pos</key>
- <value>0, 0, 1, 1</value>
+ <value>0, 1, 1, 1</value>
</param>
<param>
<key>notebook</key>
- <value>displays, 0</value>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(434, 269)</value>
+ <value>(344, 101)</value>
</param>
<param>
<key>_rotation</key>
@@ -974,86 +835,62 @@
</param>
</block>
<connection>
- <source_block_id>src</source_block_id>
- <sink_block_id>throttle</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>throttle</source_block_id>
- <sink_block_id>agr</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>agr</source_block_id>
- <sink_block_id>rx_fftsink</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>agr</source_block_id>
- <sink_block_id>wxgui_scopesink2_0</sink_block_id>
+ <source_block_id>noaa_hrpt_deframer_0</source_block_id>
+ <sink_block_id>gr_file_sink_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>agr</source_block_id>
- <sink_block_id>noaa_hrpt_pll_cf_0</sink_block_id>
+ <source_block_id>noaa_hrpt_sync_fb_0</source_block_id>
+ <sink_block_id>noaa_hrpt_deframer_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>noaa_hrpt_pll_cf_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>virtual_source_0</source_block_id>
- <sink_block_id>gr_char_to_float_0</sink_block_id>
+ <sink_block_id>noaa_hrpt_sync_fb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>noaa_hrpt_pll_cf_0</source_block_id>
- <sink_block_id>noaa_hrpt_sync_fb_0</sink_block_id>
+ <sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>noaa_hrpt_sync_fb_0</source_block_id>
- <sink_block_id>virtual_sink_1</sink_block_id>
+ <source_block_id>agr</source_block_id>
+ <sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_char_to_float_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id>
+ <source_block_id>agr</source_block_id>
+ <sink_block_id>rx_fftsink</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_char_to_float_0</source_block_id>
- <sink_block_id>gr_add_const_vxx_0</sink_block_id>
+ <source_block_id>throttle</source_block_id>
+ <sink_block_id>agr</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_const_vxx_0</source_block_id>
- <sink_block_id>gr_float_to_char_0</sink_block_id>
+ <source_block_id>src</source_block_id>
+ <sink_block_id>throttle</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_float_to_char_0</source_block_id>
- <sink_block_id>gr_file_sink_0</sink_block_id>
+ <source_block_id>agr</source_block_id>
+ <sink_block_id>matched_filter</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>noaa_hrpt_sync_fb_0</source_block_id>
- <sink_block_id>noaa_hrpt_deframer_0</sink_block_id>
+ <source_block_id>matched_filter</source_block_id>
+ <sink_block_id>noaa_hrpt_pll_cf_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
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 @@
<name>in</name>
<type>byte</type>
</sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ </source>
</block>
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 <noaa_hrpt_deframer.h>
#include <gr_io_signature.h>
+#include <cstring>
#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 <gr_sync_block.h>
+#define HRPT_SYNC_WORDS 6
+#define HRPT_MINOR_FRAME_WORDS 11090
+#define HRPT_BITS_PER_WORD 10
+
+#include <gr_block.h>
class noaa_hrpt_deframer;
typedef boost::shared_ptr<noaa_hrpt_deframer> noaa_hrpt_deframer_sptr;
@@ -31,22 +35,25 @@ typedef boost::shared_ptr<noaa_hrpt_deframer> 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 */