GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
peak_detector2_fb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H
24 #define INCLUDED_GR_PEAK_DETECTOR2_FB_H
25 
26 #include <gnuradio/blocks/api.h>
27 #include <gnuradio/sync_block.h>
28 
29 namespace gr {
30  namespace blocks {
31 
32  /*!
33  * \brief Detect the peak of a signal
34  * \ingroup peak_detectors_blk
35  *
36  * \details
37  * If a peak is detected, this block outputs a 1, or it outputs
38  * 0's. A separate debug output may be connected, to view the
39  * internal EWMA described below.
40  */
41  class BLOCKS_API peak_detector2_fb : virtual public sync_block
42  {
43  public:
44  // gr::blocks::peak_detector2_fb::sptr
46 
47  /*!
48  * Build a peak detector block with float in, byte out.
49  *
50  * \param threshold_factor_rise The threshold factor determins
51  * when a peak is present. An EWMA average of the signal is
52  * calculated and when the value of the signal goes over
53  * threshold_factor_rise*average, we call the peak.
54  * \param look_ahead The look-ahead value is used when the
55  * threshold is found to locate the peak within this range.
56  * \param alpha The gain value of a single-pole moving average filter.
57  */
58  static sptr make(float threshold_factor_rise=7,
59  int look_ahead=1000, float alpha=0.001);
60 
61  /*! \brief Set the threshold factor value for the rise time
62  * \param thr new threshold factor
63  */
64  virtual void set_threshold_factor_rise(float thr) = 0;
65 
66  /*! \brief Set the look-ahead factor
67  * \param look new look-ahead factor
68  */
69  virtual void set_look_ahead(int look) = 0;
70 
71  /*! \brief Set the running average alpha
72  * \param alpha new alpha for running average
73  */
74  virtual void set_alpha(int alpha) = 0;
75 
76  /*! \brief Get the threshold factor value for the rise time
77  * \return threshold factor
78  */
79  virtual float threshold_factor_rise() = 0;
80 
81  /*! \brief Get the look-ahead factor value
82  * \return look-ahead factor
83  */
84  virtual int look_ahead() = 0;
85 
86  /*! \brief Get the alpha value of the running average
87  * \return alpha
88  */
89  virtual float alpha() = 0;
90  };
91 
92  } /* namespace blocks */
93 } /* namespace gr */
94 
95 #endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
Detect the peak of a signal.
Definition: peak_detector2_fb.h:41
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
boost::shared_ptr< peak_detector2_fb > sptr
Definition: peak_detector2_fb.h:45
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37