diff options
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/examples/narrowband/receive_path.py | 12 | ||||
-rw-r--r-- | gr-digital/grc/CMakeLists.txt | 35 | ||||
-rw-r--r-- | gr-digital/grc/Makefile.am | 2 | ||||
-rw-r--r-- | gr-digital/grc/digital_block_tree.xml | 2 | ||||
-rw-r--r-- | gr-digital/grc/digital_mpsk_snr_est_cc.xml | 56 | ||||
-rw-r--r-- | gr-digital/grc/digital_probe_mpsk_snr_est_c.xml | 52 | ||||
-rw-r--r-- | gr-digital/swig/digital_constellation.i | 21 |
7 files changed, 145 insertions, 35 deletions
diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py index 1c5e58963..1f9310506 100644 --- a/gr-digital/examples/narrowband/receive_path.py +++ b/gr-digital/examples/narrowband/receive_path.py @@ -45,17 +45,25 @@ class receive_path(gr.hier_block2): self._rx_callback = rx_callback # this callback is fired when a packet arrives self._demod_class = demod_class # the demodulator_class we're using + self._chbw_factor = options.chbw_factor # channel filter bandwidth factor + # Get demod_kwargs demod_kwargs = self._demod_class.extract_kwargs_from_options(options) # Build the demodulator self.demodulator = self._demod_class(**demod_kwargs) + + # Make sure the channel BW factor is between 1 and sps/2 + # or the filter won't work. + if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol()/2): + sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2)) + sys.exit(1) # Design filter to get actual channel we want sw_decim = 1 chan_coeffs = gr.firdes.low_pass (1.0, # gain sw_decim * self.samples_per_symbol(), # sampling rate - 1.0, # midpoint of trans. band + self._chbw_factor, # midpoint of trans. band 0.5, # width of trans. band gr.firdes.WIN_HANN) # filter type self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs) @@ -129,6 +137,8 @@ class receive_path(gr.hier_block2): help="set samples/symbol [default=%default]") expert.add_option("", "--log", action="store_true", default=False, help="Log all parts of flow graph to files (CAUTION: lots of data)") + expert.add_option("", "--chbw-factor", type="float", default=1.0, + help="Channel bandwidth = chbw_factor x signal bandwidth [defaut=%default]") # Make a static method to call before instantiation add_options = staticmethod(add_options) diff --git a/gr-digital/grc/CMakeLists.txt b/gr-digital/grc/CMakeLists.txt index e94c53556..bace20847 100644 --- a/gr-digital/grc/CMakeLists.txt +++ b/gr-digital/grc/CMakeLists.txt @@ -17,36 +17,5 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -install(FILES - digital_block_tree.xml - digital_binary_slicer_fb.xml - digital_clock_recovery_mm_xx.xml - digital_constellation_decoder_cb.xml - digital_constellation_receiver_cb.xml - digital_correlate_access_code_bb.xml - digital_costas_loop_cc.xml - digital_cma_equalizer_cc.xml - digital_cpmmod_bc.xml - digital_fll_band_edge_cc.xml - digital_gmsk_demod.xml - digital_gmsk_mod.xml - digital_gmskmod_bc.xml - digital_kurtotic_equalizer_cc.xml - digital_lms_dd_equalizer_cc.xml - digital_mpsk_receiver_cc.xml - digital_dxpsk_mod.xml - digital_dxpsk_demod.xml - digital_psk_mod.xml - digital_psk_demod.xml - digital_qam_mod.xml - digital_qam_demod.xml - digital_ofdm_mod.xml - digital_ofdm_demod.xml - digital_ofdm_cyclic_prefixer.xml - digital_ofdm_frame_acquisition.xml - digital_ofdm_insert_preamble.xml - digital_ofdm_sampler.xml - digital_ofdm_sync_pn.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "digital_python" -) +file(GLOB xml_files "*.xml") +install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "digital_python") diff --git a/gr-digital/grc/Makefile.am b/gr-digital/grc/Makefile.am index e6dd2aa92..029eeece2 100644 --- a/gr-digital/grc/Makefile.am +++ b/gr-digital/grc/Makefile.am @@ -40,6 +40,8 @@ dist_grcblocks_DATA = \ digital_kurtotic_equalizer_cc.xml \ digital_lms_dd_equalizer_cc.xml \ digital_mpsk_receiver_cc.xml \ + digital_mpsk_snr_est_cc.xml \ + digital_probe_mpsk_snr_est_c.xml \ digital_dxpsk_mod.xml \ digital_dxpsk_demod.xml \ digital_psk_mod.xml \ diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml index 49a01973f..3ef4d0b1d 100644 --- a/gr-digital/grc/digital_block_tree.xml +++ b/gr-digital/grc/digital_block_tree.xml @@ -41,6 +41,8 @@ <block>digital_kurtotic_equalizer_cc</block> <block>digital_lms_dd_equalizer_cc</block> <block>digital_mpsk_receiver_cc</block> + <block>digital_mpsk_snr_est_cc</block> + <block>digital_probe_mpsk_snr_est_c</block> </cat> <cat> <name>Digital Modulators</name> diff --git a/gr-digital/grc/digital_mpsk_snr_est_cc.xml b/gr-digital/grc/digital_mpsk_snr_est_cc.xml new file mode 100644 index 000000000..6039e5b13 --- /dev/null +++ b/gr-digital/grc/digital_mpsk_snr_est_cc.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<!-- +################################################### +##MPSK SNR Estimator +################################################### + --> +<block> + <name>MPSK SNR Estimator</name> + <key>digital_mpsk_snr_est_cc</key> + <import>from gnuradio import digital</import> + <make>digital.mpsk_snr_est_cc($type, $tag_nsamples, $alpha)</make> + <callback>set_type($type)</callback> + <callback>set_tag_nsamples($tag_nsamples)</callback> + <callback>set_alpha($alpha)</callback> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Simple</name> + <key>0</key> + </option> + <option> + <name>Skewness</name> + <key>1</key> + </option> + <option> + <name>2nd and 4th Moment</name> + <key>2</key> + </option> + <option> + <name>SVR</name> + <key>3</key> + </option> + </param> + <param> + <name>Samples between tags</name> + <key>tag_nsamples</key> + <value>10000</value> + <type>int</type> + </param> + <param> + <name>Filter Alpha</name> + <key>alpha</key> + <value>0.001</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml new file mode 100644 index 000000000..62c5fad97 --- /dev/null +++ b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- +################################################### +##MPSK SNR Estimator +################################################### + --> +<block> + <name>MPSK SNR Estimator Probe</name> + <key>digital_probe_mpsk_snr_est_c</key> + <import>from gnuradio import digital</import> + <make>digital.probe_mpsk_snr_est_c($type, $msg_nsamples, $alpha)</make> + <callback>set_type($type)</callback> + <callback>set_msg_nsample($msg_nsamples)</callback> + <callback>set_alpha($alpha)</callback> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Simple</name> + <key>0</key> + </option> + <option> + <name>Skewness</name> + <key>1</key> + </option> + <option> + <name>2nd and 4th Moment</name> + <key>2</key> + </option> + <option> + <name>SVR</name> + <key>3</key> + </option> + </param> + <param> + <name>Samples between SNR messages</name> + <key>msg_nsamples</key> + <value>10000</value> + <type>int</type> + </param> + <param> + <name>Filter Alpha</name> + <key>alpha</key> + <value>0.001</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> +</block> diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i index 7e0ad6afe..248f90014 100644 --- a/gr-digital/swig/digital_constellation.i +++ b/gr-digital/swig/digital_constellation.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010, 2011 Free Software Foundation, Inc. + * Copyright 2010,2011,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -187,3 +187,22 @@ class digital_constellation_8psk : public digital_constellation public: digital_constellation_8psk (); }; + +#if SWIGPYTHON +/* + We want print(constellation) in python to produce nice useful output so + we include code at the end of the generated python file that overrides + the SWIG-generated __repr__ method. + */ +%pythoncode %{ + +digital_constellation_calcdist_sptr.__repr__ = lambda self: '<constellation calcdist (m=%s)>' % str(len(self.points())) +digital_constellation_rect_sptr.__repr__ = lambda self: '<constellation rect (m=%s)>' % str(len(self.points())) +digital_constellation_psk_sptr.__repr__ = lambda self: '<constellation psk (m=%s)>' % str(len(self.points())) +digital_constellation_bpsk_sptr.__repr__ = lambda self: '<constellation bpsk>' +digital_constellation_qpsk_sptr.__repr__ = lambda self: '<constellation qpsk>' +digital_constellation_dqpsk_sptr.__repr__ = lambda self: '<constellation dqpsk>' +digital_constellation_8psk_sptr.__repr__ = lambda self: '<constellation 8psk>' + +%} +#endif |