diff options
Diffstat (limited to 'gr-noaa')
-rw-r--r-- | gr-noaa/grc/usrp_rx_hrpt.grc | 513 | ||||
-rwxr-xr-x | gr-noaa/grc/usrp_rx_hrpt.py | 35 | ||||
-rw-r--r-- | gr-noaa/lib/noaa_hrpt_sync_cc.cc | 31 | ||||
-rw-r--r-- | gr-noaa/lib/noaa_hrpt_sync_cc.h | 1 |
4 files changed, 281 insertions, 299 deletions
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 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Aug 29 11:48:56 2009</timestamp> + <timestamp>Sat Aug 29 13:16:19 2009</timestamp> <block> <key>options</key> <param> @@ -257,85 +257,56 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>variable</key> <param> <key>id</key> - <value>rx_fftsink</value> + <value>max_carrier_offset</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>RX Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>1698e6</value> - </param> - <param> - <key>y_per_div</key> - <value>5</value> - </param> - <param> - <key>y_divs</key> - <value>8</value> - </param> - <param> - <key>ref_level</key> - <value>20</value> + <key>value</key> + <value>2*math.pi*100e3/sample_rate</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>_coordinate</key> + <value>(668, 107)</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>peak_hold</key> - <value>False</value> + <key>id</key> + <value>max_sync_offset</value> </param> <param> - <key>average</key> + <key>_enabled</key> <value>True</value> </param> <param> - <key>avg_alpha</key> - <value>0.1</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 0</value> + <key>value</key> + <value>0.01</value> </param> <param> <key>_coordinate</key> - <value>(194, 263)</value> + <value>(665, 173)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>wxgui_scopesink2_0_0</value> </param> <param> <key>_enabled</key> @@ -347,7 +318,7 @@ </param> <param> <key>title</key> - <value>RX Waveform</value> + <value>Post-PLL</value> </param> <param> <key>samp_rate</key> @@ -355,7 +326,7 @@ </param> <param> <key>v_scale</key> - <value>0</value> + <value>0.5</value> </param> <param> <key>t_scale</key> @@ -375,15 +346,15 @@ </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, 0</value> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(198, 609)</value> + <value>(618, 335)</value> </param> <param> <key>_rotation</key> @@ -391,38 +362,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> @@ -430,10 +397,10 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_moving_average_xx_0</value> + <value>wxgui_scopesink2_0_0_0</value> </param> <param> <key>_enabled</key> @@ -444,66 +411,79 @@ <value>complex</value> </param> <param> - <key>length</key> - <value>hs</value> + <key>title</key> + <value>Post-PLL</value> </param> <param> - <key>scale</key> - <value>1.0/hs</value> + <key>samp_rate</key> + <value>sample_rate</value> </param> <param> - <key>max_iter</key> - <value>4000</value> + <key>v_scale</key> + <value>0.5</value> </param> <param> - <key>_coordinate</key> - <value>(434, 502)</value> + <key>t_scale</key> + <value>20.0/sample_rate</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>ac_couple</key> + <value>False</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>max_carrier_offset</value> + <key>xy_mode</key> + <value>True</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(668, 107)</value> + <value>(618, 614)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>variable</key> + <key>noaa_hrpt_sync_cc</key> <param> <key>id</key> - <value>max_sync_offset</value> + <value>sync</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>0.01</value> + <key>alpha</key> + <value>sync_alpha</value> + </param> + <param> + <key>beta</key> + <value>sync_alpha**2/4.0</value> + </param> + <param> + <key>sps</key> + <value>sps</value> + </param> + <param> + <key>max_offset</key> + <value>max_sync_offset</value> </param> <param> <key>_coordinate</key> - <value>(665, 173)</value> + <value>(865, 494)</value> </param> <param> <key>_rotation</key> @@ -511,140 +491,156 @@ </param> </block> <block> - <key>variable_slider</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>pll_alpha</value> + <value>wxgui_scopesink2_0_0_0_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>PLL Alpha</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>0.005</value> + <key>title</key> + <value>Post-SYNC</value> </param> <param> - <key>min</key> - <value>0.0</value> + <key>samp_rate</key> + <value>sym_rate</value> </param> <param> - <key>max</key> + <key>v_scale</key> <value>0.5</value> </param> <param> - <key>num_steps</key> - <value>500</value> + <key>t_scale</key> + <value>20.0/sym_rate</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>xy_mode</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> </param> <param> <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <value>1, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 2</value> </param> <param> <key>_coordinate</key> - <value>(192, 100)</value> + <value>(872, 607)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>variable_slider</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>wxgui_scopesink2_0_0_1</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>SYNC Alpha</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>0.005</value> + <key>title</key> + <value>Post-SYNC</value> </param> <param> - <key>min</key> - <value>0.0</value> + <key>samp_rate</key> + <value>sym_rate</value> </param> <param> - <key>max</key> + <key>v_scale</key> <value>0.5</value> </param> <param> - <key>num_steps</key> - <value>500</value> + <key>t_scale</key> + <value>20.0/sym_rate</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> </param> <param> <key>grid_pos</key> - <value>0, 1, 1, 1</value> + <value>0, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 2</value> </param> <param> <key>_coordinate</key> - <value>(344, 101)</value> + <value>(872, 341)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>noaa_hrpt_pll_cc</key> + <key>gr_agc_xx</key> <param> <key>id</key> - <value>noaa_hrpt_pll_cc_0</value> + <value>agr</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>pll_alpha</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> + <key>rate</key> + <value>1e-6</value> </param> <param> - <key>max_offset</key> - <value>max_carrier_offset</value> + <key>reference</key> + <value>1.0</value> + </param> + <param> + <key>gain</key> + <value>1.0</value> + </param> + <param> + <key>max_gain</key> + <value>1.0</value> </param> <param> <key>_coordinate</key> - <value>(628, 502)</value> + <value>(261, 494)</value> </param> <param> <key>_rotation</key> @@ -652,69 +648,41 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>noaa_hrpt_pll_cc</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0</value> + <value>noaa_hrpt_pll_cc_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</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> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> + <key>alpha</key> + <value>pll_alpha</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>beta</key> + <value>pll_alpha**2/4.0</value> </param> <param> - <key>notebook</key> - <value>displays, 1</value> + <key>max_offset</key> + <value>max_carrier_offset</value> </param> <param> <key>_coordinate</key> - <value>(618, 335)</value> + <value>(628, 502)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> + <value>rx_fftsink</value> </param> <param> <key>_enabled</key> @@ -726,78 +694,59 @@ </param> <param> <key>title</key> - <value>Post-SYNC</value> + <value>RX Spectrum</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> - </param> - <param> - <key>xy_mode</key> - <value>False</value> + <key>baseband_freq</key> + <value>1698e6</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>y_per_div</key> + <value>5</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>y_divs</key> + <value>8</value> </param> <param> - <key>notebook</key> - <value>displays, 2</value> + <key>ref_level</key> + <value>20</value> </param> <param> - <key>_coordinate</key> - <value>(872, 341)</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>_rotation</key> - <value>180</value> + <key>fft_rate</key> + <value>30</value> </param> - </block> - <block> - <key>notebook</key> <param> - <key>id</key> - <value>displays</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>_enabled</key> + <key>average</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>avg_alpha</key> + <value>0.1</value> </param> <param> <key>grid_pos</key> - <value>1, 0, 1, 2</value> + <value>0, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(9, 99)</value> + <value>(433, 297)</value> </param> <param> <key>_rotation</key> @@ -808,7 +757,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0</value> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> @@ -820,7 +769,7 @@ </param> <param> <key>title</key> - <value>Post-PLL</value> + <value>RX Waveform</value> </param> <param> <key>samp_rate</key> @@ -828,7 +777,7 @@ </param> <param> <key>v_scale</key> - <value>0.5</value> + <value>0</value> </param> <param> <key>t_scale</key> @@ -840,7 +789,7 @@ </param> <param> <key>xy_mode</key> - <value>True</value> + <value>False</value> </param> <param> <key>num_inputs</key> @@ -852,46 +801,66 @@ </param> <param> <key>notebook</key> - <value>displays, 1</value> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(618, 614)</value> + <value>(434, 603)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>noaa_hrpt_sync_cc</key> + <key>variable_slider</key> <param> <key>id</key> - <value>sync</value> + <value>pll_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> + <key>label</key> + <value>PLL Alpha</value> </param> <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> + <key>value</key> + <value>0.001</value> </param> <param> - <key>sps</key> - <value>sps</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <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, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(865, 494)</value> + <value>(192, 100)</value> </param> <param> <key>_rotation</key> @@ -899,62 +868,58 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>variable_slider</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0_0</value> + <value>sync_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value>SYNC Alpha</value> </param> <param> - <key>title</key> - <value>Post-SYNC</value> + <key>value</key> + <value>0.001</value> </param> <param> - <key>samp_rate</key> - <value>sample_rate</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>v_scale</key> + <key>max</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> + <key>num_steps</key> + <value>500</value> </param> <param> - <key>xy_mode</key> - <value>True</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>converver</key> + <value>float_converter</value> </param> <param> <key>grid_pos</key> - <value>1, 0, 1, 1</value> + <value>0, 1, 1, 1</value> </param> <param> <key>notebook</key> - <value>displays, 2</value> + <value></value> </param> <param> <key>_coordinate</key> - <value>(872, 607)</value> + <value>(344, 101)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <connection> @@ -971,12 +936,6 @@ </connection> <connection> <source_block_id>agr</source_block_id> - <sink_block_id>gr_moving_average_xx_0</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> @@ -988,12 +947,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>noaa_hrpt_pll_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>noaa_hrpt_pll_cc_0</source_block_id> <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> <source_key>0</source_key> @@ -1023,4 +976,10 @@ <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_cc_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> 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 <noaa_hrpt_sync_cc.h> #include <gr_io_signature.h> +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, |