blob: 4637149f43d5ad76b480488e5b22369b38fa32d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "mm_f.h"
mm_f::mm_f(float omega):
d_omega(omega),
d_mu(0.5),
d_x_1(0.0),
d_a_1(0.0),
d_gain_mu(0.01),
d_gain_omega(0.25 * d_gain_mu * d_gain_mu)
{}
float mm_f::slicer(float x)
{
return x < 0 ? -1.0 : 1.0;
}
float mm_f::update(float x_0, float a_0)
{
d_mm = (d_a_1 * x_0) - (a_0 * d_x_1);
//limit d_mm
if (d_mm > 1.0) d_mm = 1.0;
else if (d_mm < -1.0) d_mm = -1.0;
//error feedback
d_omega = d_omega + d_gain_omega * d_mm;
//limit omega
/*
if (d_omega > d_max_omega)
d_omega = d_max_omega;
else if (d_omega < d_min_omega)
d_omega = d_min_omega;
*/
//update mu
d_mu = d_mu + d_omega + d_gain_mu * d_mm;
//process mu / ii advances after burst processing for burst timing
//update delay taps
d_x_1 = x_0;
d_a_1 = a_0;
return d_mu;
}
float mm_f::update(float x_0)
{
return update(x_0, slicer(x_0) );
}
|