diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-10 16:35:53 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-10 16:35:53 -0400 |
commit | 1bc6349e4714c5c4856b3abb95dc5f6b15c44281 (patch) | |
tree | b8d2235a2ad78b4238f469efa4f660fb2b7b7233 | |
parent | c6cd7e06279546629a7fd221324d50844f6fdc69 (diff) |
blocks: removing gri_control_loop; using gr::blocks::control_loop now.
24 files changed, 87 insertions, 586 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index a8ad8573b5..0eaf551675 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -54,7 +54,6 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c ) @@ -82,7 +81,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h @@ -99,7 +97,6 @@ if(ENABLE_PYTHON) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/general.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig" ) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index dabdb1bddf..bcf4392bb4 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -22,7 +22,6 @@ %{ -#include <gri_control_loop.h> #include <gr_nop.h> #include <gr_null_sink.h> #include <gr_null_source.h> @@ -50,7 +49,6 @@ #include <gr_vector_map.h> %} -%include "gri_control_loop.i" %include "gr_nop.i" %include "gr_null_sink.i" %include "gr_null_source.i" diff --git a/gnuradio-core/src/lib/general/gri_control_loop.cc b/gnuradio-core/src/lib/general/gri_control_loop.cc deleted file mode 100644 index bb3c4a3263..0000000000 --- a/gnuradio-core/src/lib/general/gri_control_loop.cc +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_control_loop.h> -#include <gr_math.h> -#include <stdexcept> - -#define M_TWOPI (2.0f*M_PI) - -gri_control_loop::gri_control_loop(float loop_bw, - float max_freq, float min_freq) - : d_phase(0), d_freq(0), d_max_freq(max_freq), d_min_freq(min_freq) -{ - // Set the damping factor for a critically damped system - d_damping = sqrtf(2.0f)/2.0f; - - // Set the bandwidth, which will then call update_gains() - set_loop_bandwidth(loop_bw); -} - -gri_control_loop::~gri_control_loop() -{ -} - -void -gri_control_loop::update_gains() -{ - float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw); - d_alpha = (4*d_damping*d_loop_bw) / denom; - d_beta = (4*d_loop_bw*d_loop_bw) / denom; -} - -void -gri_control_loop::advance_loop(float error) -{ - d_freq = d_freq + d_beta * error; - d_phase = d_phase + d_freq + d_alpha * error; -} - - -void -gri_control_loop::phase_wrap() -{ - while(d_phase>M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase<-M_TWOPI) - d_phase += M_TWOPI; -} - -void -gri_control_loop::frequency_limit() -{ - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; -} - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - -void -gri_control_loop::set_loop_bandwidth(float bw) -{ - if(bw < 0) { - throw std::out_of_range ("gri_control_loop: invalid bandwidth. Must be >= 0."); - } - - d_loop_bw = bw; - update_gains(); -} - -void -gri_control_loop::set_damping_factor(float df) -{ - if(df < 0 || df > 1.0) { - throw std::out_of_range ("gri_control_loop: invalid damping factor. Must be in [0,1]."); - } - - d_damping = df; - update_gains(); -} - -void -gri_control_loop::set_alpha(float alpha) -{ - if(alpha < 0 || alpha > 1.0) { - throw std::out_of_range ("gri_control_loop: invalid alpha. Must be in [0,1]."); - } - d_alpha = alpha; -} - -void -gri_control_loop::set_beta(float beta) -{ - if(beta < 0 || beta > 1.0) { - throw std::out_of_range ("gri_control_loop: invalid beta. Must be in [0,1]."); - } - d_beta = beta; -} - -void -gri_control_loop::set_frequency(float freq) -{ - if(freq > d_max_freq) - d_freq = d_min_freq; - else if(freq < d_min_freq) - d_freq = d_max_freq; - else - d_freq = freq; -} - -void -gri_control_loop::set_phase(float phase) -{ - d_phase = phase; - while(d_phase>M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase<-M_TWOPI) - d_phase += M_TWOPI; -} - -void -gri_control_loop::set_max_freq(float freq) -{ - d_max_freq = freq; -} - -void -gri_control_loop::set_min_freq(float freq) -{ - d_min_freq = freq; -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - - -float -gri_control_loop::get_loop_bandwidth() const -{ - return d_loop_bw; -} - -float -gri_control_loop::get_damping_factor() const -{ - return d_damping; -} - -float -gri_control_loop::get_alpha() const -{ - return d_alpha; -} - -float -gri_control_loop::get_beta() const -{ - return d_beta; -} - -float -gri_control_loop::get_frequency() const -{ - return d_freq; -} - -float -gri_control_loop::get_phase() const -{ - return d_phase; -} - -float -gri_control_loop::get_max_freq() const -{ - return d_max_freq; -} - -float -gri_control_loop::get_min_freq() const -{ - return d_min_freq; -} diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h deleted file mode 100644 index 46aa6ae243..0000000000 --- a/gnuradio-core/src/lib/general/gri_control_loop.h +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef GRI_CONTROL_LOOP -#define GRI_CONTROL_LOOP - -#include <gr_core_api.h> - -class GR_CORE_API gri_control_loop -{ - protected: - float d_phase, d_freq; - float d_max_freq, d_min_freq; - float d_damping, d_loop_bw; - float d_alpha, d_beta; - - public: - gri_control_loop() {}; - gri_control_loop(float loop_bw, float max_freq, float min_freq); - virtual ~gri_control_loop(); - - /*! \brief update the system gains from the loop bandwidth and damping factor - * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. - * These two factors can be set separately through their own - * set functions. - */ - void update_gains(); - - /*! \brief update the system gains from the loop bandwidth and damping factor - * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. - * These two factors can be set separately through their own - * set functions. - */ - void advance_loop(float error); - - /*! \brief Keep the phase between -2pi and 2pi - * - * This function keeps the phase between -2pi and 2pi. If the phase - * is greater than 2pi by d, it wraps around to be -2pi+d; similarly if - * it is less than -2pi by d, it wraps around to 2pi-d. - * - * This function should be called after advance_loop to keep the phase - * in a good operating region. It is set as a separate method in case - * another way is desired as this is fairly heavy-handed. - */ - void phase_wrap(); - - /*! \brief Keep the frequency between d_min_freq and d_max_freq - * - * This function keeps the frequency between d_min_freq and d_max_freq. - * If the frequency is greater than d_max_freq, it is set to d_max_freq. - * If the frequency is less than d_min_freq, it is set to d_min_freq. - * - * This function should be called after advance_loop to keep the frequency - * in the specified region. It is set as a separate method in case - * another way is desired as this is fairly heavy-handed. - */ - void frequency_limit(); - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Set the loop bandwidth - * - * Set the loop filter's bandwidth to \p bw. This should be between - * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive - * number. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param bw (float) new bandwidth - * - */ - void set_loop_bandwidth(float bw); - - /*! - * \brief Set the loop damping factor - * - * Set the loop filter's damping factor to \p df. The damping factor - * should be sqrt(2)/2.0 for critically damped systems. - * Set it to anything else only if you know what you are doing. It must - * be a number between 0 and 1. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param df (float) new damping factor - * - */ - void set_damping_factor(float df); - - /*! - * \brief Set the loop gain alpha - * - * Set's the loop filter's alpha gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param alpha (float) new alpha gain - * - */ - void set_alpha(float alpha); - - /*! - * \brief Set the loop gain beta - * - * Set's the loop filter's beta gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param beta (float) new beta gain - * - */ - void set_beta(float beta); - - /*! - * \brief Set the control loop's frequency. - * - * Set's the control loop's frequency. While this is normally updated by the - * inner loop of the algorithm, it could be useful to manually initialize, - * set, or reset this under certain circumstances. - * - * \param freq (float) new frequency - * - */ - void set_frequency(float freq); - - /*! - * \brief Set the control loop's phase. - * - * Set's the control loop's phase. While this is normally updated by the - * inner loop of the algorithm, it could be useful to manually initialize, - * set, or reset this under certain circumstances. - * - * \param phase (float) new phase - * - */ - void set_phase(float phase); - - /*! - * \brief Set the control loop's maximum frequency. - * - * Set the maximum frequency the control loop can track. - * - * \param freq (float) new max frequency - */ - void set_max_freq(float freq); - - /*! - * \brief Set the control loop's minimum frequency. - * - * Set the minimum frequency the control loop can track. - * - * \param freq (float) new min frequency - */ - void set_min_freq(float freq); - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Returns the loop bandwidth - */ - float get_loop_bandwidth() const; - - /*! - * \brief Returns the loop damping factor - */ - float get_damping_factor() const; - - /*! - * \brief Returns the loop gain alpha - */ - float get_alpha() const; - - /*! - * \brief Returns the loop gain beta - */ - float get_beta() const; - - /*! - * \brief Get the control loop's frequency estimate - */ - float get_frequency() const; - - /*! - * \brief Get the control loop's phase estimate - */ - float get_phase() const; - - /*! - * \brief Get the control loop's maximum frequency. - */ - float get_max_freq() const; - - /*! - * \brief Get the control loop's minimum frequency. - */ - float get_min_freq() const; -}; - -#endif /* GRI_CONTROL_LOOP */ diff --git a/gnuradio-core/src/lib/general/gri_control_loop.i b/gnuradio-core/src/lib/general/gri_control_loop.i deleted file mode 100644 index 8a23207e50..0000000000 --- a/gnuradio-core/src/lib/general/gri_control_loop.i +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -class gri_control_loop -{ - public: - gri_control_loop(float loop_bw, float max_freq, float min_freq); - virtual ~gri_control_loop(); - - void update_gains(); - void advance_loop(float error); - void phase_wrap(); - void frequency_limit(); - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_frequency(float freq); - void set_phase(float phase); - - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_frequency() const; - float get_phase() const; -}; diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc index c53e0f4332..9213a5e681 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.cc +++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010-2012 Free Software Foundation, Inc. + * Copyright 2006,2010-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -50,7 +50,7 @@ namespace gr { : gr_sync_block("pll_carriertracking_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq), + blocks::control_loop(loop_bw, max_freq, min_freq), d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) { } @@ -130,98 +130,98 @@ namespace gr { void pll_carriertracking_cc_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_carriertracking_cc_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_carriertracking_cc_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_carriertracking_cc_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_carriertracking_cc_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_carriertracking_cc_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_carriertracking_cc_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_carriertracking_cc_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_carriertracking_cc_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_carriertracking_cc_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_carriertracking_cc_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_carriertracking_cc_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_carriertracking_cc_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_carriertracking_cc_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_carriertracking_cc_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_carriertracking_cc_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h index d67223db82..54de4442d1 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -24,13 +24,13 @@ #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H #include <analog/pll_carriertracking_cc.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace analog { class pll_carriertracking_cc_impl - : public pll_carriertracking_cc, public gri_control_loop + : public pll_carriertracking_cc, public blocks::control_loop { private: float d_locksig,d_lock_threshold; diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc index 27e8d02aa4..9e55d9bedb 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.cc +++ b/gr-analog/lib/pll_freqdet_cf_impl.cc @@ -47,7 +47,7 @@ namespace gr { : gr_sync_block("pll_freqdet_cf", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(float))), - gri_control_loop(loop_bw, max_freq, min_freq) + blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -100,98 +100,98 @@ namespace gr { void pll_freqdet_cf_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_freqdet_cf_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_freqdet_cf_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_freqdet_cf_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_freqdet_cf_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_freqdet_cf_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_freqdet_cf_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_freqdet_cf_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_freqdet_cf_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_freqdet_cf_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_freqdet_cf_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_freqdet_cf_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_freqdet_cf_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_freqdet_cf_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_freqdet_cf_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_freqdet_cf_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h index 7acf53ebbf..10bcdc2157 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.h +++ b/gr-analog/lib/pll_freqdet_cf_impl.h @@ -24,13 +24,13 @@ #define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H #include <analog/pll_freqdet_cf.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace analog { class pll_freqdet_cf_impl : - public pll_freqdet_cf, public gri_control_loop + public pll_freqdet_cf, public blocks::control_loop { private: float phase_detector(gr_complex sample,float ref_phase); diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc index b94e3660a3..3f0ccc7df5 100644 --- a/gr-analog/lib/pll_refout_cc_impl.cc +++ b/gr-analog/lib/pll_refout_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010-2012 Free Software Foundation, Inc. + * Copyright 2004,2010-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -48,7 +48,7 @@ namespace gr { : gr_sync_block("pll_refout_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq) + blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -103,98 +103,98 @@ namespace gr { void pll_refout_cc_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_refout_cc_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_refout_cc_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_refout_cc_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_refout_cc_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_refout_cc_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_refout_cc_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_refout_cc_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_refout_cc_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_refout_cc_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_refout_cc_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_refout_cc_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_refout_cc_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_refout_cc_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_refout_cc_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_refout_cc_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h index 9e8ae286b1..f8572f9b64 100644 --- a/gr-analog/lib/pll_refout_cc_impl.h +++ b/gr-analog/lib/pll_refout_cc_impl.h @@ -24,13 +24,13 @@ #define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H #include <analog/pll_refout_cc.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace analog { class pll_refout_cc_impl - : public pll_refout_cc, public gri_control_loop + : public pll_refout_cc, public blocks::control_loop { private: float mod_2pi (float in); diff --git a/gr-blocks/include/blocks/control_loop.h b/gr-blocks/include/blocks/control_loop.h index e59429a1f7..475b28f944 100644 --- a/gr-blocks/include/blocks/control_loop.h +++ b/gr-blocks/include/blocks/control_loop.h @@ -37,6 +37,7 @@ namespace gr { float d_alpha, d_beta; public: + control_loop(void) {} control_loop(float loop_bw, float max_freq, float min_freq); virtual ~control_loop(); diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i index 5e71bb0007..974ee1e4bf 100644 --- a/gr-blocks/swig/blocks_swig.i +++ b/gr-blocks/swig/blocks_swig.i @@ -64,6 +64,7 @@ #include "blocks/complex_to_mag_squared.h" #include "blocks/complex_to_arg.h" #include "blocks/conjugate_cc.h" +#include "blocks/control_loop.h" #include "blocks/deinterleave.h" #include "blocks/delay.h" #include "blocks/divide_ff.h" @@ -220,6 +221,7 @@ %include "blocks/complex_to_mag_squared.h" %include "blocks/complex_to_arg.h" %include "blocks/conjugate_cc.h" +%include "blocks/control_loop.h" %include "blocks/deinterleave.h" %include "blocks/delay.h" %include "blocks/file_source.h" diff --git a/gr-digital/include/digital/fll_band_edge_cc.h b/gr-digital/include/digital/fll_band_edge_cc.h index 1a9fd0bf88..7b823630ed 100644 --- a/gr-digital/include/digital/fll_band_edge_cc.h +++ b/gr-digital/include/digital/fll_band_edge_cc.h @@ -25,7 +25,7 @@ #include <digital/api.h> #include <gr_sync_block.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace digital { @@ -84,7 +84,7 @@ namespace gr { */ class DIGITAL_API fll_band_edge_cc : virtual public gr_sync_block, - virtual public gri_control_loop + virtual public blocks::control_loop { public: // gr::digital::fll_band_edge_cc::sptr diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc b/gr-digital/lib/constellation_receiver_cb_impl.cc index c3203e9079..30be24aab9 100644 --- a/gr-digital/lib/constellation_receiver_cb_impl.cc +++ b/gr-digital/lib/constellation_receiver_cb_impl.cc @@ -54,7 +54,7 @@ namespace gr { : gr_block("constellation_receiver_cb", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signaturev(1, 5, iosig)), - gri_control_loop(loop_bw, fmax, fmin), + blocks::control_loop(loop_bw, fmax, fmin), d_constellation(constellation), d_current_const_point(0) { diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h b/gr-digital/lib/constellation_receiver_cb_impl.h index 50946840ae..763dabfde2 100644 --- a/gr-digital/lib/constellation_receiver_cb_impl.h +++ b/gr-digital/lib/constellation_receiver_cb_impl.h @@ -26,13 +26,13 @@ #include <digital/constellation_receiver_cb.h> #include <gruel/attributes.h> #include <gr_complex.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace digital { class constellation_receiver_cb_impl - : public constellation_receiver_cb, gri_control_loop + : public constellation_receiver_cb, blocks::control_loop { public: constellation_receiver_cb_impl(constellation_sptr constell, diff --git a/gr-digital/lib/costas_loop_cc_impl.cc b/gr-digital/lib/costas_loop_cc_impl.cc index 5afabf4294..fcdd45045b 100644 --- a/gr-digital/lib/costas_loop_cc_impl.cc +++ b/gr-digital/lib/costas_loop_cc_impl.cc @@ -44,7 +44,7 @@ namespace gr { : gr_sync_block("costas_loop_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))), - gri_control_loop(loop_bw, 1.0, -1.0), + blocks::control_loop(loop_bw, 1.0, -1.0), d_order(order), d_phase_detector(NULL) { // Set up the phase detector to use based on the constellation order diff --git a/gr-digital/lib/costas_loop_cc_impl.h b/gr-digital/lib/costas_loop_cc_impl.h index 9310368b4d..d9756ea2f1 100644 --- a/gr-digital/lib/costas_loop_cc_impl.h +++ b/gr-digital/lib/costas_loop_cc_impl.h @@ -25,12 +25,12 @@ #define INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H #include <digital/costas_loop_cc.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> namespace gr { namespace digital { - class costas_loop_cc_impl : public costas_loop_cc, gri_control_loop + class costas_loop_cc_impl : public costas_loop_cc, blocks::control_loop { private: int d_order; diff --git a/gr-digital/lib/fll_band_edge_cc_impl.cc b/gr-digital/lib/fll_band_edge_cc_impl.cc index 980d3ab464..c438b813f4 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.cc +++ b/gr-digital/lib/fll_band_edge_cc_impl.cc @@ -58,25 +58,25 @@ namespace gr { : gr_sync_block("fll_band_edge_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signaturev(1, 4, iosig)), - gri_control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym), - -M_TWOPI*(2.0/samps_per_sym)), + blocks::control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym), + -M_TWOPI*(2.0/samps_per_sym)), d_updated(false) { // Initialize samples per symbol if(samps_per_sym <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid number of sps. Must be > 0."); + throw std::out_of_range("fll_band_edge_cc: invalid number of sps. Must be > 0."); } d_sps = samps_per_sym; // Initialize rolloff factor if(rolloff < 0 || rolloff > 1.0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); + throw std::out_of_range("fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); } d_rolloff = rolloff; // Initialize filter length if(filter_size <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid filter size. Must be > 0."); + throw std::out_of_range("fll_band_edge_cc: invalid filter size. Must be > 0."); } d_filter_size = filter_size; @@ -97,7 +97,7 @@ namespace gr { fll_band_edge_cc_impl::set_samples_per_symbol(float sps) { if(sps <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid number of sps. Must be > 0."); + throw std::out_of_range("fll_band_edge_cc: invalid number of sps. Must be > 0."); } d_sps = sps; design_filter(d_sps, d_rolloff, d_filter_size); @@ -107,7 +107,7 @@ namespace gr { fll_band_edge_cc_impl::set_rolloff(float rolloff) { if(rolloff < 0 || rolloff > 1.0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); + throw std::out_of_range("fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); } d_rolloff = rolloff; design_filter(d_sps, d_rolloff, d_filter_size); @@ -117,7 +117,7 @@ namespace gr { fll_band_edge_cc_impl::set_filter_size(int filter_size) { if(filter_size <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid filter size. Must be > 0."); + throw std::out_of_range("fll_band_edge_cc: invalid filter size. Must be > 0."); } d_filter_size = filter_size; design_filter(d_sps, d_rolloff, d_filter_size); diff --git a/gr-digital/lib/fll_band_edge_cc_impl.h b/gr-digital/lib/fll_band_edge_cc_impl.h index 55e338b38c..9eb3e6e7ae 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.h +++ b/gr-digital/lib/fll_band_edge_cc_impl.h @@ -24,7 +24,7 @@ #define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H #include <digital/fll_band_edge_cc.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> #include <filter/fir_filter.h> namespace gr { diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.cc b/gr-digital/lib/mpsk_receiver_cc_impl.cc index 31355c5653..ea11b7cdaa 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.cc +++ b/gr-digital/lib/mpsk_receiver_cc_impl.cc @@ -63,7 +63,7 @@ namespace gr { : gr_block("mpsk_receiver_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, fmax, fmin), + blocks::control_loop(loop_bw, fmax, fmin), d_M(M), d_theta(theta), d_current_const_point(0), d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.h b/gr-digital/lib/mpsk_receiver_cc_impl.h index 3db6fa8b62..099dd424a3 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.h +++ b/gr-digital/lib/mpsk_receiver_cc_impl.h @@ -25,7 +25,7 @@ #include <digital/mpsk_receiver_cc.h> #include <gruel/attributes.h> -#include <gri_control_loop.h> +#include <blocks/control_loop.h> #include <gr_complex.h> #include <fstream> #include <filter/mmse_fir_interpolator_cc.h> @@ -34,7 +34,7 @@ namespace gr { namespace digital { class mpsk_receiver_cc_impl - : public mpsk_receiver_cc, public gri_control_loop + : public mpsk_receiver_cc, public blocks::control_loop { public: mpsk_receiver_cc_impl(unsigned int M, float theta, diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 6b6eb5e457..4142657d58 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -34,8 +34,6 @@ set(GR_SWIG_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) -set(GR_SWIG_LIBRARIES gnuradio-digital gnuradio-filter) - if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) @@ -46,7 +44,8 @@ set(GR_SWIG_TARGET_DEPS digital_generated_includes) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) -set(GR_SWIG_LIBRARIES gnuradio-digital gnuradio-filter gnuradio-analog) +set(GR_SWIG_LIBRARIES gnuradio-digital + gnuradio-filter gnuradio-analog gnuradio-blocks) GR_SWIG_MAKE(digital_swig digital_swig.i) diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 155efddf75..8462048659 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -30,7 +30,9 @@ %include "analog/cpm.h" -%include "gri_control_loop.h" +%{ +#include <blocks/control_loop.h> +%} // Used in the constellation objects %template(unsigned_int_vector) std::vector<unsigned int>; |