Pseudo LTE

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 45

Pseudo-Random Sequence (Gold Sequence)

This is not a specific physical channel, but this sequence (variation of the sequence) are used in many way
to generate a specific sequence itself (e.g, Downlink Reference Signal) or to scramble the data of a specific
channel. The Pseudo-Random Sequence used for LTE is a type of Gold Sequence defined as follows in
36.211 7.2 Pseudo-random sequence generation. (If you are not familiar with the concep of Gold Sequence,
refer to Gold Code page)

What is this used for ?

What are we use this for ? There are several different application for this sequence as listed below.
Generation of Downlink Reference Signal : Two of this Pseudo Random Sequence (Gold Sequence) is
used
Scrambling of PDSCH
Scrambling of PMCH
Scrambling of PDCCH
Generation of PUSCH DMRS (e.g, PUSCH DMRS - 1RB)

How to implement ?

I will show you a couple of different ways of implementing this pseudo random sequence here. Depending
on the language that you use and your programming style, you would have a little bit different code. Matlab
communication package and srsLTE API is verified code, but my MatLab code is not verified but I hope it is
written correctly.

< Matlab Communication Package >

If you have access to Matlab Communication Toolbox, you can implement this sequence as shown below.
(This Matlab code clip is from the book : Understanding LTE with Matlab)
< srsLTE >

Following is the implementation in srsLTE.

void srslte_sequence_set_LTE_pr(srslte_sequence_t *q, uint32_t seed) {


int n;
uint32_t *x1, *x2;

x1 = calloc(Nc + q->len + 31, sizeof(uint32_t));


if (!x1) {
perror("calloc");
return;
}
x2 = calloc(Nc + q->len + 31, sizeof(uint32_t));
if (!x2) {
free(x1);
perror("calloc");
return;
}

for (n = 0; n < 31; n++) {


x2[n] = (seed >> n) & 0x1;
}
x1[0] = 1;

for (n = 0; n < Nc + q->len; n++) {


x1[n + 31] = (x1[n + 3] + x1[n]) & 0x1;
x2[n + 31] = (x2[n + 3] + x2[n + 2] + +x2[n+1] + x2[n]) & 0x1;
}

for (n = 0; n < q->len; n++) {


q->c[n] = (x1[n + Nc] + x2[n + Nc]) & 0x1;
}

free(x1);
free(x2);
}

< My own MatLab code >

Following is the Matlab code that I wrote using Matlab default function only. This would be very inefficient at
machine level. You may not see this kind of implement at professional code example. But I wrote the code
to make it look as closer to the way described in 3GPP document as possible. The purpose of this code is to
give you better understanding of the 3GPP spec.

clear all;

% Initial condition of the polynomia x1(). This is fixed value as described in 36.211
7.2
x1_init = [1 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 ...
0];

% Initial condition of the polynomia x2().


% This is supposed to be used as c_init as described in 36.211 7.2
% But for simplicity, I just se the arbitrary value for now
x2_init = [0 0 0 0 0 0 1 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 ...
0];

% Mpn is the length of the final sequence c()


Mpn = 12*10;

% Nc as defined in 36.211 7.2


Nc = 1600;

% Create a vector(array) for x1() and x2() all initialized with 0


x1 = zeros(1,Nc + Mpn + 31);
x2 = zeros(1,Nc + Mpn + 31);

% Create a vector(array) for c() all initialized with 0


c = zeros(1,Mpn);

% Initialize x1() and x2()


x1(1:31) = x1_init;
x2(1:31) = x2_init;

% generate the m-sequence : x1()


for n = 1 : (Mpn+Nc)
x1(n+31) = mod(x1(n+3) + x1(n),2);
end;

% generate the m-sequence : x2()


for n = 1 : (Mpn+Nc)
x2(n+31) = mod(x2(n+3) + x2(n+2) + x2(n+1) + x2(n),2);
end;

% generate the resulting sequence (Gold Sequence) : c()


for n = 1 : Mpn
c(n)= mod(x1(n+Nc) + x2(n+Nc),2);
end;

% Following has no meaning in practice, but I just plotted the result just to give
you
% overall pattern

subplot(3,1,1);
stem(x1);xlim([1 length(x1)]); ylabel('x1(n)');

subplot(3,1,2);
stem(x1);xlim([1 length(x2)]); ylabel('x2(n)');

subplot(3,1,3);
stem(c);xlim([1 length(c)]); ylabel('c(n)');

Physical Cell ID

As the terminology implies, Physical Cell ID is an indentification of a cell at physical layer. It has similar role
as Primary Scrambling Code of UMTS cell.
This physical cell ID is determined by Primary Sync Signal and Secondary Sync Signal as described below.

Refer to Cell ID Detection ans System Information Detection to know specifically how this physical cell is
used in the process of initial cell detection.
Note 1: There are another type of cell ID which is carried by
SIB1(systeminformationBlockType1.cellAccessRelatedInfo .cellIdentity). When we say just 'Cell ID', it
normally refers to the cell ID carried by SIB1 but many people (including myself -:) get confused with 'cell
id' and 'physical cell id'.
Physical Cell ID is mainly used by UE to decode physical layer data being transmitted by eNodeB. Cell ID in
SIB1 is designed for eNodeB management within the core network, but this one is also used for UE to
identify a specific cell in terms of RRC/NAS layer processing.

