GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
ber_bf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013-2014 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_FEC_BER_BF_H
12 #define INCLUDED_FEC_BER_BF_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/fec/api.h>
16 
17 namespace gr {
18 namespace fec {
19 
20 /*!
21  * \brief BER block in FECAPI
22  * \ingroup error_coding_blk
23  *
24  * \details
25  *
26  * This block measures the bit error rate between two streams of
27  * packed data. It compares the bits of each streams and counts
28  * the number of incorrect bits between them. It outputs the log
29  * of the bit error rate, so a value of -X is 10^{-X} bit errors.
30  *
31  * When the \p mode is set to false (default), it is in streaming
32  * mode. This means that the output is constantly producing the
33  * current value of the BER. In this mode, there is a single
34  * output BER calculation per chunk of bytes passed to it, so
35  * there is no exact timing between calculations of BER. In this
36  * mode, the other two parameters to the constructor are ignored.
37  *
38  * When \p mode is true, the block is in test mode. This mode is
39  * used in the ber_curve_gen example and for other offline
40  * analysis of BER curves. Here, the block waits until at least \p
41  * berminerrors are observed and then produces a BER
42  * calculation. The parameter \p ber_limit helps make sure that
43  * the simulation is controlled. If the BER calculation drops
44  * below the \p ber_limit setting, the block will exit and simply
45  * return the set limit; the real BER is therefore some amount
46  * lower than this.
47  *
48  * Note that this block takes in data as packed bytes with 8-bits
49  * per byte used. It outputs a stream of floats as the log-scale BER.
50  */
51 class FEC_API ber_bf : virtual public block
52 {
53 public:
54  // gr::fec::ber_bf::sptr
55  typedef std::shared_ptr<ber_bf> sptr;
56 
57  /*!
58  * Get total number of errors counter value.
59  */
60  virtual long total_errors() = 0;
61 
62  /*!
63  * Calculate the BER between two streams of data.
64  *
65  * \param test_mode false for normal streaming mode (default);
66  * true for test mode.
67  * \param berminerrors the block needs to observe this many
68  * errors before outputting a result. Only valid when
69  * test_mode=true.
70  * \param ber_limit if the BER calculation falls below this
71  * limit, produce this value and exit. Only valid when
72  * test_mode=true.
73  */
74  static sptr
75  make(bool test_mode = false, int berminerrors = 100, float ber_limit = -7.0);
76 };
77 
78 } /* namespace fec */
79 } /* namespace gr */
80 
81 #endif /* INCLUDED_FEC_BER_BF_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
BER block in FECAPI.
Definition: ber_bf.h:52
static sptr make(bool test_mode=false, int berminerrors=100, float ber_limit=-7.0)
std::shared_ptr< ber_bf > sptr
Definition: ber_bf.h:55
virtual long total_errors()=0
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29