GNU Radio 3.6.5.1 C++ API
gr-analog/include/analog/plateau_detector_fb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 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 
24 #ifndef INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H
25 #define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H
26 
27 #include <analog/api.h>
28 #include <gr_sync_block.h>
29 
30 namespace gr {
31  namespace analog {
32 
33  /*!
34  * \brief Detects a plateau and marks the middle.
35  *
36  * \details
37  * Detect a plateau of a-priori known height. Input is a stream of floats,
38  * the output is a stream of bytes. Whenever a plateau is detected, the
39  * middle of that plateau is marked with a '1' on the output stream (all
40  * other samples are left at zero).
41  *
42  * You can use this in a Schmidl & Cox synchronisation algorithm to interpret
43  * the output of the normalized correlator. Just pass the length of the cyclic
44  * prefix (in samples) as the max_len parameter).
45  *
46  * Unlike the peak detectors, you must the now the absolute height of the plateau.
47  * Whenever the amplitude exceeds the given threshold, it starts assuming the
48  * presence of a plateau.
49  *
50  * An implicit hysteresis is provided by the fact that after detecting one plateau,
51  * it waits at least max_len samples before the next plateau can be detected.
52  */
54  {
55  public:
57 
58  /*!
59  * \param max_len Maximum length of the plateau
60  * \param threshold Anything above this value is considered a plateau
61  */
62  static sptr make(int max_len, float threshold=0.9);
63  };
64 
65  } // namespace analog
66 } // namespace gr
67 
68 #endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H */
69