GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
peak_detector2_fb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2013,2015 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 estimated mean described below.
40  */
41  class BLOCKS_API peak_detector2_fb : virtual public sync_block
42  {
43  public:
44  // gr::blocks::peak_detector2_fb::sptr
45  typedef boost::shared_ptr<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 determines
51  * when a peak is present. An average of the input signal
52  * is calculated (through a single-pole autoregressive
53  * filter) and when the value of the input signal goes
54  * over threshold_factor_rise*average, we assume we are
55  * in the neighborhood of a peak. The block will then
56  * find the position of the maximum within a window of
57  * look_ahead samples starting at the point where the
58  * threshold was crossed upwards.
59  * \param look_ahead The look-ahead value is used when the
60  * threshold is crossed upwards to locate the peak within
61  * this range.
62  * \param alpha One minus the pole of a single-pole
63  * autoregressive filter that evaluates the average of
64  * the input signal.
65  */
66  static sptr make(float threshold_factor_rise=7,
67  int look_ahead=1000, float alpha=0.001);
68 
69  /*! \brief Set the threshold factor value for the rise time
70  * \param thr new threshold factor
71  */
72  virtual void set_threshold_factor_rise(float thr) = 0;
73 
74  /*! \brief Set the look-ahead factor
75  * \param look new look-ahead factor
76  */
77  virtual void set_look_ahead(int look) = 0;
78 
79  /*! \brief Set the running average alpha
80  * \param alpha new alpha for running average
81  */
82  virtual void set_alpha(float alpha) = 0;
83 
84  /*! \brief Get the threshold factor value for the rise time
85  * \return threshold factor
86  */
87  virtual float threshold_factor_rise() = 0;
88 
89  /*! \brief Get the look-ahead factor value
90  * \return look-ahead factor
91  */
92  virtual int look_ahead() = 0;
93 
94  /*! \brief Get the alpha value of the running average
95  * \return alpha
96  */
97  virtual float alpha() = 0;
98  };
99 
100  } /* namespace blocks */
101 } /* namespace gr */
102 
103 #endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
Detect the peak of a signal.
Definition: peak_detector2_fb.h:41
boost::shared_ptr< peak_detector2_fb > sptr
Definition: peak_detector2_fb.h:45
Include this header to use the message passing features.
Definition: logger.h:131
#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