diff options
author | Johnathan Corgan | 2009-10-31 09:28:44 -0700 |
---|---|---|
committer | Johnathan Corgan | 2009-11-01 19:45:34 -0800 |
commit | ae5b4ed2ce8c4a0903eea1b264da5393a179c9fe (patch) | |
tree | 73e40e054dbc3fd063b2ce2edcb01e937c333717 /gr-noaa/apps | |
parent | edf412a8ef283d08135a1c5f9c1b4f51b771ec37 (diff) | |
download | gnuradio-ae5b4ed2ce8c4a0903eea1b264da5393a179c9fe.tar.gz gnuradio-ae5b4ed2ce8c4a0903eea1b264da5393a179c9fe.tar.bz2 gnuradio-ae5b4ed2ce8c4a0903eea1b264da5393a179c9fe.zip |
gr-noaa: Switched to 'double rate BPSK' HRPT synchronization
Added hrpt_bit_sync block
Using MM clock sync at double data rate
Created file_rx_hrpt GRC app
Updated demod_rx_hrpt GRC app
Updated usrp_rx_hrpt GRC
Updated usrp_rx_hrpt_nogui app
Deleted usrp_rx_hrpt2 GRC app
Deleted hrpt_sync_fb block
Diffstat (limited to 'gr-noaa/apps')
-rw-r--r-- | gr-noaa/apps/.gitignore | 1 | ||||
-rw-r--r-- | gr-noaa/apps/Makefile.am | 4 | ||||
-rw-r--r-- | gr-noaa/apps/demod_hrpt_file.grc | 491 | ||||
-rwxr-xr-x | gr-noaa/apps/demod_hrpt_file.py | 110 | ||||
-rw-r--r-- | gr-noaa/apps/file_rx_hrpt.grc (renamed from gr-noaa/apps/usrp_rx_hrpt2.grc) | 1024 | ||||
-rwxr-xr-x | gr-noaa/apps/file_rx_hrpt.py | 309 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt.cfg | 13 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt.grc | 702 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt.py | 289 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt2.py | 401 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt_nogui.grc | 335 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt_nogui.py | 191 |
12 files changed, 1864 insertions, 2006 deletions
diff --git a/gr-noaa/apps/.gitignore b/gr-noaa/apps/.gitignore index 773a6df9b..6bd1ab995 100644 --- a/gr-noaa/apps/.gitignore +++ b/gr-noaa/apps/.gitignore @@ -1 +1,2 @@ *.dat +*.txt
\ No newline at end of file diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index b9787a92c..961b09afa 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -25,15 +25,15 @@ if PYTHON dist_bin_SCRIPTS = \ demod_hrpt_file.py \ + file_rx_hrpt.py \ usrp_rx_hrpt.py \ - usrp_rx_hrpt2.py \ usrp_rx_hrpt_nogui.py \ usrp_rx_lrit.py EXTRA_DIST = \ + file_rx_hrpt.grc \ demod_hrpt_file.grc \ usrp_rx_hrpt.grc \ - usrp_rx_hrpt2.grc \ usrp_rx_hrpt_nogui.grc \ usrp_rx_lrit.grc endif diff --git a/gr-noaa/apps/demod_hrpt_file.grc b/gr-noaa/apps/demod_hrpt_file.grc index 7a0bbe892..a5df8786f 100644 --- a/gr-noaa/apps/demod_hrpt_file.grc +++ b/gr-noaa/apps/demod_hrpt_file.grc @@ -1,23 +1,55 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Oct 4 08:40:03 2009</timestamp> + <timestamp>Sun Nov 1 18:39:07 2009</timestamp> <block> - <key>variable</key> + <key>options</key> <param> <key>id</key> - <value>max_sync_offset</value> + <value>demod_hrpt_file</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>0.01</value> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>4096,4096</value> + </param> + <param> + <key>generate_options</key> + <value>no_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>run</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(705, 19)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -51,7 +83,7 @@ <key>variable</key> <param> <key>id</key> - <value>hs</value> + <value>sym_rate</value> </param> <param> <key>_enabled</key> @@ -59,11 +91,11 @@ </param> <param> <key>value</key> - <value>int(sps/2.0)</value> + <value>600*1109</value> </param> <param> <key>_coordinate</key> - <value>(499, 19)</value> + <value>(301, 19)</value> </param> <param> <key>_rotation</key> @@ -97,7 +129,7 @@ <key>variable</key> <param> <key>id</key> - <value>sym_rate</value> + <value>hs</value> </param> <param> <key>_enabled</key> @@ -105,11 +137,11 @@ </param> <param> <key>value</key> - <value>600*1109</value> + <value>int(sps/2.0)</value> </param> <param> <key>_coordinate</key> - <value>(301, 19)</value> + <value>(499, 19)</value> </param> <param> <key>_rotation</key> @@ -140,34 +172,45 @@ </param> </block> <block> - <key>parameter</key> + <key>variable</key> <param> <key>id</key> - <value>filename</value> + <value>max_clock_offset</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Filename</value> + <key>value</key> + <value>0.1</value> </param> <param> - <key>value</key> - <value>usrp.dat</value> + <key>_coordinate</key> + <value>(710, 17)</value> </param> <param> - <key>type</key> - <value>string</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>import</key> <param> - <key>short_id</key> - <value>F</value> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import math, os</value> </param> <param> <key>_coordinate</key> - <value>(200, 101)</value> + <value>(11, 103)</value> </param> <param> <key>_rotation</key> @@ -178,7 +221,7 @@ <key>parameter</key> <param> <key>id</key> - <value>output</value> + <value>decim</value> </param> <param> <key>_enabled</key> @@ -186,23 +229,23 @@ </param> <param> <key>label</key> - <value>Output</value> + <value>decim</value> </param> <param> <key>value</key> - <value>frames.dat</value> + <value>16</value> </param> <param> <key>type</key> - <value>string</value> + <value>intx</value> </param> <param> <key>short_id</key> - <value>o</value> + <value>d</value> </param> <param> <key>_coordinate</key> - <value>(302, 101)</value> + <value>(202, 102)</value> </param> <param> <key>_rotation</key> @@ -210,45 +253,34 @@ </param> </block> <block> - <key>gr_float_to_complex</key> + <key>parameter</key> <param> <key>id</key> - <value>f2c</value> + <value>pll_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(832, 363)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <key>label</key> + <value>pll_alpha</value> </param> - </block> - <block> - <key>virtual_sink</key> <param> - <key>id</key> - <value>samples_sink</value> + <key>value</key> + <value>0.05</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>type</key> + <value>eng_float</value> </param> <param> - <key>stream_id</key> - <value>samples</value> + <key>short_id</key> + <value>p</value> </param> <param> <key>_coordinate</key> - <value>(1070, 376)</value> + <value>(294, 101)</value> </param> <param> <key>_rotation</key> @@ -256,34 +288,34 @@ </param> </block> <block> - <key>noaa_hrpt_sync_fb</key> + <key>parameter</key> <param> <key>id</key> - <value>sync</value> + <value>clock_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> + <key>label</key> + <value>clock_alpha</value> </param> <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> + <key>value</key> + <value>0.05</value> </param> <param> - <key>sps</key> - <value>sps</value> + <key>type</key> + <value>eng_float</value> </param> <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <key>short_id</key> + <value>a</value> </param> <param> <key>_coordinate</key> - <value>(813, 455)</value> + <value>(395, 101)</value> </param> <param> <key>_rotation</key> @@ -291,49 +323,34 @@ </param> </block> <block> - <key>noaa_hrpt_deframer</key> + <key>parameter</key> <param> <key>id</key> - <value>deframer</value> + <value>sync_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1037, 483)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>file_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>label</key> + <value>sync_alpha</value> </param> <param> - <key>file</key> - <value>output</value> + <key>value</key> + <value>0.05</value> </param> <param> <key>type</key> - <value>short</value> + <value>eng_float</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>short_id</key> + <value>s</value> </param> <param> <key>_coordinate</key> - <value>(1238, 479)</value> + <value>(508, 102)</value> </param> <param> <key>_rotation</key> @@ -341,49 +358,34 @@ </param> </block> <block> - <key>noaa_hrpt_decoder</key> + <key>parameter</key> <param> <key>id</key> - <value>decoder</value> + <value>input_filename</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1237, 542)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_deinterleave</key> - <param> - <key>id</key> - <value>deinterleave</value> + <key>label</key> + <value>input_filename</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>value</key> + <value>usrp.dat</value> </param> <param> <key>type</key> - <value>float</value> - </param> - <param> - <key>num_streams</key> - <value>2</value> + <value>string</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>short_id</key> + <value>F</value> </param> <param> <key>_coordinate</key> - <value>(628, 363)</value> + <value>(618, 102)</value> </param> <param> <key>_rotation</key> @@ -394,7 +396,7 @@ <key>parameter</key> <param> <key>id</key> - <value>decim</value> + <value>output_filename</value> </param> <param> <key>_enabled</key> @@ -402,58 +404,58 @@ </param> <param> <key>label</key> - <value>Decimation</value> + <value>output_filename</value> </param> <param> <key>value</key> - <value>16</value> + <value>frames.dat</value> </param> <param> <key>type</key> - <value>intx</value> + <value>string</value> </param> <param> <key>short_id</key> - <value>d</value> + <value>o</value> </param> <param> <key>_coordinate</key> - <value>(415, 101)</value> + <value>(726, 102)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>parameter</key> + <key>gr_file_source</key> <param> <key>id</key> - <value>pll_alpha</value> + <value>file_source</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value></value> + <key>file</key> + <value>input_filename</value> </param> <param> - <key>value</key> - <value>0.05</value> + <key>type</key> + <value>short</value> </param> <param> - <key>type</key> - <value>eng_float</value> + <key>repeat</key> + <value>False</value> </param> <param> - <key>short_id</key> - <value>p</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(527, 101)</value> + <value>(62, 306)</value> </param> <param> <key>_rotation</key> @@ -461,34 +463,57 @@ </param> </block> <block> - <key>parameter</key> + <key>gr_interleaved_short_to_complex</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>cs2cf</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value></value> + <key>_coordinate</key> + <value>(297, 318)</value> </param> <param> - <key>value</key> - <value>0.05</value> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_agc_xx</key> + <param> + <key>id</key> + <value>agc</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> </param> <param> <key>type</key> - <value>eng_float</value> + <value>complex</value> </param> <param> - <key>short_id</key> - <value>s</value> + <key>rate</key> + <value>1e-5</value> + </param> + <param> + <key>reference</key> + <value>1.0</value> + </param> + <param> + <key>gain</key> + <value>1.0/32768.0</value> + </param> + <param> + <key>max_gain</key> + <value>1.0</value> </param> <param> <key>_coordinate</key> - <value>(615, 99)</value> + <value>(538, 290)</value> </param> <param> <key>_rotation</key> @@ -519,7 +544,7 @@ </param> <param> <key>_coordinate</key> - <value>(606, 463)</value> + <value>(720, 297)</value> </param> <param> <key>_rotation</key> @@ -527,41 +552,34 @@ </param> </block> <block> - <key>virtual_source</key> + <key>gr_moving_average_xx</key> <param> <key>id</key> - <value>samples_source</value> + <value>gr_moving_average_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>stream_id</key> - <value>samples</value> - </param> - <param> - <key>_coordinate</key> - <value>(164, 479)</value> + <key>type</key> + <value>float</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>length</key> + <value>hs</value> </param> - </block> - <block> - <key>gr_short_to_float</key> <param> - <key>id</key> - <value>s2f</value> + <key>scale</key> + <value>1.0/hs</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>max_iter</key> + <value>4000</value> </param> <param> <key>_coordinate</key> - <value>(365, 380)</value> + <value>(949, 297)</value> </param> <param> <key>_rotation</key> @@ -569,34 +587,42 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>gr_clock_recovery_mm_xx</key> <param> <key>id</key> - <value>file_source</value> + <value>gr_clock_recovery_mm_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>file</key> - <value>filename</value> + <key>type</key> + <value>float</value> </param> <param> - <key>type</key> - <value>short</value> + <key>omega</key> + <value>sps/2.0</value> </param> <param> - <key>repeat</key> - <value>False</value> + <key>gain_omega</key> + <value>clock_alpha**2/4.0</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>gain_mu</key> + <value>clock_alpha</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>max_clock_offset</value> </param> <param> <key>_coordinate</key> - <value>(162, 368)</value> + <value>(1158, 281)</value> </param> <param> <key>_rotation</key> @@ -604,22 +630,18 @@ </param> </block> <block> - <key>variable</key> + <key>gr_binary_slicer_fb</key> <param> <key>id</key> - <value>mf_taps</value> + <value>gr_binary_slicer_fb_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>[-0.5/hs,]*hs+[0.5/hs,]*hs</value> - </param> - <param> <key>_coordinate</key> - <value>(829, 21)</value> + <value>(112, 537)</value> </param> <param> <key>_rotation</key> @@ -627,30 +649,30 @@ </param> </block> <block> - <key>gr_fir_filter_xxx</key> + <key>gr_file_sink</key> <param> <key>id</key> - <value>gr_fir_filter_xxx_0</value> + <value>gr_file_sink_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>ccc</value> + <key>file</key> + <value>output_filename</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>type</key> + <value>short</value> </param> <param> - <key>taps</key> - <value>mf_taps</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(359, 471)</value> + <value>(732, 615)</value> </param> <param> <key>_rotation</key> @@ -658,22 +680,18 @@ </param> </block> <block> - <key>import</key> + <key>noaa_hrpt_decoder</key> <param> <key>id</key> - <value>import_0</value> + <value>noaa_hrpt_decoder_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> - </param> - <param> <key>_coordinate</key> - <value>(11, 111)</value> + <value>(730, 537)</value> </param> <param> <key>_rotation</key> @@ -681,54 +699,37 @@ </param> </block> <block> - <key>options</key> + <key>noaa_hrpt_bit_sync</key> <param> <key>id</key> - <value>demod_hrpt_file</value> + <value>noaa_hrpt_bit_sync_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>title</key> - <value>USRP HRPT Receiver</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> + <key>_coordinate</key> + <value>(330, 537)</value> </param> <param> - <key>category</key> - <value>Custom</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>noaa_hrpt_deframer</key> <param> - <key>run_options</key> - <value>run</value> + <key>id</key> + <value>noaa_hrpt_deframer_0</value> </param> <param> - <key>run</key> + <key>_enabled</key> <value>True</value> </param> <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(536, 537)</value> </param> <param> <key>_rotation</key> @@ -736,68 +737,62 @@ </param> </block> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>file_sink</sink_block_id> + <source_block_id>file_source</source_block_id> + <sink_block_id>cs2cf</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>sync</source_block_id> - <sink_block_id>deframer</sink_block_id> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>gr_binary_slicer_fb_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>sync</sink_block_id> + <source_block_id>gr_moving_average_xx_0</source_block_id> + <sink_block_id>gr_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>deinterleave</source_block_id> - <sink_block_id>f2c</sink_block_id> - <source_key>1</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>deinterleave</source_block_id> - <sink_block_id>f2c</sink_block_id> + <source_block_id>pll</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>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> + <source_block_id>gr_binary_slicer_fb_0</source_block_id> + <sink_block_id>noaa_hrpt_bit_sync_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>f2c</source_block_id> - <sink_block_id>samples_sink</sink_block_id> + <source_block_id>cs2cf</source_block_id> + <sink_block_id>agc</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_fir_filter_xxx_0</source_block_id> + <source_block_id>agc</source_block_id> <sink_block_id>pll</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>samples_source</source_block_id> - <sink_block_id>gr_fir_filter_xxx_0</sink_block_id> + <source_block_id>noaa_hrpt_deframer_0</source_block_id> + <sink_block_id>gr_file_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>s2f</source_block_id> - <sink_block_id>deinterleave</sink_block_id> + <source_block_id>noaa_hrpt_deframer_0</source_block_id> + <sink_block_id>noaa_hrpt_decoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>file_source</source_block_id> - <sink_block_id>s2f</sink_block_id> + <source_block_id>noaa_hrpt_bit_sync_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> diff --git a/gr-noaa/apps/demod_hrpt_file.py b/gr-noaa/apps/demod_hrpt_file.py index d55351868..846723185 100755 --- a/gr-noaa/apps/demod_hrpt_file.py +++ b/gr-noaa/apps/demod_hrpt_file.py @@ -1,8 +1,8 @@ #!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Sun Oct 4 08:40:03 2009 +# Title: Demod Hrpt File +# Generated: Sun Nov 1 18:39:07 2009 ################################################## from gnuradio import eng_notation @@ -11,21 +11,22 @@ from gnuradio import noaa from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from optparse import OptionParser -import math +import math, os class demod_hrpt_file(gr.top_block): - def __init__(self, filename="usrp.dat", output="frames.dat", decim=16, pll_alpha=0.05, sync_alpha=0.05): - gr.top_block.__init__(self, "USRP HRPT Receiver") + def __init__(self, decim=16, pll_alpha=0.05, clock_alpha=0.05, sync_alpha=0.05, input_filename="usrp.dat", output_filename="frames.dat"): + gr.top_block.__init__(self, "Demod Hrpt File") ################################################## # Parameters ################################################## - self.filename = filename - self.output = output self.decim = decim self.pll_alpha = pll_alpha + self.clock_alpha = clock_alpha self.sync_alpha = sync_alpha + self.input_filename = input_filename + self.output_filename = output_filename ################################################## # Variables @@ -33,44 +34,38 @@ class demod_hrpt_file(gr.top_block): self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.hs = hs = int(sps/2.0) - self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs,]*hs - self.max_sync_offset = max_sync_offset = 0.01 + self.max_clock_offset = max_clock_offset = 0.1 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) ################################################## # Blocks ################################################## - self.decoder = noaa.hrpt_decoder() - self.deframer = noaa.hrpt_deframer() - self.deinterleave = gr.deinterleave(gr.sizeof_float*1) - self.f2c = gr.float_to_complex(1) - self.file_sink = gr.file_sink(gr.sizeof_short*1, output) - self.file_source = gr.file_source(gr.sizeof_short*1, filename, False) - self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) + self.agc = gr.agc_cc(1e-5, 1.0, 1.0/32768.0, 1.0) + self.cs2cf = gr.interleaved_short_to_complex() + self.file_source = gr.file_source(gr.sizeof_short*1, input_filename, False) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.gr_file_sink_0 = gr.file_sink(gr.sizeof_short*1, output_filename) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.noaa_hrpt_bit_sync_0 = noaa.hrpt_bit_sync() + self.noaa_hrpt_decoder_0 = noaa.hrpt_decoder() + self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer() self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.s2f = gr.short_to_float() - self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) ################################################## # Connections ################################################## - self.connect((self.deframer, 0), (self.file_sink, 0)) - self.connect((self.sync, 0), (self.deframer, 0)) - self.connect((self.pll, 0), (self.sync, 0)) - self.connect((self.deinterleave, 1), (self.f2c, 1)) - self.connect((self.deinterleave, 0), (self.f2c, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) - self.connect((self.f2c, 0), (self.gr_fir_filter_xxx_0, 0)) - self.connect((self.s2f, 0), (self.deinterleave, 0)) - self.connect((self.file_source, 0), (self.s2f, 0)) - - def set_filename(self, filename): - self.filename = filename - - def set_output(self, output): - self.output = output + self.connect((self.file_source, 0), (self.cs2cf, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.gr_binary_slicer_fb_0, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.noaa_hrpt_bit_sync_0, 0)) + self.connect((self.cs2cf, 0), (self.agc, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.noaa_hrpt_deframer_0, 0), (self.noaa_hrpt_decoder_0, 0)) + self.connect((self.noaa_hrpt_bit_sync_0, 0), (self.noaa_hrpt_deframer_0, 0)) def set_decim(self, decim): self.decim = decim @@ -81,10 +76,19 @@ class demod_hrpt_file(gr.top_block): self.pll.set_alpha(self.pll_alpha) self.pll.set_beta(self.pll_alpha**2/4.0) + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self.gr_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + def set_sync_alpha(self, sync_alpha): self.sync_alpha = sync_alpha - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) + + def set_input_filename(self, input_filename): + self.input_filename = input_filename + + def set_output_filename(self, output_filename): + self.output_filename = output_filename def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate @@ -98,36 +102,34 @@ class demod_hrpt_file(gr.top_block): def set_sps(self, sps): self.sps = sps self.set_hs(int(self.sps/2.0)) + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) - def set_hs(self, hs): - self.hs = hs - self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs,]*self.hs) - - def set_mf_taps(self, mf_taps): - self.mf_taps = mf_taps - self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset self.pll.set_max_offset(self.max_carrier_offset) + def set_hs(self, hs): + self.hs = hs + self.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]") - parser.add_option("-F", "--filename", dest="filename", type="string", default="usrp.dat", - help="Set Filename [default=%default]") - parser.add_option("-o", "--output", dest="output", type="string", default="frames.dat", - help="Set Output [default=%default]") parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, - help="Set Decimation [default=%default]") + help="Set decim [default=%default]") parser.add_option("-p", "--pll-alpha", dest="pll_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), help="Set pll_alpha [default=%default]") + parser.add_option("-a", "--clock-alpha", dest="clock_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), + help="Set clock_alpha [default=%default]") parser.add_option("-s", "--sync-alpha", dest="sync_alpha", type="eng_float", default=eng_notation.num_to_str(0.05), help="Set sync_alpha [default=%default]") + parser.add_option("-F", "--input-filename", dest="input_filename", type="string", default="usrp.dat", + help="Set usrp.dat [default=%default]") + parser.add_option("-o", "--output-filename", dest="output_filename", type="string", default="frames.dat", + help="Set frames.dat [default=%default]") (options, args) = parser.parse_args() - tb = demod_hrpt_file(filename=options.filename, output=options.output, decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha) + tb = demod_hrpt_file(decim=options.decim, pll_alpha=options.pll_alpha, clock_alpha=options.clock_alpha, sync_alpha=options.sync_alpha, input_filename=options.input_filename, output_filename=options.output_filename) tb.run() diff --git a/gr-noaa/apps/usrp_rx_hrpt2.grc b/gr-noaa/apps/file_rx_hrpt.grc index d42a9eab6..fea53f800 100644 --- a/gr-noaa/apps/usrp_rx_hrpt2.grc +++ b/gr-noaa/apps/file_rx_hrpt.grc @@ -1,6 +1,61 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Sep 27 13:32:47 2009</timestamp> + <timestamp>Sun Nov 1 19:26:11 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>file_rx_hrpt</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>USRP HRPT Receiver</value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>4096,4096</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>run</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <block> <key>variable</key> <param> @@ -117,54 +172,22 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>gain</value> + <value>max_clock_offset</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>RX Gain</value> - </param> - <param> <key>value</key> - <value>saved_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>100</value> - </param> - <param> - <key>num_steps</key> - <value>100</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> + <value>0.1</value> </param> <param> <key>_coordinate</key> - <value>(340, 106)</value> + <value>(705, 19)</value> </param> <param> <key>_rotation</key> @@ -172,42 +195,42 @@ </param> </block> <block> - <key>variable_text_box</key> + <key>variable_config</key> <param> <key>id</key> - <value>freq</value> + <value>side</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Frequency</value> + <key>value</key> + <value>'A'</value> </param> <param> - <key>value</key> - <value>saved_freq</value> + <key>type</key> + <value>string</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>section</key> + <value>'usrp_rx_hrpt'</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>option</key> + <value>'side'</value> </param> <param> - <key>notebook</key> - <value></value> + <key>writeback</key> + <value>side</value> </param> <param> <key>_coordinate</key> - <value>(199, 106)</value> + <value>(194, 253)</value> </param> <param> <key>_rotation</key> @@ -215,54 +238,18 @@ </param> </block> <block> - <key>variable_slider</key> + <key>noaa_hrpt_deframer</key> <param> <key>id</key> - <value>pll_alpha</value> + <value>deframer</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>PLL Alpha</value> - </param> - <param> - <key>value</key> - <value>saved_pll_alpha</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>100</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, 2, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> <key>_coordinate</key> - <value>(479, 106)</value> + <value>(762, 975)</value> </param> <param> <key>_rotation</key> @@ -270,54 +257,30 @@ </param> </block> <block> - <key>variable_slider</key> + <key>gr_file_sink</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>frame_sink</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>SYNC Alpha</value> - </param> - <param> - <key>value</key> - <value>saved_sync_alpha</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>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> + <key>file</key> + <value>output_filename</value> </param> <param> - <key>grid_pos</key> - <value>0, 3, 1, 1</value> + <key>type</key> + <value>short</value> </param> <param> - <key>notebook</key> - <value></value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(618, 106)</value> + <value>(973, 1024)</value> </param> <param> <key>_rotation</key> @@ -325,42 +288,18 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>noaa_hrpt_bit_sync</key> <param> <key>id</key> - <value>side_text</value> + <value>noaa_hrpt_bit_sync_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>USRP Side</value> - </param> - <param> - <key>value</key> - <value>side</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> <key>_coordinate</key> - <value>(828, 20)</value> + <value>(571, 975)</value> </param> <param> <key>_rotation</key> @@ -368,42 +307,41 @@ </param> </block> <block> - <key>variable_config</key> + <key>gr_binary_slicer_fb</key> <param> <key>id</key> - <value>side</value> + <value>gr_binary_slicer_fb_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>'A'</value> - </param> - <param> - <key>type</key> - <value>string</value> + <key>_coordinate</key> + <value>(393, 975)</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>virtual_source</key> <param> - <key>section</key> - <value>'usrp'</value> + <key>id</key> + <value>virtual_source_0</value> </param> <param> - <key>option</key> - <value>'side'</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>writeback</key> - <value>side</value> + <key>stream_id</key> + <value>baseband</value> </param> <param> <key>_coordinate</key> - <value>(194, 253)</value> + <value>(173, 971)</value> </param> <param> <key>_rotation</key> @@ -411,128 +349,109 @@ </param> </block> <block> - <key>variable_config</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>decim</value> + <value>demod_scope</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>16</value> - </param> - <param> <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp'</value> + <value>float</value> </param> <param> - <key>option</key> - <value>'decim'</value> + <key>title</key> + <value>Post-Demod</value> </param> <param> - <key>writeback</key> - <value>decim</value> + <key>samp_rate</key> + <value>sym_rate*2.0</value> </param> <param> - <key>_coordinate</key> - <value>(351, 255)</value> + <key>v_scale</key> + <value>0.5</value> </param> <param> - <key>_rotation</key> + <key>v_offset</key> <value>0</value> </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_freq</value> - </param> <param> - <key>_enabled</key> - <value>True</value> + <key>t_scale</key> + <value>10.0/sym_rate</value> </param> <param> - <key>value</key> - <value>1698e6</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>type</key> - <value>real</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>section</key> - <value>'usrp'</value> + <key>win_size</key> + <value></value> </param> <param> - <key>option</key> - <value>'freq'</value> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> </param> <param> - <key>writeback</key> - <value>freq</value> + <key>notebook</key> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(507, 258)</value> + <value>(666, 542)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>variable_config</key> + <key>gr_clock_recovery_mm_xx</key> <param> <key>id</key> - <value>saved_gain</value> + <value>gr_clock_recovery_mm_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>35</value> + <key>type</key> + <value>float</value> </param> <param> - <key>type</key> - <value>real</value> + <key>omega</key> + <value>sps/2.0</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>gain_omega</key> + <value>clock_alpha**2/4.0</value> </param> <param> - <key>section</key> - <value>'usrp'</value> + <key>mu</key> + <value>0.5</value> </param> <param> - <key>option</key> - <value>'gain'</value> + <key>gain_mu</key> + <value>clock_alpha</value> </param> <param> - <key>writeback</key> - <value>gain</value> + <key>omega_relative_limit</key> + <value>max_clock_offset</value> </param> <param> <key>_coordinate</key> - <value>(664, 259)</value> + <value>(873, 696)</value> </param> <param> <key>_rotation</key> @@ -540,42 +459,34 @@ </param> </block> <block> - <key>variable_config</key> + <key>gr_moving_average_xx</key> <param> <key>id</key> - <value>saved_pll_alpha</value> + <value>gr_moving_average_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>0.05</value> - </param> - <param> <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> + <value>float</value> </param> <param> - <key>section</key> - <value>'demod'</value> + <key>length</key> + <value>hs</value> </param> <param> - <key>option</key> - <value>'pll_alpha'</value> + <key>scale</key> + <value>1.0/hs</value> </param> <param> - <key>writeback</key> - <value>pll_alpha</value> + <key>max_iter</key> + <value>4000</value> </param> <param> <key>_coordinate</key> - <value>(823, 258)</value> + <value>(682, 713)</value> </param> <param> <key>_rotation</key> @@ -583,42 +494,30 @@ </param> </block> <block> - <key>variable_config</key> + <key>noaa_hrpt_pll_cf</key> <param> <key>id</key> - <value>saved_sync_alpha</value> + <value>pll</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>0.05</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'demod'</value> + <key>alpha</key> + <value>pll_alpha</value> </param> <param> - <key>option</key> - <value>'sync_alpha'</value> + <key>beta</key> + <value>pll_alpha**2/4.0</value> </param> <param> - <key>writeback</key> - <value>sync_alpha</value> + <key>max_offset</key> + <value>max_carrier_offset</value> </param> <param> <key>_coordinate</key> - <value>(981, 258)</value> + <value>(469, 713)</value> </param> <param> <key>_rotation</key> @@ -626,42 +525,41 @@ </param> </block> <block> - <key>variable_config</key> + <key>virtual_sink</key> <param> <key>id</key> - <value>output_filename</value> + <value>virtual_sink_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>'frames.dat'</value> - </param> - <param> - <key>type</key> - <value>string</value> + <key>stream_id</key> + <value>baseband</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>_coordinate</key> + <value>(1142, 728)</value> </param> <param> - <key>section</key> - <value>'output'</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>noaa_hrpt_decoder</key> <param> - <key>option</key> - <value>'filename'</value> + <key>id</key> + <value>decoder</value> </param> <param> - <key>writeback</key> - <value>output_filename</value> + <key>_enabled</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(1139, 259)</value> + <value>(974, 925)</value> </param> <param> <key>_rotation</key> @@ -669,42 +567,22 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>variable</key> <param> <key>id</key> - <value>decim_text</value> + <value>config_filename</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Decimation</value> - </param> - <param> <key>value</key> - <value>decim</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 1, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> + <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> </param> <param> <key>_coordinate</key> - <value>(973, 20)</value> + <value>(13, 159)</value> </param> <param> <key>_rotation</key> @@ -712,22 +590,22 @@ </param> </block> <block> - <key>variable</key> + <key>import</key> <param> <key>id</key> - <value>max_sync_offset</value> + <value>import_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>0.01</value> + <key>import</key> + <value>import math, os</value> </param> <param> <key>_coordinate</key> - <value>(705, 19)</value> + <value>(11, 110)</value> </param> <param> <key>_rotation</key> @@ -735,22 +613,38 @@ </param> </block> <block> - <key>variable</key> + <key>gr_agc_xx</key> <param> <key>id</key> - <value>config_filename</value> + <value>agc</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>'usrp_rx_hrpt.cfg'</value> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>rate</key> + <value>1e-6</value> + </param> + <param> + <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>(12, 160)</value> + <value>(301, 705)</value> </param> <param> <key>_rotation</key> @@ -758,22 +652,18 @@ </param> </block> <block> - <key>import</key> + <key>gr_interleaved_short_to_complex</key> <param> <key>id</key> - <value>import_0</value> + <value>gr_interleaved_short_to_complex_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> - </param> - <param> <key>_coordinate</key> - <value>(11, 102)</value> + <value>(73, 733)</value> </param> <param> <key>_rotation</key> @@ -781,65 +671,65 @@ </param> </block> <block> - <key>noaa_hrpt_pll_cf</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>pll</value> + <value>throttle</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>pll_alpha</value> + <key>type</key> + <value>short</value> </param> <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> + <key>samples_per_second</key> + <value>sample_rate</value> </param> <param> - <key>max_offset</key> - <value>max_carrier_offset</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(664, 809)</value> + <value>(75, 679)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>noaa_hrpt_sync_fb</key> + <key>gr_file_source</key> <param> <key>id</key> - <value>sync</value> + <value>gr_file_source_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> + <key>file</key> + <value>input_filename</value> </param> <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> + <key>type</key> + <value>short</value> </param> <param> - <key>sps</key> - <value>sps</value> + <key>repeat</key> + <value>False</value> </param> <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(865, 801)</value> + <value>(76, 613)</value> </param> <param> <key>_rotation</key> @@ -847,30 +737,34 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>parameter</key> <param> <key>id</key> - <value>frame_sink</value> + <value>input_filename</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>file</key> - <value>output_filename</value> + <key>label</key> + <value>input_filename</value> + </param> + <param> + <key>value</key> + <value>'usrp.dat'</value> </param> <param> <key>type</key> - <value>short</value> + <value>string</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>short_id</key> + <value>F</value> </param> <param> <key>_coordinate</key> - <value>(1283, 937)</value> + <value>(198, 107)</value> </param> <param> <key>_rotation</key> @@ -878,37 +772,34 @@ </param> </block> <block> - <key>noaa_hrpt_deframer</key> + <key>parameter</key> <param> <key>id</key> - <value>deframer</value> + <value>decim</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1091, 829)</value> + <key>label</key> + <value>decim</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>value</key> + <value>16</value> </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> <param> - <key>id</key> - <value>decoder</value> + <key>type</key> + <value>intx</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>short_id</key> + <value>d</value> </param> <param> <key>_coordinate</key> - <value>(1281, 829)</value> + <value>(308, 107)</value> </param> <param> <key>_rotation</key> @@ -916,50 +807,46 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>variable_slider</key> <param> <key>id</key> - <value>pll_scope</value> + <value>pll_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>label</key> + <value>PLL Alpha</value> </param> <param> - <key>title</key> - <value>Demod Waveform</value> + <key>value</key> + <value>saved_pll_alpha</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>100</value> </param> <param> - <key>xy_mode</key> - <value>False</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>2,0,1,4</value> + <value>0, 0, 1, 1</value> </param> <param> <key>notebook</key> @@ -967,77 +854,62 @@ </param> <param> <key>_coordinate</key> - <value>(631, 632)</value> + <value>(397, 108)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>gr_agc_xx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>agc</value> + <value>clock_alpha</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> - </param> - <param> - <key>reference</key> - <value>1.0</value> - </param> - <param> - <key>gain</key> - <value>1.0</value> + <key>label</key> + <value>Clock Alpha</value> </param> <param> - <key>max_gain</key> - <value>1.0</value> + <key>value</key> + <value>saved_clock_alpha</value> </param> <param> - <key>_coordinate</key> - <value>(269, 801)</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>max</key> + <value>0.5</value> </param> - </block> - <block> - <key>gr_fir_filter_xxx</key> <param> - <key>id</key> - <value>gr_fir_filter_xxx_0</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>type</key> - <value>ccc</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>grid_pos</key> + <value>0, 1, 1, 1</value> </param> <param> - <key>taps</key> - <value>mf_taps</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(418, 817)</value> + <value>(539, 105)</value> </param> <param> <key>_rotation</key> @@ -1045,10 +917,10 @@ </param> </block> <block> - <key>variable</key> + <key>variable_config</key> <param> <key>id</key> - <value>mf_taps</value> + <value>saved_pll_alpha</value> </param> <param> <key>_enabled</key> @@ -1056,46 +928,31 @@ </param> <param> <key>value</key> - <value>[-0.5/hs,]*hs+[0.5/hs,]*hs</value> - </param> - <param> - <key>_coordinate</key> - <value>(830, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_source</key> - <param> - <key>id</key> - <value>file_source</value> + <value>0.05</value> </param> <param> - <key>_enabled</key> - <value>False</value> + <key>type</key> + <value>real</value> </param> <param> - <key>file</key> - <value>'usrp.dat'</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>type</key> - <value>short</value> + <key>section</key> + <value>'usrp_rx_hrpt'</value> </param> <param> - <key>repeat</key> - <value>False</value> + <key>option</key> + <value>'pll_alpha'</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>writeback</key> + <value>pll_alpha</value> </param> <param> <key>_coordinate</key> - <value>(215, 490)</value> + <value>(363, 254)</value> </param> <param> <key>_rotation</key> @@ -1103,53 +960,42 @@ </param> </block> <block> - <key>gr_deinterleave</key> + <key>variable_config</key> <param> <key>id</key> - <value>gr_deinterleave_0</value> + <value>saved_clock_alpha</value> </param> <param> <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_streams</key> - <value>2</value> + <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>value</key> + <value>0.05</value> </param> <param> - <key>_coordinate</key> - <value>(598, 485)</value> + <key>type</key> + <value>real</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>config_file</key> + <value>config_filename</value> </param> - </block> - <block> - <key>gr_float_to_complex</key> <param> - <key>id</key> - <value>gr_float_to_complex_0</value> + <key>section</key> + <value>'usrp_rx_hrpt'</value> </param> <param> - <key>_enabled</key> - <value>False</value> + <key>option</key> + <value>'clock_alpha'</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>writeback</key> + <value>clock_alpha</value> </param> <param> <key>_coordinate</key> - <value>(801, 485)</value> + <value>(527, 256)</value> </param> <param> <key>_rotation</key> @@ -1157,41 +1003,42 @@ </param> </block> <block> - <key>gr_short_to_float</key> + <key>variable_config</key> <param> <key>id</key> - <value>s2f</value> + <value>output_filename</value> </param> <param> <key>_enabled</key> - <value>False</value> + <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(393, 502)</value> + <key>value</key> + <value>'frames.dat'</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>type</key> + <value>string</value> </param> - </block> - <block> - <key>virtual_sink</key> <param> - <key>id</key> - <value>sample_stream</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>_enabled</key> - <value>False</value> + <key>section</key> + <value>'usrp_rx_hrpt'</value> </param> <param> - <key>stream_id</key> - <value>samples</value> + <key>option</key> + <value>'filename'</value> + </param> + <param> + <key>writeback</key> + <value>output_filename</value> </param> <param> <key>_coordinate</key> - <value>(1027, 498)</value> + <value>(689, 257)</value> </param> <param> <key>_rotation</key> @@ -1199,58 +1046,34 @@ </param> </block> <block> - <key>usrp_simple_source_x</key> + <key>notebook</key> <param> <key>id</key> - <value>usrp_source</value> + <value>displays</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>format</key> - <value></value> - </param> - <param> - <key>which</key> - <value>0</value> - </param> - <param> - <key>decimation</key> - <value>decim</value> - </param> - <param> - <key>frequency</key> - <value>freq</value> - </param> - <param> - <key>lo_offset</key> - <value>float('inf')</value> - </param> - <param> - <key>gain</key> - <value>gain</value> + <key>style</key> + <value>wx.NB_TOP</value> </param> <param> - <key>side</key> - <value>side</value> + <key>labels</key> + <value>['Spectrum','Demod']</value> </param> <param> - <key>rx_ant</key> - <value>RXA</value> + <key>grid_pos</key> + <value>1,0,1,2</value> </param> <param> - <key>hb_filters</key> + <key>notebook</key> <value></value> </param> <param> <key>_coordinate</key> - <value>(63, 785)</value> + <value>(12, 249)</value> </param> <param> <key>_rotation</key> @@ -1258,73 +1081,86 @@ </param> </block> <block> - <key>virtual_source</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>virtual_source_0</value> + <value>rx_fft</value> </param> <param> <key>_enabled</key> - <value>False</value> + <value>True</value> </param> <param> - <key>stream_id</key> - <value>samples</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>_coordinate</key> - <value>(69, 671)</value> + <key>title</key> + <value>RX Spectrum</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>samp_rate</key> + <value>sample_rate</value> </param> - </block> - <block> - <key>options</key> <param> - <key>id</key> - <value>usrp_rx_hrpt2</value> + <key>baseband_freq</key> + <value>0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>y_per_div</key> + <value>5</value> </param> <param> - <key>title</key> - <value>USRP HRPT Receiver</value> + <key>y_divs</key> + <value>8</value> </param> <param> - <key>author</key> - <value></value> + <key>ref_level</key> + <value>-5</value> </param> <param> - <key>description</key> - <value></value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>window_size</key> - <value>4096,4096</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>generate_options</key> - <value>wx_gui</value> + <key>fft_rate</key> + <value>15</value> </param> <param> - <key>category</key> - <value>Custom</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>run</key> + <key>average</key> <value>True</value> </param> <param> - <key>realtime_scheduling</key> - <value>1</value> + <key>avg_alpha</key> + <value>0.1</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value>640, 360</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(471, 450)</value> </param> <param> <key>_rotation</key> @@ -1332,86 +1168,86 @@ </param> </block> <connection> - <source_block_id>gr_fir_filter_xxx_0</source_block_id> - <sink_block_id>pll</sink_block_id> + <source_block_id>noaa_hrpt_bit_sync_0</source_block_id> + <sink_block_id>deframer</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>gr_fir_filter_xxx_0</sink_block_id> + <source_block_id>gr_binary_slicer_fb_0</source_block_id> + <sink_block_id>noaa_hrpt_bit_sync_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>usrp_source</source_block_id> - <sink_block_id>agc</sink_block_id> + <source_block_id>virtual_source_0</source_block_id> + <sink_block_id>gr_binary_slicer_fb_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> + <sink_block_id>frame_sink</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>pll_scope</sink_block_id> + <source_block_id>deframer</source_block_id> + <sink_block_id>decoder</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>sync</sink_block_id> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>virtual_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>sync</source_block_id> - <sink_block_id>deframer</sink_block_id> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>demod_scope</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> + <source_block_id>gr_moving_average_xx_0</source_block_id> + <sink_block_id>gr_clock_recovery_mm_xx_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>agc</sink_block_id> + <source_block_id>pll</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>file_source</source_block_id> - <sink_block_id>s2f</sink_block_id> + <source_block_id>agc</source_block_id> + <sink_block_id>pll</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>s2f</source_block_id> - <sink_block_id>gr_deinterleave_0</sink_block_id> + <source_block_id>agc</source_block_id> + <sink_block_id>rx_fft</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_deinterleave_0</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_block_id>gr_interleaved_short_to_complex_0</source_block_id> + <sink_block_id>agc</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_deinterleave_0</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> - <source_key>1</source_key> - <sink_key>1</sink_key> + <source_block_id>throttle</source_block_id> + <sink_block_id>gr_interleaved_short_to_complex_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_float_to_complex_0</source_block_id> - <sink_block_id>sample_stream</sink_block_id> + <source_block_id>gr_file_source_0</source_block_id> + <sink_block_id>throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/apps/file_rx_hrpt.py b/gr-noaa/apps/file_rx_hrpt.py new file mode 100755 index 000000000..c1491ca0e --- /dev/null +++ b/gr-noaa/apps/file_rx_hrpt.py @@ -0,0 +1,309 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Sun Nov 1 19:26:11 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import noaa +from gnuradio import window +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import math, os +import wx + +class file_rx_hrpt(grc_wxgui.top_block_gui): + + def __init__(self, input_filename='usrp.dat', decim=16): + grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") + + ################################################## + # Parameters + ################################################## + self.input_filename = input_filename + self.decim = decim + + ################################################## + # Variables + ################################################## + self.sym_rate = sym_rate = 600*1109 + self.sample_rate = sample_rate = 64e6/decim + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self.sps = sps = sample_rate/sym_rate + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(config_filename) + try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') + except: saved_pll_alpha = 0.05 + self.saved_pll_alpha = saved_pll_alpha + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(config_filename) + try: saved_clock_alpha = self._saved_clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: saved_clock_alpha = 0.05 + self.saved_clock_alpha = saved_clock_alpha + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(config_filename) + try: side = self._side_config.get('usrp_rx_hrpt', 'side') + except: side = 'A' + self.side = side + self.pll_alpha = pll_alpha = saved_pll_alpha + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(config_filename) + try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') + except: output_filename = 'frames.dat' + self.output_filename = output_filename + self.max_clock_offset = max_clock_offset = 0.1 + self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) + self.clock_alpha = clock_alpha = saved_clock_alpha + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Spectrum") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") + self.GridAdd(self.displays, 1, 0, 1, 2) + + ################################################## + # Controls + ################################################## + _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._pll_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_pll_alpha_sizer, + value=self.pll_alpha, + callback=self.set_pll_alpha, + label="PLL Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._pll_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_pll_alpha_sizer, + value=self.pll_alpha, + callback=self.set_pll_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_pll_alpha_sizer, 0, 0, 1, 1) + _clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._clock_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + label="Clock Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._clock_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_clock_alpha_sizer, 0, 1, 1, 1) + + ################################################## + # Blocks + ################################################## + self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) + self.decoder = noaa.hrpt_decoder() + self.deframer = noaa.hrpt_deframer() + self.demod_scope = scopesink2.scope_sink_f( + self.displays.GetPage(1).GetWin(), + title="Post-Demod", + sample_rate=sym_rate*2.0, + v_scale=0.5, + v_offset=0, + t_scale=10.0/sym_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.demod_scope.win, 0, 0, 1, 1) + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, input_filename, False) + self.gr_interleaved_short_to_complex_0 = gr.interleaved_short_to_complex() + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.noaa_hrpt_bit_sync_0 = noaa.hrpt_bit_sync() + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) + self.rx_fft = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=0, + y_per_div=5, + y_divs=8, + ref_level=-5, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, + average=True, + avg_alpha=0.1, + title="RX Spectrum", + peak_hold=False, + size=(640, 360), + ) + self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) + self.throttle = gr.throttle(gr.sizeof_short*1, sample_rate) + + ################################################## + # Connections + ################################################## + self.connect((self.noaa_hrpt_bit_sync_0, 0), (self.deframer, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.noaa_hrpt_bit_sync_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.gr_binary_slicer_fb_0, 0)) + self.connect((self.deframer, 0), (self.frame_sink, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.demod_scope, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.agc, 0), (self.rx_fft, 0)) + self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.agc, 0)) + self.connect((self.throttle, 0), (self.gr_interleaved_short_to_complex_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.throttle, 0)) + + def set_input_filename(self, input_filename): + self.input_filename = input_filename + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_sym_rate(self, sym_rate): + self.sym_rate = sym_rate + self.set_sps(self.sample_rate/self.sym_rate) + self.demod_scope.set_sample_rate(self.sym_rate*2.0) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) + self.set_sps(self.sample_rate/self.sym_rate) + self.rx_fft.set_sample_rate(self.sample_rate) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def set_sps(self, sps): + self.sps = sps + self.set_hs(int(self.sps/2.0)) + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) + + def set_saved_pll_alpha(self, saved_pll_alpha): + self.saved_pll_alpha = saved_pll_alpha + self.set_pll_alpha(self.saved_pll_alpha) + + def set_saved_clock_alpha(self, saved_clock_alpha): + self.saved_clock_alpha = saved_clock_alpha + self.set_clock_alpha(self.saved_clock_alpha) + + def set_side(self, side): + self.side = side + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + + def set_pll_alpha(self, pll_alpha): + self.pll_alpha = pll_alpha + self.pll.set_alpha(self.pll_alpha) + self.pll.set_beta(self.pll_alpha**2/4.0) + self._pll_alpha_slider.set_value(self.pll_alpha) + self._pll_alpha_text_box.set_value(self.pll_alpha) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + + def set_output_filename(self, output_filename): + self.output_filename = output_filename + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset + + def set_max_carrier_offset(self, max_carrier_offset): + self.max_carrier_offset = max_carrier_offset + self.pll.set_max_offset(self.max_carrier_offset) + + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self.gr_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + self._clock_alpha_slider.set_value(self.clock_alpha) + self._clock_alpha_text_box.set_value(self.clock_alpha) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-F", "--input-filename", dest="input_filename", type="string", default='usrp.dat', + help="Set usrp.dat [default=%default]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=16, + help="Set decim [default=%default]") + (options, args) = parser.parse_args() + tb = file_rx_hrpt(input_filename=options.input_filename, decim=options.decim) + tb.Run(True) + diff --git a/gr-noaa/apps/usrp_rx_hrpt.cfg b/gr-noaa/apps/usrp_rx_hrpt.cfg deleted file mode 100644 index 69f3c0bf0..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[output] -filename = frames.dat - -[demod] -pll_alpha = 0.05 -sync_alpha = 0.05 - -[usrp] -freq = 1698000000.0 -decim = 16 -side = A -gain = 35.0 - diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index d06879716..da2f41780 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>Sun Sep 27 13:37:22 2009</timestamp> + <timestamp>Sun Nov 1 19:28:12 2009</timestamp> <block> <key>options</key> <param> @@ -36,6 +36,10 @@ <value>Custom</value> </param> <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> <key>run</key> <value>True</value> </param> @@ -76,52 +80,6 @@ </param> </block> <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 76)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>'usrp_rx_hrpt.cfg'</value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 129)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -367,10 +325,10 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable_static_text</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>side_text</value> </param> <param> <key>_enabled</key> @@ -378,35 +336,23 @@ </param> <param> <key>label</key> - <value>SYNC Alpha</value> + <value>USRP Side</value> </param> <param> <key>value</key> - <value>saved_sync_alpha</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>100</value> + <value>side</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>converver</key> + <value>str_converter</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>formatter</key> + <value>None</value> </param> <param> <key>grid_pos</key> - <value>0, 3, 1, 1</value> + <value>1, 0, 1, 1</value> </param> <param> <key>notebook</key> @@ -414,7 +360,7 @@ </param> <param> <key>_coordinate</key> - <value>(618, 106)</value> + <value>(828, 20)</value> </param> <param> <key>_rotation</key> @@ -425,7 +371,7 @@ <key>variable_static_text</key> <param> <key>id</key> - <value>side_text</value> + <value>decim_text</value> </param> <param> <key>_enabled</key> @@ -433,15 +379,15 @@ </param> <param> <key>label</key> - <value>USRP Side</value> + <value>Decimation</value> </param> <param> <key>value</key> - <value>side</value> + <value>decim</value> </param> <param> <key>converver</key> - <value>str_converter</value> + <value>float_converter</value> </param> <param> <key>formatter</key> @@ -449,7 +395,7 @@ </param> <param> <key>grid_pos</key> - <value>1, 0, 1, 1</value> + <value>1, 1, 1, 1</value> </param> <param> <key>notebook</key> @@ -457,7 +403,7 @@ </param> <param> <key>_coordinate</key> - <value>(828, 20)</value> + <value>(973, 20)</value> </param> <param> <key>_rotation</key> @@ -465,10 +411,10 @@ </param> </block> <block> - <key>variable_config</key> + <key>variable</key> <param> <key>id</key> - <value>side</value> + <value>config_filename</value> </param> <param> <key>_enabled</key> @@ -476,31 +422,34 @@ </param> <param> <key>value</key> - <value>'A'</value> + <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> </param> <param> - <key>type</key> - <value>string</value> + <key>_coordinate</key> + <value>(12, 129)</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>import</key> <param> - <key>section</key> - <value>'usrp'</value> + <key>id</key> + <value>import_0</value> </param> <param> - <key>option</key> - <value>'side'</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>writeback</key> - <value>side</value> + <key>import</key> + <value>import math, os</value> </param> <param> <key>_coordinate</key> - <value>(194, 253)</value> + <value>(11, 76)</value> </param> <param> <key>_rotation</key> @@ -511,7 +460,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>decim</value> + <value>saved_freq</value> </param> <param> <key>_enabled</key> @@ -519,7 +468,7 @@ </param> <param> <key>value</key> - <value>16</value> + <value>1698e6</value> </param> <param> <key>type</key> @@ -531,19 +480,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'decim'</value> + <value>'freq'</value> </param> <param> <key>writeback</key> - <value>decim</value> + <value>freq</value> </param> <param> <key>_coordinate</key> - <value>(351, 255)</value> + <value>(507, 258)</value> </param> <param> <key>_rotation</key> @@ -554,7 +503,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>saved_freq</value> + <value>saved_gain</value> </param> <param> <key>_enabled</key> @@ -562,7 +511,7 @@ </param> <param> <key>value</key> - <value>1698e6</value> + <value>35</value> </param> <param> <key>type</key> @@ -574,19 +523,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'freq'</value> + <value>'gain'</value> </param> <param> <key>writeback</key> - <value>freq</value> + <value>gain</value> </param> <param> <key>_coordinate</key> - <value>(507, 258)</value> + <value>(664, 259)</value> </param> <param> <key>_rotation</key> @@ -597,7 +546,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>saved_gain</value> + <value>output_filename</value> </param> <param> <key>_enabled</key> @@ -605,11 +554,11 @@ </param> <param> <key>value</key> - <value>35</value> + <value>'frames.dat'</value> </param> <param> <key>type</key> - <value>real</value> + <value>string</value> </param> <param> <key>config_file</key> @@ -617,19 +566,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'gain'</value> + <value>'filename'</value> </param> <param> <key>writeback</key> - <value>gain</value> + <value>output_filename</value> </param> <param> <key>_coordinate</key> - <value>(664, 259)</value> + <value>(1139, 259)</value> </param> <param> <key>_rotation</key> @@ -637,10 +586,10 @@ </param> </block> <block> - <key>variable_config</key> + <key>variable</key> <param> <key>id</key> - <value>saved_pll_alpha</value> + <value>max_clock_offset</value> </param> <param> <key>_enabled</key> @@ -648,31 +597,66 @@ </param> <param> <key>value</key> - <value>0.05</value> + <value>0.1</value> </param> <param> - <key>type</key> - <value>real</value> + <key>_coordinate</key> + <value>(705, 19)</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable_slider</key> <param> - <key>section</key> - <value>'demod'</value> + <key>id</key> + <value>clock_alpha</value> </param> <param> - <key>option</key> - <value>'pll_alpha'</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>writeback</key> - <value>pll_alpha</value> + <key>label</key> + <value>Clock Alpha</value> + </param> + <param> + <key>value</key> + <value>saved_clock_alpha</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>100</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, 3, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(823, 258)</value> + <value>(618, 106)</value> </param> <param> <key>_rotation</key> @@ -683,7 +667,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>saved_sync_alpha</value> + <value>saved_pll_alpha</value> </param> <param> <key>_enabled</key> @@ -703,19 +687,19 @@ </param> <param> <key>section</key> - <value>'demod'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'sync_alpha'</value> + <value>'pll_alpha'</value> </param> <param> <key>writeback</key> - <value>sync_alpha</value> + <value>pll_alpha</value> </param> <param> <key>_coordinate</key> - <value>(981, 258)</value> + <value>(823, 258)</value> </param> <param> <key>_rotation</key> @@ -726,7 +710,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>output_filename</value> + <value>saved_clock_alpha</value> </param> <param> <key>_enabled</key> @@ -734,11 +718,11 @@ </param> <param> <key>value</key> - <value>'frames.dat'</value> + <value>0.05</value> </param> <param> <key>type</key> - <value>string</value> + <value>real</value> </param> <param> <key>config_file</key> @@ -746,19 +730,19 @@ </param> <param> <key>section</key> - <value>'output'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'filename'</value> + <value>'clock_alpha'</value> </param> <param> <key>writeback</key> - <value>output_filename</value> + <value>clock_alpha</value> </param> <param> <key>_coordinate</key> - <value>(1139, 259)</value> + <value>(981, 258)</value> </param> <param> <key>_rotation</key> @@ -766,42 +750,42 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>variable_config</key> <param> <key>id</key> - <value>decim_text</value> + <value>decim</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Decimation</value> + <key>value</key> + <value>16</value> </param> <param> - <key>value</key> - <value>decim</value> + <key>type</key> + <value>real</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>section</key> + <value>'usrp_rx_hrpt'</value> </param> <param> - <key>grid_pos</key> - <value>1, 1, 1, 1</value> + <key>option</key> + <value>'decim'</value> </param> <param> - <key>notebook</key> - <value></value> + <key>writeback</key> + <value>decim</value> </param> <param> <key>_coordinate</key> - <value>(973, 20)</value> + <value>(351, 255)</value> </param> <param> <key>_rotation</key> @@ -809,10 +793,10 @@ </param> </block> <block> - <key>variable</key> + <key>variable_config</key> <param> <key>id</key> - <value>max_sync_offset</value> + <value>side</value> </param> <param> <key>_enabled</key> @@ -820,11 +804,31 @@ </param> <param> <key>value</key> - <value>0.01</value> + <value>'A'</value> + </param> + <param> + <key>type</key> + <value>string</value> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp_rx_hrpt'</value> + </param> + <param> + <key>option</key> + <value>'side'</value> + </param> + <param> + <key>writeback</key> + <value>side</value> </param> <param> <key>_coordinate</key> - <value>(705, 19)</value> + <value>(194, 253)</value> </param> <param> <key>_rotation</key> @@ -847,11 +851,11 @@ </param> <param> <key>labels</key> - <value>['RX','Demod']</value> + <value>['Spectrum','Demod']</value> </param> <param> <key>grid_pos</key> - <value>2, 0, 1, 4</value> + <value>2,0,1,4</value> </param> <param> <key>notebook</key> @@ -859,7 +863,7 @@ </param> <param> <key>_coordinate</key> - <value>(15, 237)</value> + <value>(12, 249)</value> </param> <param> <key>_rotation</key> @@ -867,34 +871,49 @@ </param> </block> <block> - <key>noaa_hrpt_sync_fb</key> + <key>noaa_hrpt_deframer</key> <param> <key>id</key> - <value>sync</value> + <value>deframer</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> + <key>_coordinate</key> + <value>(762, 975)</value> </param> <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_file_sink</key> <param> - <key>sps</key> - <value>sps</value> + <key>id</key> + <value>frame_sink</value> </param> <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>file</key> + <value>output_filename</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(840, 715)</value> + <value>(973, 1024)</value> </param> <param> <key>_rotation</key> @@ -902,10 +921,10 @@ </param> </block> <block> - <key>noaa_hrpt_deframer</key> + <key>noaa_hrpt_bit_sync</key> <param> <key>id</key> - <value>deframer</value> + <value>noaa_hrpt_bit_sync_0</value> </param> <param> <key>_enabled</key> @@ -913,7 +932,7 @@ </param> <param> <key>_coordinate</key> - <value>(1071, 743)</value> + <value>(571, 975)</value> </param> <param> <key>_rotation</key> @@ -921,10 +940,10 @@ </param> </block> <block> - <key>noaa_hrpt_decoder</key> + <key>gr_binary_slicer_fb</key> <param> <key>id</key> - <value>decoder</value> + <value>gr_binary_slicer_fb_0</value> </param> <param> <key>_enabled</key> @@ -932,7 +951,7 @@ </param> <param> <key>_coordinate</key> - <value>(1274, 743)</value> + <value>(393, 975)</value> </param> <param> <key>_rotation</key> @@ -940,30 +959,22 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>virtual_source</key> <param> <key>id</key> - <value>frame_sink</value> + <value>virtual_source_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>file</key> - <value>output_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>stream_id</key> + <value>baseband</value> </param> <param> <key>_coordinate</key> - <value>(1273, 851)</value> + <value>(173, 971)</value> </param> <param> <key>_rotation</key> @@ -971,53 +982,109 @@ </param> </block> <block> - <key>variable</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>mf_taps</value> + <value>demod_scope</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>[-0.5/hs,]*hs+[0.5/hs]*hs</value> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Post-Demod</value> + </param> + <param> + <key>samp_rate</key> + <value>sym_rate*2.0</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>10.0/sym_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> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(792, 158)</value> + <value>(666, 542)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>noaa_hrpt_pll_cf</key> + <key>gr_clock_recovery_mm_xx</key> <param> <key>id</key> - <value>pll</value> + <value>gr_clock_recovery_mm_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>pll_alpha</value> + <key>type</key> + <value>float</value> </param> <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> + <key>omega</key> + <value>sps/2.0</value> </param> <param> - <key>max_offset</key> - <value>max_carrier_offset</value> + <key>gain_omega</key> + <value>clock_alpha**2/4.0</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>gain_mu</key> + <value>clock_alpha</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>max_clock_offset</value> </param> <param> <key>_coordinate</key> - <value>(632, 723)</value> + <value>(873, 696)</value> </param> <param> <key>_rotation</key> @@ -1025,10 +1092,10 @@ </param> </block> <block> - <key>gr_fir_filter_xxx</key> + <key>gr_moving_average_xx</key> <param> <key>id</key> - <value>gr_fir_filter_xxx_0</value> + <value>gr_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -1036,19 +1103,23 @@ </param> <param> <key>type</key> - <value>ccc</value> + <value>float</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>length</key> + <value>hs</value> </param> <param> - <key>taps</key> - <value>mf_taps</value> + <key>scale</key> + <value>1.0/hs</value> + </param> + <param> + <key>max_iter</key> + <value>4000</value> </param> <param> <key>_coordinate</key> - <value>(400, 731)</value> + <value>(682, 713)</value> </param> <param> <key>_rotation</key> @@ -1056,58 +1127,72 @@ </param> </block> <block> - <key>usrp_simple_source_x</key> + <key>noaa_hrpt_pll_cf</key> <param> <key>id</key> - <value>usrp_source</value> + <value>pll</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>alpha</key> + <value>pll_alpha</value> </param> <param> - <key>format</key> - <value></value> + <key>beta</key> + <value>pll_alpha**2/4.0</value> </param> <param> - <key>which</key> + <key>max_offset</key> + <value>max_carrier_offset</value> + </param> + <param> + <key>_coordinate</key> + <value>(469, 713)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>virtual_sink</key> <param> - <key>decimation</key> - <value>decim</value> + <key>id</key> + <value>virtual_sink_0</value> </param> <param> - <key>frequency</key> - <value>freq</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>lo_offset</key> - <value>float('inf')</value> + <key>stream_id</key> + <value>baseband</value> </param> <param> - <key>gain</key> - <value>gain</value> + <key>_coordinate</key> + <value>(1142, 728)</value> </param> <param> - <key>side</key> - <value>side</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>noaa_hrpt_decoder</key> <param> - <key>rx_ant</key> - <value>RXA</value> + <key>id</key> + <value>decoder</value> </param> <param> - <key>hb_filters</key> - <value></value> + <key>_enabled</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(28, 699)</value> + <value>(974, 925)</value> </param> <param> <key>_rotation</key> @@ -1146,7 +1231,7 @@ </param> <param> <key>_coordinate</key> - <value>(240, 715)</value> + <value>(301, 705)</value> </param> <param> <key>_rotation</key> @@ -1154,10 +1239,10 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>usrp_simple_source_x</key> <param> <key>id</key> - <value>rx_scope</value> + <value>usrp_source</value> </param> <param> <key>_enabled</key> @@ -1168,44 +1253,44 @@ <value>complex</value> </param> <param> - <key>title</key> - <value>RX Waveform</value> + <key>format</key> + <value></value> </param> <param> - <key>samp_rate</key> - <value>sample_rate</value> + <key>which</key> + <value>0</value> </param> <param> - <key>v_scale</key> - <value>0</value> + <key>decimation</key> + <value>decim</value> </param> <param> - <key>t_scale</key> - <value>20.0/sample_rate</value> + <key>frequency</key> + <value>freq</value> </param> <param> - <key>ac_couple</key> - <value>False</value> + <key>lo_offset</key> + <value>float('inf')</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>gain</key> + <value>gain</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>side</key> + <value>side</value> </param> <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> + <key>rx_ant</key> + <value>RXA</value> </param> <param> - <key>notebook</key> - <value>displays, 0</value> + <key>hb_filters</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(406, 838)</value> + <value>(89, 689)</value> </param> <param> <key>_rotation</key> @@ -1275,63 +1360,12 @@ <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> - </param> - <param> - <key>_coordinate</key> - <value>(406, 466)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>pll_scope</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Demod Waveform</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> + <key>win</key> + <value>None</value> </param> <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> + <key>win_size</key> + <value>640, 360</value> </param> <param> <key>grid_pos</key> @@ -1339,67 +1373,73 @@ </param> <param> <key>notebook</key> - <value>displays, 1</value> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(605, 552)</value> + <value>(477, 457)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> + <source_block_id>noaa_hrpt_bit_sync_0</source_block_id> + <sink_block_id>deframer</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>sync</source_block_id> - <sink_block_id>deframer</sink_block_id> + <source_block_id>gr_binary_slicer_fb_0</source_block_id> + <sink_block_id>noaa_hrpt_bit_sync_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>sync</sink_block_id> + <source_block_id>virtual_source_0</source_block_id> + <sink_block_id>gr_binary_slicer_fb_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>pll_scope</sink_block_id> + <source_block_id>deframer</source_block_id> + <sink_block_id>frame_sink</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>rx_scope</sink_block_id> + <source_block_id>deframer</source_block_id> + <sink_block_id>decoder</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>rx_fft</sink_block_id> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>virtual_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>demod_scope</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>gr_fir_filter_xxx_0</sink_block_id> + <source_block_id>gr_moving_average_xx_0</source_block_id> + <sink_block_id>gr_clock_recovery_mm_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_fir_filter_xxx_0</source_block_id> + <source_block_id>pll</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>agc</source_block_id> <sink_block_id>pll</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -1410,4 +1450,10 @@ <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>agc</source_block_id> + <sink_block_id>rx_fft</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index ae70f25c8..c1d0fd6e9 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,12 +2,13 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 27 13:37:23 2009 +# Generated: Sun Nov 1 19:28:13 2009 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import noaa +from gnuradio import window from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 @@ -17,7 +18,7 @@ from grc_gnuradio import usrp as grc_usrp from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import ConfigParser -import math +import math, os import wx class usrp_rx_hrpt(grc_wxgui.top_block_gui): @@ -28,10 +29,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## # Variables ################################################## - self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' self._decim_config = ConfigParser.ConfigParser() self._decim_config.read(config_filename) - try: decim = self._decim_config.getfloat('usrp', 'decim') + try: decim = self._decim_config.getfloat('usrp_rx_hrpt', 'decim') except: decim = 16 self.decim = decim self.sym_rate = sym_rate = 600*1109 @@ -39,79 +40,55 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.sps = sps = sample_rate/sym_rate self._side_config = ConfigParser.ConfigParser() self._side_config.read(config_filename) - try: side = self._side_config.get('usrp', 'side') + try: side = self._side_config.get('usrp_rx_hrpt', 'side') except: side = 'A' self.side = side - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(config_filename) - try: saved_sync_alpha = self._saved_sync_alpha_config.getfloat('demod', 'sync_alpha') - except: saved_sync_alpha = 0.05 - self.saved_sync_alpha = saved_sync_alpha self._saved_pll_alpha_config = ConfigParser.ConfigParser() self._saved_pll_alpha_config.read(config_filename) - try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('demod', 'pll_alpha') + try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') except: saved_pll_alpha = 0.05 self.saved_pll_alpha = saved_pll_alpha self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat('usrp', 'gain') + try: saved_gain = self._saved_gain_config.getfloat('usrp_rx_hrpt', 'gain') except: saved_gain = 35 self.saved_gain = saved_gain self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(config_filename) - try: saved_freq = self._saved_freq_config.getfloat('usrp', 'freq') + try: saved_freq = self._saved_freq_config.getfloat('usrp_rx_hrpt', 'freq') except: saved_freq = 1698e6 self.saved_freq = saved_freq - self.hs = hs = int(sps/2.0) - self.sync_alpha = sync_alpha = saved_sync_alpha + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(config_filename) + try: saved_clock_alpha = self._saved_clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: saved_clock_alpha = 0.05 + self.saved_clock_alpha = saved_clock_alpha self.side_text = side_text = side self.pll_alpha = pll_alpha = saved_pll_alpha self._output_filename_config = ConfigParser.ConfigParser() self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('output', 'filename') + try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') except: output_filename = 'frames.dat' self.output_filename = output_filename - self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs]*hs - self.max_sync_offset = max_sync_offset = 0.01 + self.max_clock_offset = max_clock_offset = 0.1 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) self.gain = gain = saved_gain self.freq = freq = saved_freq self.decim_text = decim_text = decim + self.clock_alpha = clock_alpha = saved_clock_alpha ################################################## # Notebooks ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Spectrum") self.displays.AddPage(grc_wxgui.Panel(self.displays), "Demod") self.GridAdd(self.displays, 2, 0, 1, 4) ################################################## # Controls ################################################## - _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._sync_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - label="SYNC Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._sync_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_sync_alpha_sizer, 0, 3, 1, 1) self._side_text_static_text = forms.static_text( parent=self.GetWin(), value=self.side_text, @@ -182,6 +159,29 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): converter=forms.float_converter(), ) self.GridAdd(self._decim_text_static_text, 1, 1, 1, 1) + _clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._clock_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + label="Clock Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._clock_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_clock_alpha_sizer, + value=self.clock_alpha, + callback=self.set_clock_alpha, + minimum=0.0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_clock_alpha_sizer, 0, 3, 1, 1) ################################################## # Blocks @@ -189,20 +189,24 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) self.decoder = noaa.hrpt_decoder() self.deframer = noaa.hrpt_deframer() - self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.pll_scope = scopesink2.scope_sink_f( + self.demod_scope = scopesink2.scope_sink_f( self.displays.GetPage(1).GetWin(), - title="Demod Waveform", - sample_rate=sample_rate, + title="Post-Demod", + sample_rate=sym_rate*2.0, v_scale=0.5, - t_scale=20.0/sample_rate, + v_offset=0, + t_scale=10.0/sym_rate, ac_couple=False, xy_mode=False, num_inputs=1, ) - self.displays.GetPage(1).GridAdd(self.pll_scope.win, 0, 0, 1, 1) + self.displays.GetPage(1).GridAdd(self.demod_scope.win, 0, 0, 1, 1) + self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.noaa_hrpt_bit_sync_0 = noaa.hrpt_bit_sync() + self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) self.rx_fft = fftsink2.fft_sink_c( self.displays.GetPage(0).GetWin(), baseband_freq=freq, @@ -217,20 +221,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): avg_alpha=0.1, title="RX Spectrum", peak_hold=False, + size=(640, 360), ) self.displays.GetPage(0).GridAdd(self.rx_fft.win, 0, 0, 1, 1) - self.rx_scope = scopesink2.scope_sink_c( - self.displays.GetPage(0).GetWin(), - title="RX Waveform", - sample_rate=sample_rate, - v_scale=0, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(0).GridAdd(self.rx_scope.win, 1, 0, 1, 1) - self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") self.usrp_source.set_decim_rate(decim) self.usrp_source.set_frequency(freq, verbose=True) @@ -239,104 +232,101 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ################################################## # Connections ################################################## + self.connect((self.noaa_hrpt_bit_sync_0, 0), (self.deframer, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.noaa_hrpt_bit_sync_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.gr_binary_slicer_fb_0, 0)) self.connect((self.deframer, 0), (self.frame_sink, 0)) - self.connect((self.sync, 0), (self.deframer, 0)) - self.connect((self.pll, 0), (self.sync, 0)) - self.connect((self.pll, 0), (self.pll_scope, 0)) - self.connect((self.agc, 0), (self.rx_scope, 0)) - self.connect((self.agc, 0), (self.rx_fft, 0)) self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0)) - self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.demod_scope, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.agc, 0), (self.pll, 0)) self.connect((self.usrp_source, 0), (self.agc, 0)) + self.connect((self.agc, 0), (self.rx_fft, 0)) def set_config_filename(self, config_filename): self.config_filename = config_filename - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) - self._side_config.write(open(self.config_filename, 'w')) - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) - self._decim_config.write(open(self.config_filename, 'w')) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_hrpt'): + self._saved_freq_config.add_section('usrp_rx_hrpt') + self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section('usrp'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + if not self._saved_gain_config.has_section('usrp_rx_hrpt'): + self._saved_gain_config.add_section('usrp_rx_hrpt') + self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) self._saved_gain_config.write(open(self.config_filename, 'w')) - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) self._output_filename_config = ConfigParser.ConfigParser() self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) self._output_filename_config.write(open(self.config_filename, 'w')) + self._saved_pll_alpha_config = ConfigParser.ConfigParser() + self._saved_pll_alpha_config.read(self.config_filename) + if not self._saved_pll_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) + self._decim_config = ConfigParser.ConfigParser() + self._decim_config.read(self.config_filename) + if not self._decim_config.has_section('usrp_rx_hrpt'): + self._decim_config.add_section('usrp_rx_hrpt') + self._decim_config.set('usrp_rx_hrpt', 'decim', str(self.decim)) + self._decim_config.write(open(self.config_filename, 'w')) + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) def set_decim(self, decim): self.decim = decim self.set_sample_rate(64e6/self.decim) + self.set_decim_text(self.decim) self._decim_config = ConfigParser.ConfigParser() self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) + if not self._decim_config.has_section('usrp_rx_hrpt'): + self._decim_config.add_section('usrp_rx_hrpt') + self._decim_config.set('usrp_rx_hrpt', 'decim', str(self.decim)) self._decim_config.write(open(self.config_filename, 'w')) - self.set_decim_text(self.decim) self.usrp_source.set_decim_rate(self.decim) def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate self.set_sps(self.sample_rate/self.sym_rate) + self.demod_scope.set_sample_rate(self.sym_rate*2.0) def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) self.set_sps(self.sample_rate/self.sym_rate) - self.rx_scope.set_sample_rate(self.sample_rate) self.rx_fft.set_sample_rate(self.sample_rate) - self.pll_scope.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps self.set_hs(int(self.sps/2.0)) + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) def set_side(self, side): self.side = side self.set_side_text(self.side) self._side_config = ConfigParser.ConfigParser() self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) self._side_config.write(open(self.config_filename, 'w')) - def set_saved_sync_alpha(self, saved_sync_alpha): - self.saved_sync_alpha = saved_sync_alpha - self.set_sync_alpha(self.saved_sync_alpha) - def set_saved_pll_alpha(self, saved_pll_alpha): self.saved_pll_alpha = saved_pll_alpha self.set_pll_alpha(self.saved_pll_alpha) @@ -349,22 +339,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.saved_freq = saved_freq self.set_freq(self.saved_freq) - def set_hs(self, hs): - self.hs = hs - self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs]*self.hs) - - 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._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) + def set_saved_clock_alpha(self, saved_clock_alpha): + self.saved_clock_alpha = saved_clock_alpha + self.set_clock_alpha(self.saved_clock_alpha) def set_side_text(self, side_text): self.side_text = side_text @@ -376,9 +353,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self._pll_alpha_text_box.set_value(self.pll_alpha) self._saved_pll_alpha_config = ConfigParser.ConfigParser() self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + if not self._saved_pll_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_pll_alpha_config.add_section('usrp_rx_hrpt') + self._saved_pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) self.pll.set_alpha(self.pll_alpha) self.pll.set_beta(self.pll_alpha**2/4.0) @@ -387,32 +364,31 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.output_filename = output_filename self._output_filename_config = ConfigParser.ConfigParser() self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) self._output_filename_config.write(open(self.config_filename, 'w')) - def set_mf_taps(self, mf_taps): - self.mf_taps = mf_taps - self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset self.pll.set_max_offset(self.max_carrier_offset) + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + def set_gain(self, gain): self.gain = gain self._gain_slider.set_value(self.gain) self._gain_text_box.set_value(self.gain) self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section('usrp'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) + if not self._saved_gain_config.has_section('usrp_rx_hrpt'): + self._saved_gain_config.add_section('usrp_rx_hrpt') + self._saved_gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) self._saved_gain_config.write(open(self.config_filename, 'w')) self.usrp_source.set_gain(self.gain) @@ -421,9 +397,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self._freq_text_box.set_value(self.freq) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_hrpt'): + self._saved_freq_config.add_section('usrp_rx_hrpt') + self._saved_freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) self.usrp_source.set_frequency(self.freq) self.rx_fft.set_baseband_freq(self.freq) @@ -432,6 +408,19 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.decim_text = decim_text self._decim_text_static_text.set_value(self.decim_text) + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self._clock_alpha_slider.set_value(self.clock_alpha) + self._clock_alpha_text_box.set_value(self.clock_alpha) + self._saved_clock_alpha_config = ConfigParser.ConfigParser() + self._saved_clock_alpha_config.read(self.config_filename) + if not self._saved_clock_alpha_config.has_section('usrp_rx_hrpt'): + self._saved_clock_alpha_config.add_section('usrp_rx_hrpt') + self._saved_clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._saved_clock_alpha_config.write(open(self.config_filename, 'w')) + self.gr_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") (options, args) = parser.parse_args() diff --git a/gr-noaa/apps/usrp_rx_hrpt2.py b/gr-noaa/apps/usrp_rx_hrpt2.py deleted file mode 100755 index 319335169..000000000 --- a/gr-noaa/apps/usrp_rx_hrpt2.py +++ /dev/null @@ -1,401 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Sun Sep 27 13:32:48 2009 -################################################## - -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import noaa -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from gnuradio.wxgui import forms -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import usrp as grc_usrp -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import ConfigParser -import math -import wx - -class usrp_rx_hrpt2(grc_wxgui.top_block_gui): - - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="USRP HRPT Receiver") - - ################################################## - # Variables - ################################################## - self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(config_filename) - try: decim = self._decim_config.getfloat('usrp', 'decim') - except: decim = 16 - self.decim = decim - self.sym_rate = sym_rate = 600*1109 - self.sample_rate = sample_rate = 64e6/decim - self.sps = sps = sample_rate/sym_rate - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(config_filename) - try: side = self._side_config.get('usrp', 'side') - except: side = 'A' - self.side = side - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(config_filename) - try: saved_sync_alpha = self._saved_sync_alpha_config.getfloat('demod', 'sync_alpha') - except: saved_sync_alpha = 0.05 - self.saved_sync_alpha = saved_sync_alpha - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(config_filename) - try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat('demod', 'pll_alpha') - except: saved_pll_alpha = 0.05 - self.saved_pll_alpha = saved_pll_alpha - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat('usrp', 'gain') - except: saved_gain = 35 - self.saved_gain = saved_gain - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(config_filename) - try: saved_freq = self._saved_freq_config.getfloat('usrp', 'freq') - except: saved_freq = 1698e6 - self.saved_freq = saved_freq - self.hs = hs = int(sps/2.0) - self.sync_alpha = sync_alpha = saved_sync_alpha - self.side_text = side_text = side - self.pll_alpha = pll_alpha = saved_pll_alpha - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('output', 'filename') - except: output_filename = 'frames.dat' - self.output_filename = output_filename - self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs,]*hs - self.max_sync_offset = max_sync_offset = 0.01 - self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.gain = gain = saved_gain - self.freq = freq = saved_freq - self.decim_text = decim_text = decim - - ################################################## - # Controls - ################################################## - _sync_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._sync_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - label="SYNC Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._sync_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_sync_alpha_sizer, - value=self.sync_alpha, - callback=self.set_sync_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_sync_alpha_sizer, 0, 3, 1, 1) - self._side_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.side_text, - callback=self.set_side_text, - label="USRP Side", - converter=forms.str_converter(), - ) - self.GridAdd(self._side_text_static_text, 1, 0, 1, 1) - _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL) - self._pll_alpha_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_pll_alpha_sizer, - value=self.pll_alpha, - callback=self.set_pll_alpha, - label="PLL Alpha", - converter=forms.float_converter(), - proportion=0, - ) - self._pll_alpha_slider = forms.slider( - parent=self.GetWin(), - sizer=_pll_alpha_sizer, - value=self.pll_alpha, - callback=self.set_pll_alpha, - minimum=0.0, - maximum=0.5, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_pll_alpha_sizer, 0, 2, 1, 1) - _gain_sizer = wx.BoxSizer(wx.VERTICAL) - self._gain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_gain_sizer, - value=self.gain, - callback=self.set_gain, - label="RX Gain", - converter=forms.float_converter(), - proportion=0, - ) - self._gain_slider = forms.slider( - parent=self.GetWin(), - sizer=_gain_sizer, - value=self.gain, - callback=self.set_gain, - minimum=0, - maximum=100, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_gain_sizer, 0, 1, 1, 1) - self._freq_text_box = forms.text_box( - parent=self.GetWin(), - value=self.freq, - callback=self.set_freq, - label="Frequency", - converter=forms.float_converter(), - ) - self.GridAdd(self._freq_text_box, 0, 0, 1, 1) - self._decim_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.decim_text, - callback=self.set_decim_text, - label="Decimation", - converter=forms.float_converter(), - ) - self.GridAdd(self._decim_text_static_text, 1, 1, 1, 1) - - ################################################## - # Blocks - ################################################## - self.agc = gr.agc_cc(1e-6, 1.0, 1.0, 1.0) - self.decoder = noaa.hrpt_decoder() - self.deframer = noaa.hrpt_deframer() - self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) - self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.pll_scope = scopesink2.scope_sink_f( - self.GetWin(), - title="Demod Waveform", - sample_rate=sample_rate, - v_scale=0.5, - t_scale=20.0/sample_rate, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.GridAdd(self.pll_scope.win, 2, 0, 1, 4) - self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) - self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") - self.usrp_source.set_decim_rate(decim) - self.usrp_source.set_frequency(freq, verbose=True) - self.usrp_source.set_gain(gain) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) - self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0)) - self.connect((self.usrp_source, 0), (self.agc, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.pll, 0), (self.pll_scope, 0)) - self.connect((self.pll, 0), (self.sync, 0)) - self.connect((self.sync, 0), (self.deframer, 0)) - self.connect((self.deframer, 0), (self.frame_sink, 0)) - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) - self._side_config.write(open(self.config_filename, 'w')) - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) - self._decim_config.write(open(self.config_filename, 'w')) - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section('usrp'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def set_decim(self, decim): - self.decim = decim - self.set_sample_rate(64e6/self.decim) - self._decim_config = ConfigParser.ConfigParser() - self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) - self._decim_config.write(open(self.config_filename, 'w')) - self.set_decim_text(self.decim) - self.usrp_source.set_decim_rate(self.decim) - - def set_sym_rate(self, sym_rate): - self.sym_rate = sym_rate - self.set_sps(self.sample_rate/self.sym_rate) - - def set_sample_rate(self, sample_rate): - self.sample_rate = sample_rate - self.set_max_carrier_offset(2*math.pi*100e3/self.sample_rate) - self.set_sps(self.sample_rate/self.sym_rate) - self.pll_scope.set_sample_rate(self.sample_rate) - - def set_sps(self, sps): - self.sps = sps - self.set_hs(int(self.sps/2.0)) - - def set_side(self, side): - self.side = side - self.set_side_text(self.side) - self._side_config = ConfigParser.ConfigParser() - self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) - self._side_config.write(open(self.config_filename, 'w')) - - def set_saved_sync_alpha(self, saved_sync_alpha): - self.saved_sync_alpha = saved_sync_alpha - self.set_sync_alpha(self.saved_sync_alpha) - - def set_saved_pll_alpha(self, saved_pll_alpha): - self.saved_pll_alpha = saved_pll_alpha - self.set_pll_alpha(self.saved_pll_alpha) - - def set_saved_gain(self, saved_gain): - self.saved_gain = saved_gain - self.set_gain(self.saved_gain) - - def set_saved_freq(self, saved_freq): - self.saved_freq = saved_freq - self.set_freq(self.saved_freq) - - def set_hs(self, hs): - self.hs = hs - self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs,]*self.hs) - - 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._saved_sync_alpha_config = ConfigParser.ConfigParser() - self._saved_sync_alpha_config.read(self.config_filename) - if not self._saved_sync_alpha_config.has_section('demod'): - self._saved_sync_alpha_config.add_section('demod') - self._saved_sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._saved_sync_alpha_config.write(open(self.config_filename, 'w')) - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) - - def set_side_text(self, side_text): - self.side_text = side_text - self._side_text_static_text.set_value(self.side_text) - - def set_pll_alpha(self, pll_alpha): - self.pll_alpha = pll_alpha - self._pll_alpha_slider.set_value(self.pll_alpha) - self._pll_alpha_text_box.set_value(self.pll_alpha) - self._saved_pll_alpha_config = ConfigParser.ConfigParser() - self._saved_pll_alpha_config.read(self.config_filename) - if not self._saved_pll_alpha_config.has_section('demod'): - self._saved_pll_alpha_config.add_section('demod') - self._saved_pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._saved_pll_alpha_config.write(open(self.config_filename, 'w')) - self.pll.set_alpha(self.pll_alpha) - self.pll.set_beta(self.pll_alpha**2/4.0) - - def set_output_filename(self, output_filename): - self.output_filename = output_filename - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - - def set_mf_taps(self, mf_taps): - self.mf_taps = mf_taps - self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) - - def set_max_carrier_offset(self, max_carrier_offset): - self.max_carrier_offset = max_carrier_offset - self.pll.set_max_offset(self.max_carrier_offset) - - def set_gain(self, gain): - self.gain = gain - self._gain_slider.set_value(self.gain) - self._gain_text_box.set_value(self.gain) - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section('usrp'): - self._saved_gain_config.add_section('usrp') - self._saved_gain_config.set('usrp', 'gain', str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) - self.usrp_source.set_gain(self.gain) - - def set_freq(self, freq): - self.freq = freq - self._freq_text_box.set_value(self.freq) - self._saved_freq_config = ConfigParser.ConfigParser() - self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section('usrp'): - self._saved_freq_config.add_section('usrp') - self._saved_freq_config.set('usrp', 'freq', str(self.freq)) - self._saved_freq_config.write(open(self.config_filename, 'w')) - self.usrp_source.set_frequency(self.freq) - - def set_decim_text(self, decim_text): - self.decim_text = decim_text - self._decim_text_static_text.set_value(self.decim_text) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - if gr.enable_realtime_scheduling() != gr.RT_OK: - print "Error: failed to enable realtime scheduling." - tb = usrp_rx_hrpt2() - tb.Run(True) - diff --git a/gr-noaa/apps/usrp_rx_hrpt_nogui.grc b/gr-noaa/apps/usrp_rx_hrpt_nogui.grc index fadc2d1da..918a954bd 100644 --- a/gr-noaa/apps/usrp_rx_hrpt_nogui.grc +++ b/gr-noaa/apps/usrp_rx_hrpt_nogui.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Sep 27 10:13:25 2009</timestamp> + <timestamp>Sun Nov 1 19:32:32 2009</timestamp> <block> <key>options</key> <param> @@ -13,7 +13,7 @@ </param> <param> <key>title</key> - <value>USRP HRPT Receiver</value> + <value></value> </param> <param> <key>author</key> @@ -36,6 +36,10 @@ <value>Custom</value> </param> <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> <key>run</key> <value>True</value> </param> @@ -171,7 +175,7 @@ <key>variable</key> <param> <key>id</key> - <value>max_sync_offset</value> + <value>max_clock_offset</value> </param> <param> <key>_enabled</key> @@ -179,7 +183,7 @@ </param> <param> <key>value</key> - <value>0.01</value> + <value>0.1</value> </param> <param> <key>_coordinate</key> @@ -202,11 +206,11 @@ </param> <param> <key>value</key> - <value>'usrp_rx_hrpt.cfg'</value> + <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> </param> <param> <key>_coordinate</key> - <value>(12, 167)</value> + <value>(13, 162)</value> </param> <param> <key>_rotation</key> @@ -225,11 +229,11 @@ </param> <param> <key>import</key> - <value>import math</value> + <value>import math, os</value> </param> <param> <key>_coordinate</key> - <value>(11, 112)</value> + <value>(11, 109)</value> </param> <param> <key>_rotation</key> @@ -240,7 +244,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>output_filename</value> + <value>clock_alpha</value> </param> <param> <key>_enabled</key> @@ -248,11 +252,11 @@ </param> <param> <key>value</key> - <value>'frames.dat'</value> + <value>0.05</value> </param> <param> <key>type</key> - <value>string</value> + <value>real</value> </param> <param> <key>config_file</key> @@ -260,19 +264,19 @@ </param> <param> <key>section</key> - <value>'output'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'filename'</value> + <value>'clock_alpha'</value> </param> <param> <key>writeback</key> - <value>output_filename</value> + <value>clock_alpha</value> </param> <param> <key>_coordinate</key> - <value>(1146, 122)</value> + <value>(986, 101)</value> </param> <param> <key>_rotation</key> @@ -283,7 +287,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>gain</value> </param> <param> <key>_enabled</key> @@ -291,7 +295,7 @@ </param> <param> <key>value</key> - <value>0.05</value> + <value>35</value> </param> <param> <key>type</key> @@ -303,19 +307,19 @@ </param> <param> <key>section</key> - <value>'demod'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'sync_alpha'</value> + <value>'gain'</value> </param> <param> <key>writeback</key> - <value>sync_alpha</value> + <value>gain</value> </param> <param> <key>_coordinate</key> - <value>(988, 121)</value> + <value>(668, 101)</value> </param> <param> <key>_rotation</key> @@ -326,7 +330,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>pll_alpha</value> + <value>freq</value> </param> <param> <key>_enabled</key> @@ -334,7 +338,7 @@ </param> <param> <key>value</key> - <value>0.05</value> + <value>1698e6</value> </param> <param> <key>type</key> @@ -346,19 +350,19 @@ </param> <param> <key>section</key> - <value>'demod'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'pll_alpha'</value> + <value>'freq'</value> </param> <param> <key>writeback</key> - <value>pll_alpha</value> + <value>freq</value> </param> <param> <key>_coordinate</key> - <value>(830, 121)</value> + <value>(511, 100)</value> </param> <param> <key>_rotation</key> @@ -369,7 +373,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>gain</value> + <value>decim</value> </param> <param> <key>_enabled</key> @@ -377,7 +381,7 @@ </param> <param> <key>value</key> - <value>35</value> + <value>16</value> </param> <param> <key>type</key> @@ -389,19 +393,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'gain'</value> + <value>'decim'</value> </param> <param> <key>writeback</key> - <value>gain</value> + <value>decim</value> </param> <param> <key>_coordinate</key> - <value>(671, 122)</value> + <value>(355, 97)</value> </param> <param> <key>_rotation</key> @@ -412,7 +416,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>freq</value> + <value>output_filename</value> </param> <param> <key>_enabled</key> @@ -420,11 +424,11 @@ </param> <param> <key>value</key> - <value>1698e6</value> + <value>'frames.dat'</value> </param> <param> <key>type</key> - <value>real</value> + <value>string</value> </param> <param> <key>config_file</key> @@ -432,19 +436,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'freq'</value> + <value>'filename'</value> </param> <param> <key>writeback</key> - <value>freq</value> + <value>output_filename</value> </param> <param> <key>_coordinate</key> - <value>(514, 121)</value> + <value>(1143, 101)</value> </param> <param> <key>_rotation</key> @@ -455,7 +459,7 @@ <key>variable_config</key> <param> <key>id</key> - <value>decim</value> + <value>pll_alpha</value> </param> <param> <key>_enabled</key> @@ -463,7 +467,7 @@ </param> <param> <key>value</key> - <value>16</value> + <value>0.05</value> </param> <param> <key>type</key> @@ -475,19 +479,19 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> - <value>'decim'</value> + <value>'pll_alpha'</value> </param> <param> <key>writeback</key> - <value>decim</value> + <value>pll_alpha</value> </param> <param> <key>_coordinate</key> - <value>(358, 118)</value> + <value>(827, 100)</value> </param> <param> <key>_rotation</key> @@ -518,7 +522,7 @@ </param> <param> <key>section</key> - <value>'usrp'</value> + <value>'usrp_rx_hrpt'</value> </param> <param> <key>option</key> @@ -530,7 +534,7 @@ </param> <param> <key>_coordinate</key> - <value>(201, 116)</value> + <value>(198, 95)</value> </param> <param> <key>_rotation</key> @@ -538,18 +542,38 @@ </param> </block> <block> - <key>noaa_hrpt_decoder</key> + <key>gr_agc_xx</key> <param> <key>id</key> - <value>decoder</value> + <value>agc</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> + </param> + <param> + <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>(1247, 347)</value> + <value>(339, 434)</value> </param> <param> <key>_rotation</key> @@ -608,7 +632,7 @@ </param> <param> <key>_coordinate</key> - <value>(29, 303)</value> + <value>(127, 418)</value> </param> <param> <key>_rotation</key> @@ -616,22 +640,42 @@ </param> </block> <block> - <key>variable</key> + <key>gr_clock_recovery_mm_xx</key> <param> <key>id</key> - <value>mf_taps</value> + <value>gr_clock_recovery_mm_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>[-0.5/hs,]*hs+[0.5/hs,]*hs</value> + <key>type</key> + <value>float</value> + </param> + <param> + <key>omega</key> + <value>sps/2.0</value> + </param> + <param> + <key>gain_omega</key> + <value>clock_alpha**2/4.0</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>gain_mu</key> + <value>clock_alpha</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>max_clock_offset</value> </param> <param> <key>_coordinate</key> - <value>(825, 19)</value> + <value>(920, 426)</value> </param> <param> <key>_rotation</key> @@ -639,10 +683,10 @@ </param> </block> <block> - <key>gr_agc_xx</key> + <key>gr_moving_average_xx</key> <param> <key>id</key> - <value>agc</value> + <value>gr_moving_average_xx_0</value> </param> <param> <key>_enabled</key> @@ -650,27 +694,77 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>float</value> </param> <param> - <key>rate</key> - <value>1e-6</value> + <key>length</key> + <value>hs</value> </param> <param> - <key>reference</key> - <value>1.0</value> + <key>scale</key> + <value>1.0/hs</value> </param> <param> - <key>gain</key> - <value>1.0</value> + <key>max_iter</key> + <value>4000</value> </param> <param> - <key>max_gain</key> - <value>1.0</value> + <key>_coordinate</key> + <value>(720, 442)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_pll_cf</key> + <param> + <key>id</key> + <value>pll</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>pll_alpha</value> + </param> + <param> + <key>beta</key> + <value>pll_alpha**2/4.0</value> + </param> + <param> + <key>max_offset</key> + <value>max_carrier_offset</value> </param> <param> <key>_coordinate</key> - <value>(246, 319)</value> + <value>(507, 442)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>virtual_sink</key> + <param> + <key>id</key> + <value>virtual_sink_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>stream_id</key> + <value>baseband</value> + </param> + <param> + <key>_coordinate</key> + <value>(1180, 457)</value> </param> <param> <key>_rotation</key> @@ -689,7 +783,7 @@ </param> <param> <key>_coordinate</key> - <value>(1060, 347)</value> + <value>(815, 673)</value> </param> <param> <key>_rotation</key> @@ -720,7 +814,7 @@ </param> <param> <key>_coordinate</key> - <value>(1251, 454)</value> + <value>(1026, 722)</value> </param> <param> <key>_rotation</key> @@ -728,34 +822,37 @@ </param> </block> <block> - <key>noaa_hrpt_sync_fb</key> + <key>noaa_hrpt_bit_sync</key> <param> <key>id</key> - <value>sync</value> + <value>noaa_hrpt_bit_sync_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> + <key>_coordinate</key> + <value>(624, 673)</value> </param> <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_binary_slicer_fb</key> <param> - <key>sps</key> - <value>sps</value> + <key>id</key> + <value>gr_binary_slicer_fb_0</value> </param> <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <key>_enabled</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(833, 319)</value> + <value>(446, 673)</value> </param> <param> <key>_rotation</key> @@ -763,30 +860,22 @@ </param> </block> <block> - <key>noaa_hrpt_pll_cf</key> + <key>virtual_source</key> <param> <key>id</key> - <value>pll</value> + <value>virtual_source_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>pll_alpha</value> - </param> - <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> - </param> - <param> - <key>max_offset</key> - <value>max_carrier_offset</value> + <key>stream_id</key> + <value>baseband</value> </param> <param> <key>_coordinate</key> - <value>(638, 327)</value> + <value>(226, 669)</value> </param> <param> <key>_rotation</key> @@ -794,30 +883,18 @@ </param> </block> <block> - <key>gr_fir_filter_xxx</key> + <key>noaa_hrpt_decoder</key> <param> <key>id</key> - <value>gr_fir_filter_xxx_0</value> + <value>decoder</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>ccc</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>taps</key> - <value>mf_taps</value> - </param> - <param> <key>_coordinate</key> - <value>(402, 335)</value> + <value>(1027, 623)</value> </param> <param> <key>_rotation</key> @@ -831,38 +908,56 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> + <source_block_id>agc</source_block_id> + <sink_block_id>pll</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pll</source_block_id> - <sink_block_id>sync</sink_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>gr_moving_average_xx_0</source_block_id> + <sink_block_id>gr_clock_recovery_mm_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>virtual_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>sync</source_block_id> + <source_block_id>noaa_hrpt_bit_sync_0</source_block_id> <sink_block_id>deframer</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> + <source_block_id>gr_binary_slicer_fb_0</source_block_id> + <sink_block_id>noaa_hrpt_bit_sync_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>gr_fir_filter_xxx_0</sink_block_id> + <source_block_id>virtual_source_0</source_block_id> + <sink_block_id>gr_binary_slicer_fb_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_fir_filter_xxx_0</source_block_id> - <sink_block_id>pll</sink_block_id> + <source_block_id>deframer</source_block_id> + <sink_block_id>frame_sink</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>deframer</source_block_id> + <sink_block_id>decoder</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/apps/usrp_rx_hrpt_nogui.py b/gr-noaa/apps/usrp_rx_hrpt_nogui.py index 9917847bb..33259a231 100755 --- a/gr-noaa/apps/usrp_rx_hrpt_nogui.py +++ b/gr-noaa/apps/usrp_rx_hrpt_nogui.py @@ -1,8 +1,8 @@ #!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph -# Title: USRP HRPT Receiver -# Generated: Sun Sep 27 10:13:25 2009 +# Title: Usrp Rx Hrpt Nogui +# Generated: Sun Nov 1 19:32:32 2009 ################################################## from gnuradio import eng_notation @@ -13,59 +13,58 @@ from gnuradio.gr import firdes from grc_gnuradio import usrp as grc_usrp from optparse import OptionParser import ConfigParser -import math +import math, os class usrp_rx_hrpt_nogui(gr.top_block): def __init__(self): - gr.top_block.__init__(self, "USRP HRPT Receiver") + gr.top_block.__init__(self, "Usrp Rx Hrpt Nogui") ################################################## # Variables ################################################## - self.config_filename = config_filename = 'usrp_rx_hrpt.cfg' + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' self._decim_config = ConfigParser.ConfigParser() self._decim_config.read(config_filename) - try: decim = self._decim_config.getfloat('usrp', 'decim') + try: decim = self._decim_config.getfloat('usrp_rx_hrpt', 'decim') except: decim = 16 self.decim = decim self.sym_rate = sym_rate = 600*1109 self.sample_rate = sample_rate = 64e6/decim self.sps = sps = sample_rate/sym_rate - self.hs = hs = int(sps/2.0) - self._sync_alpha_config = ConfigParser.ConfigParser() - self._sync_alpha_config.read(config_filename) - try: sync_alpha = self._sync_alpha_config.getfloat('demod', 'sync_alpha') - except: sync_alpha = 0.05 - self.sync_alpha = sync_alpha self._side_config = ConfigParser.ConfigParser() self._side_config.read(config_filename) - try: side = self._side_config.get('usrp', 'side') + try: side = self._side_config.get('usrp_rx_hrpt', 'side') except: side = 'A' self.side = side self._pll_alpha_config = ConfigParser.ConfigParser() self._pll_alpha_config.read(config_filename) - try: pll_alpha = self._pll_alpha_config.getfloat('demod', 'pll_alpha') + try: pll_alpha = self._pll_alpha_config.getfloat('usrp_rx_hrpt', 'pll_alpha') except: pll_alpha = 0.05 self.pll_alpha = pll_alpha self._output_filename_config = ConfigParser.ConfigParser() self._output_filename_config.read(config_filename) - try: output_filename = self._output_filename_config.get('output', 'filename') + try: output_filename = self._output_filename_config.get('usrp_rx_hrpt', 'filename') except: output_filename = 'frames.dat' self.output_filename = output_filename - self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs,]*hs - self.max_sync_offset = max_sync_offset = 0.01 + self.max_clock_offset = max_clock_offset = 0.1 self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate + self.hs = hs = int(sps/2.0) self._gain_config = ConfigParser.ConfigParser() self._gain_config.read(config_filename) - try: gain = self._gain_config.getfloat('usrp', 'gain') + try: gain = self._gain_config.getfloat('usrp_rx_hrpt', 'gain') except: gain = 35 self.gain = gain self._freq_config = ConfigParser.ConfigParser() self._freq_config.read(config_filename) - try: freq = self._freq_config.getfloat('usrp', 'freq') + try: freq = self._freq_config.getfloat('usrp_rx_hrpt', 'freq') except: freq = 1698e6 self.freq = freq + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(config_filename) + try: clock_alpha = self._clock_alpha_config.getfloat('usrp_rx_hrpt', 'clock_alpha') + except: clock_alpha = 0.05 + self.clock_alpha = clock_alpha ################################################## # Blocks @@ -74,9 +73,11 @@ class usrp_rx_hrpt_nogui(gr.top_block): self.decoder = noaa.hrpt_decoder() self.deframer = noaa.hrpt_deframer() self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps)) + self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset) + self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000) + self.noaa_hrpt_bit_sync_0 = noaa.hrpt_bit_sync() self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset) - self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) self.usrp_source = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") self.usrp_source.set_decim_rate(decim) self.usrp_source.set_frequency(freq, verbose=True) @@ -86,56 +87,58 @@ class usrp_rx_hrpt_nogui(gr.top_block): # Connections ################################################## self.connect((self.usrp_source, 0), (self.agc, 0)) - self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.pll, 0), (self.sync, 0)) - self.connect((self.sync, 0), (self.deframer, 0)) + self.connect((self.agc, 0), (self.pll, 0)) + self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0)) + self.connect((self.gr_moving_average_xx_0, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.noaa_hrpt_bit_sync_0, 0), (self.deframer, 0)) + self.connect((self.gr_binary_slicer_fb_0, 0), (self.noaa_hrpt_bit_sync_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.gr_binary_slicer_fb_0, 0)) self.connect((self.deframer, 0), (self.frame_sink, 0)) - self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0)) - self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0)) + self.connect((self.deframer, 0), (self.decoder, 0)) def set_config_filename(self, config_filename): self.config_filename = config_filename - self._output_filename_config = ConfigParser.ConfigParser() - self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) - self._output_filename_config.write(open(self.config_filename, 'w')) - self._sync_alpha_config = ConfigParser.ConfigParser() - self._sync_alpha_config.read(self.config_filename) - if not self._sync_alpha_config.has_section('demod'): - self._sync_alpha_config.add_section('demod') - self._sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._sync_alpha_config.write(open(self.config_filename, 'w')) - self._pll_alpha_config = ConfigParser.ConfigParser() - self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('demod'): - self._pll_alpha_config.add_section('demod') - self._pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) - self._pll_alpha_config.write(open(self.config_filename, 'w')) + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_alpha_config.write(open(self.config_filename, 'w')) self._gain_config = ConfigParser.ConfigParser() self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp'): - self._gain_config.add_section('usrp') - self._gain_config.set('usrp', 'gain', str(self.gain)) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) self._gain_config.write(open(self.config_filename, 'w')) self._freq_config = ConfigParser.ConfigParser() self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp'): - self._freq_config.add_section('usrp') - self._freq_config.set('usrp', 'freq', str(self.freq)) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) self._freq_config.write(open(self.config_filename, 'w')) self._decim_config = ConfigParser.ConfigParser() self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) + if not self._decim_config.has_section('usrp_rx_hrpt'): + self._decim_config.add_section('usrp_rx_hrpt') + self._decim_config.set('usrp_rx_hrpt', 'decim', str(self.decim)) self._decim_config.write(open(self.config_filename, 'w')) + self._output_filename_config = ConfigParser.ConfigParser() + self._output_filename_config.read(self.config_filename) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) + self._output_filename_config.write(open(self.config_filename, 'w')) + self._pll_alpha_config = ConfigParser.ConfigParser() + self._pll_alpha_config.read(self.config_filename) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) + self._pll_alpha_config.write(open(self.config_filename, 'w')) self._side_config = ConfigParser.ConfigParser() self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) self._side_config.write(open(self.config_filename, 'w')) def set_decim(self, decim): @@ -143,9 +146,9 @@ class usrp_rx_hrpt_nogui(gr.top_block): self.set_sample_rate(64e6/self.decim) self._decim_config = ConfigParser.ConfigParser() self._decim_config.read(self.config_filename) - if not self._decim_config.has_section('usrp'): - self._decim_config.add_section('usrp') - self._decim_config.set('usrp', 'decim', str(self.decim)) + if not self._decim_config.has_section('usrp_rx_hrpt'): + self._decim_config.add_section('usrp_rx_hrpt') + self._decim_config.set('usrp_rx_hrpt', 'decim', str(self.decim)) self._decim_config.write(open(self.config_filename, 'w')) self.usrp_source.set_decim_rate(self.decim) @@ -161,38 +164,24 @@ class usrp_rx_hrpt_nogui(gr.top_block): def set_sps(self, sps): self.sps = sps self.set_hs(int(self.sps/2.0)) - - def set_hs(self, hs): - self.hs = hs - self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs,]*self.hs) - - def set_sync_alpha(self, sync_alpha): - self.sync_alpha = sync_alpha - self._sync_alpha_config = ConfigParser.ConfigParser() - self._sync_alpha_config.read(self.config_filename) - if not self._sync_alpha_config.has_section('demod'): - self._sync_alpha_config.add_section('demod') - self._sync_alpha_config.set('demod', 'sync_alpha', str(self.sync_alpha)) - self._sync_alpha_config.write(open(self.config_filename, 'w')) - self.sync.set_alpha(self.sync_alpha) - self.sync.set_beta(self.sync_alpha**2/4.0) + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps/2.0) def set_side(self, side): self.side = side self._side_config = ConfigParser.ConfigParser() self._side_config.read(self.config_filename) - if not self._side_config.has_section('usrp'): - self._side_config.add_section('usrp') - self._side_config.set('usrp', 'side', str(self.side)) + if not self._side_config.has_section('usrp_rx_hrpt'): + self._side_config.add_section('usrp_rx_hrpt') + self._side_config.set('usrp_rx_hrpt', 'side', str(self.side)) self._side_config.write(open(self.config_filename, 'w')) def set_pll_alpha(self, pll_alpha): self.pll_alpha = pll_alpha self._pll_alpha_config = ConfigParser.ConfigParser() self._pll_alpha_config.read(self.config_filename) - if not self._pll_alpha_config.has_section('demod'): - self._pll_alpha_config.add_section('demod') - self._pll_alpha_config.set('demod', 'pll_alpha', str(self.pll_alpha)) + if not self._pll_alpha_config.has_section('usrp_rx_hrpt'): + self._pll_alpha_config.add_section('usrp_rx_hrpt') + self._pll_alpha_config.set('usrp_rx_hrpt', 'pll_alpha', str(self.pll_alpha)) self._pll_alpha_config.write(open(self.config_filename, 'w')) self.pll.set_alpha(self.pll_alpha) self.pll.set_beta(self.pll_alpha**2/4.0) @@ -201,30 +190,29 @@ class usrp_rx_hrpt_nogui(gr.top_block): self.output_filename = output_filename self._output_filename_config = ConfigParser.ConfigParser() self._output_filename_config.read(self.config_filename) - if not self._output_filename_config.has_section('output'): - self._output_filename_config.add_section('output') - self._output_filename_config.set('output', 'filename', str(self.output_filename)) + if not self._output_filename_config.has_section('usrp_rx_hrpt'): + self._output_filename_config.add_section('usrp_rx_hrpt') + self._output_filename_config.set('usrp_rx_hrpt', 'filename', str(self.output_filename)) self._output_filename_config.write(open(self.config_filename, 'w')) - def set_mf_taps(self, mf_taps): - self.mf_taps = mf_taps - self.gr_fir_filter_xxx_0.set_taps((self.mf_taps)) - - def set_max_sync_offset(self, max_sync_offset): - self.max_sync_offset = max_sync_offset - self.sync.set_max_offset(self.max_sync_offset) + def set_max_clock_offset(self, max_clock_offset): + self.max_clock_offset = max_clock_offset def set_max_carrier_offset(self, max_carrier_offset): self.max_carrier_offset = max_carrier_offset self.pll.set_max_offset(self.max_carrier_offset) + def set_hs(self, hs): + self.hs = hs + self.gr_moving_average_xx_0.set_length_and_scale(self.hs, 1.0/self.hs) + def set_gain(self, gain): self.gain = gain self._gain_config = ConfigParser.ConfigParser() self._gain_config.read(self.config_filename) - if not self._gain_config.has_section('usrp'): - self._gain_config.add_section('usrp') - self._gain_config.set('usrp', 'gain', str(self.gain)) + if not self._gain_config.has_section('usrp_rx_hrpt'): + self._gain_config.add_section('usrp_rx_hrpt') + self._gain_config.set('usrp_rx_hrpt', 'gain', str(self.gain)) self._gain_config.write(open(self.config_filename, 'w')) self.usrp_source.set_gain(self.gain) @@ -232,12 +220,23 @@ class usrp_rx_hrpt_nogui(gr.top_block): self.freq = freq self._freq_config = ConfigParser.ConfigParser() self._freq_config.read(self.config_filename) - if not self._freq_config.has_section('usrp'): - self._freq_config.add_section('usrp') - self._freq_config.set('usrp', 'freq', str(self.freq)) + if not self._freq_config.has_section('usrp_rx_hrpt'): + self._freq_config.add_section('usrp_rx_hrpt') + self._freq_config.set('usrp_rx_hrpt', 'freq', str(self.freq)) self._freq_config.write(open(self.config_filename, 'w')) self.usrp_source.set_frequency(self.freq) + def set_clock_alpha(self, clock_alpha): + self.clock_alpha = clock_alpha + self._clock_alpha_config = ConfigParser.ConfigParser() + self._clock_alpha_config.read(self.config_filename) + if not self._clock_alpha_config.has_section('usrp_rx_hrpt'): + self._clock_alpha_config.add_section('usrp_rx_hrpt') + self._clock_alpha_config.set('usrp_rx_hrpt', 'clock_alpha', str(self.clock_alpha)) + self._clock_alpha_config.write(open(self.config_filename, 'w')) + self.gr_clock_recovery_mm_xx_0.set_gain_omega(self.clock_alpha**2/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.clock_alpha) + if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") (options, args) = parser.parse_args() |