Note 2 : Relationship between Physical Cell ID and Cell Specific Reference Signal
The resource element locations for Cell Specific Reference signal is influenced by Physical Cell ID(see NOTE2
of Reference Signal - Downlink for details). In case all other variables are the same, there can be conditions
where the resource element for the reference signal is same even when the physical cell ID is different if
any two Physical Cell IDs (let's call them PCI1 and PCI2) meets the following condition.

PCI1 mod 6 == PCI2 mod 6

If these values are same and the reference signal from two cells may interfere each other and UE would
have difficulties detecting cell.
It means that you should be carefull when you are allocating Physical Cell IDs in eNodeB deployment or
when you assign physical cell IDs for multiple cells on Network Simulator (UE test equipment).

Note 3 : Physical Cell ID and Pseudo-Random Sequence


Most of downlink signal and data is scrambled by a specific Pseudo-Random Sequence and PCI is involved in
the initialization of the pseudo random sequence generation algorithm. Due to this random sequence, even
when exactly same data is transmitted from higher layer, the physical data turns into a unique sequence for
each eNB. Refer to Pseudo-Random Sequence page for the details.

PSS (Primary Synchronization Channel)

PSS is a specific physical layer signal that is used for radio frame synchronization. It has characterstics as
listed below.
Mapped to 72 active sub carriers(6 resource blocks), centered around the DC subcarrier in slot 0
(Subframe 0) and slot 10 (Subframe 5) in FDD.
Mapped to 72 active sub carriers(6 resource blocks), centered around the DC subcarrier in slot
1 (Subframe 1) and slot 11 (Subframe 6) in TDD.
Made up of 62 Zadoff Chu Sequence Values
Used for Downlink Frame Synchronization
One of the critical factors determining Physical Cell ID
May Not be a big issues for most of the case since it would be working fine for most of the device that you
have for test. Otherwise it would have not been given to you for test.

However, If you are a developer working at early stage of LTE chipset, this would be one of the first signal
you have to implement.
Algorithm for PSS Generation
Generating PSS with default Matlab function
Cross Correlation between different PSS
Correlation between a PSS and its PhaseShifted Version
Correlation between a PSS and its Noised Version
Algorithm for PSS Generation

The exact PSS symbol calculation is done by the following formula as described in 36.211 - 6.11.1. For the
specific example of generated PSS, refer to Matlab : Toolbox : LTE : PSS page or PSS with default Matlab
function.

Generating PSS with default Matlab function

Followings are the Matlab code for generating PSS and its result for each NID value.
clear all;

u_shift = [25 29 34];

NID = 0;
d_u = [];

for n = 0:61

u = u_shift(NID+1);

if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

subplot(1,3,1);
plot(real(d_u(1:31)),imag(d_u(1:31)),'ko','MarkerFaceColor',[0 0 0]);
axis([-1.5 1.5 -1.5 1.5]);
title('n=0..30');

subplot(1,3,2);
plot(real(d_u(32:62)),imag(d_u(32:62)),'bo','MarkerFaceColor',[0 0 1]);
axis([-1.5 1.5 -1.5 1.5]);
title('n=31..61');

subplot(1,3,3);
plot(real(d_u(1:62)),imag(d_u(1:62)),'ro','MarkerFaceColor',[1 0 0]);
axis([-1.5 1.5 -1.5 1.5]);
title('n=0..61');

NID Result

0
1

Followings are the numberical result (print out of d_u[ ] array) for each NID;
NID = 0 NID = 1 NID = 2
1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
0.3653 - 0.9309i -0.7331 - 0.6802i -0.7331 + 0.6802i
-0.7331 - 0.6802i 0.0747 + 0.9972i 0.0747 - 0.9972i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
0.9556 + 0.2948i 0.8262 + 0.5633i 0.8262 - 0.5633i
-0.5000 - 0.8660i -0.5000 + 0.8660i -0.5000 - 0.8660i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
-0.2225 - 0.9749i -0.9010 + 0.4339i -0.9010 - 0.4339i
0.6235 + 0.7818i -0.2225 + 0.9749i -0.2225 - 0.9749i
0.4562 + 0.8899i -0.4113 - 0.9115i -0.4113 + 0.9115i
0.3653 - 0.9309i -0.7331 - 0.6802i -0.7331 + 0.6802i
0.9556 + 0.2948i 0.8262 + 0.5633i 0.8262 - 0.5633i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
-0.5000 + 0.8660i -0.5000 - 0.8660i -0.5000 + 0.8660i
-0.7331 + 0.6802i 0.0747 - 0.9972i 0.0747 + 0.9972i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
-0.2225 + 0.9749i -0.9010 - 0.4339i -0.9010 + 0.4339i
0.6235 + 0.7818i -0.2225 + 0.9749i -0.2225 - 0.9749i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
-0.5000 - 0.8660i -0.5000 + 0.8660i -0.5000 - 0.8660i
-0.5000 + 0.8660i -0.5000 - 0.8660i -0.5000 + 0.8660i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
-0.9888 + 0.1490i 0.9556 - 0.2948i 0.9556 + 0.2948i
0.9556 - 0.2948i 0.8262 - 0.5633i 0.8262 + 0.5633i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
-0.2225 - 0.9749i -0.9010 + 0.4339i -0.9010 - 0.4339i
1.0000 - 0.0000i 1.0000 - 0.0000i 1.0000 + 0.0000i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
-0.7331 + 0.6802i 0.0747 - 0.9972i 0.0747 + 0.9972i
-0.9888 + 0.1490i 0.9556 - 0.2948i 0.9556 + 0.2948i
-0.9888 + 0.1490i 0.9556 - 0.2948i 0.9556 + 0.2948i
-0.7331 + 0.6802i 0.0747 - 0.9972i 0.0747 + 0.9972i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
1.0000 - 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i
-0.2225 - 0.9749i -0.9010 + 0.4339i -0.9010 - 0.4339i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
0.9556 - 0.2948i 0.8262 - 0.5633i 0.8262 + 0.5633i
-0.9888 + 0.1490i 0.9556 - 0.2948i 0.9556 + 0.2948i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
-0.5000 + 0.8660i -0.5000 - 0.8660i -0.5000 + 0.8660i
-0.5000 - 0.8660i -0.5000 + 0.8660i -0.5000 - 0.8660i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
0.6235 + 0.7818i -0.2225 + 0.9749i -0.2225 - 0.9749i
-0.2225 + 0.9749i -0.9010 - 0.4339i -0.9010 + 0.4339i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
-0.7331 + 0.6802i 0.0747 - 0.9972i 0.0747 + 0.9972i
-0.5000 + 0.8660i -0.5000 - 0.8660i -0.5000 + 0.8660i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
0.9556 + 0.2948i 0.8262 + 0.5633i 0.8262 - 0.5633i
0.3653 - 0.9309i -0.7331 - 0.6802i -0.7331 + 0.6802i
0.4562 + 0.8899i -0.4113 - 0.9115i -0.4113 + 0.9115i
0.6235 + 0.7818i -0.2225 + 0.9749i -0.2225 - 0.9749i
-0.2225 - 0.9749i -0.9010 + 0.4339i -0.9010 - 0.4339i
0.7660 - 0.6428i 0.7660 + 0.6428i 0.7660 - 0.6428i
-0.5000 - 0.8660i -0.5000 + 0.8660i -0.5000 - 0.8660i
0.9556 + 0.2948i 0.8262 + 0.5633i 0.8262 - 0.5633i
0.9802 + 0.1981i -0.7971 + 0.6038i -0.7971 - 0.6038i
-0.7331 - 0.6802i 0.0747 + 0.9972i 0.0747 - 0.9972i
0.3653 - 0.9309i -0.7331 - 0.6802i -0.7331 + 0.6802i
-0.7971 - 0.6038i -0.9691 - 0.2468i -0.9691 + 0.2468i
1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 - 0.0000i

Cross Correlation between different PSS

Threre are three types of PSSs in LTE. To make all these three type unique (distinctive to each other), it is
designed that the cross correlation between each PSS be very low. Following example shows the cross
correlation between each PSS.
Following is the Matlab source code that produce the result as shown above. I used Matlab dsp package to
calculate the cross correlation. If you don't have Matlab dsp package, try to write your own script for
calculating cross correlation
clear all;

u_shift = [25 29 34];

% Generate PSS for NID = 0

NID = 0;
d_u = [];

for n = 0:61

u = u_shift(NID+1);

if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

d_u_NID0 = d_u';
% Generate PSS for NID = 1

NID = 1;
d_u = [];

for n = 0:61

u = u_shift(NID+1);

if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

d_u_NID1 = d_u';

% Generate PSS for NID = 2

NID = 2;
d_u = [];

for n = 0:61

u = u_shift(NID+1);

if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

d_u_NID2 = d_u';

% Cross Correlation between PSS

Hxcorr = dsp.Crosscorrelator;
taps = 0:61;
taps = taps';

XCorr_0_0 = step(Hxcorr,d_u_NID0,d_u_NID0);
XCorr_0_1 = step(Hxcorr,d_u_NID0,d_u_NID1);
XCorr_0_2 = step(Hxcorr,d_u_NID0,d_u_NID2);
subplot(3,1,1);
stem(taps,abs(XCorr_0_0(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([0 100]);
title('Corr between PSS(NID0) and PSS(NID1)');

subplot(3,1,2);
stem(taps,abs(XCorr_0_1(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([0 100]);
title('Corr between PSS(NID0) and PSS(NID2)');

subplot(3,1,3);
stem(taps,abs(XCorr_0_2(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([0 100]);
title('Corr between PSS(NID0) and PSS(NID3)');

Correlation between a PSS and its PhaseShifted Version

This example shows the correlation between a PSS and its phaseshifted copy. As you see here, the
magnitue (absolute value) of correlation does not changes even if you do phase shift. However, you can
figure out the degree of phase shift by taking the angle of correlation.
With this property, you can identify a PSS in a received signal without worrying about any possible phase
shift that might have occurred by communication channel. In addition, you can figure out the amount of
phase shift by taking the angle value of the correlation and use that value to compensate (undo) the phase
shift.

Correlation between two identical PSS Correlation between a PSS and pi/3 rad shifted vers
Following is the matlab source code that produced the result shown above. I used Matlab dsp package to
calculate the cross correlation. If you don't have Matlab dsp package, try to write your own script for
calculating cross correlation
clear all;

u_shift = [25 29 34];

% Generate PSS for NID = 0

NID = 0;
d_u = [];

for n = 0:61

u = u_shift(NID+1);
if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

phShift = pi/3;

d_u_NID0 = transpose(d_u); % Original PSS


d_u_NID0_PhaseShift = transpose(d_u .* exp(j*phShift)); % PhaseShifted PSS

% Cross Correlation between PSS

Hxcorr = dsp.Crosscorrelator;
taps = 0:61;
taps = taps';

XCorr_0_0_Shifted = step(Hxcorr,d_u_NID0,d_u_NID0_PhaseShift);

subplot(3,2,1);
plot(real(d_u_NID0),imag(d_u_NID0),'ro','MarkerFaceColor',[1 0 0]);
title('PSS');

subplot(3,2,2);
plot(real(d_u_NID0_PhaseShift),imag(d_u_NID0_PhaseShift),'bo','MarkerFaceColor',[0 0
1]);
title(strcat('PSS:',num2str(phShift)));

subplot(3,2,[3 4]);
stem(taps,abs(XCorr_0_0_Shifted(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([0 100]);
title('Abs(Corr) : PSS(NID0) and PhaseShifted PSS(NID0)');

subplot(3,2,[5 6]);
stem(taps,angle(XCorr_0_0_Shifted(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([-pi pi]);
title('Angle(Corr): PSS(NID0) and PhaseShifted PSS(NID0)');

Correlation between a PSS and its Noised Version

This example shows the noise tolerance of PSS. The example on the left shows the correlation between a
PSS and the one with 50 dB SNR (practically no Noise condition) and the example on the right shows the
correlation between a PSS and the one with 10 dB SNR.

Correlation between two identical PSS Correlation between a PSS and noised version
Following is the matlab source code that produced the result shown above. I used Matlab dsp package to
calculate the cross correlation. If you don't have Matlab dsp package, try to write your own script for
calculating cross correlation.
clear all;

u_shift = [25 29 34];

% Generate PSS for NID = 0

NID = 0;
d_u = [];

for n = 0:61

u = u_shift(NID+1);
if n <= 30
d = exp(-j*pi*u*n*(n+1)/63);
else
d = exp(-j*pi*u*(n+1)*(n+2)/63);
end;

d_u = [d_u d];

end;

d_u_NID0 = transpose(d_u);

% Specify SNR in dB. Try setting various different value here and see how the result
changes
SNR_dB = 10;

% Get the number of symbols


N = length(d_u_NID0);

% Calculate Symbol Energy


Eavg = sum(abs(d_u_NID0) .^ 2)/length(N);

% Convert SNR (in dB) to SNR (in Linear)


SNR_lin = 10 .^ (SNR_dB/10);

% Calculate the Sigma (Standard Deviation) of AWGN


awgnSigma = sqrt(Eavg/(2*SNR_lin));

% Generate a sequence of noise with Normal Distribution and rescale it with the sigma
awgn = awgnSigma*(randn(1,N)+j*randn(1,N));
awgn = awgn';

% Add AWGN to PSS


d_u_NID0_Awgn = d_u_NID0 + awgn;

% Cross Correlation between PSS


Hxcorr = dsp.Crosscorrelator;
taps = 0:61;
taps = taps';

XCorr_0_0_AWGN = step(Hxcorr,d_u_NID0,d_u_NID0_Awgn);

subplot(3,2,1);
plot(real(d_u_NID0),imag(d_u_NID0),'ro','MarkerFaceColor',[1 0 0]);
axis([-2 2 -2 2]);
title('PSS');

subplot(3,2,2);
plot(real(d_u_NID0),imag(d_u_NID0),'bo', ...
'MarkerFaceColor',[0 0 1]);
hold on;
plot(real(d_u_NID0_Awgn),imag(d_u_NID0_Awgn),'bo', ...
'MarkerFaceColor',[0 0 0],'MarkerSize',1);
axis([-2 2 -2 2]);
title(strcat('PSS:',num2str(SNR_dB)));
hold off;

subplot(3,2,[3 4]);
stem(taps,abs(XCorr_0_0_AWGN(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([0 100]);
title('Abs(Corr) : PSS(NID0) and Noised PSS(NID0)');

subplot(3,2,[5 6]);
stem(taps,angle(XCorr_0_0_AWGN(62:end)),'bo','MarkerFaceColor',[0 0 1]);
xlim([0 length(taps)]); ylim([-pi pi]);
title('Angle(Corr): PSS(NID0) and Noised PSS(NID0)');
SSS (Secondary Synchronization Channel)

SSS is a specific physical layer signal that is used for radio frame synchronization. It has characterstics as
listed below.
Mapped to 72 active sub carriers(6 resource blocks), centered around the DC subcarrier in slot 0
(Subframe 0) and slot 10 (Subframe 5) in FDD.
o The sequence of SSS in subframe 0 and the one in subframe 5 are different from each other
Made up of 62 Scrambling Sequence (based on m-sequence)
o The value in odd indexed resource element and the one in even indexed resource elements is
generated by different equation
Used for Downlink Frame Synchronization
One of the critical factors determining Physical Cell ID
May Not be a big issues for most of the case since it would be working fine for most of the device that you
have for test. Otherwise it would have not been given to you for test.
However, If you are a developer working at early stage of LTE chipset, this would be one of the first signal
you have to implement.

The exact PSS symbol calculation is done by the following formula as described in 36.211 - 6.11.2. For the
specific example of generated PSS, refer to Matlab : Toolbox : LTE : SSS page.

< Symbol Generation of SSS >


< Resource Element Mapping >
< Matlab code for SSS Generation >

Following is the Matlab code for SSS Generation. This is only for the SSS in subframe 0 and I think you can
easily modify this to generate the sequence for subframe 5.
clear all;

NID1 = 0;
NID2 = 0;
q_prime = floor(NID1/30);
q = floor(((NID1+q_prime*(q_prime+1)/2))/30);
m_prime = NID1 + q *(q+1)/2;
m0 = mod(m_prime, 31);
m1 = mod(m0 + floor(m_prime/31)+1,31);

%%%%%%%%%%%%%%%%% generate d_even() sequence %%%%%%%%%%%%%%%%


% Generate the sequence x_s() : x() for calculating s_tilda()
x_s = zeros(1,31);
x_s(1:5) = [0 0 0 0 1];

for i = 0:25
x_s((i+5)+1) = mod(x_s(i+2+1)+x_s(i+1),2);
end;

% Generate the sequence x_c() : x() for calculating c_tilda()


x_c = zeros(1,31);
x_c(1:5) = [0 0 0 0 1];
for i = 0:25
x_c((i+5)+1) = mod(x_c(i+3+1)+x_c(i+1),2);
end;

% Generate the sequence s_tilda()


s_tilda = zeros(1,31);
for i = 0:30
s_tilda(i+1) = 1 - 2*x_s(i+1);
end;

% Generate the sequence c_tilda()


c_tilda = zeros(1,31);
for i = 0:30
c_tilda(i+1) = 1 - 2*x_c(i+1);
end;

% Generate s0_m0_even()
s0_m0_even = zeros(1,31);
for n = 0:30
s0_m0_even(n+1) = s_tilda(mod(n+m0,31)+1);
end;

% Generate c0_even()
c0_even = zeros(1,31);
for n = 0:30
c0_even(n+1) = c_tilda(mod(n+NID2,31)+1);
end;

% Calculate d_even_sub0
d_even_sub0 = s0_m0_even .* c0_even;

%%%%%%%%%%%%%%%%% generate d_odd() sequence %%%%%%%%%%%%%%%%


% Generate the sequence x_s() : x() for calculating s_tilda()
x_z = zeros(1,31);
x_z(1:5) = [0 0 0 0 1];

for i = 0:25
x_z((i+5)+1) = mod(x_z(i+4+1) + x_z(i+2+1) + x_z(i+1+1)+ x_z(i+1),2);
end;

% Generate the sequence z_tilda()


z_tilda = zeros(1,31);
for i = 0:30
z_tilda(i+1) = 1 - 2*x_z(i+1);
end;

% Generate s1_m1_odd()
s1_m1_odd = zeros(1,31);
for n = 0:30
s1_m1_odd(n+1) = s_tilda(mod(n+m1,31)+1);
end;

% Generate c1_odd()
c1_odd = zeros(1,31);
for n = 0:30
c1_odd(n+1) = c_tilda(mod(n+NID2+3,31)+1);
end;

% Generate z1_m0_odd()
z1_m0_odd = zeros(1,31);
for n = 0:30
z1_m0_odd(n+1) = z_tilda(mod(n+mod(m0,8),31)+1);
end;

% Calculate d_odd_sub0
d_odd_sub0 = s1_m1_odd .* c1_odd .* z1_m0_odd;

% Calculate d_sub0
d_sub0 = zeros(1,62);
d_sub0(1:2:end-1) = d_even_sub0;
d_sub0(2:2:end) = d_odd_sub0;

subplot(1,5,1);
plot(real(d_sub0),imag(d_sub0),'ro','MarkerFaceColor',[1 0 1]);axis([-1.5 1.5 -1.5 1.5]);
subplot(1,5,[2 5]);
plot(real(d_sub0),'ro-');xlim([0 length(d_sub0)]);

Following is numberical output of d_sub0

1 1 1 -1 1 1 1 1 1 -1 1 1 -1 -1 -1 -1
-1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 -1 -1
-1 -1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 1 -1
1 1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1
Reference Signal - Downlink

Most of the channels (e.g, DPSCH, DPCCH, PBCH etc) is for carrying a special information (a sequence of
bits) and they have some higher layer channel connected to them, but Reference Signal is a special signal
that exists only at PHY layer. This is not for delivering any specific information. The purpose of this
Reference Signal is to deliver the reference point for the downlink power.

When UE try to figure out DL power (i.e, the power of the signal from a eNode B), it
measure the power of this reference signal and take it as downlink cell power. Another
important role of reference signal is to help the receiver demodulate the received
signal. Since the reference signal is made up of data known to both transmitter and
reciever, the reciever can figure out how the communication channel destort the data
by comparing the decoded received reference signal and predefined reference signal,
and use the result of this comparison to equalize (post process) the recieved user data.
The process for the reciever to perform this comparision and figure out the
characteristics of a communication channel is called 'Channel Estimation' which is one
of the most critical part of many high-end wireless communication like LTE. (If you are
really interested in the detailed procedure, I would strongly suggest you to study
the basic concept of channel estimation)

These reference signal are carried by multiples of specific Resource Elements in each
slots and the location of the resource elements are specifically determined by antenna
configuration.

As LTE gets evolved into higher version, we are getting more and more reference
signal which is mapped to a specific antenna port. And we are getting more and more
confused as a result -:)

Following shows the reference signals supported by each 3GPP version.

3GPP Reference Signal (Antenna Ports)


36.211 V8.9.0 (2010-01) - Section 6.10 p0,p1,p2,p3,p4,p5

36 211 V9.1.0 (2010-04) - Section 6.10 p0,p1,p2,p3,p4,p5,p6,p7,p8

36.211 V10.7.0 (2013-04) - Section 6.10 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p15,p16,p17,p18,p19,p20,p21,p2

36 211 V11.4.0 (2013-10) - Section 6.10 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p15,p16,p17,p18,p19,p20,p21,p2

For the exact Resource Element locations of each reference signal, refer to following pages.

RS (Reference Signal) - Cell Specific (Antenna port 0,1,2,3)

RS (Reference Signal ) - MBSFN (Antenna Port 4)

RS (Reference Signal ) - UE Specific (Antenna Port 5,7,8,9,10)

RS (Reference Signal ) - Positioning (Antenna Port 6)

RS (Reference Signal ) - CSI (Antenna Port 15,16,17,18,19,20,21,22)

To implement this signal, you need to go through two steps - signal generation and resource allocation. The
details of signal generation and resource allocation would vary on the type of reference signal. In this page,
I would focus mostly on Cell Specific Reference Signal to give you general idea.

Generation of Reference Signal (Symbol Data of the Reference Signal)

Signal generation is done by the following procedure. You would notice that Cell ID is a key parameter for
the sequence and you would guess the sequence will be unique for each Cell ID.
Another thing you would notice here would be that downlink reference signal is a kind of Gold sequence
whereas most of UL reference signal and DL Synchronization signal is based on Zadoff Chu sequence. (c(n)
is a Gold Sequence(Psuedo Random Sequence)and you see the reference signal is generated by combining
the two Gold Sequences). Following equation is based on 36.211 6.10.1.1

< LTE Downlink Refence Signal - Sequence Generation >

One example of reference signal symbol data is as follows. This is generated by Matlab LTE Toolbox and
Refer to Matlab :ToolBox : LTE : Downlink : Cell Specific Reference Signal for the detailed Matlab source.
You don't have to try to understand the details of how this is generated (If you really want to understand
the details of the signal generation. The only way is to create a program on your own based on the
mathematical formula shown above). With this example, you can just build up some intuitive
understandings of reference signal properties. See the constellation, it is QPSK, not Zadoff Chu.

< LTE Downlink Reference Signal - Matlab Tool Box >


This is Cell Specific Reference Signal for
enb.NDLRB = 6;
System Bandwidth = 1.4,
enb.CellRefP = 1;
TM1,
enb.NCellID = 10;
PCI = 10,
enb.NSubframe = 0;
Subframe Number = 0
Resource Allocation (Resource Element Mapping) of Reference Signal

Once you have generated the sequence, next step is to allocate each data point of the sequence to a
specified resource elements. That is done by the following process. The resulting location of the process is
as shown in Reference Signal section of Downlink Frame Structurepage. Following equation is based on
36.211 6.10.1.2

< LTE Downlink Reference Signal - RE Mapping >


Note 1 : The DL Reference Signal (Cell Specific Reference Signal) is mainly determined by Physical Cell ID.
Note 2 : The resource element locations for DL reference signal gets different according to Physical Cell ID,
but there is possibility that the reference signal location with two different physical cell ID can be same if
(PCI1 mod 6) == (PCI2 mod 6). (PCI stands for Physical Cell ID). It means that you should be careful when
you allocate the physical cell ID for multiple cells in a specific area. Following is some of examples of
Reference Signal Location with different physical cell IDs.
(I created following subframe structure using LTE Resource Grid and edited to fit the topics of this page)

< LTE Downlink Reference Signal - SISO - Location based on Physical Cell ID >
If you examined the location of the reference signal (black cells) shown above, you may ask "According to
the RE mapping formula, the reference signal shift is done by ' CellID mod 6' which imply that the reference
signal location would repeat at every 6 CellID interval, but according to the grid shown above it seems the
location repeats at every 3 CellID interval, not 6. Because of this, UE may experience some degree of RS
interference at every 3 CellID intervals even though RS location is shifted by 'CellID mod 6'. (You may see
this kind of interference at Intra Frequency Interference between LTE and LTE with Varying Physical Cell ID
(PCI) )

Actually this is a kind of illusion. In reality the location repeats at every 6 cellID, but the interval of the
reference signal in frequency domain (vertical direction) repeats at every 3 RE(resource element) and all
the reference signal is marked in a same color (black). That's why it looks as if it repeat at every 3 CellID.
To remove this confusion, I marked the RS at a symbol and marked in different color with 6 REs in vertical
direction(I picked only one symbol.. it was too much work to mark different colors manually in Windows
Paint :). Now you may (hopefuly) see the shift by 6 interval.

< LTE Downlink Reference Signal - SISO - Location based on Physical Cell ID >
Reference Signal (Antenna Port Number) vs Transmission Mode

Reference Signals are used for various purpose and the type of reference signal being used varies
depending on transmission mode. Some of the possible combination of refernece signal and transmission
mode are as follows.
Reference Signal (Antenna Port)
No of No of No of DCI
TM No of CW
Layers Tx Rx Format Control CH PDSCH CSI Meas UE Specif
TM1 1 1 1 1 1, 1A p0 p0 p0 N/A
2 2 1, 1A p0,p1 p0,p1 p0,p1 N/A
TM2 1 2
4 2 1, 1A p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

2 2 2 1A p0,p1 p0,p1 p0,p1 N/A


1
TM3 4 4 2 1A p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

2 2 2 2 2A p0,p1 p0,p1 p0,p1 N/A


4 4 2 2A p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

1 1 1 1A p0 p0 p0 N/A

1 2 2 2 2 p0,p1 p0,p1 p0,p1 N/A


TM4 4 4 2 2 p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A
2 2 2 2 p0,p1 p0,p1 p0,p1 N/A
2
4 4 2 2 p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

1 2 2 1D p0,p1 p0,p1 p0,p1 N/A

2 2 2 1A p0,p1 p0,p1 p0,p1 N/A


TM5 1
1 4 2 1A,1D p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

4 4 2 1A,1D p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A


2 2 2 1A,1B p0,p1 p0,p1 p0,p1 N/A
TM6 1
4 4 2 1A,1B p0,p1,p2,p3 p0,p1,p2,p3 p0,p1,p2,p3 N/A

1 1 1 1 p0 p5 ? p5

1 2 2 1 p0,p1 p5 ? p5

TM7 1 1 4 2 1 p0,p1,p3,p4 p5 ? p5

2 2 2 1A p0,p1 p0,p1 p0,p1 N/A

4 4 2 1A p0,p1,p3,p4 p0,p1,p3,p4 p0,p1,p3,p4 N/A

1 2 2 2B p0 p7 or p8 ? p7 or p8

1 2 2 2 1A p0,p1 p7 or p8 ? p7 or p8

TM8 4 4 2 1A p0,p1,p3,p4 p7 or p8 ? p7 or p8

2 2 2 2B p0,p1 p7,p8 ? p7,p8


2
4 4 2 2B p0,p1,p3,p4 p7,p8 ? p7,p8

1 2 2 2 1A p0,p1 p0,p1 p0,p1 N/A

2 2 2 2C p0,p1 p7,p8 p15,p16 p7,p8


TM9
2 4 4 2 2C p0,p1 p7,p8 p15,p16,p17,p18 p7,p8
p15,p16,p17,p18
8 8 2 2C p0,p1,p3,p4 p7,p8 p7,p8
p19,p20,p21,p22
Note : ',' indicate "AND". (E.g, p0, p1 means that p0 AND p1 are used)
Note : UE Specific means "UE Specific Reference Signal, UE Specific Antenna ports" or is called "DMRS
(Demodulation Reference Signal) as well.
Note : "No of Tx" means the number of Tx antenna on eNodeB and "No of Rx" means number of Rx antenna
on UE
Note : TM9 can have much more combinations, but I listed only on the combination I have seen until now
(Jun 2014)
Communication - Channel Estimation
As I explained in other pages, in all communication the signal goes through a medium (called channel) and
the signal gets distorted or various noise is added to the signal while the signal goes through the channel.
To properly decode the received signal without much errors are to remove the distortion and noise applied
by the channel from the received signal. To do this, the first step is to figure out the characteristics of the
channel that the signal has gone through. The technique/process to characterize the channel is called
'channel estimation'. This process would be illustrated as below.

There are many different ways for channel estimation, but fundamental concepts are similar. The process is
done as follows.

i) set a mathematical model to correlate 'transmitted signal' and 'recieved signal' using 'channel' matrix.
ii) Transmit a known signal (we normally called this as 'reference signal' or 'pilot signal') and detect the
received signal.
iii) By comparing the transmitted signal and the received signal, we can figure out each elements of channel
matrix.
As an example of this process, I will briefly describes on how this process in LTE. Of course, I cannot write
down full details of this process in LTE and a lot of details are up to implementation (meaning the detailed
algorithm may vary with each specific chipset implmenetation). However, overall concept would be similar.
General Algorithm
Channel Estimation for SISO
o Estimation of Chnnel Coefficient
o Estimation of Noise
Channel Estimation for 2 x 2 MIMO
o Estimation of Chnnel Coefficient
o Estimation of Noise

General Algorithm

How can we figure out the properties of the channel ? i.e, how can we estimate the channel ? In a very high
level view, it can be illustrated as below. This illustration says followings :
i) we embed the set of predefined signal (This is called a reference signal)
ii) As these reference signal go through the channel, it get distorted (attenuated, phase-shifted,
noised) along with other signals
iii) we detect/decode the received reference signal at the reciever
iv) Compare the transmitted reference signal and the received reference signal and find correlation
between them.
Channel Estimation for SISO

Now let's think of the case of LTE SISO case and see how we can estimate channel properties (channel
coefficient and noise estimate). Since this is SISO, reference signal is embedded onto only one antenna port
(port 0). The vertical line in the resource map represents frequency domain. So I indexed each of reference
signal with f1, f2, f3...fn. Each reference symbol can be a complex number (I/Q data) that can be plotted as
shown below. Each complex number (Reference Symbol) on the left (transmission side) is modified
(distorted) to each corresponding symbols on the right (recieved symbol). Channel Estimation is the
process of finding correlation between the array of complex numbers on the left and the array of complex
numbers on the right.
The detailed method of the estimation can very depending on the implementation. The method that will be
described here is based on the Open Source : srsLTE (Refer to [1])
< Estimation of Channel Coefficient >

Since this is only one antenna, system model for each transmitted reference signal and received reference
signal can be represented as follows. y() represents the array of received reference signal, x() represents
the array of transmitted reference signal() and h() represents the array of channel coefficient. f1, f2,... just
integer indices.

We know what x() are because it is given and the y() is also know because it is measured/detected from the
reciever. With these, we can easily calculate coefficient array as shown below.
Now we have all the channel coefficient for the location where reference signals are located. But we need
channel coeffcient at all the location including those points where there is no reference signal. It means that
we need to figure out the channel coefficient for those location with no reference signal. The most common
way to do this to this is to interpolate the measured coefficient array. In case of srsLTE, it does a averaging
first and then did interpolation over the averaged channel coefficient.

< Estimation of Noise >

Next step is to estimate the noise properties. Theoretically, the noise can be calculated as below.
However, what we need is the statistical properties of the noise .. not the exact noise value. we can
estimate the noise using only measured channel coefficient and averaged channel as shown below (Actually
exact noise value does not have much meaning because the noise value keep changes and it is of no use to
use those specific noise value). In srsLTE, the author used this method.

Channel Estimation for 2 x 2 MIMO

Let's assume that we have a communication system as shown below. x(t) indicates the transmitted signal
and y(t) indicates the received signal. When x(t) gets transmitted into the air (channel), it gets distorted
and gets various noise and may interfere each other. so the recieved signal y(t) cannot be same as the
transmitted signal x(t).
This relation among the transmitted signal, received signal and channel matrix can be modeled in
mathematical form as shown below.

In this equation, we know the value x1,x2 (known transmitted signals) and y1,y2 (detected/recieved
signal). The parts that we don't know is H matrix and noise (n1,n2).
For simplicity, let's assume that there is no noise in this channel, meaning that we can set n1, n2 to be 0.
(Of course, in real channel there are always noise and estimate noise is a very important part of channel
estimation, but we assume in this example that there is no noise just to make it simple. I will add later the
case with noise when I have better knowledge to describe the case in plain language).

Since we have a mathematical model, the next step is to transmit a known signal (reference signal) and
figure out channel parameter from the reference signal.

Let's suppose we have sent a known signal with the amplitude of 1 through only one antenna and the other
antenna is OFF now. Since the signal propagate through the air and it will be detected by both antenna at
the reciever side. Now let's assume that the first antenna received the reference signal with the amplitude
of 0.8 and the second antenna received it with amplitude of 0.2. With this result, we can figure out one row
of channel matrix (H) as shown below.
Let's suppose we have sent a known signal with the amplitude of 1 through only the other (second) antenna
and the first antenna is OFF now. Since the signal propagate through the air and it will be detected by both
antenna at the reciever side. Now let's assume that the first antenna received the reference signal with the
amplitude of 0.3 and the second antenna received it with amplitude of 0.7. With this result, we can figure
out one row of channel matrix (H) as shown below.
Simple enough ? I think (hope) that you didn't have any problems with understanding this basic concept.
But if you use this method exactly as described above, there would be some inefficiency. According to the
concept explained above, there should be a moment when you transmit only reference signal without real
data just to estimate the channel information, meaning that data rate will be decreased because of channel
estimation process. To remove this inefficiency, the real communication system transmit the reference
signal and data simulteneously.
Now the question is "How can we implement the concept described above while transmitting the reference
signal and data simultaneously ?". There can be several different ways to do this and different
communication system would use a little bit of different methodology.

In case of LTE as an example, we use the method described as shown below. In case of 2 x 2 MIMO in LTE,
each sub frame has different locations for reference signal for each antenna. The subframe for antenna 0
transmitted the reference signal allocated for antenna 0 and does not transmit any signal at the reference
signal allocated for antenna 1. The subframe for antenna 1 transmitted the reference signal allocated for
antenna 1 and does not transmit any signal at the reference signal allocated for antenna 0. So if you decode
at the two reciever antenna the resource elements allocated for reference signal for antenna 0, you can
estimate h11, h12. (here we also assume that there is no noise for simplicity). If you decode at the two
reciever antenna the resource elements allocated for reference signal for antenna 1, you can estimate h21,
h22. (here we also assume that there is no noise for simplicity).
< Estimation of Chnnel Coefficient >

The process illustrated above is to measure H matrix for one specific points in frequency domain in a LTE
OFDMA symbol. If you apply the measured H value as it is in the process of decoding other parts of symbol,
the accuracy of the decoded symbol might not be as good as it can be because the measured data used in
previous step would contain some level of noise. So in real application, some kind of post processing is
applied to the H values measured by the method described above and in this post processing procedure we
could figure out the overal statistical properties of Noise (e.g, mean, variance and statistical distribution of
the noise). One thing to keep in mind is that the specific noise value obtained in this process does not have
much meaning by itself. The specific value obtained from the reference signal would not be same as the
noise value to decode other data (non-reference signal) because the noise value changes randomly.
However, the overal properties of those random noise can be an important information (e.g, used in SNR
estimation etc).

Before moving on, let's briefly think of the mathematical model again. Even though we decribe a system
equation as follows including the noise term, it doesn't mean that you can directly measure the noise. It is
impossible. This equation just show that the detected signal (y) contains a certain portions of noise
component.
So, when we measure the channel coefficient, we used the equipment that does not have noise term as
shown below.

In specific application in LTE, we have multiple measurement points (multiple reference signal) within a
OFDM symbol. These measurement points are represented on frequency domain. So, let's rewrite channel
matrix as follows to indicate the measurement point of each channel matrix.

Now let's assume that you have measured H matrix across a whole OFDM symbol, you would have multiple
H matrix as below, each of which indicate the H matrix at one specific frequency.

Now you have an array of H matrix. This array is made up of four different group, each of the group is
highlighted with different colors as shown below.
When you apply the post processing algorithm, the algorithm needs to be applied to each of these groups
separately. So for simplicity, I rearranged the array of H matrix into multiple of independent arrays (4
arrays in this case) as shown below.

For each of these arrays, I will do the same processing as illustrated below. (Each chipset maker may apply
apply a little bit different method, but overall idea would be similar). In the method illustrated below, the
data (the array of channel coefficient in each frequency points) is applied with IFFT, meaning the dta is
converted into a time domain resulting in an array of time domain data labeled as (2). Actually this is a
impulse response of the specific channel path. And then we apply a specific filtering (or windowing) to this
time domain data. In this example, replace the data from a certain point with zero and creating the result
labeled as (3). You may apply a more sophisticated filter or windowing instead of this kind of simple
zeroing. And then, by converting the filtered channel impulse data back to frequency domain, I get the
filtered channel coefficient and I use that value as 'Estimated channel coefficient' in the processing of
decoding other recieved signal (i.e, decoding non-reference data).
By doing the same process to all the four array, you get the four arrays of 'Estimated Channel Coefficient
Array'. From these four arrays, you can reconstructed the array of estimated channel matrix as follows.

< Estimation of Noise >


With this estimated channel matrix, you can estimate the noise values at each point using the following
equation. This is same as original system equation at the beginning of this page except that H matrix is
replaced by 'Estimated H' matrix and now we know all the values except noise value. So, by plugging in all
the know values we can calculate (estimate) noise values at each measurement point.

If you apply this equation for all the measurement point, you would get the noise values for all the
measurement point and from those calculated noise value you can get the statistical properties of the noise.
As mentioned above, the each individual noise value calculated here does not have much meaning because
the value cannot be directly applicable to decoding other signal (non-reference signal), but the statistical
characteristics of these noise can be a very useful information to determine the nature of the channel.

You might also like