diff options
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-digital/grc/digital_constellation_receiver_cb.xml | 20 | ||||
-rw-r--r-- | gr-digital/include/digital_additive_scrambler_bb.h | 4 | ||||
-rw-r--r-- | gr-digital/include/digital_constellation.h | 3 | ||||
-rw-r--r-- | gr-digital/include/digital_descrambler_bb.h | 4 | ||||
-rw-r--r-- | gr-digital/include/digital_scrambler_bb.h | 4 | ||||
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation.cc | 13 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation_receiver_cb.cc | 11 | ||||
-rwxr-xr-x | gr-digital/python/qa_constellation.py | 4 | ||||
-rw-r--r-- | gr-digital/swig/CMakeLists.txt | 1 |
11 files changed, 57 insertions, 11 deletions
diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt index eb7ed67e1..864cd673a 100644 --- a/gr-digital/CMakeLists.txt +++ b/gr-digital/CMakeLists.txt @@ -29,6 +29,7 @@ include(GrComponent) GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL Boost_FOUND ENABLE_GR_CORE + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml b/gr-digital/grc/digital_constellation_receiver_cb.xml index 36c8e1b30..ffda8b85b 100644 --- a/gr-digital/grc/digital_constellation_receiver_cb.xml +++ b/gr-digital/grc/digital_constellation_receiver_cb.xml @@ -37,4 +37,24 @@ <name>out</name> <type>byte</type> </source> + <source> + <name>error</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>phase</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>frequency</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>symbol</name> + <type>complex</type> + <optional>1</optional> + </source> </block> diff --git a/gr-digital/include/digital_additive_scrambler_bb.h b/gr-digital/include/digital_additive_scrambler_bb.h index d4bd7d4ae..f1d0113e9 100644 --- a/gr-digital/include/digital_additive_scrambler_bb.h +++ b/gr-digital/include/digital_additive_scrambler_bb.h @@ -24,7 +24,7 @@ #include <digital_api.h> #include <gr_sync_block.h> -#include <gri_lfsr.h> +#include <analog/lfsr.h> class digital_additive_scrambler_bb; typedef boost::shared_ptr<digital_additive_scrambler_bb> digital_additive_scrambler_bb_sptr; @@ -57,7 +57,7 @@ class DIGITAL_API digital_additive_scrambler_bb : public gr_sync_block digital_make_additive_scrambler_bb(int mask, int seed, int len, int count); - gri_lfsr d_lfsr; + gr::analog::lfsr d_lfsr; int d_count; int d_bits; diff --git a/gr-digital/include/digital_constellation.h b/gr-digital/include/digital_constellation.h index a72bfb74c..76cd30b25 100644 --- a/gr-digital/include/digital_constellation.h +++ b/gr-digital/include/digital_constellation.h @@ -120,6 +120,9 @@ public: unsigned int d_rotational_symmetry; unsigned int d_dimensionality; unsigned int d_arity; + // The orignal constellation points were multiplied by this factor to get a + // constellation with average magnitude 1. + float d_scalefactor; float get_distance(unsigned int index, const gr_complex *sample); unsigned int get_closest_point(const gr_complex *sample); diff --git a/gr-digital/include/digital_descrambler_bb.h b/gr-digital/include/digital_descrambler_bb.h index b719803f3..d503102a9 100644 --- a/gr-digital/include/digital_descrambler_bb.h +++ b/gr-digital/include/digital_descrambler_bb.h @@ -24,7 +24,7 @@ #include <digital_api.h> #include <gr_sync_block.h> -#include "gri_lfsr.h" +#include <analog/lfsr.h> class digital_descrambler_bb; typedef boost::shared_ptr<digital_descrambler_bb> digital_descrambler_bb_sptr; @@ -49,7 +49,7 @@ class DIGITAL_API digital_descrambler_bb : public gr_sync_block friend DIGITAL_API digital_descrambler_bb_sptr digital_make_descrambler_bb(int mask, int seed, int len); - gri_lfsr d_lfsr; + gr::analog::lfsr d_lfsr; digital_descrambler_bb(int mask, int seed, int len); diff --git a/gr-digital/include/digital_scrambler_bb.h b/gr-digital/include/digital_scrambler_bb.h index d6f08dcc8..cafb0e5f2 100644 --- a/gr-digital/include/digital_scrambler_bb.h +++ b/gr-digital/include/digital_scrambler_bb.h @@ -24,7 +24,7 @@ #include <digital_api.h> #include <gr_sync_block.h> -#include "gri_lfsr.h" +#include <analog/lfsr.h> class digital_scrambler_bb; typedef boost::shared_ptr<digital_scrambler_bb> digital_scrambler_bb_sptr; @@ -49,7 +49,7 @@ class DIGITAL_API digital_scrambler_bb : public gr_sync_block friend DIGITAL_API digital_scrambler_bb_sptr digital_make_scrambler_bb(int mask, int seed, int len); - gri_lfsr d_lfsr; + gr::analog::lfsr d_lfsr; digital_scrambler_bb(int mask, int seed, int len); diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index bd4f1a500..155a10098 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -22,6 +22,7 @@ ######################################################################## include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} ${GR_DIGITAL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/../include ) @@ -146,4 +147,4 @@ add_library(gnuradio-digital SHARED ${gr_digital_sources}) target_link_libraries(gnuradio-digital ${digital_libs}) GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel") -add_dependencies(gnuradio-digital digital_generated_includes digital_generated_swigs) +add_dependencies(gnuradio-digital digital_generated_includes digital_generated_swigs gnuradio-analog) diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc index d9a53c493..da79f2caa 100644 --- a/gr-digital/lib/digital_constellation.cc +++ b/gr-digital/lib/digital_constellation.cc @@ -49,6 +49,17 @@ digital_constellation::digital_constellation (std::vector<gr_complex> constellat d_rotational_symmetry(rotational_symmetry), d_dimensionality(dimensionality) { + // Scale constellation points so that average magnitude is 1. + float summed_mag = 0; + unsigned int constsize = d_constellation.size(); + for (unsigned int i=0; i<constsize; i++) { + gr_complex c = d_constellation[i]; + summed_mag += sqrt(c.real()*c.real() + c.imag()*c.imag()); + } + d_scalefactor = constsize/summed_mag; + for (unsigned int i=0; i<constsize; i++) { + d_constellation[i] = d_constellation[i]*d_scalefactor; + } if (pre_diff_code.size() == 0) d_apply_pre_diff_code = false; else if (pre_diff_code.size() != constellation.size()) @@ -293,6 +304,8 @@ digital_constellation_rect::digital_constellation_rect (std::vector<gr_complex> n_real_sectors(real_sectors), n_imag_sectors(imag_sectors), d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors) { + d_width_real_sectors *= d_scalefactor; + d_width_imag_sectors *= d_scalefactor; find_sector_values(); } diff --git a/gr-digital/lib/digital_constellation_receiver_cb.cc b/gr-digital/lib/digital_constellation_receiver_cb.cc index b9239962a..faaa760fd 100644 --- a/gr-digital/lib/digital_constellation_receiver_cb.cc +++ b/gr-digital/lib/digital_constellation_receiver_cb.cc @@ -47,13 +47,13 @@ digital_make_constellation_receiver_cb(digital_constellation_sptr constell, fmin, fmax)); } -static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float)}; +static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)}; static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); digital_constellation_receiver_cb::digital_constellation_receiver_cb (digital_constellation_sptr constellation, float loop_bw, float fmin, float fmax) : gr_block ("constellation_receiver_cb", gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signaturev (1, 4, iosig)), + gr_make_io_signaturev (1, 5, iosig)), gri_control_loop(loop_bw, fmax, fmin), d_constellation(constellation), d_current_const_point(0) @@ -93,10 +93,12 @@ digital_constellation_receiver_cb::general_work (int noutput_items, gr_complex sample, nco; float *out_err = 0, *out_phase = 0, *out_freq = 0; - if(output_items.size() == 4) { + gr_complex *out_symbol; + if(output_items.size() == 5) { out_err = (float *) output_items[1]; out_phase = (float *) output_items[2]; out_freq = (float *) output_items[3]; + out_symbol = (gr_complex*)output_items[4]; } while((i < noutput_items) && (i < ninput_items[0])) { @@ -109,10 +111,11 @@ digital_constellation_receiver_cb::general_work (int noutput_items, out[i] = sym_value; - if(output_items.size() == 4) { + if(output_items.size() == 5) { out_err[i] = phase_error; out_phase[i] = d_phase; out_freq[i] = d_freq; + out_symbol[i] = sample; } i++; } diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index b17d2a0fc..6962ec633 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -69,6 +69,10 @@ tested_constellation_info = ( {'m': (2, 4, 8, 16, 32, 64), 'mod_code': tested_mod_codes, }, True, None), + (qam.qam_constellation, + {'constellation_points': (4, 16, 64), + 'mod_code': tested_mod_codes, }, + True, None), (digital_swig.constellation_bpsk, {}, True, None), (digital_swig.constellation_qpsk, {}, False, None), (digital_swig.constellation_dqpsk, {}, True, None), diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index df5f04148..42bc8baa6 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -105,6 +105,7 @@ execute_process( ) set(GR_SWIG_INCLUDE_DIRS + ${GR_ANALOG_INCLUDE_DIRS} ${GR_DIGITAL_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} |