GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
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 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H
12#define INCLUDED_GR_PEAK_DETECTOR2_FB_H
13
14#include <gnuradio/blocks/api.h>
15#include <gnuradio/sync_block.h>
16
17namespace gr {
18namespace blocks {
19
20/*!
21 * \brief Detect the peak of a signal
22 * \ingroup peak_detectors_blk
23 *
24 * \details
25 * If a peak is detected, this block outputs a 1, or it outputs
26 * 0's. A separate debug output may be connected, to view the
27 * internal estimated mean described below.
28 */
30{
31public:
32 // gr::blocks::peak_detector2_fb::sptr
33 typedef std::shared_ptr<peak_detector2_fb> sptr;
34
35 /*!
36 * Build a peak detector block with float in, byte out.
37 *
38 * \param threshold_factor_rise The threshold factor determines
39 * when a peak is present. An average of the input signal
40 * is calculated (through a single-pole autoregressive
41 * filter) and when the value of the input signal goes
42 * over threshold_factor_rise*average, we assume we are
43 * in the neighborhood of a peak. The block will then
44 * find the position of the maximum within a window of
45 * look_ahead samples starting at the point where the
46 * threshold was crossed upwards.
47 * \param look_ahead The look-ahead value is used when the
48 * threshold is crossed upwards to locate the peak within
49 * this range.
50 * \param alpha One minus the pole of a single-pole
51 * autoregressive filter that evaluates the average of
52 * the input signal.
53 */
54 static sptr
55 make(float threshold_factor_rise = 7, int look_ahead = 1000, float alpha = 0.001);
56
57 /*! \brief Set the threshold factor value for the rise time
58 * \param thr new threshold factor
59 */
60 virtual void set_threshold_factor_rise(float thr) = 0;
61
62 /*! \brief Set the look-ahead factor
63 * \param look new look-ahead factor
64 */
65 virtual void set_look_ahead(int look) = 0;
66
67 /*! \brief Set the running average alpha
68 * \param alpha new alpha for running average
69 */
70 virtual void set_alpha(float alpha) = 0;
71
72 /*! \brief Get the threshold factor value for the rise time
73 * \return threshold factor
74 */
75 virtual float threshold_factor_rise() = 0;
76
77 /*! \brief Get the look-ahead factor value
78 * \return look-ahead factor
79 */
80 virtual int look_ahead() = 0;
81
82 /*! \brief Get the alpha value of the running average
83 * \return alpha
84 */
85 virtual float alpha() = 0;
86};
87
88} /* namespace blocks */
89} /* namespace gr */
90
91#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
Detect the peak of a signal.
Definition: peak_detector2_fb.h:30
virtual void set_look_ahead(int look)=0
Set the look-ahead factor.
static sptr make(float threshold_factor_rise=7, int look_ahead=1000, float alpha=0.001)
virtual float threshold_factor_rise()=0
Get the threshold factor value for the rise time.
virtual void set_alpha(float alpha)=0
Set the running average alpha.
virtual float alpha()=0
Get the alpha value of the running average.
virtual int look_ahead()=0
Get the look-ahead factor value.
virtual void set_threshold_factor_rise(float thr)=0
Set the threshold factor value for the rise time.
std::shared_ptr< peak_detector2_fb > sptr
Definition: peak_detector2_fb.h:33
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29