4G/LTE - WiFi Offload |
||
DMRS - PUSCH - 1RB
This is an example of implementation. In this specific example, I used the case with single RB and group hopping/sequence hopping disabled just to simplify the code. You may revise/extend this code for more general case like 2 RB case or greather than 2 RB case. clear all;
% 36.211 (v12.30) Table 5.5.1.2-1: Psi_1RB = ... [ ... -1 1 3 -3 3 3 1 1 3 1 -3 3; ... 1 1 3 3 3 -1 1 -3 -3 1 -3 3; ... 1 1 -3 -3 -3 -1 -3 -3 1 -3 1 -1; ... -1 1 1 1 1 -1 -3 -3 1 -3 3 -1; ... -1 3 1 -1 1 -1 -3 -1 1 -1 1 3; ... 1 -3 3 -1 -1 1 1 -1 -1 3 -3 1; ... -1 3 -3 -3 -3 3 1 -1 3 3 -3 1; ... -3 -1 -1 -1 1 -3 3 -1 1 -3 3 1; ... 1 -3 3 1 -1 -1 -1 1 1 3 -1 1; ... 1 -3 -1 3 3 -1 -3 1 1 1 1 1; ... -1 3 -1 1 1 -3 -3 -1 -3 -3 3 -1; ... 3 1 -1 -1 3 3 -3 1 3 1 3 3; ... 1 -3 1 1 -3 1 1 1 -3 -3 -3 1; ... 3 3 -3 3 -3 1 1 3 -1 -3 3 3; ... -3 1 -1 -3 -1 3 1 3 3 3 -1 1; ... 3 -1 1 -3 -1 -1 1 1 3 1 -1 -3; ... 1 3 1 -1 1 3 3 3 -1 -1 3 -1; ... -3 1 1 3 -3 3 -3 -3 3 1 3 -1; ... -3 3 1 1 -3 1 -3 -3 -1 -1 1 -3; ... -1 3 1 3 1 -1 -1 3 -3 -1 -3 -1; ... -1 -3 1 1 1 1 3 1 -1 1 -3 -1; ... -1 3 -1 1 -3 -3 -3 -3 -3 1 -1 -3; ... 1 1 -3 -3 -3 -3 -1 3 -3 1 -3 3; ... 1 1 -1 -3 -1 -3 1 -1 1 3 -1 1; ... 1 1 3 1 3 3 -1 1 -1 -3 -3 1; ... 1 -3 3 3 1 3 3 1 -3 -1 -1 3; ... 1 3 -3 -3 3 -3 1 -1 -1 3 -1 -3; ... -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1 3 -3 -3 1 -1 -1 1 3 ... ];
% UL reference signal prime numbers less than 2048 from 3GPP TS 36.211 v8.x % (ts_136211v080900p.pdf)section 5.5.1.1 PrimeNo = ... [ ... 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, ... 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ... 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, ... 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, ... 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, ... 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, ... 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, ... 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, ... 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, ... 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, ... 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, ... 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, ... 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, ... 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, ... 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, ... 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, ... 947, 953, 967, 971, 977, 983, 991, 997,1009,1013, ... 1019,1021,1031,1033,1039,1049,1051,1061,1063,1069, ... 1087,1091,1093,1097,1103,1109,1117,1123,1129,1151, ... 1153,1163,1171,1181,1187,1193,1201,1213,1217,1223, ... 1229,1231,1237,1249,1259,1277,1279,1283,1289,1291, ... 1297,1301,1303,1307,1319,1321,1327,1361,1367,1373, ... 1381,1399,1409,1423,1427,1429,1433,1439,1447,1451, ... 1453,1459,1471,1481,1483,1487,1489,1493,1499,1511, ... 1523,1531,1543,1549,1553,1559,1567,1571,1579,1583, ... 1597,1601,1607,1609,1613,1619,1621,1627,1637,1657, ... 1663,1667,1669,1693,1697,1699,1709,1721,1723,1733, ... 1741,1747,1753,1759,1777,1783,1787,1789,1801,1811, ... 1823,1831,1847,1861,1867,1871,1873,1877,1879,1889, ... 1901,1907,1913,1931,1933,1949,1951,1973,1979,1987, ... 1993,1997,1999,2003,2011,2017,2027,2029,2039 ... ];
% 36.211 v8.x (ts_136211v080900p.pdf) Table 5.5.2.1.1-2 N_1_DMRS = [0 2 3 4 6 8 9 10];
% 36.211 v8.x (ts_136211v080900p.pdf) Table 5.5.2.1.1-2 N_2_DMRS = [0 6 3 4 2 8 10 9];
cyclicShift = 0; N_UL_symb = 7; N_slot = 0;
% Calculate n_PRS_ns ====================================================
% Calculate c_init that will be used to initialize x2(n) N_Cell_ID = 5; Delta_ss = 0; f_ss_PUCCH = mod(N_Cell_ID,30); f_ss_PUSCH = mode(f_ss_PUCCH + Delta_ss,30); c_init = floor(N_Cell_ID / 30) * 2^5 + f_ss_PUSCH;
% initialization vector for x1(n) 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];
% Convert c_init (Decimal) into binary vector % c_init : a decimal number to be converted into a binary sequence % 31 indicates the length of the binary sequence % 2 indicates the base of the sequence. Meaning this is a binary sequence x2_init = de2bi(c_init, 31, 2,'right-msb');
% set the length of c(n). This can be from 1 to '8 * N_UL_symb * 20 + 7' % I set the maximum possible number (this is derived from "8 * N_UL_symb * 20 + 7") Mpn = 8 * N_UL_symb * 20 + 7;
% 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); x2 = zeros(1,Nc + 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)-31) x1(n+31) = mod(x1(n+3) + x1(n),2); end;
% generate the m-sequence : x2() for n = 1 : ((Mpn+Nc)-31) x2(n+31) = mod(x2(n+3) + x2(n+2) + x2(n+1) + x2(n),2); end;
% Calculate p_PRS n_PRS_ns = 0; for i = 0 : 7 n = 8 * N_UL_symb * N_slot + i c = mod(x1(n+Nc+1) + x2(n+Nc+1),2) n_PRS_ns = n_PRS_ns + c*(2^i) end;
% Calculate n_cs ===================================================== % I put "cyclicShift + 1" in stead of cyclicShift since the array index % in Matlab starts with 1 in stead of 0. n_cs = mod( N_1_DMRS(cyclicShift+1) + N_2_DMRS(cyclicShift+1) + n_PRS_ns, 12);
% Calculate alpha ==================================================== alpha = 2*pi*n_cs / 12;
% Calculate r_a_u_v for 1 RB case ==================================== v = 0; % group number u = f_ss_PUSCH; % sequence number n = 0:11; phaseShift = exp(j*alpha*n); r_a_u_v = phaseShift .* exp(j*Psi_1RB(u+1,:)*pi/4);
% plot DMRS =========================================================== plot(real(r_a_u_v),imag(r_a_u_v),'ro','MarkerFaceColor',[1 0 0]); axis([-1.5 1.5 -1.5 1.5]);
I did some experiment of the code with changing N_Cell_ID and got the result as follows.
This is just for reference. I just plotted the all the possible 30 patterns of PUSCH 1RB DMRS with the following condition.
Cell ID = 0 No of RB = 1 Slot Number = 0 Following is the routine for plotting. phaseShift is the value calculated in the routine listed above. %plot DMRS for all u ================================================= for i = 1:30 r_a_u_v = phaseShift .* exp(j*Psi_1RB(i,:)*pi/4); subplot(6,5,i); plot(real(r_a_u_v),imag(r_a_u_v),'ro','MarkerFaceColor',[1 0 0]); axis([-1.5 1.5 -1.5 1.5]); end;
|
||