diff options
75 files changed, 277 insertions, 3675 deletions
diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 53ceba08e7..8f99ea4e9d 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -215,9 +215,6 @@ Synchronization .. autosummary:: :nosignatures: - gnuradio.gr.pll_carriertracking_cc - gnuradio.gr.pll_freqdet_cf - gnuradio.gr.pll_refout_cc gnuradio.gr.simple_correlator Type Conversions @@ -255,13 +252,7 @@ Signal Level Control (AGC) .. autosummary:: :nosignatures: - gnuradio.gr.agc2_cc - gnuradio.gr.agc2_ff - gnuradio.gr.agc_cc - gnuradio.gr.agc_ff gnuradio.gr.ctcss_squelch_ff - gnuradio.gr.dpll_bb - gnuradio.gr.feedforward_agc_cc gnuradio.gr.peak_detector2_fb gnuradio.gr.pwr_squelch_cc gnuradio.gr.pwr_squelch_ff diff --git a/docs/sphinx/source/gr/level_blk.rst b/docs/sphinx/source/gr/level_blk.rst index d6c565c65d..1be9f2ffaa 100644 --- a/docs/sphinx/source/gr/level_blk.rst +++ b/docs/sphinx/source/gr/level_blk.rst @@ -1,13 +1,8 @@ gnuradio.gr: Signal Level Control (AGC) ======================================= -.. autooldblock:: gnuradio.gr.agc2_cc -.. autooldblock:: gnuradio.gr.agc2_ff -.. autooldblock:: gnuradio.gr.agc_cc -.. autooldblock:: gnuradio.gr.agc_ff .. autooldblock:: gnuradio.gr.ctcss_squelch_ff .. autooldblock:: gnuradio.gr.dpll_bb -.. autooldblock:: gnuradio.gr.feedforward_agc_cc .. autooldblock:: gnuradio.gr.peak_detector2_fb .. autooldblock:: gnuradio.gr.pwr_squelch_cc .. autooldblock:: gnuradio.gr.pwr_squelch_ff diff --git a/docs/sphinx/source/gr/sync_blk.rst b/docs/sphinx/source/gr/sync_blk.rst index b4875bdbdc..d5e3c3d7c5 100644 --- a/docs/sphinx/source/gr/sync_blk.rst +++ b/docs/sphinx/source/gr/sync_blk.rst @@ -1,7 +1,4 @@ gnuradio.gr: Synchronization ============================ -.. autooldblock:: gnuradio.gr.pll_carriertracking_cc -.. autooldblock:: gnuradio.gr.pll_freqdet_cf -.. autooldblock:: gnuradio.gr.pll_refout_cc .. autooldblock:: gnuradio.gr.simple_correlator diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 7173246ea0..42c32b54c4 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -127,10 +127,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h @@ -139,7 +135,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h @@ -159,10 +154,6 @@ if(ENABLE_PYTHON) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/general.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig" @@ -175,10 +166,6 @@ endif(ENABLE_PYTHON) set(gr_core_general_triple_threats complex_vec_test gr_add_ff - gr_agc_cc - gr_agc_ff - gr_agc2_cc - gr_agc2_ff gr_align_on_samplenumbers_ss gr_bin_statistics_f gr_char_to_float @@ -193,13 +180,11 @@ set(gr_core_general_triple_threats gr_cpm gr_ctcss_squelch_ff gr_decode_ccsds_27_fb - gr_dpll_bb gr_deinterleave gr_delay gr_encode_ccsds_27_bb gr_endian_swap gr_fake_channel_coder_pp - gr_feedforward_agc_cc gr_feval gr_firdes gr_float_to_char @@ -230,9 +215,6 @@ set(gr_core_general_triple_threats gr_pa_2x2_phase_combiner gr_peak_detector2_fb gr_phase_modulator_fc - gr_pll_carriertracking_cc - gr_pll_freqdet_cf - gr_pll_refout_cc gr_prefs gr_probe_avg_mag_sqrd_c gr_probe_avg_mag_sqrd_cf diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index b8d567b7cf..a8799e5c01 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -62,10 +62,6 @@ #include <gr_deinterleave.h> #include <gr_delay.h> #include <gr_simple_squelch_cc.h> -#include <gr_agc_ff.h> -#include <gr_agc_cc.h> -#include <gr_agc2_ff.h> -#include <gr_agc2_cc.h> #include <gr_rms_cf.h> #include <gr_rms_ff.h> #include <gr_nlog10_ff.h> @@ -80,11 +76,7 @@ #include <gr_conjugate_cc.h> #include <gr_vco_f.h> #include <gr_threshold_ff.h> -#include <gr_dpll_bb.h> #include <gr_fmdet_cf.h> -#include <gr_pll_freqdet_cf.h> -#include <gr_pll_refout_cc.h> -#include <gr_pll_carriertracking_cc.h> #include <gr_probe_avg_mag_sqrd_c.h> #include <gr_probe_avg_mag_sqrd_cf.h> #include <gr_probe_avg_mag_sqrd_f.h> @@ -106,7 +98,6 @@ #include <gr_pwr_squelch_cc.h> #include <gr_pwr_squelch_ff.h> #include <gr_ctcss_squelch_ff.h> -#include <gr_feedforward_agc_cc.h> #include <gr_bin_statistics_f.h> #include <gr_peak_detector2_fb.h> #include <gr_repeat.h> @@ -167,10 +158,6 @@ %include "gr_deinterleave.i" %include "gr_delay.i" %include "gr_simple_squelch_cc.i" -%include "gr_agc_ff.i" -%include "gr_agc_cc.i" -%include "gr_agc2_ff.i" -%include "gr_agc2_cc.i" %include "gr_rms_cf.i" %include "gr_rms_ff.i" %include "gr_nlog10_ff.i" @@ -185,11 +172,7 @@ %include "gr_conjugate_cc.i" %include "gr_vco_f.i" %include "gr_threshold_ff.i" -%include "gr_dpll_bb.i" %include "gr_fmdet_cf.i" -%include "gr_pll_freqdet_cf.i" -%include "gr_pll_refout_cc.i" -%include "gr_pll_carriertracking_cc.i" %include "gr_probe_avg_mag_sqrd_c.i" %include "gr_probe_avg_mag_sqrd_cf.i" %include "gr_probe_avg_mag_sqrd_f.i" @@ -211,7 +194,6 @@ %include "gr_pwr_squelch_cc.i" %include "gr_pwr_squelch_ff.i" %include "gr_ctcss_squelch_ff.i" -%include "gr_feedforward_agc_cc.i" %include "gr_bin_statistics_f.i" %include "gr_peak_detector2_fb.i" %include "gr_repeat.i" diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.cc b/gnuradio-core/src/lib/general/gr_agc2_cc.cc deleted file mode 100644 index 5097babc9b..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_agc2_cc.h> -#include <gr_io_signature.h> -#include <gri_agc2_cc.h> - -gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain)); -} - -gr_agc2_cc::gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h deleted file mode 100644 index 54bae1aae9..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_GR_AGC2_CC_H -#define INCLUDED_GR_AGC2_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_cc.h> - -class gr_agc2_cc; -typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr; - -GR_CORE_API gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc -{ - friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC2_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.i b/gnuradio-core/src/lib/general/gr_agc2_cc.i deleted file mode 100644 index 6d7b221010..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc2_cc) - -%include <gri_agc2_cc.i> - -gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc2_cc : public gr_sync_block , public gri_agc2_cc -{ - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.cc b/gnuradio-core/src/lib/general/gr_agc2_ff.cc deleted file mode 100644 index 792ee1c6be..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 <gr_agc2_ff.h> -#include <gr_io_signature.h> -#include <gri_agc2_ff.h> - -gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_ff (attack_rate, decay_rate, reference, - gain, max_gain)); -} - -gr_agc2_ff::gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc2_ff (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h deleted file mode 100644 index 48529948c0..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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 INCLUDED_GR_AGC2_FF_H -#define INCLUDED_GR_AGC2_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_ff.h> -class gr_agc2_ff; -typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr; - -GR_CORE_API gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * - * \ingroup level_blk - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff -{ - friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, - float reference, float gain, float max_gain); - gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC2_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.i b/gnuradio-core/src/lib/general/gr_agc2_ff.i deleted file mode 100644 index 646391aa7f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc2_ff) - -%include <gri_agc2_ff.i> - -gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc2_ff : public gr_sync_block , public gri_agc2_ff -{ - gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.cc b/gnuradio-core/src/lib/general/gr_agc_cc.cc deleted file mode 100644 index e98f3a303f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_agc_cc.h> -#include <gr_io_signature.h> -#include <gri_agc_cc.h> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_cc (rate, reference, gain, max_gain)); -} - -gr_agc_cc::gr_agc_cc (float rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc_cc (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h deleted file mode 100644 index 9f35350dbd..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_GR_AGC_CC_H -#define INCLUDED_GR_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_cc.h> -class gr_agc_cc; -typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr; - -GR_CORE_API gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc -{ - friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, - float gain, float max_gain); - gr_agc_cc (float rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.i b/gnuradio-core/src/lib/general/gr_agc_cc.i deleted file mode 100644 index f942713b08..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc_cc) - -%include <gri_agc_cc.i> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc_cc : public gr_sync_block , public gri_agc_cc -{ - gr_agc_cc (float rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.cc b/gnuradio-core/src/lib/general/gr_agc_ff.cc deleted file mode 100644 index 6050dc7f0a..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 <gr_agc_ff.h> -#include <gr_io_signature.h> -#include <gri_agc_ff.h> - -gr_agc_ff_sptr -gr_make_agc_ff (float rate, float reference, float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_ff (rate, reference, gain, max_gain)); -} - -gr_agc_ff::gr_agc_ff (float rate, float reference, float gain, float max_gain) - : gr_sync_block ("gr_agc_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc_ff (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h deleted file mode 100644 index dc618213bb..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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 INCLUDED_GR_AGC_FF_H -#define INCLUDED_GR_AGC_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_ff.h> -class gr_agc_ff; -typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr; - -GR_CORE_API gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff -{ - friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, - float gain, float max_gain); - gr_agc_ff (float rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.i b/gnuradio-core/src/lib/general/gr_agc_ff.i deleted file mode 100644 index 03c571e1a4..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc_ff) - -%include <gri_agc_ff.i> - -gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc_ff : public gr_sync_block , public gri_agc_ff -{ - gr_agc_ff (float rate, float reference, float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.cc b/gnuradio-core/src/lib/general/gr_dpll_bb.cc deleted file mode 100644 index 1d5a0d4fda..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2010 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 <gr_dpll_bb.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_dpll_bb_sptr -gr_make_dpll_bb (float period, float gain) -{ - return gnuradio::get_initial_sptr(new gr_dpll_bb (period, gain)); -} - -gr_dpll_bb::gr_dpll_bb (float period, float gain) - : gr_sync_block ("dpll_bb", - gr_make_io_signature (1, 1, sizeof (char)), - gr_make_io_signature (1, 1, sizeof (char))), - d_restart(0),d_pulse_phase(0) -{ - d_pulse_frequency = 1.0/period; - d_gain = gain; - d_decision_threshold = 1.0 - 0.5*d_pulse_frequency; -#if 1 - fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n", - d_pulse_frequency, - period, - d_gain, - d_decision_threshold); -#endif -} - -int -gr_dpll_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *iptr = (const char *) input_items[0]; - char *optr = (char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - optr[i]= 0; - if(iptr[i] == 1) { - if (d_restart == 0) { - d_pulse_phase = 1; - } else { - if (d_pulse_phase > 0.5) d_pulse_phase += d_gain*(1.0-d_pulse_phase); - else d_pulse_phase -= d_gain*d_pulse_phase; - } - d_restart = 3; - } - if (d_pulse_phase > d_decision_threshold) { - d_pulse_phase -= 1.0; - if (d_restart > 0) { - d_restart -= 1; - optr[i] = 1; - } - } - d_pulse_phase += d_pulse_frequency; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h deleted file mode 100644 index a7df974fb4..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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 INCLUDED_GR_DPLL_BB_H -#define INCLUDED_GR_DPLL_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_dpll_bb; -typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr; - -GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - -/*! - * \brief Detect the peak of a signal - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - */ -class GR_CORE_API gr_dpll_bb : public gr_sync_block -{ - friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - - gr_dpll_bb (float period, float gain); - - private: - unsigned char d_restart; - float d_pulse_phase, d_pulse_frequency,d_gain,d_decision_threshold; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.i b/gnuradio-core/src/lib/general/gr_dpll_bb.i deleted file mode 100644 index f31a873743..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dpll_bb) - - gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - -class gr_dpll_bb : public gr_sync_block -{ - private: - gr_dpll_bb (float period, float gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc deleted file mode 100644 index 147b64e9bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_feedforward_agc_cc.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference) -{ - return gnuradio::get_initial_sptr(new gr_feedforward_agc_cc (nsamples, reference)); -} - -gr_feedforward_agc_cc::gr_feedforward_agc_cc (int nsamples, float reference) - : gr_sync_block ("gr_feedforward_agc_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_nsamples(nsamples), d_reference(reference) -{ - if (nsamples < 1) - throw std::invalid_argument("gr_feedforward_agc_cc: nsamples must be >= 1"); - - set_history(nsamples); -} - -gr_feedforward_agc_cc::~gr_feedforward_agc_cc() -{ -} - -inline static float -mag_squared(gr_complex x) -{ - return x.real() * x.real() + x.imag() * x.imag(); -} - -// approximate sqrt(x^2 + y^2) -inline static float -envelope(gr_complex x) -{ - float r_abs = std::fabs(x.real()); - float i_abs = std::fabs(x.imag()); - - if (r_abs > i_abs) - return r_abs + 0.4 * i_abs; - else - return i_abs + 0.4 * r_abs; -} - -int -gr_feedforward_agc_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - int nsamples = d_nsamples; - float gain; - - for (int i = 0; i < noutput_items; i++){ - //float max_env = 1e-12; // avoid divide by zero - float max_env = 1e-4; // avoid divide by zero, indirectly set max gain - for (int j = 0; j < nsamples; j++) - max_env = std::max(max_env, envelope(in[i+j])); - gain = d_reference / max_env; - out[i] = gain * in[i]; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h deleted file mode 100644 index 63e5e4c436..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_GR_FEEDFORWARD_AGC_CC_H -#define INCLUDED_GR_FEEDFORWARD_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_feedforward_agc_cc; -typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr; - -GR_CORE_API gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); - -/*! - * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples - * \ingroup level_blk - */ -class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block -{ - friend GR_CORE_API gr_feedforward_agc_cc_sptr - gr_make_feedforward_agc_cc(int nsamples, float reference); - - int d_nsamples; - float d_reference; - - gr_feedforward_agc_cc(int nsamples, float reference); - - public: - ~gr_feedforward_agc_cc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i deleted file mode 100644 index 1fd5a2c26d..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,feedforward_agc_cc); - -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); - -class gr_feedforward_agc_cc : public gr_sync_block -{ - gr_feedforward_agc_cc(int nsamples, float reference); - - public: - ~gr_feedforward_agc_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc deleted file mode 100644 index b7b1291a3d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 <gr_pll_carriertracking_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq) - : 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), - d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) -{ -} - -float -gr_pll_carriertracking_cc::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_carriertracking_cc::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - // sample_phase = atan2(sample.imag(),sample.real()); - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -bool -gr_pll_carriertracking_cc::lock_detector(void) -{ - return (fabsf(d_locksig) > d_lock_threshold); -} - -bool -gr_pll_carriertracking_cc::squelch_enable(bool set_squelch) -{ - return d_squelch_enable = set_squelch; -} - -float -gr_pll_carriertracking_cc::set_lock_threshold(float threshold) -{ - return d_lock_threshold = threshold; -} - -int -gr_pll_carriertracking_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - - float error; - float t_imag, t_real; - - for (int i = 0; i < noutput_items; i++){ - gr_sincosf(d_phase, &t_imag, &t_real); - optr[i] = iptr[i] * gr_complex(t_real, -t_imag); - - error = phase_detector(iptr[i],d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - - d_locksig = d_locksig * (1.0 - d_alpha) + \ - d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); - - if ((d_squelch_enable) && !lock_detector()) - optr[i] = 0; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h deleted file mode 100644 index b3bc5ddd0c..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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 INCLUDED_GR_PLL_CARRIERTRACKING_CC_H -#define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_carriertracking_cc; -typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr; - -GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs the - * input signal mixed with that carrier. - * \ingroup sync_blk - * - * input: stream of complex; output: stream of complex - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs that signal, downconverted to DC - * - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - - float d_locksig,d_lock_threshold; - bool d_squelch_enable; - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample,float ref_phase); -public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i deleted file mode 100644 index a20adf7e20..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_carriertracking_cc); - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); - -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc deleted file mode 100644 index f80f4ed07a..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <gr_pll_freqdet_cf.h> -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_freqdet_cf_sptr -gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (loop_bw, max_freq, min_freq)); -} - -gr_pll_freqdet_cf::gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) - : 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) -{ -} - -float -gr_pll_freqdet_cf::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_freqdet_cf::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -int -gr_pll_freqdet_cf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - float *optr = (float *) output_items[0]; - - float error; - int size = noutput_items; - - while (size-- > 0) { - *optr++ = d_freq; - - error = phase_detector(*iptr++,d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h deleted file mode 100644 index 3dfc8d7093..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_GR_PLL_FREQDET_CF_H -#define INCLUDED_GR_PLL_FREQDET_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_freqdet_cf; -typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr; - -GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs - * an estimate of that frequency. Useful for FM Demod. - * \ingroup sync_blk - * - * input: stream of complex; output: stream of floats - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs an estimate of that frequency in radians per sample. - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - - float mod_2pi (float in); - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float phase_detector(gr_complex sample,float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i deleted file mode 100644 index 87e515adb8..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_freqdet_cf) - - gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc deleted file mode 100644 index 9f95c3f64e..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <gr_pll_refout_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_refout_cc_sptr -gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_refout_cc::gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq) - : 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) -{ -} - -float -gr_pll_refout_cc::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_refout_cc::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -int -gr_pll_refout_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - - float error; - float t_imag, t_real; - int size = noutput_items; - - while (size-- > 0) { - gr_sincosf(d_phase,&t_imag,&t_real); - *optr++ = gr_complex(t_real,t_imag); - - error = phase_detector(*iptr++,d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h deleted file mode 100644 index ef5cd31e27..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_GR_PLL_REFOUT_CC_H -#define INCLUDED_GR_PLL_REFOUT_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_refout_cc; -typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr; - -GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs a carrier - * \ingroup sync_blk - * - * input: stream of complex; output: stream of complex - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs a clean version which is phase and frequency - * aligned to it. - * - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ -class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample, float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i deleted file mode 100644 index 630c0444fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_refout_cc) - -gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - -class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h deleted file mode 100644 index 55aa19b9ae..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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_AGC2_CC_H_ -#define _GRI_AGC2_CC_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ -class GR_CORE_API gri_agc2_cc { - - public: - gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float decay_rate () const { return _decay_rate; } - float attack_rate () const { return _attack_rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_decay_rate (float rate) { _decay_rate = rate; } - void set_attack_rate (float rate) { _attack_rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale (gr_complex input){ - gr_complex output = input * _gain; - - float tmp = -_reference + sqrt(output.real()*output.real() + - output.imag()*output.imag()); - float rate = _decay_rate; - if((tmp) > _gain) - rate = _attack_rate; - _gain -= tmp*rate; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // Not sure about this; will blow up if _gain < 0 (happens when rates are too high), - // but is this the solution? - if (_gain < 0.0) - _gain = 10e-5; - - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (gr_complex output[], const gr_complex input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain -}; - -#endif /* _GRI_AGC2_CC_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.i b/gnuradio-core/src/lib/general/gri_agc2_cc.i deleted file mode 100644 index 08716c6edc..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rates - * - * For Power the absolute value of the complex number is used. - */ - - -class gri_agc2_cc { - - public: - gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - float decay_rate (); - float attack_rate (); - float reference (); - float gain (); - float max_gain (); - void set_decay_rate (float rate); - void set_attack_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain(float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h deleted file mode 100644 index a8b46bec5c..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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_AGC2_FF_H_ -#define _GRI_AGC2_FF_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rate - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gri_agc2_ff { - - public: - gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float attack_rate () const { return _attack_rate; } - float decay_rate () const { return _decay_rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_attack_rate (float rate) { _attack_rate = rate; } - void set_decay_rate (float rate) { _decay_rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input){ - float output = input * _gain; - - float tmp = (fabsf(output)) - _reference; - float rate = _decay_rate; - if(fabsf(tmp) > _gain) - rate = _attack_rate; - _gain -= tmp*rate; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // Not sure about this - if (_gain < 0.0) - _gain = 10e-5; - - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (float output[], const float input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack_rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain -}; - -#endif /* _GRI_AGC2_FF_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.i b/gnuradio-core/src/lib/general/gri_agc2_ff.i deleted file mode 100644 index 9f97d8f0dd..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ - - -class gri_agc2_ff { - - public: - gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, float gain = 1.0, float max_gain = 0.0); - float attack_rate (); - float decay_rate (); - float reference (); - float gain (); - float max_gain (); - void set_attack_rate (float rate); - void set_decay_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain (float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h deleted file mode 100644 index 90edc5dcd2..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_cc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_GRI_AGC_CC_H -#define INCLUDED_GRI_AGC_CC_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gri_agc_cc { - - public: - gri_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale (gr_complex input){ - gr_complex output = input * _gain; - - _gain += _rate * (_reference - sqrt(output.real()*output.real() + - output.imag()*output.imag())); - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (gr_complex output[], const gr_complex input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain -}; - -#endif /* INCLUDED_GRI_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.i b/gnuradio-core/src/lib/general/gri_agc_cc.i deleted file mode 100644 index d3dd9b61bc..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_cc.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - - -class gri_agc_cc { - - public: - gri_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - float rate (); - float reference (); - float gain (); - float max_gain (); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h deleted file mode 100644 index 1c233c7461..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_ff.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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 INCLUDED_GRI_AGC_FF_H -#define INCLUDED_GRI_AGC_FF_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ -class GR_CORE_API gri_agc_ff { - - public: - gri_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain) {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input){ - float output = input * _gain; - _gain += (_reference - fabsf (output)) * _rate; - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (float output[], const float input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain -}; - -#endif /* INCLUDED_GRI_AGC_FF_H */ - diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.i b/gnuradio-core/src/lib/general/gri_agc_ff.i deleted file mode 100644 index df4acf7af8..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_ff.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ - -class gri_agc_ff { - - public: - gri_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -}; diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h deleted file mode 100644 index d0ce3d850a..0000000000 --- a/gnuradio-core/src/lib/general/gri_lfsr.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 INCLUDED_GRI_LFSR_H -#define INCLUDED_GRI_LFSR_H - -#include <gr_core_api.h> -#include <stdexcept> -#include <stdint.h> - -/*! - * \brief Fibonacci Linear Feedback Shift Register using specified polynomial mask - * \ingroup misc - * - * Generates a maximal length pseudo-random sequence of length 2^degree-1 - * - * Constructor: gri_lfsr(int mask, int seed, int reg_len); - * - * mask - polynomial coefficients representing the locations - * of feedback taps from a shift register which are xor'ed - * together to form the new high order bit. - * - * Some common masks might be: - * x^4 + x^3 + x^0 = 0x19 - * x^5 + x^3 + x^0 = 0x29 - * x^6 + x^5 + x^0 = 0x61 - * - * seed - the initialization vector placed into the register - * durring initialization. Low order bit corresponds - * to x^0 coefficient -- the first to be shifted as output. - * - * reg_len - specifies the length of the feedback shift register - * to be used. Durring each iteration, the register - * is rightshifted one and the new bit is placed in bit reg_len. - * reg_len should generally be at least order(mask) + 1 - * - * - * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register - * for more explanation. - * - * - * - * next_bit() - Standard LFSR operation - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register. - * - * next_bit_scramble(unsigned char input) - Scramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register and the input LSB. - * - * next_bit_descramble(unsigned char input) - Descramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the modulo 2 sum of the masked shift register and the input LSB. - * The shift register MSB is assigned from the LSB of the input. - * - * See http://en.wikipedia.org/wiki/Scrambler for operation of these - * last two functions (see multiplicative scrambler.) - * - */ - -class /*GR_CORE_API*/ gri_lfsr -{ - private: - uint32_t d_shift_register; - uint32_t d_mask; - uint32_t d_seed; - uint32_t d_shift_register_length; // less than 32 - - static uint32_t - popCount(uint32_t x) - { - uint32_t r = x - ((x >> 1) & 033333333333) - - ((x >> 2) & 011111111111); - return ((r + (r >> 3)) & 030707070707) % 63; - } - - public: - - gri_lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len) - : d_shift_register(seed), - d_mask(mask), - d_seed(seed), - d_shift_register_length(reg_len) - { - if (reg_len > 31) - throw std::invalid_argument("reg_len must be <= 31"); - } - - unsigned char next_bit() { - unsigned char output = d_shift_register & 1; - unsigned char newbit = popCount( d_shift_register & d_mask )%2; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_scramble(unsigned char input) { - unsigned char output = d_shift_register & 1; - unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1); - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_descramble(unsigned char input) { - unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1); - unsigned char newbit = input & 1; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - /*! - * Reset shift register to initial seed value - */ - void reset() { d_shift_register = d_seed; } - - /*! - * Rotate the register through x number of bits - * where we are just throwing away the results to get queued up correctly - */ - void pre_shift(int num){ - for(int i=0; i<num; i++){ - next_bit(); - } - } - - int mask() const { return d_mask; } -}; - -#endif /* INCLUDED_GRI_LFSR_H */ diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt index b8ec6c88c4..dae287ca3a 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt @@ -21,19 +21,9 @@ include(GrPython) GR_PYTHON_INSTALL(FILES __init__.py - am_demod.py filterbank.py - fm_demod.py - fm_emph.py - nbfm_rx.py - nbfm_tx.py rational_resampler.py - standard_squelch.py stream_to_vector_decimator.py - wfm_rcv.py - wfm_rcv_fmdet.py - wfm_rcv_pll.py - wfm_tx.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2impl COMPONENT "core_python" ) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py deleted file mode 100755 index 9fd633576e..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py +++ /dev/null @@ -1,433 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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. -# - -from gnuradio import gr, gr_unittest -import math - -test_output = False - -class test_agc (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - - def test_001(self): - ''' Test the complex AGC loop (single rate input) ''' - tb = self.tb - - expected_result = ( - (100.000244140625+7.2191943445432116e-07j), - (72.892257690429688+52.959323883056641j), - (25.089065551757812+77.216217041015625j), - (-22.611061096191406+69.589706420898438j), - (-53.357715606689453+38.766635894775391j), - (-59.458671569824219+3.4792964243024471e-07j), - (-43.373462677001953-31.512666702270508j), - (-14.94139289855957-45.984889984130859j), - (13.478158950805664-41.48150634765625j), - (31.838506698608398-23.132022857666016j), - (35.519271850585938-3.1176801940091536e-07j), - (25.942903518676758+18.848621368408203j), - (8.9492912292480469+27.5430908203125j), - (-8.0852642059326172+24.883890151977539j), - (-19.131628036499023+13.899936676025391j), - (-21.383295059204102+3.1281737733479531e-07j), - (-15.650330543518066-11.370632171630859j), - (-5.4110145568847656-16.65339469909668j), - (4.9008159637451172-15.083160400390625j), - (11.628337860107422-8.4484796524047852j), - (13.036135673522949-2.288476110834381e-07j), - (9.5726661682128906+6.954948902130127j), - (3.3216962814331055+10.223132133483887j), - (-3.0204284191131592+9.2959251403808594j), - (-7.1977195739746094+5.2294478416442871j), - (-8.1072216033935547+1.8976157889483147e-07j), - (-5.9838657379150391-4.3475332260131836j), - (-2.0879747867584229-6.4261269569396973j), - (1.9100792407989502-5.8786196708679199j), - (4.5814824104309082-3.3286411762237549j), - (5.1967458724975586-1.3684227440080576e-07j), - (3.8647139072418213+2.8078789710998535j), - (1.3594740629196167+4.1840314865112305j), - (-1.2544282674789429+3.8607344627380371j), - (-3.0366206169128418+2.2062335014343262j), - (-3.4781389236450195+1.1194014604143376e-07j), - (-2.6133756637573242-1.8987287282943726j), - (-0.9293016791343689-2.8600969314575195j), - (0.86727333068847656-2.6691930294036865j), - (2.1243946552276611-1.5434627532958984j), - (2.4633183479309082-8.6486437567145913e-08j), - (1.8744727373123169+1.3618841171264648j), - (0.67528903484344482+2.0783262252807617j), - (-0.63866174221038818+1.965599536895752j), - (-1.5857341289520264+1.152103066444397j), - (-1.8640764951705933+7.6355092915036948e-08j), - (-1.4381576776504517-1.0448826551437378j), - (-0.52529704570770264-1.6166983842849731j), - (0.50366902351379395-1.5501341819763184j), - (1.26766037940979-0.92100900411605835j)) - - sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) - - agc = gr.agc_cc(1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat")) - - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - - def test_002(self): - ''' Test the floating point AGC loop (single rate input) ''' - tb = self.tb - - expected_result = ( - 7.2191943445432116e-07, - 58.837181091308594, - 89.700050354003906, - 81.264183044433594, - 45.506141662597656, - 4.269894304798072e-07, - -42.948936462402344, - -65.50335693359375, - -59.368724822998047, - -33.261005401611328, - -4.683740257860336e-07, - 31.423542022705078, - 47.950984954833984, - 43.485683441162109, - 24.378345489501953, - 5.7254135299444897e-07, - -23.062990188598633, - -35.218441009521484, - -31.964075088500977, - -17.934831619262695, - -5.0591745548445033e-07, - 16.998210906982422, - 25.982204437255859, - 23.606258392333984, - 13.260685920715332, - 4.9936483037527069e-07, - -12.59880542755127, - -19.28221321105957, - -17.54347038269043, - -9.8700437545776367, - -4.188150626305287e-07, - 9.4074573516845703, - 14.422011375427246, - 13.145503044128418, - 7.41046142578125, - 3.8512698097292741e-07, - -7.0924453735351562, - -10.896408081054688, - -9.9552040100097656, - -5.6262712478637695, - -3.1982864356905338e-07, - 5.4131259918212891, - 8.3389215469360352, - 7.6409502029418945, - 4.3320145606994629, - 2.882407841298118e-07, - -4.194943904876709, - -6.4837145805358887, - -5.9621825218200684, - -3.3931560516357422) - - sampling_freq = 100 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_f () - head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) - - agc = gr.agc_ff(1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc_ff.dat")) - - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) - - def test_003(self): - ''' Test the complex AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - ((100.000244140625+7.2191943445432116e-07j), - (0.80881959199905396+0.58764183521270752j), - (0.30894950032234192+0.95084899663925171j), - (-0.30895623564720154+0.95086973905563354j), - (-0.80887287855148315+0.58768033981323242j), - (-0.99984413385391235+5.850709250410091e-09j), - (-0.80889981985092163-0.58770018815994263j), - (-0.30897706747055054-0.95093393325805664j), - (0.30898112058639526-0.95094609260559082j), - (0.80893135070800781-0.58772283792495728j), - (0.99990922212600708-8.7766354184282136e-09j), - (0.80894720554351807+0.58773452043533325j), - (0.30899339914321899+0.95098406076431274j), - (-0.30899572372436523+0.95099133253097534j), - (-0.80896598100662231+0.58774799108505249j), - (-0.99994778633117676+1.4628290578855285e-08j), - (-0.80897533893585205-0.58775502443313599j), - (-0.30900305509567261-0.95101380348205566j), - (0.30900448560714722-0.95101797580718994j), - (0.80898630619049072-0.58776277303695679j), - (0.99997037649154663-1.7554345532744264e-08j), - (0.80899184942245483+0.58776694536209106j), - (0.30900871753692627+0.95103120803833008j), - (-0.30900952219963074+0.95103377103805542j), - (-0.8089984655380249+0.58777159452438354j), - (-0.99998390674591064+2.3406109050938539e-08j), - (-0.809001624584198-0.58777409791946411j), - (-0.30901208519935608-0.95104163885116577j), - (0.30901262164115906-0.95104306936264038j), - (0.80900543928146362-0.587776780128479j), - (0.99999171495437622-2.6332081404234486e-08j), - (0.80900734663009644+0.58777821063995361j), - (0.30901408195495605+0.95104765892028809j), - (-0.30901429057121277+0.95104855298995972j), - (-0.80900967121124268+0.58777981996536255j), - (-0.99999648332595825+3.2183805842578295e-08j), - (-0.80901080369949341-0.58778077363967896j), - (-0.30901527404785156-0.95105135440826416j), - (0.30901545286178589-0.95105189085006714j), - (0.80901217460632324-0.58778166770935059j), - (0.99999916553497314-3.5109700036173308e-08j), - (0.809012770652771+0.58778214454650879j), - (0.30901595950126648+0.9510534405708313j), - (-0.30901598930358887+0.95105385780334473j), - (-0.80901366472244263+0.58778274059295654j), - (-1.0000008344650269+4.0961388947380328e-08j), - (-0.8090139627456665-0.58778303861618042j), - (-0.30901634693145752-0.95105475187301636j), - (0.30901640653610229-0.95105493068695068j), - (0.80901449918746948-0.5877833366394043j)) - - sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) - - agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - - def test_004(self): - ''' Test the floating point AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - (7.2191943445432116e-07, - 58.837181091308594, - 40.194305419921875, - 2.9183335304260254, - 0.67606079578399658, - 8.6260438791896377e-09, - -1.4542514085769653, - -1.9210131168365479, - -1.0450780391693115, - -0.61939650774002075, - -1.2590258613442984e-08, - 1.4308931827545166, - 1.9054338932037354, - 1.0443156957626343, - 0.61937344074249268, - 2.0983527804219193e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443152189254761, - -0.61937344074249268, - -2.5180233009791664e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443154573440552, - 0.61937344074249268, - 3.3573645197293445e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443152189254761, - -0.61937350034713745, - -3.7770352179222755e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443154573440552, - 0.61937350034713745, - 4.6163762590367696e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443153381347656, - -0.61937344074249268, - -5.0360466019583328e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443155765533447, - 0.61937344074249268, - 5.8753879983441948e-08, - -1.4308837652206421, - -1.9054274559020996, - -1.0443153381347656, - -0.61937344074249268) - - sampling_freq = 100 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_f () - head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) - - agc = gr.agc2_ff(1e-2, 1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat")) - - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) - - - def test_005(self): - ''' Test the complex AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - ((100.000244140625+7.2191943445432116e-07j), - (0.80881959199905396+0.58764183521270752j), - (0.30894950032234192+0.95084899663925171j), - (-0.30895623564720154+0.95086973905563354j), - (-0.80887287855148315+0.58768033981323242j), - (-0.99984413385391235+5.850709250410091e-09j), - (-0.80889981985092163-0.58770018815994263j), - (-0.30897706747055054-0.95093393325805664j), - (0.30898112058639526-0.95094609260559082j), - (0.80893135070800781-0.58772283792495728j), - (0.99990922212600708-8.7766354184282136e-09j), - (0.80894720554351807+0.58773452043533325j), - (0.30899339914321899+0.95098406076431274j), - (-0.30899572372436523+0.95099133253097534j), - (-0.80896598100662231+0.58774799108505249j), - (-0.99994778633117676+1.4628290578855285e-08j), - (-0.80897533893585205-0.58775502443313599j), - (-0.30900305509567261-0.95101380348205566j), - (0.30900448560714722-0.95101797580718994j), - (0.80898630619049072-0.58776277303695679j), - (0.99997037649154663-1.7554345532744264e-08j), - (0.80899184942245483+0.58776694536209106j), - (0.30900871753692627+0.95103120803833008j), - (-0.30900952219963074+0.95103377103805542j), - (-0.8089984655380249+0.58777159452438354j), - (-0.99998390674591064+2.3406109050938539e-08j), - (-0.809001624584198-0.58777409791946411j), - (-0.30901208519935608-0.95104163885116577j), - (0.30901262164115906-0.95104306936264038j), - (0.80900543928146362-0.587776780128479j), - (0.99999171495437622-2.6332081404234486e-08j), - (0.80900734663009644+0.58777821063995361j), - (0.30901408195495605+0.95104765892028809j), - (-0.30901429057121277+0.95104855298995972j), - (-0.80900967121124268+0.58777981996536255j), - (-0.99999648332595825+3.2183805842578295e-08j), - (-0.80901080369949341-0.58778077363967896j), - (-0.30901527404785156-0.95105135440826416j), - (0.30901545286178589-0.95105189085006714j), - (0.80901217460632324-0.58778166770935059j), - (0.99999916553497314-3.5109700036173308e-08j), - (0.809012770652771+0.58778214454650879j), - (0.30901595950126648+0.9510534405708313j), - (-0.30901598930358887+0.95105385780334473j), - (-0.80901366472244263+0.58778274059295654j), - (-1.0000008344650269+4.0961388947380328e-08j), - (-0.8090139627456665-0.58778303861618042j), - (-0.30901634693145752-0.95105475187301636j), - (0.30901640653610229-0.95105493068695068j), - (0.80901449918746948-0.5877833366394043j)) - - sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) - - agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - - - def test_100(self): # FIXME needs work - ''' Test complex feedforward agc with constant input ''' - input_data = 16*(0.0,) + 64*(1.0,) + 64*(0.0,) - expected_result = () - - src = gr.vector_source_c(input_data) - agc = gr.feedforward_agc_cc(16, 2.0) - dst = gr.vector_sink_c () - self.tb.connect (src, agc, dst) - - if test_output == True: - self.tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_feedforward_cc.dat")) - - self.tb.run () - dst_data = dst.data () - #self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - - -if __name__ == '__main__': - gr_unittest.run(test_agc, "test_agc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py deleted file mode 100755 index 8964db53db..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_pll_carriertracking (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_pll_carriertracking (self): - expected_result = ((1.00000238419+7.21919457547e-09j), - (0.998025715351+0.062790453434j), - (0.992777824402+0.119947694242j), - (0.985192835331+0.171441286802j), - (0.976061582565+0.217501848936j), - (0.966034710407+0.258409559727j), - (0.95565611124+0.294477283955j), - (0.945357382298+0.326030552387j), - (0.935475051403+0.353395611048j), - (0.926258146763+0.376889169216j), - (0.917895197868+0.39681750536j), - (0.910515546799+0.413470208645j), - (0.904196679592+0.427117019892j), - (0.898972511292+0.438006043434j), - (0.894769787788+0.446523308754j), - (0.891652584076+0.452715367079j), - (0.8895829916+0.456773489714j), - (0.888502895832+0.458873122931j), - (0.888343691826+0.459175437689j), - (0.889035582542+0.457833081484j), - (0.890497922897+0.454985737801j), - (0.892645597458+0.450762689114j), - (0.895388305187+0.445282936096j), - (0.898648142815+0.438664674759j), - (0.902342617512+0.431016951799j), - (0.906392872334+0.422441422939j), - (0.910642921925+0.413191765547j), - (0.915039420128+0.403358519077j), - (0.919594764709+0.392864197493j), - (0.92425006628+0.381792247295j), - (0.928944349289+0.370217680931j), - (0.933634519577+0.358220815659j), - (0.938279032707+0.345874190331j), - (0.942840516567+0.333247303963j), - (0.947280526161+0.32040438056j), - (0.951574921608+0.307409763336j), - (0.955703914165+0.294323593378j), - (0.959648966789+0.281201630831j), - (0.963392794132+0.268095195293j), - (0.966880619526+0.255221515894j), - (0.970162451267+0.242447137833j), - (0.973235487938+0.229809194803j), - (0.97609680891+0.217341512442j), - (0.978744983673+0.20507311821j), - (0.981189727783+0.193033605814j), - (0.983436584473+0.181248426437j), - (0.985490739346+0.169738590717j), - (0.987353682518+0.158523857594j), - (0.989041447639+0.147622272372j), - (0.990563035011+0.137049794197j), - (0.991928339005+0.126818582416j), - (0.993117690086+0.117111675441j), - (0.994156062603+0.107930034399j), - (0.995076179504+0.0990980416536j), - (0.995887458324+0.0906178802252j), - (0.996591091156+0.0824909061193j), - (0.997202515602+0.0747182965279j), - (0.997730851173+0.0672992765903j), - (0.998185396194+0.0602316558361j), - (0.99856698513+0.0535135567188j), - (0.998885989189+0.0471420884132j), - (0.99915266037+0.0411129891872j), - (0.999372899532+0.0354214012623j), - (0.999548316002+0.0300626158714j), - (0.999680638313+0.0252036750317j), - (0.999784469604+0.020652115345j), - (0.999865531921+0.0163950324059j), - (0.999923825264+0.0124222636223j), - (0.999960243702+0.00872156023979j), - (0.999983668327+0.00528120994568j), - (0.999997138977+0.00209015607834j), - (1.00000119209-0.00086285173893j), - (0.999992132187-0.00358882546425j), - (0.999979138374-0.00609711557627j), - (0.999963641167-0.00839691981673j), - (0.999947249889-0.0104993218556j), - (0.999924004078-0.0122378543019j), - (0.999904811382-0.0136305987835j), - (0.999888062477-0.0148707330227j), - (0.9998742342-0.0159679055214j), - (0.999856114388-0.0169314742088j), - (0.999839782715-0.0177700817585j), - (0.999826967716-0.0184917747974j), - (0.999818325043-0.0191045701504j), - (0.999807476997-0.0196143388748j), - (0.999797284603-0.0200265944004j), - (0.999791204929-0.0203481912613j), - (0.99978852272-0.0205836892128j), - (0.99978530407-0.0207380950451j), - (0.999785065651-0.0206423997879j), - (0.999787807465-0.0204866230488j), - (0.999794304371-0.0202808082104j), - (0.999800384045-0.0200312435627j), - (0.999803245068-0.0197458267212j), - (0.9998087883-0.0194311738014j), - (0.999816894531-0.0190933048725j), - (0.999825954437-0.0187371373177j), - (0.999829888344-0.0183679759502j), - (0.999835848808-0.017987690866j), - (0.999844014645-0.0176006518304j)) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_carriertracking_cc(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c () - - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) - - self.tb.run () - dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py deleted file mode 100755 index 219e9b84b6..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_pll_freqdet (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_pll_freqdet (self): - expected_result = (0.0, - 4.33888922882e-08, - 0.367369994515, - 1.08135249597, - 2.10983253908, - 3.42221529438, - 4.98940390402, - 6.78379190842, - 8.77923286024, - 10.9510106794, - 13.2758363182, - 15.7317829127, - 18.2982902299, - 20.9561068599, - 23.6755271122, - 26.452952094, - 29.2731265301, - 32.1219053479, - 34.9862418188, - 37.8540971414, - 40.7144315483, - 43.5571390869, - 46.3730179743, - 49.1537231663, - 51.8917218889, - 54.58026103, - 57.2015358514, - 59.7513664199, - 62.2380533124, - 64.657612252, - 67.006640002, - 69.2822432184, - 71.4820384499, - 73.6041047056, - 75.6469478817, - 77.6094829742, - 79.4909866472, - 81.2911031615, - 83.0097850853, - 84.6355598352, - 86.1820937186, - 87.6504420946, - 89.0418441206, - 90.3577286819, - 91.5996432431, - 92.7692775646, - 93.8684162704, - 94.8989269904, - 95.8627662892, - 96.7619381633, - 97.598505899, - 98.362769679, - 99.0579904444, - 99.6992633875, - 100.288805948, - 100.828805921, - 101.321421457, - 101.76878699, - 102.17300138, - 102.536116055, - 102.860158727, - 103.147085962, - 103.398830608, - 103.617254366, - 103.792467691, - 103.939387906, - 104.060030865, - 104.15631756, - 104.230085975, - 104.283067372, - 104.316933727, - 104.333238432, - 104.333440018, - 104.318914008, - 104.290941063, - 104.250742554, - 104.187634452, - 104.103822339, - 104.013227468, - 103.916810336, - 103.815448432, - 103.709936239, - 103.600997093, - 103.489283183, - 103.375351833, - 103.259712936, - 103.142828952, - 103.025091195, - 102.90686726, - 102.776726069, - 102.648078982, - 102.521459607, - 102.397294831, - 102.275999684, - 102.157882471, - 102.043215927, - 101.93218978, - 101.824958181, - 101.72159228, - 101.622151366) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_freqdet_cf(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_float, int (freq)) - dst = gr.vector_sink_f () - - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) - - self.tb.run () - dst_data = dst.data () - - # convert it from normalized frequency to absolute frequency (Hz) - dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data] - - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3) - -if __name__ == '__main__': - gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py deleted file mode 100755 index f319f63814..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2010 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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_pll_refout (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_pll_refout (self): - expected_result = ((1+0j), - (1+6.4087357643e-10j), - (0.999985277653+0.00542619498447j), - (0.999868750572+0.0162021834403j), - (0.99948567152+0.0320679470897j), - (0.99860727787+0.0527590736747j), - (0.996953129768+0.0780025869608j), - (0.994203746319+0.107512556016j), - (0.990011692047+0.140985429287j), - (0.984013140202+0.178095817566j), - (0.975838363171+0.218493551016j), - (0.965121984482+0.261800557375j), - (0.95151245594+0.307610183954j), - (0.934681296349+0.355486690998j), - (0.914401650429+0.404808044434j), - (0.890356600285+0.455263823271j), - (0.862329125404+0.506348133087j), - (0.830152392387+0.557536482811j), - (0.793714106083+0.608290970325j), - (0.752960026264+0.658066213131j), - (0.707896590233+0.706316053867j), - (0.658591926098+0.752500295639j), - (0.605175673962+0.796091973782j), - (0.547837555408+0.836584687233j), - (0.48682525754+0.873499393463j), - (0.42244040966+0.906390726566j), - (0.355197101831+0.934791445732j), - (0.285494059324+0.958380460739j), - (0.213591173291+0.976923108101j), - (0.139945343137+0.990159213543j), - (0.065038472414+0.997882783413j), - (-0.0106285437942+0.999943494797j), - (-0.0865436866879+0.996248066425j), - (-0.162189796567+0.986759603024j), - (-0.23705175519+0.971496999264j), - (-0.310622543097+0.950533330441j), - (-0.38240903616+0.923993110657j), - (-0.451937526464+0.89204955101j), - (-0.518758952618+0.854920566082j), - (-0.582311093807+0.812966048717j), - (-0.642372369766+0.76639264822j), - (-0.698591887951+0.715520322323j), - (-0.750654160976+0.660695314407j), - (-0.798280358315+0.602286040783j), - (-0.841228663921+0.540679454803j), - (-0.87929558754+0.476276367903j), - (-0.912315964699+0.409486919641j), - (-0.940161883831+0.340728074312j), - (-0.962742805481+0.270418733358j), - (-0.980004072189+0.198977485299j), - (-0.991925954819+0.126818284392j), - (-0.99851256609+0.0545223206282j), - (-0.999846458435-0.0175215266645j), - (-0.996021270752-0.0891158208251j), - (-0.987133920193-0.159895718098j), - (-0.973306238651-0.2295101583j), - (-0.954683184624-0.297624111176j), - (-0.931430280209-0.363919824362j), - (-0.903732538223-0.428097635508j), - (-0.871792256832-0.489875763655j), - (-0.835827112198-0.548992812634j), - (-0.796068251133-0.605206847191j), - (-0.752758979797-0.658296227455j), - (-0.706152498722-0.70805978775j), - (-0.656641483307-0.754202902317j), - (-0.604367733002-0.79670548439j), - (-0.549597978592-0.835429251194j), - (-0.492602348328-0.870254516602j), - (-0.433654457331-0.901079237461j), - (-0.373029649258-0.927819430828j), - (-0.31100410223-0.950408577919j), - (-0.247853919864-0.968797445297j), - (-0.183855071664-0.982953369617j), - (-0.119282215834-0.992860376835j), - (-0.0544078871608-0.998518764973j), - (0.0104992967099-0.999944865704j), - (0.0749994292855-0.997183561325j), - (0.138844624162-0.990314185619j), - (0.201967850327-0.979392170906j), - (0.264124274254-0.964488625526j), - (0.325075358152-0.945688128471j), - (0.3845885396-0.92308807373j), - (0.442438393831-0.89679890871j), - (0.498407125473-0.866943061352j), - (0.552284479141-0.833655714989j), - (0.603869199753-0.797083437443j), - (0.652970373631-0.757383465767j), - (0.69940674305-0.714723825455j), - (0.743007957935-0.66928255558j), - (0.78350687027-0.62138313055j), - (0.820889055729-0.571087777615j), - (0.855021059513-0.51859331131j), - (0.885780930519-0.46410369873j), - (0.913058102131-0.407829582691j), - (0.936754107475-0.349988251925j), - (0.956783294678-0.290801793337j), - (0.973072886467-0.230497643352j), - (0.985563337803-0.169307261705j), - (0.9942086339-0.1074674353j), - (0.9989772439-0.0452152714133j)) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_refout_cc(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c () - - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) - - self.tb.run () - dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_pll_refout, "test_pll_refout.xml") diff --git a/gr-analog/python/CMakeLists.txt b/gr-analog/python/CMakeLists.txt index 08570eea33..f42ee20086 100644 --- a/gr-analog/python/CMakeLists.txt +++ b/gr-analog/python/CMakeLists.txt @@ -25,6 +25,16 @@ include(GrPython) GR_PYTHON_INSTALL( FILES __init__.py + am_demod.py + fm_demod.py + fm_emph.py + nbfm_rx.py + nbfm_tx.py + standard_squelch.py + wfm_rcv.py + wfm_rcv_fmdet.py + wfm_rcv_pll.py + wfm_tx.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog COMPONENT "analog_python" ) diff --git a/gr-analog/python/__init__.py b/gr-analog/python/__init__.py index fc345028b9..a5ab5715d7 100644 --- a/gr-analog/python/__init__.py +++ b/gr-analog/python/__init__.py @@ -25,3 +25,14 @@ Blocks and utilities for analog modulation and demodulation. # The presence of this file turns this directory into a Python package from analog_swig import * + +from am_demod import * +from fm_demod import * +from fm_emph import * +from nbfm_rx import * +from nbfm_tx import * +from standard_squelch import * +from wfm_rcv import * +from wfm_rcv_fmdet import * +from wfm_rcv_pll import * +from wfm_tx import * diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py b/gr-analog/python/am_demod.py index 6420348be3..2730aa2622 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py +++ b/gr-analog/python/am_demod.py @@ -1,5 +1,5 @@ # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir +from gnuradio import gr +from gnuradio import filter class am_demod_cf(gr.hier_block2): """ @@ -44,13 +45,13 @@ class am_demod_cf(gr.hier_block2): MAG = gr.complex_to_mag() DCR = gr.add_const_ff(-1.0) - audio_taps = optfir.low_pass(0.5, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) + audio_taps = filter.optfir.low_pass(0.5, # Filter gain + channel_rate, # Sample rate + audio_pass, # Audio passband + audio_stop, # Audio stopband + 0.1, # Passband ripple + 60) # Stopband attenuation + LPF = filter.fir_filter_fff(audio_decim, audio_taps) self.connect(self, MAG, DCR, LPF, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py b/gr-analog/python/fm_demod.py index cc93d5b45c..c14ed1682e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py +++ b/gr-analog/python/fm_demod.py @@ -1,5 +1,5 @@ # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir +from gnuradio import gr, analog, filter from gnuradio.blks2impl.fm_emph import fm_deemph from math import pi @@ -49,15 +49,15 @@ class fm_demod_cf(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_float)) # Output signature k = channel_rate/(2*pi*deviation) - QUAD = gr.quadrature_demod_cf(k) + QUAD = analog.quadrature_demod_cf(k) - audio_taps = optfir.low_pass(gain, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) + audio_taps = filter.optfir.low_pass(gain, # Filter gain + channel_rate, # Sample rate + audio_pass, # Audio passband + audio_stop, # Audio stopband + 0.1, # Passband ripple + 60) # Stopband attenuation + LPF = filter.fir_filter_fff(audio_decim, audio_taps) if tau is not None: DEEMPH = fm_deemph(channel_rate, tau) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py b/gr-analog/python/fm_emph.py index 080ebe151f..2821f6e3cd 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py +++ b/gr-analog/python/fm_emph.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,6 @@ from gnuradio import gr, filter import math - # # 1 # H(s) = ------- @@ -53,7 +52,7 @@ class fm_deemph(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_float)) # Output signature w_p = 1/tau - w_pp = math.tan (w_p / (fs * 2)) # prewarped analog freq + w_pp = math.tan(w_p / (fs * 2)) # prewarped analog freq a1 = (w_pp - 1)/(w_pp + 1) b0 = w_pp/(1 + w_pp) @@ -66,7 +65,7 @@ class fm_deemph(gr.hier_block2): print "btaps =", btaps print "ataps =", ataps global plot1 - plot1 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) + plot1 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) deemph = filter.iir_filter_ffd(btaps, ataps) self.connect(self, deemph, self) @@ -145,7 +144,7 @@ class fm_preemph(gr.hier_block2): print "btaps =", btaps print "ataps =", ataps global plot2 - plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) + plot2 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) preemph = filter.iir_filter_ffd(btaps, ataps) self.connect(self, preemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py b/gr-analog/python/nbfm_rx.py index 40eb255e1e..1d307328b1 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py +++ b/gr-analog/python/nbfm_rx.py @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,9 +20,10 @@ # import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_deemph -#from gnuradio.blks2impl.standard_squelch import standard_squelch +from gnuradio import gr +from gnuradio import filter +from gnuradio import analog +import fm_deemph class nbfm_rx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): @@ -63,23 +64,23 @@ class nbfm_rx(gr.hier_block2): # FM Demodulator input: complex; output: float k = quad_rate/(2*math.pi*max_dev) - self.quad_demod = gr.quadrature_demod_cf(k) + self.quad_demod = analog.quadrature_demod_cf(k) # FM Deemphasis IIR filter - self.deemph = fm_deemph (quad_rate, tau=tau) + self.deemph = fm_deemph(quad_rate, tau=tau) # compute FIR taps for audio filter audio_decim = quad_rate // audio_rate - audio_taps = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - 2.7e3, # Audio LPF cutoff - 0.5e3, # Transition band - gr.firdes.WIN_HAMMING) # filter type + audio_taps = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + 2.7e3, # Audio LPF cutoff + 0.5e3, # Transition band + gr.firdes.WIN_HAMMING) # filter type print "len(audio_taps) =", len(audio_taps) # Decimating audio filter # input: float; output: float; taps: float - self.audio_filter = gr.fir_filter_fff(audio_decim, audio_taps) + self.audio_filter = filter.fir_filter_fff(audio_decim, audio_taps) self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py b/gr-analog/python/nbfm_tx.py index 75e96f2374..a108aac49e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py +++ b/gr-analog/python/nbfm_tx.py @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,10 +20,9 @@ # import math -from gnuradio import gr, optfir, filter -from gnuradio.blks2impl.fm_emph import fm_preemph - -#from gnuradio import ctcss +from gnuradio import gr, filter +from gnuradio import analog +from fm_emph import fm_preemph class nbfm_tx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): @@ -58,23 +57,23 @@ class nbfm_tx(gr.hier_block2): if do_interp: interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 4500, # passband cutoff - 7000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB + interp_taps = filter.optfir.low_pass(interp_factor, # gain + quad_rate, # Fs + 4500, # passband cutoff + 7000, # stopband cutoff + 0.1, # passband ripple dB + 40) # stopband atten dB #print "len(interp_taps) =", len(interp_taps) self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps) - self.preemph = fm_preemph (quad_rate, tau=tau) + self.preemph = fm_preemph(quad_rate, tau=tau) k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) + self.modulator = analog.frequency_modulator_fc(k) if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) + self.connect(self, self.interpolator, self.preemph, self.modulator, self) else: self.connect(self, self.preemph, self.modulator, self) @@ -85,5 +84,5 @@ class ctcss_gen_f(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - self.plgen = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0) + self.plgen = analog.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0) self.connect(self.plgen, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py b/gr-analog/python/standard_squelch.py index bd7fb535ae..986397a48e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py +++ b/gr-analog/python/standard_squelch.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,8 @@ # import math -from gnuradio import gr, optfir +from gnuradio import gr +from gnuradio import filter class standard_squelch(gr.hier_block2): def __init__(self, audio_rate): @@ -30,41 +31,41 @@ class standard_squelch(gr.hier_block2): self.input_node = gr.add_const_ff(0) # FIXME kludge - self.low_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615)) + self.low_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615)) self.low_square = gr.multiply_ff() - self.low_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant + self.low_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant - self.hi_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615)) + self.hi_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615)) self.hi_square = gr.multiply_ff() - self.hi_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) + self.hi_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.sub = gr.sub_ff(); self.add = gr.add_ff(); self.gate = gr.threshold_ff(0.3,0.43,0) - self.squelch_lpf = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) + self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.div = gr.divide_ff() self.squelch_mult = gr.multiply_ff() - self.connect (self, self.input_node) - self.connect (self.input_node, (self.squelch_mult, 0)) + self.connect(self, self.input_node) + self.connect(self.input_node, (self.squelch_mult, 0)) - self.connect (self.input_node,self.low_iir) - self.connect (self.low_iir,(self.low_square,0)) - self.connect (self.low_iir,(self.low_square,1)) - self.connect (self.low_square,self.low_smooth,(self.sub,0)) - self.connect (self.low_smooth, (self.add,0)) + self.connect(self.input_node,self.low_iir) + self.connect(self.low_iir,(self.low_square,0)) + self.connect(self.low_iir,(self.low_square,1)) + self.connect(self.low_square,self.low_smooth,(self.sub,0)) + self.connect(self.low_smooth, (self.add,0)) - self.connect (self.input_node,self.hi_iir) - self.connect (self.hi_iir,(self.hi_square,0)) - self.connect (self.hi_iir,(self.hi_square,1)) - self.connect (self.hi_square,self.hi_smooth,(self.sub,1)) - self.connect (self.hi_smooth, (self.add,1)) + self.connect(self.input_node,self.hi_iir) + self.connect(self.hi_iir,(self.hi_square,0)) + self.connect(self.hi_iir,(self.hi_square,1)) + self.connect(self.hi_square,self.hi_smooth,(self.sub,1)) + self.connect(self.hi_smooth, (self.add,1)) - self.connect (self.sub, (self.div, 0)) - self.connect (self.add, (self.div, 1)) - self.connect (self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1)) - self.connect (self.squelch_mult, self) + self.connect(self.sub, (self.div, 0)) + self.connect(self.add, (self.div, 1)) + self.connect(self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1)) + self.connect(self.squelch_mult, self) def set_threshold(self, threshold): self.gate.set_hi(threshold) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py b/gr-analog/python/wfm_rcv.py index fe4fdd1a6a..addbb1d258 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py +++ b/gr-analog/python/wfm_rcv.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr +from gnuradio import gr, analog, filter from gnuradio.blks2impl.fm_emph import fm_deemph import math @@ -50,19 +50,19 @@ class wfm_rcv(gr.hier_block2): # if they need to. E.g., to plot its output. # # input: complex; output: float - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) + self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) # input: float; output: float - self.deemph = fm_deemph (audio_rate) + self.deemph = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + audio_rate/2 - width_of_transition_band, + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) self.connect (self, self.fm_demod, self.audio_filter, self.deemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py b/gr-analog/python/wfm_rcv_fmdet.py index 24c710a494..68c7a3a1d7 100755..100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py +++ b/gr-analog/python/wfm_rcv_fmdet.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006 Free Software Foundation, Inc. +# Copyright 2005,2006,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr +from gnuradio import gr, filter, analog from gnuradio.blks2impl.fm_emph import fm_deemph import math @@ -48,22 +48,22 @@ class wfm_rcv_fmdet(gr.hier_block2): # # input: complex; output: float - self.fm_demod = gr.fmdet_cf (demod_rate, lowfreq, highfreq, 0.05) + self.fm_demod = analog.fmdet_cf(demod_rate, lowfreq, highfreq, 0.05) # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) + self.deemph_Left = fm_deemph(audio_rate) + self.deemph_Right = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0 , # gain + demod_rate, # sampling rate + 15000 , + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) if 1: # Pick off the stereo carrier/2 with this filter. It # attenuated 10 dB so apply 10 dB gain We pick off the @@ -72,12 +72,13 @@ class wfm_rcv_fmdet(gr.hier_block2): ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO ## DEEMPHASIS - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_carrier_filter_coeffs = \ + filter.firdes.complex_band_pass(10.0, + demod_rate, + -19020, + -18980, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) #print "stereo carrier filter ", stereo_carrier_filter_coeffs @@ -87,37 +88,41 @@ class wfm_rcv_fmdet(gr.hier_block2): # Left-Right audio. It is attenuated 10 dB so apply 10 dB # gain - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_dsbsc_filter_coeffs = \ + filter.firdes.complex_band_pass(20.0, + demod_rate, + 38000-15000/2, + 38000+15000/2, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients # for stereo carrier - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, - stereo_carrier_filter_coeffs) + self.stereo_carrier_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_carrier_filter_coeffs) # carrier is twice the picked off carrier so arrange to do # a commplex multiply self.stereo_carrier_generator = gr.multiply_cc(); # Pick off the rds signal - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_rds_filter_coeffs = \ + filter.firdes.complex_band_pass(30.0, + demod_rate, + 57000 - 1500, + 57000 + 1500, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, - stereo_rds_filter_coeffs) + self.rds_signal_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_rds_filter_coeffs) self.rds_carrier_generator = gr.multiply_cc(); self.rds_signal_generator = gr.multiply_cc(); self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); @@ -125,9 +130,9 @@ class wfm_rcv_fmdet(gr.hier_block2): loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; min_freq = -2.0*math.pi*19010/audio_rate; - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, - max_freq, - min_freq); + self.stereo_carrier_pll_recovery = analog.pll_refout_cc(loop_bw, + max_freq, + min_freq); #self.stereo_carrier_pll_recovery.squelch_enable(False) ##pll_refout does not have squelch yet, so disabled for @@ -145,54 +150,55 @@ class wfm_rcv_fmdet(gr.hier_block2): self.Make_Left = gr.add_ff(); self.Make_Right = gr.sub_ff(); - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, - stereo_dsbsc_filter_coeffs) + self.stereo_dsbsc_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_dsbsc_filter_coeffs) if 1: # send the real signal to complex filter to pick off the # carrier and then to one side of a multiplier - self.connect (self, self.fm_demod, self.stereo_carrier_filter, - self.stereo_carrier_pll_recovery, - (self.stereo_carrier_generator,0)) + self.connect(self, self.fm_demod, self.stereo_carrier_filter, + self.stereo_carrier_pll_recovery, + (self.stereo_carrier_generator,0)) # send the already filtered carrier to the otherside of the carrier # the resulting signal from this multiplier is the carrier # with correct phase but at -38000 Hz. - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) + self.connect(self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) + self.connect(self.stereo_carrier_generator, (self.stereo_basebander,0)) # send the demphasized audio to the DSBSC pick off filter, the complex # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier # the result is BASEBANDED DSBSC with phase zero! - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) + self.connect(self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) # Pick off the real part since the imaginary is # theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) + self.connect(self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) #take the same real part of the DSBSC baseband signal and #send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) + self.connect(self.LmR_real,(self.Make_Right,1)) # Make rds carrier by taking the squared pilot tone and # multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) + self.connect(self.stereo_basebander,(self.rds_carrier_generator,0)) + self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) + self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) # take rds_carrier_generator output and send into mixer 1 # channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) + self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1)) # send basebanded rds signal and send into "processor" # which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) + self.connect(self.rds_signal_generator,self_rds_signal_processor) if 1: diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py b/gr-analog/python/wfm_rcv_pll.py index 0b8706bf27..953cd538f1 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py +++ b/gr-analog/python/wfm_rcv_pll.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006 Free Software Foundation, Inc. +# Copyright 2005,2006,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,12 +19,12 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr +from gnuradio import gr, filter, analog from gnuradio.blks2impl.fm_emph import fm_deemph import math class wfm_rcv_pll(gr.hier_block2): - def __init__ (self, demod_rate, audio_decimation): + def __init__(self, demod_rate, audio_decimation): """ Hierarchical block for demodulating a broadcast FM signal. @@ -48,32 +48,33 @@ class wfm_rcv_pll(gr.hier_block2): # input: complex; output: float loop_bw = 2*math.pi/100.0 max_freq = 2.0*math.pi*90e3/demod_rate - self.fm_demod = gr.pll_freqdet_cf (loop_bw, max_freq,-max_freq) + self.fm_demod = analog.pll_freqdet_cf(loop_bw, max_freq,-max_freq) # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) + self.deemph_Left = fm_deemph(audio_rate) + self.deemph_Right = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0 , # gain + demod_rate, # sampling rate + 15000 , + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) if 1: # Pick off the stereo carrier/2 with this filter. It attenuated 10 dB so apply 10 dB gain # We pick off the negative frequency half because we want to base band by it! ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO DEEMPHASIS - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_carrier_filter_coeffs = \ + filter.firdes.complex_band_pass(10.0, + demod_rate, + -19020, + -18980, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) #print "stereo carrier filter ", stereo_carrier_filter_coeffs @@ -81,17 +82,19 @@ class wfm_rcv_pll(gr.hier_block2): # Pick off the double side band suppressed carrier Left-Right audio. It is attenuated 10 dB so apply 10 dB gain - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_dsbsc_filter_coeffs = \ + filter.firdes.complex_band_pass(20.0, + demod_rate, + 38000-15000/2, + 38000+15000/2, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs) + self.stereo_carrier_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs) # carrier is twice the picked off carrier so arrange to do a commplex multiply @@ -99,37 +102,32 @@ class wfm_rcv_pll(gr.hier_block2): # Pick off the rds signal - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_rds_filter_coeffs = \ + filter.firdes.complex_band_pass(30.0, + demod_rate, + 57000 - 1500, + 57000 + 1500, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs) - - - - - + self.rds_signal_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs) self.rds_carrier_generator = gr.multiply_cc(); self.rds_signal_generator = gr.multiply_cc(); self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); - - loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; min_freq = -2.0*math.pi*19010/audio_rate; - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, max_freq, min_freq); + self.stereo_carrier_pll_recovery = \ + analog.pll_refout_cc(loop_bw, max_freq, min_freq); #self.stereo_carrier_pll_recovery.squelch_enable(False) #pll_refout does not have squelch yet, so disabled for now - # set up mixer (multiplier) to get the L-R signal at baseband self.stereo_basebander = gr.multiply_cc(); @@ -140,38 +138,39 @@ class wfm_rcv_pll(gr.hier_block2): self.Make_Left = gr.add_ff(); self.Make_Right = gr.sub_ff(); - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs) - + self.stereo_dsbsc_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs) if 1: # send the real signal to complex filter to pick off the carrier and then to one side of a multiplier - self.connect (self, self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0)) + self.connect(self, self.fm_demod, self.stereo_carrier_filter, + self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0)) # send the already filtered carrier to the otherside of the carrier - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) + self.connect(self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) # the resulting signal from this multiplier is the carrier with correct phase but at -38000 Hz. # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) + self.connect(self.stereo_carrier_generator, (self.stereo_basebander,0)) # send the demphasized audio to the DSBSC pick off filter, the complex # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) + self.connect(self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) # the result is BASEBANDED DSBSC with phase zero! # Pick off the real part since the imaginary is theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) + self.connect(self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) #take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) + self.connect(self.LmR_real,(self.Make_Right,1)) # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) + self.connect(self.stereo_basebander,(self.rds_carrier_generator,0)) + self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) + self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) # take rds_carrier_generator output and send into mixer 1 channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) + self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1)) # send basebanded rds signal and send into "processor" which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) + self.connect(self.rds_signal_generator,self_rds_signal_processor) if 1: diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py b/gr-analog/python/wfm_tx.py index e7547d6524..4c074b5317 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py +++ b/gr-analog/python/wfm_tx.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,8 +20,10 @@ # import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_preemph +from gnuradio import gr +from gnuradio import filter +from gnuradio import analog +from fm_emph import fm_preemph class wfm_tx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3): @@ -55,22 +57,22 @@ class wfm_tx(gr.hier_block2): if do_interp: interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 16000, # passband cutoff - 18000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB + interp_taps = filter.optfir.low_pass(interp_factor, # gain + quad_rate, # Fs + 16000, # passband cutoff + 18000, # stopband cutoff + 0.1, # passband ripple dB + 40) # stopband atten dB print "len(interp_taps) =", len(interp_taps) - self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps) + self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps) - self.preemph = fm_preemph (quad_rate, tau=tau) + self.preemph = fm_preemph(quad_rate, tau=tau) k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) + self.modulator = analog.frequency_modulator_fc (k) if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) + self.connect(self, self.interpolator, self.preemph, self.modulator, self) else: self.connect(self, self.preemph, self.modulator, self) diff --git a/gr-atsc/CMakeLists.txt b/gr-atsc/CMakeLists.txt index 3cb9b39de8..c9a033fc1a 100644 --- a/gr-atsc/CMakeLists.txt +++ b/gr-atsc/CMakeLists.txt @@ -31,6 +31,7 @@ GR_REGISTER_COMPONENT("gr-atsc" ENABLE_GR_ATSC ENABLE_GR_CORE ENABLE_GR_FFT ENABLE_GR_FILTER + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_ATSC_INCLUDE_DIRS diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt index 386a8792db..6fc588b8a3 100644 --- a/gr-atsc/src/lib/CMakeLists.txt +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011-212 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} ${GR_ATSC_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) @@ -97,6 +98,7 @@ list(APPEND gr_atsc_sources list(APPEND atsc_libs gnuradio-filter + gnuradio-analog gnuradio-core ${Boost_LIBRARIES} ) diff --git a/gr-atsc/src/lib/atsc_fpll.h b/gr-atsc/src/lib/atsc_fpll.h index 0474b8f766..13099b045d 100644 --- a/gr-atsc/src/lib/atsc_fpll.h +++ b/gr-atsc/src/lib/atsc_fpll.h @@ -25,11 +25,13 @@ #include <atsc_api.h> #include <gr_sync_block.h> #include <gr_nco.h> -#include <gr_single_pole_iir.h> -#include <gri_agc_ff.h> +#include <filter/single_pole_iir.h> +#include <analog/agc.h> #include <stdio.h> #include <atsci_diag_output.h> +using namespace gr; + class atsc_fpll; typedef boost::shared_ptr<atsc_fpll> atsc_fpll_sptr; @@ -68,9 +70,9 @@ public: double initial_phase; bool debug_no_update; gr_nco<float,float> nco; - gri_agc_ff agc; // automatic gain control - gr_single_pole_iir<float,float,float> afci; - gr_single_pole_iir<float,float,float> afcq; + analog::kernel::agc_ff agc; // automatic gain control + filter::single_pole_iir<float,float,float> afci; + filter::single_pole_iir<float,float,float> afcq; }; diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index fdb5acd819..4ea656e29c 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -73,6 +73,8 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-digital/swig ${CMAKE_BINARY_DIR}/gr-filter/python ${CMAKE_BINARY_DIR}/gr-filter/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-digital) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index 855249dc63..b71118ebcb 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -36,6 +36,11 @@ try: except ImportError: import filter_swig as filter +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + # default values (used in __init__ and add_options) _def_samples_per_symbol = 2 _def_excess_bw = 0.35 @@ -264,7 +269,7 @@ class generic_demod(gr.hier_block2): ntaps = 11 * int(self._samples_per_symbol*nfilts) # Automatic gain control - self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + self.agc = analog.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) # Frequency correction fll_ntaps = 55 diff --git a/gr-uhd/apps/hf_explorer/hfx.py b/gr-uhd/apps/hf_explorer/hfx.py index 1f08bd8ba6..8033273d06 100755 --- a/gr-uhd/apps/hf_explorer/hfx.py +++ b/gr-uhd/apps/hf_explorer/hfx.py @@ -81,6 +81,8 @@ import os, wx, sys, math import wx.lib.evtmgr as em from gnuradio.wxgui import powermate, fftsink2 from gnuradio import gr, audio, eng_notation +from gnuradio import analog +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio import uhd from optparse import OptionParser @@ -272,23 +274,23 @@ class MyFrame(wx.Frame): self.tb.connect (self.src, radio_file) # 2nd DDC - xlate_taps = gr.firdes.low_pass ( \ - 1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) - self.xlate = gr.freq_xlating_fir_filter_ccf ( \ + xlate_taps = filter.firdes.low_pass ( \ + 1.0, input_rate, 16e3, 4e3, filter.firdes.WIN_HAMMING ) + self.xlate = filter.freq_xlating_fir_filter_ccf ( \ fir_decim, xlate_taps, self.tune_offset, input_rate ) # Complex Audio filter - audio_coeffs = gr.firdes.complex_band_pass ( + audio_coeffs = filter.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate -3000, # low cutoff 0, # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window self.slider_fcutoff_hi.SetValue(0) self.slider_fcutoff_lo.SetValue(-3000) - self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs) + self.audio_filter = filter.fir_filter_ccc(1, audio_coeffs) # Main +/- 16Khz spectrum display self.fft = fftsink2.fft_sink_c(self.panel_2, fft_size=512, @@ -307,10 +309,10 @@ class MyFrame(wx.Frame): # AM branch self.sel_am = gr.multiply_const_cc(0) # the following frequencies turn out to be in radians/sample - # gr.pll_refout_cc(alpha,beta,min_freq,max_freq) + # analog.pll_refout_cc(alpha,beta,min_freq,max_freq) # suggested alpha = X, beta = .25 * X * X - pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), - (2.*math.pi*6.5e3/self.af_sample_rate)) + pll = analog.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), + (2.*math.pi*6.5e3/self.af_sample_rate)) self.pll_carrier_scale = gr.multiply_const_cc(complex(10,0)) am_det = gr.multiply_cc() # these are for converting +7.5kHz to -7.5kHz @@ -322,15 +324,15 @@ class MyFrame(wx.Frame): phaser2 = gr.multiply_const_ff(-1) # filter for pll generated carrier - pll_carrier_coeffs = gr.firdes.complex_band_pass ( + pll_carrier_coeffs = filter.firdes.complex_band_pass ( 2.0, # gain self.af_sample_rate, # sample rate 7400, # low cutoff 7600, # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window - self.pll_carrier_filter = gr.fir_filter_ccc (1, pll_carrier_coeffs) + self.pll_carrier_filter = filter.fir_filter_ccc (1, pll_carrier_coeffs) self.sel_sb = gr.multiply_const_ff(1) combine = gr.add_ff() @@ -610,13 +612,13 @@ class MyFrame(wx.Frame): # Calculate taps and apply def filter(self): - audio_coeffs = gr.firdes.complex_band_pass ( + audio_coeffs = filter.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate self.slider_fcutoff_lo.GetValue(), # low cutoff self.slider_fcutoff_hi.GetValue(), # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window self.audio_filter.set_taps(audio_coeffs) def set_lsb(self, event): diff --git a/gr-uhd/apps/uhd_rx_nogui b/gr-uhd/apps/uhd_rx_nogui index 9977f55a3c..cb6238353e 100755 --- a/gr-uhd/apps/uhd_rx_nogui +++ b/gr-uhd/apps/uhd_rx_nogui @@ -21,6 +21,7 @@ # from gnuradio import gr, gru, uhd, optfir, audio, blks2 +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -159,10 +160,10 @@ class app_top_block(gr.top_block): int(channel_rate/20), # 50ms rise/fall False) # Zero, not gate output - AGC = gr.agc_cc(1.0/channel_rate, # Time constant - 1.0, # Reference power - 1.0, # Initial gain - 1.0) # Maximum gain + AGC = analog.agc_cc(1.0/channel_rate, # Time constant + 1.0, # Reference power + 1.0, # Initial gain + 1.0) # Maximum gain DEMOD = demod(channel_rate, audio_decim) diff --git a/gr-uhd/examples/python/usrp_am_mw_rcv.py b/gr-uhd/examples/python/usrp_am_mw_rcv.py index 40a7fee68d..6965ef5af9 100755 --- a/gr-uhd/examples/python/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/python/usrp_am_mw_rcv.py @@ -21,6 +21,7 @@ # from gnuradio import gr, eng_notation, optfir +from gnuradio import analog from gnuradio import audio from gnuradio import uhd from gnuradio import blks2 @@ -113,7 +114,7 @@ class wfm_rx_block (stdgui2.std_top_block): else: self.chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs) - self.agc = gr.agc_cc(0.1, 1, 1, 100000) + self.agc = analog.agc_cc(0.1, 1, 1, 100000) self.am_demod = gr.complex_to_mag() self.volume_control = gr.multiply_const_ff(self.vol) diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py index b42cf57992..794fec4e1f 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ b/gr-uhd/examples/python/usrp_tv_rcv.py @@ -47,6 +47,7 @@ except: print "FYI: gr-video-sdl is not installed" print "realtime SDL video output window will not be available" from gnuradio import uhd +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -194,7 +195,7 @@ class tv_rx_block (stdgui2.std_top_block): file_sink=gr.file_sink(gr.sizeof_char, options.out_filename) self.dst =file_sink - self.agc=gr.agc_cc(1e-7,1.0,1.0) #1e-7 + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () self.set_blacklevel=gr.add_const_ff(0.0) self.invert_and_scale = gr.multiply_const_ff (0.0) #-self.contrast *128.0*255.0/(200.0) diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py index cfb36222cb..54275bb037 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py @@ -35,6 +35,7 @@ development but not yet in cvs. """ from gnuradio import gr, eng_notation +from gnuradio import analog from gnuradio import audio from gnuradio import uhd from gnuradio.eng_option import eng_option @@ -158,7 +159,7 @@ class my_top_block(gr.top_block): raise SystemExit, 1 - self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () self.set_blacklevel = gr.add_const_ff(options.brightness +255.0) self.invert_and_scale = gr.multiply_const_ff (-options.contrast *128.0*255.0/(200.0)) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 31298a2288..9feeaf1190 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -123,10 +123,6 @@ <block>gr_mpsk_sync_cc</block> - <block>gr_pll_carriertracking_cc</block> - <block>gr_pll_freqdet_cf</block> - <block>gr_pll_refout_cc</block> - <block>gr_simple_correlator</block> <block>blks2_packet_decoder</block> @@ -134,15 +130,10 @@ </cat> <cat> <name>Level Controls</name> - <block>gr_dpll_bb</block> <block>gr_peak_detector_xb</block> <block>gr_peak_detector2_fb</block> <block>gr_sample_and_hold_xx</block> - <block>gr_agc_xx</block> - <block>gr_agc2_xx</block> - <block>gr_feedforward_agc_cc</block> - <block>gr_mute_xx</block> <block>gr_simple_squelch_cc</block> <block>blks2_standard_squelch</block> diff --git a/grc/blocks/gr_agc2_xx.xml b/grc/blocks/gr_agc2_xx.xml deleted file mode 100644 index 55b20d4e82..0000000000 --- a/grc/blocks/gr_agc2_xx.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##AGC2 -################################################### - --> -<block> - <name>AGC2</name> - <key>gr_agc2_xx</key> - <import>from gnuradio import gr</import> - <make>gr.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make> - <callback>set_attack_rate($attack_rate)</callback> - <callback>set_decay_rate($decay_rate)</callback> - <callback>set_reference($reference)</callback> - <callback>set_gain($gain)</callback> - <callback>set_max_gain($max_gain)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Attack Rate</name> - <key>attack_rate</key> - <value>1e-1</value> - <type>real</type> - </param> - <param> - <name>Decay Rate</name> - <key>decay_rate</key> - <value>1e-2</value> - <type>real</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Max Gain</name> - <key>max_gain</key> - <value>0.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/grc/blocks/gr_agc_xx.xml b/grc/blocks/gr_agc_xx.xml deleted file mode 100644 index c87d239edd..0000000000 --- a/grc/blocks/gr_agc_xx.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##AGC -################################################### - --> -<block> - <name>AGC</name> - <key>gr_agc_xx</key> - <import>from gnuradio import gr</import> - <make>gr.agc_$(type.fcn)($rate, $reference, $gain, $max_gain)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Rate</name> - <key>rate</key> - <value>1e-4</value> - <type>real</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Max Gain</name> - <key>max_gain</key> - <value>0.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/grc/blocks/gr_dpll_bb.xml b/grc/blocks/gr_dpll_bb.xml deleted file mode 100644 index 044d398ff1..0000000000 --- a/grc/blocks/gr_dpll_bb.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Detect Peak -################################################### - --> -<block> - <name>Detect Peak</name> - <key>gr_dpll_bb</key> - <import>from gnuradio import gr</import> - <make>gr.dpll_bb($period, $gain)</make> - <param> - <name>Period</name> - <key>period</key> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_pll_carriertracking_cc.xml b/grc/blocks/gr_pll_carriertracking_cc.xml deleted file mode 100644 index 27e6732482..0000000000 --- a/grc/blocks/gr_pll_carriertracking_cc.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Carrier Tracking -################################################### - --> -<block> - <name>PLL Carrier Tracking</name> - <key>gr_pll_carriertracking_cc</key> - <import>from gnuradio import gr</import> - <make>gr.pll_carriertracking_cc($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/grc/blocks/gr_pll_freqdet_cf.xml b/grc/blocks/gr_pll_freqdet_cf.xml deleted file mode 100644 index d6e4694f00..0000000000 --- a/grc/blocks/gr_pll_freqdet_cf.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Frequency Det -################################################### - --> -<block> - <name>PLL Freq Det</name> - <key>gr_pll_freqdet_cf</key> - <import>from gnuradio import gr</import> - <make>gr.pll_freqdet_cf($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/grc/blocks/gr_pll_refout_cc.xml b/grc/blocks/gr_pll_refout_cc.xml deleted file mode 100644 index b231ddd19a..0000000000 --- a/grc/blocks/gr_pll_refout_cc.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Reference Out -################################################### - --> -<block> - <name>PLL Ref Out</name> - <key>gr_pll_refout_cc</key> - <import>from gnuradio import gr</import> - <make>gr.pll_refout_cc($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> |