Realization of AeroMACS
demodulator functions
4.1 Synchronization algorithms
In this section we are going to illustrate the synchronization algorithms employed in the physical layer of AeroMACS. We concentrate only on the forward link, that is from BS to MS, while complete information on both forward and reverse link can be found in [3].
In the forward link, each MS receives the broadcast signal transmitted by the BS and performs the following operations:
1. it checks whether a training symbol is present or not in the received sample stream;
2. after the training symbol has been detected, it computes a timing estimation to identify the beginning of the DL subframe;
3. it computes an estimation of the fractional carrier frequency offset (FCFO);
4. it estimates the integer carrier frequency offset (ICFO) and identifies the BS on the basis of the transmitted training symbol;
5. it performs channel estimation and equalization.
In the next subsections we are going to discuss in details these operations.
4.1.1 Training symbol detection
The first task that the MS must accomplish during the forward link synchronization phase is the detection of the training symbol within the stream of received samples. As specified in subsection on page 32, the training symbol is placed at the beginning of each DL subframe (training preamble) and contains N = 512 subcarriers with indices n = 0, 1, . . . , N − 1 . Out of all available 512 subcarriers, only a subset of 143 subcarriers are actually modulated by a BPSK pseudonoise (PN) sequence, which is selected among 114 possible choices and univocally identifies the transmitting BS. The modulated subcarriers are separated by a couple of unmodulated (null) subcarriers and there are 42 left and 41 right guard subcarriers. The indices of the modulated subcarriers during the DL subframe preamble are given by
i
m=
η
0+ 3m
N− 71 ≤ m ≤ 71 (4.1)
where η
0∈ {0, 1, 2} is an unknown parameter that designates the preamble carrier-set for
identification of the cell sector, while the notation |n|
Ndenotes the modulo-n operation
reducing n to the interval [0, N − 1].
In our software realization we defined all the possible preambles in the una tantum, as elements of the string array wimaxset1 in exadecimal format as follows:
704
string wimaxset1[114];
705
wimaxset1[0]="66C9CB4D1C8F31D60F5795886EE02FFF6BE4";
706
wimaxset1[1]="D8C30DA58B5ED71056C5D79032B80E05522C";
707
wimaxset1[2]="8EB62664E3B2C5222DE18E9000561F25AAFC";
708
wimaxset1[3]="3B32299087C257CD31C67E4AA5DD697B0E08";
Then we converted the above sequences in a binary format and stored them in the auxiliary string set_bin ; finally we mapped 0 and 1 bits into binary symbols ±1 and set the DC frequency to zero:
742
string set_bin;
743
for(unsigned short int i=0; i<114; i++)
744
{
745
set_bin.clear();
746
for(unsigned int j=0; j<wimaxset1[i].length(); j++)
747
{
748
if(wimaxset1[i][j]<0x41) esa_out=wimaxset1[i][j]−0x30;
749
else esa_out=wimaxset1[i][j] −0x37;
750
set_bin+=(esa_out&0x08)>>3;
751
set_bin+=(esa_out&0x04)>>2;
752
set_bin+=(esa_out&0x02)>>1;
753
set_bin+=esa_out&0x01;
754
}
755
for(unsigned int pre_carrier=0; pre_carrier<pre_index; pre_carrier++)
756
preamble_sym[i][wimaxset2[i][1]+3∗pre_carrier+virt_pre_sx]=
757
(float)(2∗sqrt(2))∗mapperB[(int)set_bin[pre_carrier]];
758
preamble_sym[i][continua]=0;
759
}
where preamble_sym contains the modulated preamble symbols and wimaxset2 is a two- dimensional vector containing the cell IDs in position 0 and preamble carrier sets η
0in position 1, relating to the index 0, 1, . . . , 113 according to the order specified in the standard:
735
for(unsigned short int i=0; i<96; i++){
736
wimaxset2[i][0]=i%32;
737
wimaxset2[i][1]=floor(i/32);}
738
for(unsigned short int i=96; i<114; i++){
739
wimaxset2[i][0]=i%32;
740
wimaxset2[i][1]=i%3;}
The training preamble is preceded by a CP containing N
g= 64 samples. The complex envelope of the transmitted signal is thus given by
s
p(t) = A
√ N
71
X
m=−71
a
p(m)e
j2π(η0+3m)t/Tu− T
g≤ t ≤ T
u(4.2)
where T
uis the OFDM symbol duration with guard interval, a
p= [a
p(−71), a
p(−70) . . . a
p(71)]
is the sequence of pilot symbols belonging to the p
thpreamble (with p = 0, 1, . . . , 113 and a
p(m) = ±1), while A = 2 √
2 accounts for the power boosting applied to the pilot tones. It is worth observing that, as mentioned before, the preamble index p univocally determines the integer η
0.
The samples of s
p(t) taken at the instants t
k= kT
u/N take the form
s
p(k) = A
√ N
71
X
m=−71
a
p(m)e
j2πk(η0+3m)/N− N
g≤ k ≤ N − 1 (4.3)
Equation (4.2) indicates that s
p(t) is the product of a periodic signal with period T
u/3 multiplied by a complex exponential e
j2πη0t/Tu. Unfortunately, such periodicity does not hold true for the corresponding samples s
p(k) since N is not a multiple of three. However, we expect that samples corresponding to the training preamble taken at a distance of N
c= ⌊N/3⌋ = 170 are highly correlated.
We denote by f
∆the CFO normalized by the subcarrier spacing. The samples received at the MS and corresponding to the training preamble are thus given by
r(k) = A
√ N e
j2π(f∆−η0)k/N71
X
m=−71
a
p(m)H(i
m)e
j6πmk/N+ w(k) (4.4)
with i
mbeing defined as in Equation (4.1). The quantities w(k) account for thermal noise
and are modeled as statistically independent and complex-valued Gaussian random variables
with zero-mean and variance σ
w2, while H(i
m) is the channel frequency response over the n
thsubcarrier. Denoting by h = [h(0), h(1), . . . , h(L − 1)] the channel impulse response (CIR),
we have
H(n) =
L−1
X
l=0
h(l)e
j2πnl/N0 ≤ n ≤ N − 1 (4.5)
where the energy of h is normalized such that E n H(n)
2
o
= 1.
To proceed further, we define the N
c-lag correlation of r(k) as
R
r(N
c) = E n
r(k + N
c)r
∗(k) o
(4.6)
Then, substituting Equation (4.4) into Equation (4.6) and modeling the pilot symbols as statistically independent random variables, we see that during the training preamble it is
R
r(N
c) = A
2N e
j2π(f∆−η0)Nc/N71
X
m=−71
e
j6πmNc/N. (4.7)
On the other hand, the samples received at the MS and belonging to an OFDM data symbol are expressed by
r(k) = e
j2πf ∆k/Ns
R(k) + w(k) (4.8)
where s
R(k) is the useful component of the received signal, which takes the form
s
R(k) = 1
√ N
210
X
n=−210
c(n)H(n)e
j2πnk/N. (4.9)
In the above expression, the information symbols c(n) are modeled as statistically indepen- dent random variables with zero mean and energy C
2= E n
|c(n)|
2o
. Substituting Equation (4.9) into Equation (4.6) provides the N
c-lag correlation corresponding to an OFDM data symbol in the form
R
r(N
c) = C
2N e
j2πf∆Nc/N210
X
n=−210
e
j2πnNc/N(4.10)
Computation of Equations (4.7) and (4.10) reveals that R
r(N
c) is significantly larger during the training preamble than during an OFDM data symbol. This suggests that |R
r(N
c)|
provides useful information as to whether a training preamble is present or not in the received
samples r(k).
Unfortunately, the quantity R
r(N
c) is not available at the receiver due to the presence of the statistical expectation in Equation (4.6). To overcome this difficulty, we replace R
r(N
c) by the sample correlation function evaluated over an integration window spanning 2N
csamples.
This function is defined as
C(d) = 1 2N
c2Nc−1
X
k=0
r
∗(d + k)r(d + k + N
c) (4.11)
where d is a time index which slides along in time as the receiver searches for the training preamble. The quantity |C(d)| is then normalized by an estimation of the received energy over the integration window, which is obtained as
P (d) = 1 2N
c2Nc−1
X
k=0
r(d + k)
2
. (4.12)
This provide the metric
M (d) =
C(d)
maxP (d), P (d + N
c) (4.13)
which is virtually independent of the instantaneous received power.
In order to reduce the implementation complexity, we can iteratively compute the quantities defined in Equations (4.11) and (4.12) as
C(d + 1) = C(d) + 1 2N
ch
r
∗(d + 2N
c)r(d + 3N
c) − r
∗(d)r(d + N
c) i
(4.14)
P (d + 1) = P (d) + 1 2N
ch
r(d + 2N
c)
2
− r(d)
2
i
(4.15) for d = 0, 1, . . . , with
C(0) = 1 2N
c2Nc−1
X
k=0
r
∗(k)r(k + N
c) (4.16)
P (0) = 1 2N
c2Nc−1
X
k=0
r(k)
2
. (4.17)
Figure 4.1 shows the metric M (d) in function of d in experimental results obtained in absence
of thermal noise, with N = 1024 and N
g= 128.
Figure 4.1: M (d) metric evaluation for N = 1024 and N
g= 128
We can see that the metric M (d) has a peak in the neighborhood of the training preamble and exhibits a plateau whose duration is approximately equal to the CP length. A synch flag indicating the presence of the training symbol is thus obtained by comparing M (d) with a suitable threshold λ
0. More precisely, let us assume that M (d
0− 1) < λ
0and M (d
0) > λ
0. Then, we declare a DL subframe detection at d = d0, after which the receiver starts a synchronization procedure to acquire timing and frequency information as illustrated later.
The threshold λ
0must be designed so as to achieve a reasonable trade off between the false alarm probability P
f a(i.e. the probability of detecting a DL subframe preamble when it is actually absent) and the missed detection probability P
md(i.e. the probability of not detecting a preamble when it is actually present). Clearly, increasing λ
0reduces P
f abut degrades the detection capability. A common approach for the threshold design is based on the Neyman- Pearson criterion, according to which λ
0is selected so as to achieve a target value of P
f a. It can be proved that the false alarm probability is approximately given by
P
f a= e
−2λ20Nc(4.18)
and turns out to be independent of the SNR level. Solving with respect to λ
0yields
λ
0= s
ln(1/P
f a)
2N
c(4.19)
which can be used to select the threshold that corresponds to a specified false alarm proba- bility.
In the software implementation we started by initially buffering from the input stream an amount of samples equal to the number of samples carried by two consecutive DL subframes.
So, if a transmission is in progress, the buffer surely contains at least one complete training symbol.
1114
while(start_flag)
1115
{
1116
for(unsigned short int i=0; i<sizeof(sync_buffer)/8; i++)
1117
fread(&sync_buffer[i], 8, 1, input);
We initialized start_flag flag as true and turned it false once detected a training preamble and completed the coarse timing aquisition. In practice start_flag is related to the training operations that the receiver needs to do only once at the very beginning of the transmission.
For synchronization recovery during transmission there’s no need to perform this part of the algorithm, as we assumed that the receiver has to recover only the fine synchronization.
If there is no trasmission in act the receiver discards the current samples and collects a new amount of them. We iteratively computed quantities C(d), P (d) and P (d + N
c) as in Equations (4.14) and (4.15) on the samples collected in sync_buffer , while the metric M (d) is computed for every new sample and compared with a threshold λ
0= 0.26, which assures a P
f a= 10
−10.
1138
if(MM>0.26) {start_flag=false; flag_aux=true; break;} //go to fine timing
1139
}
4.1.2 Timing estimation
Now, we assume that the metric M (d) overcomes the threshold λ
0at d = d
0. Then, the
receiver starts a timing synchronization procedure whose goal is to identify the beginning
of each OFDMA block so as to find the correct position of the DFT window. Since the
CFO is still unknown in this phase, it is desirable that the timing recovery scheme be robust
against possibly large frequency offsets. Unfortunately, M (d) cannot provide reliable timing
information since the plateau region shown in Figure 4.1 reduces its localization capability. A
popular approach for timing estimation in multicarrier systems relies on the autocorrelation
properties that the cyclic prefix induces on the time domain samples. In practice, the following
N-lag autocorrelation function is used as a timing metric:
γ(d) =
N g+1
X
k=0
r(d + k + N )r
∗(d + k) d
0+ 1 ≤ d ≤ d
0+ N
T(4.20)
where N
T= N + N
gis the block length (including the CP) expressed in sampling intervals.
In practice, γ(d) is recursively computed as:
γ(d + 1) = γ(d) + r(d + N
g+ N )r
∗(d + N
g) − r(d + N)r
∗(d) (4.21)
for d = d
0+ 1, d
0+ 2, · · · , with γ(d
0) obtained as in Equation (4.20). Since the CP is just a duplication of the last N
gsamples of the OFDM block, we expect that |γ(d)| exhibits a peak whenever the samples r(d + k) with 0 ≤ k ≤ N
g− 1 belong to the CP. This intuition is confirmed by experimental results in Figure 4.2 , where |γ(d)| is shown as a function of the time index d for N
g= 128 and SN R = 5dB. The channel response is compliant with the ITU-vehicular A model. As we can see, |γ(d)| is characterized by a sharp peak that is positioned at the beginning of the received OFDMA block. Since the peak does not exhibit any plateau region, we expect that timing information can be achieved from |γ(d)| without any ambiguity.
Figure 4.2: γ(d) metric evaluation for N
g= 128 and SN R = 5dB
We shall observe that, in applications where the CP length N
gis relatively small, accurate
timing recovery may be difficult to be gained as a consequence of the short integration window
employed in Equation (4.20). A possible remedy to this drawback consists of averaging γ(d) over a specified number M
Bof OFDM blocks. This produces the following modified metric:
¯ γ(d) =
MB−1
X
m=0
γ(d + mN
T) (4.22)
in which |¯γ(d)| is still computed as in Equation ( 4.20). The timing estimation is eventually found by locating the global maximum of γ(d) over a time interval I = [d
0+ 1, d
0+ N
T], i.e.,
d = arg max ˆ
d∈I
|¯γ(d)| (4.23)
While in an AWGN channel the mean of the metric peak is exactly placed at the start of the OFDM symbol (i.e., at d = 0), in a multipath channel it is delayed by some samples as a consequence of the channel dispersion. Figure 4.3 shows numerical results illustrating the probability density function (PDF) as obtained with N
g= 128 and M
B= 8. Again, ITU-Vehicular A channel model is adopted, and SN R = 5dB. In this experiment, the value d = 0 corresponds to the first sample of the CP and represents the correct timing instant.
Numerical simulations confirm that the PDF of d becomes narrower as M
Bincreases due to the improved accuracy of the corresponding timing estimation.
Figure 4.3: PDF of the timing estimation for N
g= 128, M
B= 8 and SN R = 5dB
We implemented this step by recursively computing γ(d) with Equation (4.21) over a number
M
B= 10 OFDMA blocks, for d = d
temp, d
temp+ 1, · · · , where d
temp= d
0+ 2N
c. The last
operation is needed as we didn’t want our algorithm to be affected by the preamble, since it has a CP and we wanted to synchronize the receiver on the first OFDMA useful symbol. We performed the research of global maximum of γ(d) with the following logical scheme:
d_fine=d_temp;
max=gamma (d_temp);
if(gamma(d) > gamma(d−1)){
max=gamma (d);
d_fine=d}
with d = d
temp+ 1, d
temp+ 2, · · · , d
temp+ N
T.
4.1.3 Fractional frequency offset estimation
Due to the unavoidable misalignments of local oscillators, there can be an offset between transmitter and receiver carrier frequencies. The presence of a carrier frequency offset pro- duces a shift of the received signal in the frequency domain. In multicarrier applications, it is expedient to decompose the frequency error f
∆into an integer part (ICFO), which is multiple of the subcarrier spacing ∆f = 1/T
u, plus a remaining fractional part (FCFO), less than ∆f /2 in magnitude. This amounts to putting f
∆= ǫ + µ where µ is integer-valued and represents the ICFO, while ǫ is the FCFO belonging to the interval (−0.5, +0.5). If not properly compensated, the former results into a shift of the subcarrier indices at the DFT output, while the latter produces ICI and MAI due to a loss of orthogonality among subcarriers. The frequency estimation algorithm provides an estimation of f
∆in the form f ˆ
∆= ˆ ǫ + ˆ µ, where ˆ ǫ and ˆ µ are the estimations of ǫ and µ, respectively. Here, we concentrate on the acquisition of ǫ, while the problem of estimating the integer offset µ is addressed in the next subsection.
We begin by considering the timing metric ¯ γ( ˆ d) evaluated at the optimum time instant d given in Equation (4.23). Substituting Equation (4.20) into Equation (4.22) and letting ˆ d ˆ
k,m= ˆ d + k + mN
Tfor notational conciseness, we obtain
¯ γ( ˆ d) =
MB−1
X
m=0 Ng−1
X
k=0
r ˆ d
k,m+ N )r
∗( ˆ d
k,m(4.24)
where r(k) are the received samples, which can be expressed as
r(k) = s
R(k)e
j2πf∆k/N+ w(k). (4.25)
In the above Equation, w(k) is white Gaussian noise with zero-mean and variance σ
w2, while s
R(k) is the useful signal component given in Equation (4.9). To proceed further, we put Equation (4.25) into the equivalent form
r(k) = e
j2πf∆k/Ns
R(k) + ˜ w(k)
(4.26)
where ˜ w(k) = w(k)e
j2πf∆k/Nhas the same statistics of w(k). Then, we assume that the samples {r( ˆ d
k,m); k = 0, 1, . . . , N
g− 1} belong to the CP of the m
thOFDMA block. Such a situation occurs with unit probability in the absence of thermal noise and for transmissions over an AWGN channel. In the presence of thermal noise and multipath propagation, it holds true with high probability provided that the timing estimation d is sufficiently accurate.
Hence, neglecting the contribution of IBI for simplicity, we have
r ˆ d
k,m= e
j2πf∆dˆk,m/Ns
Rd ˆ
k,m+ ˜ w ˆ d
k,m(4.27)
r ˆ d
k,m+ N = e
j2πf∆( ˆdk,m+N )/Ns
Rd ˆ
k,m+ ˜ w ˆ d
k,m+ N
(4.28)
which, combined with Equation (4.24), yields
¯
γ( ˆ d) = M
BN
gσ
s2e
j2πf∆(1 + η) (4.29)
where
σ
s2= 1 M
BN
gMB−1
X
m=0 Ng−1
X
k=0
s
Rd ˆ
k,m2
(4.30)
is the recived signal energy, and
η = 1
M
BN
gσ
s2MB−1
X
m=0 Ng−1
X
k=0
h s ˆ d
k,m˜ w
∗d ˆ
k,m+ s
∗d ˆ
k,m˜ w ˆ d
k,m+ N + ˜ w
∗d ˆ
k,m˜ w ˆ d
k,m+ N i
(4.31)
is a disturbance term. Recalling that f
∆= ǫ + µ with µ being integer valued, from Equation
(4.29) we see that an estimation of the FCFO can be computed as
ˆ ǫ = 1
2π arg n
¯ γ( ˆ d) o
(4.32)
where arg{X} denotes the principal value of the argument of X. In absence of IBI, ˆǫ is unbiased with a variance
var{ˆǫ} = 1 4π
2M
BN
gSN R
−1+ 1
2 SN R
−2. (4.33)
Software implementation si done simply by computing the principal value of the argument of ¯ γ( ˆ d):
1151
fcfo=gamma/abs(gamma);
with fcfo declared as a complex <float> value. Note that the real frequency offset would be arg(fcfo)/2∗M_PI , but what we really needed to compensate it, as explained in the next section, is e
−j2πkˆǫ/N, that is the value of gamma normalized at his absolute value.
4.1.4 Integer frequency offset estimation and preamble identification In the considered AeroMACS profile, the subcarrier spacing is ∆f = 10.93kHz while the carrier frequency is approximately 5GHz. Assuming an overall oscillator instability of ±2 parts per million at both the transmit and receive ends as specified in the standard, the maximum frequency offset between the received carrier and the local oscillator frequencies is ±20kHz, which corresponds to f
∆= ±1.83kHz. This means that the ICFO can take values in the set J
µ= {±2, ±1, 0} and must be estimated in some manner. Another task that the receiver has to accomplish is the identification of the received training preamble in order to univocally specify the transmitting BS. As mentioned in the first subsection, the training preamble is selected among 114 possible choices and is characterized by a pseudonoise sequence of 143 BPSK symbols modulating one every three subcarriers. The indices i
m(−71 ≤ m ≤ 71) of the modulated subcarriers are expressed in Equation (4.1), where η
0∈ {0, 1, 2} designates the cell sector. In this section we illustrate a method for jointly estimating the ICFO and the transmitted preamble sequence and our implementation.
For this purpose, we use the timing estimation ˆ d provided in Equation (4.23) in order to
select the N samples belonging to the received training preamble, say r(k + ˆ d) with k =
0, 1, . . . , N − 1. Next, we counter-rotate samples r(k + ˆ d) at an angular speed 2πˆ ǫ/N so as to
compensate for the FCFO. This produces the frequency-corrected samples
x(k) = r(k + ˆ d)e
j2πkˆǫ/Nk = 0, 1, . . . , N − 1 (4.34)
which are then fed to the DFT unit, yielding the frequency-domain samples
X(n) = 1
√ N
N −1
X
k=0
x(k)e
−j2πnk/Nk = 0, 1, . . . , N − 1. (4.35)
To proceed further, we consider the situation where the p
thtraining preamble {a
p(m); −71 ≤ m ≤ 71} has been transmitted (with p = 0, 1, . . . , 113) and define the following zero-padded sequence:
a
(ZP )p(n) =
a
p(m) if n = i
m0 otherwise
(4.36)
with i
m= |η
0+ 3m|
Nfor −71 ≤ m ≤ 71. Then, assuming ideal FCFO compensation and recalling that the ICFO results into a shift of the subcarrier indices at the DFT output, we may write
X(n) = AH(n + µ)b
p(n + µ)e
−j2πδd(n+µ)/N+ W (n) (4.37)
where A = 2 √
2 is the power boosting factor and b
p(n) is the periodic repetition of a
(ZP )p(n) with period N . Also, W (n) is the contribution of the thermal noise while δ
dis the timing error, which appears as a linear phase shift across the subcarriers. As anticipated, we aim at jointly estimating the ICFO µ ∈ J
µand the training index p ∈ J
p= {0, 1, . . . , 113}. One possible approach consists of looking for the global maximum of the objective function
Φ(˜ µ, ˜ p) =
N −1
X
n=3
Y
µ˜(n; ˜ µ)Y
µ˜∗(n − 3; ˜ µ)
2
(4.38)
with respect to (˜ µ, ˜ p) ∈ J
µ× J
p, where Y
µ˜(n; ˜ µ) is the product of the DFT output with the hypothesized shifted sequence b
p˜(n + ˜ µ), i.e.,
Y
µ˜(n; ˜ µ) = X(n)b
p˜(n + ˜ µ). (4.39)
The estimated values of µ and p are thus given by
(ˆ µ, ˆ p) = arg max
(˜µ,˜p)∈Jµ×Jp
n Φ(˜ µ, ˜ p) o
(4.40)
The use of the metric Φ(˜ µ, ˜ p) can be justified with the following arguments. Substituting Equation (4.37) into Equation (4.38) and neglecting for simplicity the thermal noise contri- bution, produces
Φ(˜ µ, ˜ p) = A
4N −1
X
n=3
H(n + µ)H
∗(n + µ − 3)d
p(n + µ)d
p˜(n + ˜ µ)
2
(4.41)
where d
p(n) is the following differential sequence:
d
p(n) = b
p(n)b
p(n − 3). (4.42)
On the other hand, since the channel response is expected to keep approximately constant over three adjacent subcarriers, we may put H(n+µ−3) ≈ H(n+µ) and rewrite Equation ( 4.41) as
Φ(˜ µ, ˜ p) = A
4N −1
X
n=3
H(n + µ)
2
d
p(n + µ)d
p˜(n + ˜ µ)
2
. (4.43)
At this stage we apply the Schwartz inequality to show that
Φ(˜ µ, ˜ p) ≤ A
4N −1
X
n=3
H(n + µ)d
p(n + µ)
2
2
(4.44)
where the equality holds true if d
p(n + µ) = d
p˜(n + ˜ µ) or, equivalently, if (˜ µ, ˜ p) = (µ, p). The above result indicates that, in the absence of noise and in case of ideal FCFO compensation, the metric Φ(˜ µ, ˜ p) achieves a global maximum when (˜ µ, ˜ p) = (µ, p), which justifies its use for the joint estimation of µ and p.
Implementation of this step started with the FCFO compensation. We used the value stored in the fcfo variable for multiplying samples belonging to the preamble symbol. As we aligned the receiver at the beginning of the first OFDMA data symbol, the indices identifying the preamble symbol starts from (d
0− N). Next, we applied FFT to the appropriate plane:
1163
for(unsigned short int i=0; i<subcarrier; i++)
1164
IN_FFT[1][i]=sync_buffer[d_opt−subcarrier+i]∗fcfo;
1165
1166
fftwf_execute(OFDM_FFT2);
1167
fftwf_cleanup();
Due to the above consideration about J
µwe defined the array icf_o[5]={−2,−1,0,1,2} which contains the possible allowed ICFO, and computed Φ(˜ µ, ˜ p) performing an exhaustive research of the maximum value. This value gave us the index of the transmitted training symbol, and also the position in wimaxset2 at which we could read the cell ID and η
0. The effective ICFO is given by the sum of the estimated ICFO and η
0.
1171
for(unsigned short int i=0; i<5; i++)
1172
{
1173
for(unsigned short int j=0; j<114; j++)
1174
{
1175
gamma=0;
1176
for(unsigned short int k=0; k<subcarrier; k++)
1177
tempor[k]=(OUT_FFT[1][k]∗preamble_sym[j][(k−icf_o[i])%subcarrier]);
1178
1179
for(unsigned short int k=3; k<subcarrier; k++)
1180
gamma+=tempor[k]∗conj(tempor[k−3]);
1181
1182
MM=gamma.real()∗gamma.real()+gamma.imag()∗gamma.imag();
1183
if(MM>maxxx) {maxxx=MM; icfo=icf_o[i]; ind=j;}
1184
}
1185
}
1186
IDcell=wimaxset2[ind][0];
1187
segment=wimaxset2[ind][1];
1188
icfo+=segment;
4.1.5 Timing recovery
Once the receiver has completed the initial synchronization algorithms it starts receiving and processing data from the input stream. Due to the already mentioned inaccuracies in the local oscillator it is possible that the receiver looses the correct sampling time and needs to be synchronized again. For noticing the loss of timing we took advantage of the DC subcarrier that is not modulated at all. A value in this subcarrier that differs too much from zero for a large number of OFDMA symbols means that we are no longer aligned with the transmitter samples. We thus defined an “accumulated metric” as float sync_met=0 , and updated it with the real part of the current value on the DC carrier every new received OFDMA symbol:
604
sync_met+=OUT_FFT[0][continua].real()+OUT_FFT[1][continua].real();
where continua denotes the DC carrier physical index.
The recovery take place when the so defined metric exceeds a fixed threshold. Since the check is made at the end of each DL subframe, i.e. every 29 OFDMA symbols, we chose a threshold of 5. This value is low enough to be almost certainly exceeded if the timing goes wrong, and high enough no to be exceeded due to unavoidable incoherent additive noise.
When the metric exceeds the threshold, sync_buffer is filled again and the synchronization algorithms takes place at the next DL subframe, starting from the fine timing phase described on page 97. The overall check is the following:
1274
if(abs(sync_met)>5)
1275
{
1276
cout<<"−−>resync!!!<−−"<<endl;
1277
sync_met=0;
1278
syn=0;
1279
for(unsigned short int i=0; i<sizeof(sync_buffer)/8/2; i++)
1280
fread(&sync_buffer[i], 8, 1, input);
1281
sync_flag=true;
1282
}
As we were analyzing our case in absence of thermal noise and propagation channel, we put in the code an instruction to decide when to perform the synchronization recovery, e.g. every 20 DL subframes.
1272
if(!(source_pointer%20)) sync_met=10;
4.2 OFDMA DL subframe interpretation
As we saw in the previous chapter, the OFDMA DL subframe includes different type of fields:
FCH, DLMAP, ULMAP and users DATA. They are to be intended as “statics” since we have used fixed MAC information by mean field.cpp script. However, we have to do some importants clarification:
• FCH and DLMAP fields are always present within a DL subframe and they always start
at the same point, since FCH is positioned at the beginning of the DL subframe and
it has a fixed size, while DLMAP always follows the FCH but it can have a variable
size, which is indicated by mean the FCH. Thus, a receiver already knows the starting
position of these two field. It has only to read the DLMAP size into the FCH.
• ULMAP and DATA field are to be intended as bursts. So they can be anywhere within a DL subframe and, similar (but not equal) to the DLMAP, they can have any size bounded within the DL subframe. In other, we considered the one user case, but there may be multiple users and therefore multiple DATA bursts. They can be recognized and found from the receiver by mean the DLMAP, which carries their position information and size information.
For a review of our implemented DL subframe, we remember Figure 3.9 on page 86.
In order to consider these two cases we used two different functions. The first one is named static_field_interpreter and it provides to read the FCH field first and the DLMAP field second in a sequentially way, just they are adjacent and mandatory within a DL subframe. Following the code:
void static_field_interpreter(int L, complex <float> ∗symbol_buffer,const char ∗str) {
if(!strcmp(str,"FCH")) {
ofdm_offset = 1;
S = 0;
ofdm_index_start = 0;
symbol_count = 0;
ofdm_index_end = SUBCARRIER_DATI_xSUBCHANNEL ∗ L;
//[...]
}
else if (!strcmp(str,"DLMAP")) {
S = 0;
ofdm_index_start = ofdm_index_end;
if(L<11) {
ofdm_index_end = SUBCARRIER_DATI_xSUBCHANNEL ∗ (L%15);
//[...]
} else {
ofdm_index_end = datadata;
//[...]
L−=11;
Nslot = ceil((float) L/N_SLOT);
//[...]
if(slot_count == (Nslot −1) and L != N_SLOT)
ofdm_index_end = SUBCARRIER_DATI_xSUBCHANNEL ∗ (L%15);
//[...]
} } }
where S , slot_count and symbol_count are substantially counters. L is the slot-length of the current field to be read. What about FCH, L will be fixed to value 4, while about DLMAP the slot-length will be indicated after that the FCH is being read. symbol_buffer is a pointer to the complex vector to be filled with the read symbols and str is a char variable which indicate if the current DL subframe is either FCH or DLMAP.
The ofdm_offset variable needs to select the right OFDMA symbol offset from where the field starts on the time axis, while ofdm_index_start and ofdm_index_end need to indicate where the field starts and ends on the frequency axis. As we can see from the code, ofdm_offset is set up to 1 and ofdm_index_start is set up to 0 for the FCH reading, just this field is constant positioned and constant sized. In the DLMAP reading, ofdm_index_start is equal to the ofdm_index_end after the FCH reading, because of DLMAP follows the FCH. Afterwards, ofdm_index_end is set up according to L and considering if the DLMAP field occupies even the next OFDMA symbols. Considering the overall number of available subchannel in a 512 subcarrier model there are 15 subchannels per OFDMA symbol 4 of which are occupied from FCH. So there are two possible cases:
• if(L < 11) ofdm_offset remains 1 and ofdm_index_end is set up according to L slot-length
• if(L ≤ 11) L is calculated and set up considering the larger size of the DLMAP. Every times an OFDMA symbol is being read, ofdm_offset increase by 2.
In this way the DLMAP field may be large as requested. We found ourselve in the second
case since that our DLMAP occupies the first four OFDMA symbols, but not all subchannels
available, as indicated in subsection 3.3.3.
The call to the function is performed in this way about the DLMAP:
1358
DLMAP_repetition = bindec(&FCH[7],2); //DLMAP_repetition = 2;
1359
DLMAP_coding = bindec(&FCH[9],3); //DLMAP_coding = 3;
1360
DLMAP_length = bindec(&FCH[12],8); //DLMAP_length = 20;
1361
1362
switch (DLMAP_repetition)
1363
{
1364
case 0: DLMAP_repetition = 1; break;
1365
case 1: DLMAP_repetition = 2; break;
1366
case 2: DLMAP_repetition = 4; break;
1367
case 3: DLMAP_repetition = 6; break;
1368
}
1369
1370
//LETTURA DLMAP
1371
static_field_interpreter(DLMAP_length,SI_1,"DLMAP");
As explained, we got the DLMAP information from the FCH string previously interpreted.
Then, we pass only the DLMAP_length information to static_field_interpreter as input param- eter.
The second function provided to read the burst is named burst_interpreter . It differs from the latter function for the input parameters both as regards the number and as reguards the type. We report these ones before explain the implementation of the function:
35
struct Burst{
36
short int OFDMA_symbol_os;
37
short int subchannel_os;
38
short int OFDMA_symbol;
39
short int subchannel;
40
short int repetition;
41
};
This is a data structure which include the relevant factors needed to know for identify
the position of the burst and its size. These are nothing more than the entry situated in
the DL−MAP IE() entry within the DL−MAP IE() as explained in subsection 2.3.4. Once a
receiver has interpreted the FCH and the the DLMAP, it has to recognize the bursts sent to
itself and subsequently get its positioning information. In our case the receiver only needs to
know the positioning because there are the ULMAP burst and only one DATA burst, so they
doesn’t discover if it’s the “owner” of the DATA burst.
The following code explain the ULMAP reading starting from the knowledge of the DLMAP.
The user DATA reading is performed at the same way.
1375
//ULMAP
1376
ULMAP_IE.OFDMA_symbol_os = bindec(&DLMAP[124],8);
1377
ULMAP_IE.subchannel_os = bindec(&DLMAP[132],6);
1378
ULMAP_IE.OFDMA_symbol = bindec(&DLMAP[141],7);
1379
ULMAP_IE.subchannel = bindec(&DLMAP[148],6);
1380
ULMAP_IE.repetition = bindec(&DLMAP[154],2);
1381
1382
switch (ULMAP_IE.repetition)
1383
{
1384
case 0: ULMAP_IE.repetition = 1; break;
1385
case 1: ULMAP_IE.repetition = 2; break;
1386
case 2: ULMAP_IE.repetition = 4; break;
1387
case 3: ULMAP_IE.repetition = 6; break;
1388
}
1389
1390
burst_interpreter(ULMAP_IE, SI_1);
where ULMAP_IE is a burst data structure. It stores the burst information got from the DLMAP string (already demodulated) into its variable. Then it will be the input parameter for the burst_interpreter function. Following the code:
640
void burst_interpreter(Burst &T_Burst, complex <float> ∗symbol_buffer)
641
{
642
int OFDMA_symbol_os, OFDMA_symbol, ofdma_count;
643
644
OFDMA_symbol_os = T_Burst.OFDMA_symbol_os;
645
OFDMA_symbol = T_Burst.OFDMA_symbol;
646
647
S = 0;
648
ofdm_index_start = SUBCARRIER_DATI_xSUBCHANNEL ∗ T_Burst.subchannel_os;
649
ofdm_index_end = SUBCARRIER_DATI_xSUBCHANNEL ∗ T_Burst.subchannel;
650
651
//[...]
652
}
It’s easy to see that there are the same variables in static_field_interpreter function. Differently, they take the values from the passed burst data structure instead of taking fixed or pseudofixed values (pseudofixed because of DLMAP in static_field_interpreter is not merely a constant field and its length depends from the length indicated into the FCH field).
Into the square parenthesis present in both function above there are the construction of the sequence of modulated symbols extracted from the indicated zone of the DL subframe and the demodulation operation explained on the next paragraph. The Dl subframe reading is carried out at the same way used for filling the DL subframe and, more precisely, a data region. It’s depicted in Figure 2.9 on page 38.
A characteristic of these functions is that they can operate even if there are many more users and hence more burst within the DL subframe whether they are burst carrying data information or services information. Thus, it is fully-compliance with AeroMACS standard potentially.
4.3 OFDM demodulation
The OFDM demodulator follows the scheme depicted in Figure 4.4. The operations to be performed are complementary of the operations made at the transmitter side, with the addition of the channel estimation (CE) block.
Figure 4.4: OFDM demodulation scheme
CP removal and FFT computation
The first block removes the Cyclic Prefix from the readed samples. We implemented it as follows:
657
for(int index=prefix; index<(subcarrier+prefix); index++){
658
IN_FFT[0][index−prefix]=TX_FRAME[OFDMA_symbol_os+ofdma_count][index];
659
IN_FFT[1][index−prefix]=TX_FRAME[OFDMA_symbol_os+ofdma_count+1][index];}
where prefix is defined as the CP dimension ( #define prefix 64 ), OFDMA_symbol_os is the symbol offset of the considered burst (i.e. the OFDMA symbol at which the burst starts: in our case this value is 7 for the DATA burst. Look at subsection 3.3.3), and ofdma_count is an inde- pendent counter incremented for each received OFDMA symbol. We defined complex <float>
IN_FFT[2][subcarrier] as the FFT block input vector: in practice IN_FFT is the complementary of IN_IFFT described in section 3.2 on page 72.
After removing CP we performed FFT computation using fftw3.h library as described for the modulator:
662
fftwf_execute(OFDM_FFT1);
663
fftwf_cleanup();
664
fftwf_execute(OFDM_FFT2);
665
fftwf_cleanup();
As in the modulator side the planning is made in the una tantum phase, in which we initialized two different planes. The only difference is that here we put FFT_FORWARD as the “sign” argument to specify that we want our code to perform a direct DFT.
1135
OFDM_FFT1 = fftwf_plan_dft_1d (subcarrier,
1136
reinterpret_cast<fftwf_complex ∗>(& IN_FFT[0][0]),
1137
reinterpret_cast<fftwf_complex ∗>(& OUT_FFT[0][0]),
1138
FFTW_FORWARD,
1139
FFTW_PATIENT);
1140
1141
OFDM_FFT2 = fftwf_plan_dft_1d (subcarrier,
1142
reinterpret_cast<fftwf_complex ∗>(& IN_FFT[1][0]),
1143
reinterpret_cast<fftwf_complex ∗>(& OUT_FFT[1][0]),
1144
FFTW_FORWARD,
1145
FFTW_PATIENT);
Channel estimation
In OFDMA transmissions, the effect of channel distortion on each subcarrier is represented by a single complex-valued coefficient affecting the amplitude and phase of the corresponding information symbol. Coherent detection of the transmitted data can be performed only after this multiplicative distortion has been compensated for. This operation is known as channel equalization and is normally accomplished in the frequency domain if an estimation of the channel response is available at the receiver side for all active users on the assigned subcarriers. Although there are many channel estimation techniques available in the literature, it is important to have an estimation technique that is specifically tailored for the pilot arrangement employed in the AeroMACS system and that involves low computational and hardware complexity. In this section we will concentrate only on the Forward Link Channel Estimation.
The cluster structure and pilot tones allocation have been described in details in subsec- tions 2.3.6 and 3.3.2, respectively. At the receiver side we first extracted the pilot tones from their fixed positions, which are specified in the pilot_vect[2][pilotpilot] array described on subsection 3.3.1 on page 81 for the transmitter and generated by the receiver too.
668
for(P=0; P<pilotpilot; P++){
669
tonipilota[2∗P]=OUT_FFT[0][pilot_vect[0][P]+virt_sx]/boost;
670
tonipilota[2∗P+1]=OUT_FFT[1][pilot_vect[1][P]+virt_sx]/boost;}
As we can see we arranged pilot tones in a complex <float> array named tonipilota , with the variable boost=(float)((4∗subcarrier)/3) taking into account boosting and normalization by N .
After the FFT operation the k
threceived symbol has the form
X
k(N ) = c
k(n)H
k(n) + w
k(n) n = 0, 1, . . . , N − 1 (4.45)
where H
k(n) is the channel frequency response over the n
thsubcarrier, c
k(n) are the trans- mitted (data or pilot) symbols and w
k(n) represents the thermal noise contribution, which is modeled as a white Gaussian process with power σ
w2.
The channel response is first estimated at the pilot positions as
H ˆ
m(p) = X
m(p)
c
m(p) (4.46)
where (m, p) are the time-frequency coordinates of one of the available pilot tones. Interpola- tion techniques are next employed to obtain the channel response over the information-bearing subcarriers.
To simplify the notation, we focus on a single cluster and consider two consecutive symbols with time index k = 0, 1 and frequency index n = 0, 1, . . . , 13. The channel response over the considered cluster is assumed to vary linearly in both the time and frequency directions. This amounts to putting
H
k(n) = ak + bn + c (4.47)
where θ = [a, b, c]
Tare suitable coefficients that must be estimated according to some opti- mization criterion. For this purpose, we see form Figure 3.7 on page 81 that the time-frequency coordinates of the four available pilots in the cluster are {(0, 0); (1, 4); (1, 8); (0, 12)}. Arrang- ing the channel estimations at the pilot positions into a vector ˆ H = [ ˆ H
0(0), ˆ H
1(4), ˆ H
1(8), H ˆ
0(12)]
T, from Equation (4.47) we have
H ˆ = Aθ + w (4.48)
where A is the matrix
A =
0 0 1
1 4 1
1 8 1
0 12 1
(4.49)
while w accounts for the noise contribution. The unknown vector θ can be estimated from Equation (4.48):
θ = (A ˆ
TA )
−1A
TH ˆ (4.50)
or equivalently,
ˆ a = 1
2 h
− ˆ H
0(0) + ˆ H
1(4) + ˆ H
1(8) − ˆ H
0(12) i ˆb = 1
40
h −3 ˆ H
0(0) − ˆ H
1(4) + ˆ H
1(8) + 3 ˆ H
0(12) i ˆ
c = 1 20
h 19 ˆ H
0(0) + 3 ˆ H
1(4) − 3 ˆ H
1(8) + ˆ H
0(12) i
(4.51)
With the so obtained values the channel estimations over the considered cluster are eventually obtained in the form
H ˆ
k(n) = ˆ ak + ˆbn + ˆ c (4.52)
In low-mobility applications, the channel response is expected to keep approximately con- stant over two consecutive OFDMA symbols. In this hypothesis, interpolation in the time- domain is not necessary and the same channel estimation ˆ H
0(n) = ˆ H
1(n) = ˆ H(n) can be used for both symbols in the considered cluster. In order to keep the computational complexity as low as possible, we employed a method in which the channel estimations obtained over two consecutive pilot carriers are interpolated so as to determine the channel response for data subcarriers located in between the pilots. The resulting channel estimation algorithm can be summarized as follows:
1. Estimate the channel response on the pilot subcarriers as indicated in Equation (4.46), thereby obtaining the quantities ˆ H(p) where p = 0, 1, 4, 12.
2. Employ the four estimated values ˆ H(p) to find all the other channel gains through a linear interpolation in the frequency direction:
H(n) = ˆ ˆ H(p) + (n − p)β(p) p < n < p + 4 (4.53)
where β(p) = [ ˆ H(p + 4) − ˆ H(p)]/4.
3. Extrapolate from subcarrier n = 12 the channel estimation for subcarrier n = 13 by considerating ˆ H(13) = ˆ H(12).
Figure 4.5 depicts the so obtained situation.
We realized the aforesaid operations with the following code. alpha is the vector containing
the channel response at pilot positions, computed dividing the received symbol by its actual
value stored in pilot_sym (generated as described in subsection 3.3.2). Coefficients β(p) are
computed by the previously mentioned relation and stored in the vector beta . Finally we
applied the linear interpolator, thus obtaining the estimated values ˆ H(n) with n = 0 + 14 ·
i, 1 + 14 · i, . . . , 13 + 14 · i, being i = 0, 1, . . . , 29 the cluster index. alpha and beta are computed
for each cluster separately.
Figure 4.5: Channel estimation within a single cluster
676
for(unsigned char i=0; i<ncluster; i++)
677
{
678
alpha[0]=tonipilota[i∗4+1]/pilot_sym[pilot_vect[1][i∗2]+ofdm_offset+1][segment][IDcell];
679
alpha[1]=tonipilota[i∗4]/pilot_sym[pilot_vect[0][i∗2]+ofdm_offset][segment][IDcell];
680
alpha[2]=tonipilota[i∗4+2]/pilot_sym[pilot_vect[0][i∗2+1]+ofdm_offset][segment][IDcell];
681
alpha[3]=tonipilota[i∗4+3]/pilot_sym[pilot_vect[1][i∗2+1]+ofdm_offset+1][segment][IDcell];
682
beta[0]=coeff∗(alpha[1]−alpha[0]);
683
beta[1]=coeff∗(alpha[2]−alpha[1]);
684
beta[2]=coeff∗(alpha[3]−alpha[2]);
685
686
for(unsigned char j=0; j<12; j++)
687
chan[14∗i+j]=alpha[j/4]+beta[j/4]∗(float)(j&0x3);
688
chan[14∗i+13]=chan[14∗i+12]=alpha[3];
689
}
Demapper
The obtained string of symbols need to be passed to the demapper block, in order to get the proper string of bits needed at the input of the receiving chain (section 4.4). To implement the demapper we set up a number of maps equal to the number of supported modulations:
328
char str_demap64[64][6];
329
char str_demap16[16][4];
330
char str_demapQ[4][2];
331
char str_demapB[2];
We stored here the demodulated bits associated with all the possible symbols of that constel- lation, following obviously the same Gray rule used by the transmitter. For example, for a 16-QAM modulation we had:
752
count_d=0x00;
753
for(dd=0;dd<16;dd+=2){
754
if(count_d==0x00){
755
str_demap16[dd][1]=0x00; str_demap16[dd][3]=0x00;
756
str_demap16[dd+1][1]=0x00; str_demap16[dd+1][3]=0x01;}
757
else{
758
str_demap16[dd][1]=0x01; str_demap16[dd][3]=0x01;
759
str_demap16[dd+1][1]=0x01; str_demap16[dd+1][3]=0x00;}
760
count_d^=0x01;
761
}
762
for(dd=0;dd<16;dd++){
763
if(dd<4){str_demap16[dd][0]=0x00; str_demap16[dd][2]=0x00;}
764
else if(dd>=4 and dd<8){str_demap16[dd][0]=0x00; str_demap16[dd][2]=0x01;}
765
else if(dd>=8 and dd<12){str_demap16[dd][0]=0x01; str_demap16[dd][2]=0x01;}
766
else {str_demap16[dd][0]=0x01; str_demap16[dd][2]=0x00;}
767
}
For software implementation of the demapper we defined the function string demodulation (complex <float> ∗str, int Nsym, int costellazione) , where (∗str) is a pointer to the input string of modulated symbols, Nsym is the number of symbols being demodualted and costellazione is the order of the used constellation. The function returns a string of bits which can be processed by the other blocks of the receiver chain. We report here the 16-QAM case:
429
case 16:
430
{
431
while(Nsym−−)
432
{
433
s_real = (∗str).real()/subcarrier;
434
s_imag = (∗str++).imag()/subcarrier;
435
436
if (s_real>=0 and s_real<2){
437
if (s_imag>=0 and s_imag<2) bitout.append(str_demap16[5],4);
438
else if (s_imag>= −2 and s_imag<0) bitout.append(str_demap16[6],4);
439
else if (s_imag< −2) bitout.append(str_demap16[7],4);
440
else bitout.append(str_demap16[4],4);}
4.4 Channel decoding
The operations to be performed in order to regain the original data beginning from the OFDMA DL subframe are the same ones that being performed at the transmitter, but on the reverse succession. Figure 4.6 depicts this.
Figure 4.6: channel decoding chain
The first two steps (Demapping in symbols sequence and Demodulation) have been ex- plained in the previous section, so we’d consider directly the successive steps. These ones have been included in a unique function named RX_block . Following the declaration:
251
string RX_block(int mod, int R, string str_in, const char ∗sent)
it takes in input these parameter:
mod : is the current modulation R: is the current repetition factor
str_in : is the bits string outputting from the demodulator. It concerns the data of an entire burst or, similarly, a field like FCH, DLMAP or ULMAP.
sent : says to the function whether the current block has to be derandomize or not During the channel coding exposition, we already talk about block-oriented behaviour of the chain. We said we used FECblocks function in order to split up the data in blocks of data according to the mandatory Table 2.13 on page 56. This splitting operation had the purpose to reset or initialize some steps of the chain.
Channel decoding chain makes uses of this same method to compute the data, so FECblocks is included into RX_block . For a elucidation about, please see subsection 3.1 on page 63.
Precisely, it operates at the beginning of the function, immediately before the derepeater.
Thus, it takes the bytes length of str_in string as input parameter and split up it in blocks of
bytes, compliance with values required of the last table mentioned. As channel coding chain,
channel decoding chain will be repeated as many times as is the numbers of block on which
str_in has been splitted.
4.4.1 Derepeater
This task extracts a single copy of a block which was been repeated. For example, if the repetition factor R is 4 it means that the current block (and then the current burst) was been repeated in the way that it occupied 4 times as much its normal size. So the derepeater has to get only one copy of the original block (burst). Figure 4.7 shows has we just been said.
Figure 4.7: Example of block extraction with repetition factor R = 4
Theoretically, we should extract a different copy, not necessarily the first one.
The code which implements this operation is very simple:
279
str_der.assign(str_in, Nbit_shift, VIT_IN);
where str_in has already been treated, Nbit_shift takes into account the beginning point of the str_in string which where starting the extraction operation and VIT_IN concerns the size of the copy to be extracted. str_der string will be a substring of str_in .
4.4.2 Bit deinterleaver
Bit deinterleaver step provide to regroup together those bits which were been scattered by the interleaver step during the coding process. We used the Equations (2.17a) and 2.17b on page 57 in order to perform the deinterleving operation, so we compute and stored the result in three two-dimensional array kj4 , kj16 and kj64 during the una tantum phase, as many array as in the number of the allowed modulation type. The second dimension takes in account the different supported size of the blocks (see Table 2.13 on page 56).
1117
for(j=0; j<Fec; j++) //Fec = 576
1118
{
1119
step = floor(d∗j/Fec);
1120
1121
mj = s[0]∗floor(j/s[0])+((j+step)%s[0]); kj4[5][j]=d∗mj−(Fec−1)∗floor(d∗mj/Fec);
1122
mj = s[1]∗floor(j/s[1])+((j+step)%s[1]); kj16[5][j]=d∗mj−(Fec−1)∗floor(d∗mj/Fec);
1123
mj = s[2]∗floor(j/s[2])+((j+step)%s[2]); kj64[5][j]=d∗mj−(Fec−1)∗floor(d∗mj/Fec);
1124
}
This is a part of the initialization phase into the una tantum script segment. It provides to implement the Equations (2.17a) and (2.17b) and stores the results in kj4 for the QPSK modulation, kj16 for 16-QAM modulation and kj64 for 64-QAM modulation. j counter run from 0 to 576 because it takes in account the 36 bytes block case, that is 576 = 36 x 8.
Bit deinterleaving operation into RX_block function is performed before the FECblocks process. At first, we select the right array according to the current modulation
255
switch (mod)
256
{
257
case 64: kj = kj64; break;
258
case 16: kj = kj16; break;
259
case 4: kj = kj4; break;
260
}
and then, we regroup together the bits from str_der string into str_dei string, which is previously resized to the current block size
282
str_dei.resize(VIT_IN,char());
283
for (bit=0; bit<VIT_IN; bit++)
284
str_dei[kj[mod][bit]] = str_der[bit];
mod span from 0 to 5 and it has been gotten in an empirical way based on the size of the current block, just as in the interleaving process.
276