GNU Radio C++ API
digital_cma_equalizer_cc.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2011 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_DIGITAL_CMA_EQUALIZER_CC_H
24
#define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H
25
26
#include <
digital_api.h
>
27
#include <
gr_adaptive_fir_ccc.h
>
28
#include <
gr_math.h
>
29
#include <iostream>
30
31
class
digital_cma_equalizer_cc
;
32
typedef
boost::shared_ptr<digital_cma_equalizer_cc>
digital_cma_equalizer_cc_sptr
;
33
34
DIGITAL_API
digital_cma_equalizer_cc_sptr
35
digital_make_cma_equalizer_cc
(
int
num_taps,
float
modulus,
float
mu,
int
sps);
36
37
/*!
38
* \brief Implements constant modulus adaptive filter on complex stream
39
* \ingroup eq_blk
40
* \ingroup digital
41
*
42
* The error value and tap update equations (for p=2) can be found in:
43
*
44
* D. Godard, "Self-Recovering Equalization and Carrier Tracking in
45
* Two-Dimensional Data Communication Systems," IEEE Transactions on
46
* Communications, Vol. 28, No. 11, pp. 1867 - 1875, 1980,
47
*/
48
class
DIGITAL_API
digital_cma_equalizer_cc
:
public
gr_adaptive_fir_ccc
49
{
50
private
:
51
float
d_modulus;
52
float
d_mu;
53
54
friend
DIGITAL_API
digital_cma_equalizer_cc_sptr
digital_make_cma_equalizer_cc
(
int
num_taps,
55
float
modulus,
56
float
mu,
57
int
sps);
58
digital_cma_equalizer_cc
(
int
num_taps,
float
modulus,
float
mu,
int
sps);
59
60
protected
:
61
62
virtual
gr_complex
error
(
const
gr_complex
&out)
63
{
64
gr_complex
error = out*(norm(out) - d_modulus);
65
float
re =
gr_clip
(error.real(), 1.0);
66
float
im =
gr_clip
(error.imag(), 1.0);
67
return
gr_complex
(re, im);
68
}
69
70
virtual
void
update_tap
(
gr_complex
&tap,
const
gr_complex
&in)
71
{
72
// Hn+1 = Hn - mu*conj(Xn)*zn*(|zn|^2 - 1)
73
tap -= d_mu*conj(in)*
d_error
;
74
}
75
76
public
:
77
float
get_gain
()
78
{
79
return
d_mu;
80
}
81
82
void
set_gain
(
float
mu)
83
{
84
if
(mu < 0.0f || mu > 1.0f) {
85
throw
std::out_of_range(
"digital_cma_equalizer::set_gain: Gain value must be in [0,1]"
);
86
}
87
d_mu = mu;
88
}
89
90
float
get_modulus
()
91
{
92
return
d_modulus;
93
}
94
95
void
set_modulus
(
float
mod)
96
{
97
if
(mod < 0)
98
throw
std::out_of_range(
"digital_cma_equalizer::set_modulus: Modulus value must be >= 0"
);
99
d_modulus = mod;
100
}
101
};
102
103
#endif
gr-digital
include
digital_cma_equalizer_cc.h
Generated on Mon Jul 8 2013 15:25:00 for GNU Radio C++ API by
1.8.4