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