diff options
author | Johnathan Corgan | 2009-09-28 17:52:53 -0700 |
---|---|---|
committer | Johnathan Corgan | 2009-09-28 17:52:53 -0700 |
commit | c88f64ad42a8473a1749275c0e579284b20eb283 (patch) | |
tree | 60ec91761826f0cc37a868bcc6bc643c4829dbbb | |
parent | fb4883e9d4b6d4b25f4167d074a51eb109c69e93 (diff) | |
parent | 745a36295016a08bcf8e81e0246b53cd1a487716 (diff) | |
download | gnuradio-c88f64ad42a8473a1749275c0e579284b20eb283.tar.gz gnuradio-c88f64ad42a8473a1749275c0e579284b20eb283.tar.bz2 gnuradio-c88f64ad42a8473a1749275c0e579284b20eb283.zip |
Merge branch 'wip/gr-noaa' of http://gnuradio.org/git/jcorgan into master
* 'wip/gr-noaa' of http://gnuradio.org/git/jcorgan:
Restored original HRPT GUI script and documented various script choices.
Renamed simplified HRPT script to allow restoring original
General improvements in HRPT receiver
-rw-r--r-- | gr-noaa/README | 22 | ||||
-rw-r--r-- | gr-noaa/apps/Makefile.am | 4 | ||||
-rw-r--r-- | gr-noaa/apps/demod_hrpt_file.grc | 331 | ||||
-rwxr-xr-x | gr-noaa/apps/demod_hrpt_file.py | 55 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt.grc | 455 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt.py | 27 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt2.grc | 1418 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt2.py | 401 | ||||
-rw-r--r-- | gr-noaa/apps/usrp_rx_hrpt_nogui.grc | 869 | ||||
-rwxr-xr-x | gr-noaa/apps/usrp_rx_hrpt_nogui.py | 250 |
10 files changed, 3418 insertions, 414 deletions
diff --git a/gr-noaa/README b/gr-noaa/README index d99c0d90a..fada3550a 100644 --- a/gr-noaa/README +++ b/gr-noaa/README @@ -5,10 +5,10 @@ As the scripts are generated using GRC, GRC must be installed at runtime in order for them to operate. -HRPT Operation --------------- +HRPT OPERATION usrp_rx_hrpt.py +--------------- This GUI script will receive HRPT RF, demodulate, synchronize, and deframe HRPT minor frames into a file. The file stores a series of 11090 word, @@ -24,12 +24,26 @@ The present HRPT demodulator is only tested at decimation 16. The only other valid decimation rates are 24 and 32, which may word but with more bit errors. No other decimation rates will work. +usrp_rx_hrpt2.py +---------------- + +This GUI script uses fewer graphical displays to reduce CPU consumption on +slower machines, but otherwise operates identically to userp_rx_hrpt.py. + +usrp_rx_hrpt_nogui.py +--------------------- + +This non-GUI script operates without a display and requires that all parameters +be set in the configuration file prior to running. It has no command-line +parameters, and works identically to the GUI scripts. demod_hrpt_file.py +------------------ -This command-line only script will operate on a file generated with +This non-GUI script will operate on a file generated with usrp_rx_cfile.py and output frames in the same format as above. It does -*not* use the configuration file above. +*not* use the configuration file above; instead you must pass parameters to +it on the command line. To exit the program, press Enter. Usage: demod_hrpt_file.py: [options] diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index 906638ff1..b9787a92c 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -26,10 +26,14 @@ if PYTHON dist_bin_SCRIPTS = \ demod_hrpt_file.py \ usrp_rx_hrpt.py \ + usrp_rx_hrpt2.py \ + usrp_rx_hrpt_nogui.py \ usrp_rx_lrit.py EXTRA_DIST = \ 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 4a5e87170..16f83f780 100644 --- a/gr-noaa/apps/demod_hrpt_file.grc +++ b/gr-noaa/apps/demod_hrpt_file.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Wed Sep 23 11:37:25 2009</timestamp> + <timestamp>Sun Sep 27 09:51:42 2009</timestamp> <block> <key>options</key> <param> @@ -191,34 +191,22 @@ </param> </block> <block> - <key>parameter</key> + <key>import</key> <param> <key>id</key> - <value>decim</value> + <value>import_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Decimation</value> - </param> - <param> - <key>value</key> - <value>16</value> - </param> - <param> - <key>type</key> - <value>intx</value> - </param> - <param> - <key>short_id</key> - <value>d</value> + <key>import</key> + <value>import math</value> </param> <param> <key>_coordinate</key> - <value>(404, 102)</value> + <value>(9, 92)</value> </param> <param> <key>_rotation</key> @@ -229,7 +217,7 @@ <key>parameter</key> <param> <key>id</key> - <value>pll_alpha</value> + <value>filename</value> </param> <param> <key>_enabled</key> @@ -237,23 +225,23 @@ </param> <param> <key>label</key> - <value></value> + <value>Filename</value> </param> <param> <key>value</key> - <value>0.05</value> + <value>usrp.dat</value> </param> <param> <key>type</key> - <value>eng_float</value> + <value>string</value> </param> <param> <key>short_id</key> - <value>p</value> + <value>F</value> </param> <param> <key>_coordinate</key> - <value>(516, 102)</value> + <value>(200, 101)</value> </param> <param> <key>_rotation</key> @@ -264,7 +252,7 @@ <key>parameter</key> <param> <key>id</key> - <value>sync_alpha</value> + <value>output</value> </param> <param> <key>_enabled</key> @@ -272,23 +260,23 @@ </param> <param> <key>label</key> - <value></value> + <value>Output</value> </param> <param> <key>value</key> - <value>0.05</value> + <value>frames.dat</value> </param> <param> <key>type</key> - <value>eng_float</value> + <value>string</value> </param> <param> <key>short_id</key> - <value>s</value> + <value>o</value> </param> <param> <key>_coordinate</key> - <value>(601, 103)</value> + <value>(302, 101)</value> </param> <param> <key>_rotation</key> @@ -296,22 +284,22 @@ </param> </block> <block> - <key>import</key> + <key>gr_float_to_complex</key> <param> <key>id</key> - <value>import_0</value> + <value>f2c</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(9, 92)</value> + <value>(832, 363)</value> </param> <param> <key>_rotation</key> @@ -319,34 +307,57 @@ </param> </block> <block> - <key>parameter</key> + <key>virtual_sink</key> <param> <key>id</key> - <value>filename</value> + <value>samples_sink</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Filename</value> + <key>stream_id</key> + <value>samples</value> </param> <param> - <key>value</key> - <value>usrp.dat</value> + <key>_coordinate</key> + <value>(1070, 376)</value> </param> <param> - <key>type</key> - <value>string</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>noaa_hrpt_sync_fb</key> <param> - <key>short_id</key> - <value>F</value> + <key>id</key> + <value>sync</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>sync_alpha</value> + </param> + <param> + <key>beta</key> + <value>sync_alpha**2/4.0</value> + </param> + <param> + <key>sps</key> + <value>sps</value> + </param> + <param> + <key>max_offset</key> + <value>max_sync_offset</value> </param> <param> <key>_coordinate</key> - <value>(200, 101)</value> + <value>(813, 455)</value> </param> <param> <key>_rotation</key> @@ -354,10 +365,29 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>noaa_hrpt_deframer</key> <param> <key>id</key> - <value>file_source</value> + <value>deframer</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> @@ -365,23 +395,19 @@ </param> <param> <key>file</key> - <value>filename</value> + <value>output</value> </param> <param> <key>type</key> <value>short</value> </param> <param> - <key>repeat</key> - <value>False</value> - </param> - <param> <key>vlen</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(102, 368)</value> + <value>(1238, 479)</value> </param> <param> <key>_rotation</key> @@ -389,10 +415,10 @@ </param> </block> <block> - <key>gr_short_to_float</key> + <key>noaa_hrpt_decoder</key> <param> <key>id</key> - <value>s2f</value> + <value>decoder</value> </param> <param> <key>_enabled</key> @@ -400,7 +426,7 @@ </param> <param> <key>_coordinate</key> - <value>(305, 380)</value> + <value>(1237, 542)</value> </param> <param> <key>_rotation</key> @@ -431,7 +457,7 @@ </param> <param> <key>_coordinate</key> - <value>(526, 363)</value> + <value>(628, 363)</value> </param> <param> <key>_rotation</key> @@ -439,45 +465,34 @@ </param> </block> <block> - <key>gr_float_to_complex</key> + <key>parameter</key> <param> <key>id</key> - <value>f2c</value> + <value>decim</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(730, 363)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <key>label</key> + <value>Decimation</value> </param> - </block> - <block> - <key>virtual_sink</key> <param> - <key>id</key> - <value>samples_sink</value> + <key>value</key> + <value>16</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>type</key> + <value>intx</value> </param> <param> - <key>stream_id</key> - <value>samples</value> + <key>short_id</key> + <value>d</value> </param> <param> <key>_coordinate</key> - <value>(968, 376)</value> + <value>(415, 101)</value> </param> <param> <key>_rotation</key> @@ -485,22 +500,34 @@ </param> </block> <block> - <key>virtual_source</key> + <key>parameter</key> <param> <key>id</key> - <value>samples_source</value> + <value>pll_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>stream_id</key> - <value>samples</value> + <key>label</key> + <value></value> + </param> + <param> + <key>value</key> + <value>0.05</value> + </param> + <param> + <key>type</key> + <value>eng_float</value> + </param> + <param> + <key>short_id</key> + <value>p</value> </param> <param> <key>_coordinate</key> - <value>(104, 479)</value> + <value>(527, 101)</value> </param> <param> <key>_rotation</key> @@ -508,34 +535,34 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> + <key>parameter</key> <param> <key>id</key> - <value>matched_filter</value> + <value>sync_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value></value> </param> <param> - <key>length</key> - <value>hs</value> + <key>value</key> + <value>0.05</value> </param> <param> - <key>scale</key> - <value>1.0/hs</value> + <key>type</key> + <value>eng_float</value> </param> <param> - <key>max_iter</key> - <value>4000</value> + <key>short_id</key> + <value>s</value> </param> <param> <key>_coordinate</key> - <value>(302, 463)</value> + <value>(615, 99)</value> </param> <param> <key>_rotation</key> @@ -566,7 +593,7 @@ </param> <param> <key>_coordinate</key> - <value>(504, 463)</value> + <value>(606, 463)</value> </param> <param> <key>_rotation</key> @@ -574,34 +601,22 @@ </param> </block> <block> - <key>noaa_hrpt_sync_fb</key> + <key>virtual_source</key> <param> <key>id</key> - <value>sync</value> + <value>samples_source</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>sync_alpha</value> - </param> - <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> - </param> - <param> - <key>sps</key> - <value>sps</value> - </param> - <param> - <key>max_offset</key> - <value>max_sync_offset</value> + <key>stream_id</key> + <value>samples</value> </param> <param> <key>_coordinate</key> - <value>(711, 455)</value> + <value>(164, 479)</value> </param> <param> <key>_rotation</key> @@ -609,10 +624,10 @@ </param> </block> <block> - <key>noaa_hrpt_deframer</key> + <key>gr_short_to_float</key> <param> <key>id</key> - <value>deframer</value> + <value>s2f</value> </param> <param> <key>_enabled</key> @@ -620,7 +635,7 @@ </param> <param> <key>_coordinate</key> - <value>(935, 483)</value> + <value>(365, 380)</value> </param> <param> <key>_rotation</key> @@ -628,10 +643,10 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>gr_file_source</key> <param> <key>id</key> - <value>file_sink</value> + <value>file_source</value> </param> <param> <key>_enabled</key> @@ -639,19 +654,23 @@ </param> <param> <key>file</key> - <value>output</value> + <value>filename</value> </param> <param> <key>type</key> <value>short</value> </param> <param> + <key>repeat</key> + <value>False</value> + </param> + <param> <key>vlen</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(1136, 479)</value> + <value>(162, 368)</value> </param> <param> <key>_rotation</key> @@ -659,18 +678,22 @@ </param> </block> <block> - <key>noaa_hrpt_decoder</key> + <key>variable</key> <param> <key>id</key> - <value>decoder</value> + <value>mf_taps</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>(1135, 542)</value> + <value>(829, 21)</value> </param> <param> <key>_rotation</key> @@ -678,34 +701,30 @@ </param> </block> <block> - <key>parameter</key> + <key>gr_fir_filter_xxx</key> <param> <key>id</key> - <value>output</value> + <value>gr_fir_filter_xxx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Output</value> - </param> - <param> - <key>value</key> - <value>frames.dat</value> + <key>type</key> + <value>ccc</value> </param> <param> - <key>type</key> - <value>string</value> + <key>decim</key> + <value>1</value> </param> <param> - <key>short_id</key> - <value>o</value> + <key>taps</key> + <value>mf_taps</value> </param> <param> <key>_coordinate</key> - <value>(302, 101)</value> + <value>(359, 471)</value> </param> <param> <key>_rotation</key> @@ -731,18 +750,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>matched_filter</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>deinterleave</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> @@ -755,12 +762,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>file_source</source_block_id> - <sink_block_id>s2f</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> @@ -773,8 +774,26 @@ <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_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> <source_block_id>samples_source</source_block_id> - <sink_block_id>matched_filter</sink_block_id> + <sink_block_id>gr_fir_filter_xxx_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_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_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 a1469e9e0..309a79209 100755 --- a/gr-noaa/apps/demod_hrpt_file.py +++ b/gr-noaa/apps/demod_hrpt_file.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Wed Sep 23 11:37:25 2009 +# Generated: Sun Sep 27 09:34:15 2009 ################################################## from gnuradio import eng_notation @@ -15,17 +15,17 @@ import math class demod_hrpt_file(gr.top_block): - def __init__(self, decim=16, pll_alpha=0.05, sync_alpha=0.05, filename="usrp.dat", output="frames.dat"): + 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") ################################################## # Parameters ################################################## + self.filename = filename + self.output = output self.decim = decim self.pll_alpha = pll_alpha self.sync_alpha = sync_alpha - self.filename = filename - self.output = output ################################################## # Variables @@ -33,9 +33,10 @@ 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_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate - self.hs = hs = int(sps/2.0) ################################################## # Blocks @@ -46,7 +47,7 @@ class demod_hrpt_file(gr.top_block): 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.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) + 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.s2f = gr.short_to_float() self.sync = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset) @@ -57,13 +58,19 @@ class demod_hrpt_file(gr.top_block): 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.matched_filter, 0), (self.pll, 0)) - self.connect((self.s2f, 0), (self.deinterleave, 0)) self.connect((self.deinterleave, 1), (self.f2c, 1)) self.connect((self.deinterleave, 0), (self.f2c, 0)) - self.connect((self.file_source, 0), (self.s2f, 0)) self.connect((self.deframer, 0), (self.decoder, 0)) - self.connect((self.f2c, 0), (self.matched_filter, 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 def set_decim(self, decim): self.decim = decim @@ -79,12 +86,6 @@ class demod_hrpt_file(gr.top_block): self.sync.set_alpha(self.sync_alpha) self.sync.set_beta(self.sync_alpha**2/4.0) - def set_filename(self, filename): - self.filename = filename - - def set_output(self, output): - self.output = output - def set_sym_rate(self, sym_rate): self.sym_rate = sym_rate self.set_sps(self.sample_rate/self.sym_rate) @@ -98,6 +99,14 @@ class demod_hrpt_file(gr.top_block): 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_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) @@ -106,24 +115,20 @@ class demod_hrpt_file(gr.top_block): 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.matched_filter.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]") 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("-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", "--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]") (options, args) = parser.parse_args() - tb = demod_hrpt_file(decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha, filename=options.filename, output=options.output) + tb = demod_hrpt_file(filename=options.filename, output=options.output, decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha) tb.start() raw_input('Press Enter to quit: ') tb.stop() diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index 90d868769..d06879716 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>Wed Sep 23 11:32:00 2009</timestamp> + <timestamp>Sun Sep 27 13:37:22 2009</timestamp> <block> <key>options</key> <param> @@ -76,41 +76,6 @@ </param> </block> <block> - <key>gr_moving_average_xx</key> - <param> - <key>id</key> - <value>matched_filter</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>length</key> - <value>hs</value> - </param> - <param> - <key>scale</key> - <value>1.0/hs</value> - </param> - <param> - <key>max_iter</key> - <value>4000</value> - </param> - <param> - <key>_coordinate</key> - <value>(441, 723)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>import</key> <param> <key>id</key> @@ -867,6 +832,230 @@ </param> </block> <block> + <key>notebook</key> + <param> + <key>id</key> + <value>displays</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>style</key> + <value>wx.NB_TOP</value> + </param> + <param> + <key>labels</key> + <value>['RX','Demod']</value> + </param> + <param> + <key>grid_pos</key> + <value>2, 0, 1, 4</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(15, 237)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_sync_fb</key> + <param> + <key>id</key> + <value>sync</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>sync_alpha</value> + </param> + <param> + <key>beta</key> + <value>sync_alpha**2/4.0</value> + </param> + <param> + <key>sps</key> + <value>sps</value> + </param> + <param> + <key>max_offset</key> + <value>max_sync_offset</value> + </param> + <param> + <key>_coordinate</key> + <value>(840, 715)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_deframer</key> + <param> + <key>id</key> + <value>deframer</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1071, 743)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_decoder</key> + <param> + <key>id</key> + <value>decoder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1274, 743)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_file_sink</key> + <param> + <key>id</key> + <value>frame_sink</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> + </param> + <param> + <key>_coordinate</key> + <value>(1273, 851)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>mf_taps</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>(792, 158)</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>(632, 723)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_fir_filter_xxx</key> + <param> + <key>id</key> + <value>gr_fir_filter_xxx_0</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>(400, 731)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> <key>usrp_simple_source_x</key> <param> <key>id</key> @@ -918,7 +1107,7 @@ </param> <param> <key>_coordinate</key> - <value>(56, 699)</value> + <value>(28, 699)</value> </param> <param> <key>_rotation</key> @@ -957,7 +1146,7 @@ </param> <param> <key>_coordinate</key> - <value>(273, 715)</value> + <value>(240, 715)</value> </param> <param> <key>_rotation</key> @@ -1016,7 +1205,7 @@ </param> <param> <key>_coordinate</key> - <value>(439, 829)</value> + <value>(406, 838)</value> </param> <param> <key>_rotation</key> @@ -1071,7 +1260,7 @@ </param> <param> <key>fft_rate</key> - <value>30</value> + <value>15</value> </param> <param> <key>peak_hold</key> @@ -1095,7 +1284,7 @@ </param> <param> <key>_coordinate</key> - <value>(439, 465)</value> + <value>(406, 466)</value> </param> <param> <key>_rotation</key> @@ -1118,7 +1307,7 @@ </param> <param> <key>title</key> - <value>Post-PLL</value> + <value>Demod Waveform</value> </param> <param> <key>samp_rate</key> @@ -1161,176 +1350,6 @@ <value>180</value> </param> </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>displays</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['RX','Demod']</value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 1, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 237)</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>(632, 723)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_sync_fb</key> - <param> - <key>id</key> - <value>sync</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>sync_alpha</value> - </param> - <param> - <key>beta</key> - <value>sync_alpha**2/4.0</value> - </param> - <param> - <key>sps</key> - <value>sps</value> - </param> - <param> - <key>max_offset</key> - <value>max_sync_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(840, 715)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_deframer</key> - <param> - <key>id</key> - <value>deframer</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1071, 743)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1274, 743)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>frame_sink</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> - </param> - <param> - <key>_coordinate</key> - <value>(1273, 851)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> <connection> <source_block_id>deframer</source_block_id> <sink_block_id>frame_sink</sink_block_id> @@ -1368,20 +1387,20 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>matched_filter</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>matched_filter</source_block_id> - <sink_block_id>pll</sink_block_id> + <source_block_id>agc</source_block_id> + <sink_block_id>gr_fir_filter_xxx_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_fir_filter_xxx_0</source_block_id> + <sink_block_id>pll</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 7efbecd3a..ae70f25c8 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Wed Sep 23 11:32:04 2009 +# Generated: Sun Sep 27 13:37:23 2009 ################################################## from gnuradio import eng_notation @@ -62,6 +62,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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 @@ -70,9 +71,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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.hs = hs = int(sps/2.0) self.gain = gain = saved_gain self.freq = freq = saved_freq self.decim_text = decim_text = decim @@ -189,11 +190,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): self.decoder = noaa.hrpt_decoder() self.deframer = noaa.hrpt_deframer() self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename) - self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000) + 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.displays.GetPage(1).GetWin(), - title="Post-PLL", + title="Demod Waveform", sample_rate=sample_rate, v_scale=0.5, t_scale=20.0/sample_rate, @@ -211,7 +212,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): ref_scale=2.0, sample_rate=sample_rate, fft_size=1024, - fft_rate=30, + fft_rate=15, average=True, avg_alpha=0.1, title="RX Spectrum", @@ -244,9 +245,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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.agc, 0), (self.matched_filter, 0)) - self.connect((self.matched_filter, 0), (self.pll, 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.usrp_source, 0), (self.agc, 0)) def set_config_filename(self, config_filename): @@ -348,6 +349,10 @@ 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) @@ -387,6 +392,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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) @@ -395,10 +404,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui): 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.matched_filter.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) diff --git a/gr-noaa/apps/usrp_rx_hrpt2.grc b/gr-noaa/apps/usrp_rx_hrpt2.grc new file mode 100644 index 000000000..d42a9eab6 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt2.grc @@ -0,0 +1,1418 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Sun Sep 27 13:32:47 2009</timestamp> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>max_carrier_offset</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>2*math.pi*100e3/sample_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(575, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sym_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>600*1109</value> + </param> + <param> + <key>_coordinate</key> + <value>(301, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>sample_rate/sym_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(397, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>hs</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>int(sps/2.0)</value> + </param> + <param> + <key>_coordinate</key> + <value>(499, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sample_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>64e6/decim</value> + </param> + <param> + <key>_coordinate</key> + <value>(198, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>gain</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> + </param> + <param> + <key>_coordinate</key> + <value>(340, 106)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_text_box</key> + <param> + <key>id</key> + <value>freq</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frequency</value> + </param> + <param> + <key>value</key> + <value>saved_freq</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>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(199, 106)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>pll_alpha</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> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>sync_alpha</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>SYNC Alpha</value> + </param> + <param> + <key>value</key> + <value>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> + </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>(618, 106)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_static_text</key> + <param> + <key>id</key> + <value>side_text</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> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>side</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> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp'</value> + </param> + <param> + <key>option</key> + <value>'side'</value> + </param> + <param> + <key>writeback</key> + <value>side</value> + </param> + <param> + <key>_coordinate</key> + <value>(194, 253)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>decim</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> + </param> + <param> + <key>option</key> + <value>'decim'</value> + </param> + <param> + <key>writeback</key> + <value>decim</value> + </param> + <param> + <key>_coordinate</key> + <value>(351, 255)</value> + </param> + <param> + <key>_rotation</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> + </param> + <param> + <key>value</key> + <value>1698e6</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> + </param> + <param> + <key>option</key> + <value>'freq'</value> + </param> + <param> + <key>writeback</key> + <value>freq</value> + </param> + <param> + <key>_coordinate</key> + <value>(507, 258)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_gain</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>35</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> + </param> + <param> + <key>option</key> + <value>'gain'</value> + </param> + <param> + <key>writeback</key> + <value>gain</value> + </param> + <param> + <key>_coordinate</key> + <value>(664, 259)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_pll_alpha</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> + </param> + <param> + <key>option</key> + <value>'pll_alpha'</value> + </param> + <param> + <key>writeback</key> + <value>pll_alpha</value> + </param> + <param> + <key>_coordinate</key> + <value>(823, 258)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_sync_alpha</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> + </param> + <param> + <key>option</key> + <value>'sync_alpha'</value> + </param> + <param> + <key>writeback</key> + <value>sync_alpha</value> + </param> + <param> + <key>_coordinate</key> + <value>(981, 258)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>output_filename</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> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'output'</value> + </param> + <param> + <key>option</key> + <value>'filename'</value> + </param> + <param> + <key>writeback</key> + <value>output_filename</value> + </param> + <param> + <key>_coordinate</key> + <value>(1139, 259)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_static_text</key> + <param> + <key>id</key> + <value>decim_text</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> + </param> + <param> + <key>_coordinate</key> + <value>(973, 20)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>max_sync_offset</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>0.01</value> + </param> + <param> + <key>_coordinate</key> + <value>(705, 19)</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, 160)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </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, 102)</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>(664, 809)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_sync_fb</key> + <param> + <key>id</key> + <value>sync</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>sync_alpha</value> + </param> + <param> + <key>beta</key> + <value>sync_alpha**2/4.0</value> + </param> + <param> + <key>sps</key> + <value>sps</value> + </param> + <param> + <key>max_offset</key> + <value>max_sync_offset</value> + </param> + <param> + <key>_coordinate</key> + <value>(865, 801)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_file_sink</key> + <param> + <key>id</key> + <value>frame_sink</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> + </param> + <param> + <key>_coordinate</key> + <value>(1283, 937)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_deframer</key> + <param> + <key>id</key> + <value>deframer</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1091, 829)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_decoder</key> + <param> + <key>id</key> + <value>decoder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1281, 829)</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> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value>2,0,1,4</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(631, 632)</value> + </param> + <param> + <key>_rotation</key> + <value>180</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>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>(269, 801)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_fir_filter_xxx</key> + <param> + <key>id</key> + <value>gr_fir_filter_xxx_0</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>(418, 817)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>mf_taps</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>(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> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>file</key> + <value>'usrp.dat'</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>repeat</key> + <value>False</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(215, 490)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_deinterleave</key> + <param> + <key>id</key> + <value>gr_deinterleave_0</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> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(598, 485)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_float_to_complex</key> + <param> + <key>id</key> + <value>gr_float_to_complex_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(801, 485)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_short_to_float</key> + <param> + <key>id</key> + <value>s2f</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(393, 502)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>virtual_sink</key> + <param> + <key>id</key> + <value>sample_stream</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>stream_id</key> + <value>samples</value> + </param> + <param> + <key>_coordinate</key> + <value>(1027, 498)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>usrp_simple_source_x</key> + <param> + <key>id</key> + <value>usrp_source</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> + </param> + <param> + <key>side</key> + <value>side</value> + </param> + <param> + <key>rx_ant</key> + <value>RXA</value> + </param> + <param> + <key>hb_filters</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(63, 785)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>virtual_source</key> + <param> + <key>id</key> + <value>virtual_source_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>stream_id</key> + <value>samples</value> + </param> + <param> + <key>_coordinate</key> + <value>(69, 671)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>options</key> + <param> + <key>id</key> + <value>usrp_rx_hrpt2</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</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>gr_fir_filter_xxx_0</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>agc</source_block_id> + <sink_block_id>gr_fir_filter_xxx_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_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> + <connection> + <source_block_id>pll</source_block_id> + <sink_block_id>pll_scope</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_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_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_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_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_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_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>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> + </connection> + <connection> + <source_block_id>gr_float_to_complex_0</source_block_id> + <sink_block_id>sample_stream</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-noaa/apps/usrp_rx_hrpt2.py b/gr-noaa/apps/usrp_rx_hrpt2.py new file mode 100755 index 000000000..319335169 --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt2.py @@ -0,0 +1,401 @@ +#!/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 new file mode 100644 index 000000000..fadc2d1da --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt_nogui.grc @@ -0,0 +1,869 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Sun Sep 27 10:13:25 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>usrp_rx_hrpt_nogui</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> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value>1</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> + <key>id</key> + <value>max_carrier_offset</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>2*math.pi*100e3/sample_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(575, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sym_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>600*1109</value> + </param> + <param> + <key>_coordinate</key> + <value>(301, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>sample_rate/sym_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(397, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>hs</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>int(sps/2.0)</value> + </param> + <param> + <key>_coordinate</key> + <value>(499, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sample_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>64e6/decim</value> + </param> + <param> + <key>_coordinate</key> + <value>(198, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>max_sync_offset</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>0.01</value> + </param> + <param> + <key>_coordinate</key> + <value>(705, 19)</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, 167)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </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, 112)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>output_filename</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> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'output'</value> + </param> + <param> + <key>option</key> + <value>'filename'</value> + </param> + <param> + <key>writeback</key> + <value>output_filename</value> + </param> + <param> + <key>_coordinate</key> + <value>(1146, 122)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>sync_alpha</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> + </param> + <param> + <key>option</key> + <value>'sync_alpha'</value> + </param> + <param> + <key>writeback</key> + <value>sync_alpha</value> + </param> + <param> + <key>_coordinate</key> + <value>(988, 121)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>pll_alpha</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> + </param> + <param> + <key>option</key> + <value>'pll_alpha'</value> + </param> + <param> + <key>writeback</key> + <value>pll_alpha</value> + </param> + <param> + <key>_coordinate</key> + <value>(830, 121)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>gain</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>35</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> + </param> + <param> + <key>option</key> + <value>'gain'</value> + </param> + <param> + <key>writeback</key> + <value>gain</value> + </param> + <param> + <key>_coordinate</key> + <value>(671, 122)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>freq</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1698e6</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> + </param> + <param> + <key>option</key> + <value>'freq'</value> + </param> + <param> + <key>writeback</key> + <value>freq</value> + </param> + <param> + <key>_coordinate</key> + <value>(514, 121)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>decim</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> + </param> + <param> + <key>option</key> + <value>'decim'</value> + </param> + <param> + <key>writeback</key> + <value>decim</value> + </param> + <param> + <key>_coordinate</key> + <value>(358, 118)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>side</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> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp'</value> + </param> + <param> + <key>option</key> + <value>'side'</value> + </param> + <param> + <key>writeback</key> + <value>side</value> + </param> + <param> + <key>_coordinate</key> + <value>(201, 116)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_decoder</key> + <param> + <key>id</key> + <value>decoder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1247, 347)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>usrp_simple_source_x</key> + <param> + <key>id</key> + <value>usrp_source</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> + </param> + <param> + <key>side</key> + <value>side</value> + </param> + <param> + <key>rx_ant</key> + <value>RXA</value> + </param> + <param> + <key>hb_filters</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(29, 303)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>mf_taps</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>(825, 19)</value> + </param> + <param> + <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>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>(246, 319)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_deframer</key> + <param> + <key>id</key> + <value>deframer</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1060, 347)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_file_sink</key> + <param> + <key>id</key> + <value>frame_sink</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> + </param> + <param> + <key>_coordinate</key> + <value>(1251, 454)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>noaa_hrpt_sync_fb</key> + <param> + <key>id</key> + <value>sync</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>sync_alpha</value> + </param> + <param> + <key>beta</key> + <value>sync_alpha**2/4.0</value> + </param> + <param> + <key>sps</key> + <value>sps</value> + </param> + <param> + <key>max_offset</key> + <value>max_sync_offset</value> + </param> + <param> + <key>_coordinate</key> + <value>(833, 319)</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>(638, 327)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_fir_filter_xxx</key> + <param> + <key>id</key> + <value>gr_fir_filter_xxx_0</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> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>usrp_source</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>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_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_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_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_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_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-noaa/apps/usrp_rx_hrpt_nogui.py b/gr-noaa/apps/usrp_rx_hrpt_nogui.py new file mode 100755 index 000000000..9917847bb --- /dev/null +++ b/gr-noaa/apps/usrp_rx_hrpt_nogui.py @@ -0,0 +1,250 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: USRP HRPT Receiver +# Generated: Sun Sep 27 10:13:25 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 grc_gnuradio import usrp as grc_usrp +from optparse import OptionParser +import ConfigParser +import math + +class usrp_rx_hrpt_nogui(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "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.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') + 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') + 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') + 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_config = ConfigParser.ConfigParser() + self._gain_config.read(config_filename) + try: gain = self._gain_config.getfloat('usrp', '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') + except: freq = 1698e6 + self.freq = freq + + ################################################## + # 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.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.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.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)) + + 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._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)) + 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)) + 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)) + 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'): + 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_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.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) + + 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) + + 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)) + 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)) + 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) + + 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_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)) + self._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_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)) + self._freq_config.write(open(self.config_filename, 'w')) + self.usrp_source.set_frequency(self.freq) + +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_hrpt_nogui() + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() + |