1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % Copyright (c) 2021 Intel.
5 % Licensed under the Apache License, Version 2.0 (the "License");
6 % you may not use this file except in compliance with the License.
7 % You may obtain a copy of the License at
9 % http://www.apache.org/licenses/LICENSE-2.0
11 % Unless required by applicable law or agreed to in writing, software
12 % distributed under the License is distributed on an "AS IS" BASIS,
13 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 % See the License for the specific language governing permissions and
15 % limitations under the License.
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20 %This script was tested with GNU Octave, version 3.8.2 or Matlab 9.2.0.538062 (R2017a)
25 % 5MHz 10MHz 15MHz 20 MHz
26 nLteNumRbsPerSymF1 = ...
28 % 5MHz 10MHz 15MHz 20 MHz
29 [25, 50, 75, 100] % Numerology 0 (15KHz)
32 % 5MHz 10MHz 15MHz 20 MHz 25 MHz 30 MHz 40 MHz 50MHz 60 MHz 70 MHz 80 MHz 90 MHz 100 MHz
35 % 5MHz 10MHz 15MHz 20 MHz 25 MHz 30 MHz 40 MHz 50MHz 60 MHz 70 MHz 80 MHz 90 MHz 100 MHz
36 [25, 52, 79, 106, 133, 160, 216, 270, 0, 0, 0, 0, 0] % Numerology 0 (15KHz)
37 [11, 24, 38, 51, 65, 78, 106, 133, 162, 0, 217, 245, 273] % Numerology 1 (30KHz)
38 [0, 11, 18, 24, 31, 38, 51, 65, 79, 0, 107, 121, 135] % Numerology 2 (60KHz)
43 % 50Mhz 100MHz 200MHz 400MHz
44 [66, 132, 264, 0] % Numerology 2 (60KHz)
45 [32, 66, 132, 264] % Numerology 3 (120KHz)
48 % total number of tests
50 tech_all = ... % 0 - NR 1- LTE
52 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2
57 true, true, true, true, false, true, true, true, true, true, true, true, true, true, true
62 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
67 5, 10, 20, 100, 100, 100, 20, 10, 5, 20, 10, 5, 20, 10, 5
72 4, 4, 4, 4, 4, 8, 4, 4, 4, 8, 8, 8, 4, 4, 4
77 false, false, false, false, false, true, false, false, false, true, true, true, false, false, false
82 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
84 path_to_usecase_all = ...
86 "./usecase/cat_a/mu0_5mhz/";
87 "./usecase/cat_a/mu0_10mhz/";
88 "./usecase/cat_a/mu0_20mhz/";
89 "./usecase/cat_a/mu1_100mhz/";
90 "./usecase/cat_a/mu3_100mhz/";
91 "./usecase/cat_b/mu1_100mhz/";
92 "./usecase/lte_a/mu0_20mhz/";
93 "./usecase/lte_a/mu0_10mhz/";
94 "./usecase/lte_a/mu0_5mhz/";
95 "./usecase/lte_b/mu0_20mhz/";
96 "./usecase/lte_b/mu0_10mhz/";
97 "./usecase/lte_b/mu0_5mhz/";
98 "./usecase/dss/mu0_20mhz/";
99 "./usecase/dss/mu0_10mhz/";
100 "./usecase/dss/mu0_5mhz/";
103 path_to_usecase_all = cellstr(path_to_usecase_all)
107 20,20,20,20,20,20,20,20,20,10,10,10,20,20,20
110 %select mu and bw to generate test files
111 for test_num =(1:1:tests_total)
113 isLte=tech_all(test_num) %false
114 sub6=sub6_all(test_num) %false
115 mu=mu_all(test_num) % 0,1, or 3
116 bw=bw_all(test_num) %5,10,20,100 MHz
117 ant_num = ant_num_all(test_num)
118 bfw_gen=bfw_gen_all(test_num)
119 trx = trx_all(test_num)
120 size(path_to_usecase_all)
121 path_to_usecase = path_to_usecase_all(test_num)
123 nSlots=nSlots_all(test_num) % any 40 and 160
131 numRBs = nLteNumRbsPerSymF1(nNumerology,0+1);
133 numRBs = nLteNumRbsPerSymF1(nNumerology,1+1);
135 numRBs = nLteNumRbsPerSymF1(nNumerology,2+1);
137 numRBs = nLteNumRbsPerSymF1(nNumerology,3+1);
147 numRBs = nNumRbsPerSymF1(nNumerology,0+1);
149 numRBs = nNumRbsPerSymF1(nNumerology,1+1);
151 numRBs = nNumRbsPerSymF1(nNumerology,2+1);
153 numRBs = nNumRbsPerSymF1(nNumerology,3+1);
155 numRBs = nNumRbsPerSymF1(nNumerology,4+1);
157 numRBs = nNumRbsPerSymF1(nNumerology,5+1);
159 numRBs = nNumRbsPerSymF1(nNumerology,6+1);
161 numRBs = nNumRbsPerSymF1(nNumerology,7+1);
163 numRBs = nNumRbsPerSymF1(nNumerology,8+1);
165 numRBs = nNumRbsPerSymF1(nNumerology,9+1);
167 numRBs = nNumRbsPerSymF1(nNumerology,10+1);
169 numRBs = nNumRbsPerSymF1(nNumerology,11+1);
171 numRBs = nNumRbsPerSymF1(nNumerology,12+1);
173 disp('Unknown BW && mu')
178 if (mu >=2) && (mu <= 3)
182 numRBs = nNumRbsPerSymF2(nNumerology-1,0+1);
184 numRBs = nNumRbsPerSymF2(nNumerology-1,1+1);
186 numRBs = nNumRbsPerSymF2(nNumerology-1,2+1);
188 numRBs = nNumRbsPerSymF2(nNumerology-1,3+1);
190 disp('Unknown BW && mu')
196 disp('Incorrect Numerology and BW combination.')
205 %ifft_in = load('ifft_in.txt')
208 ifft_in = [[1:1:(numRBs*12)]', [1:1:(numRBs*12)]'];
211 for (i=1:1:nSlots*14-1)
212 ifft_in_1 = ifft_in + i;
213 ant_c = [ant_c; ifft_in_1];
216 %write files for IQ samples
217 for ant = 1:1:ant_num
219 antX_16=int16(antX.');
220 file_name = strcat(path_to_usecase,"ant_", num2str(ant-1),".bin");
222 fileID = fopen(file_name,'w');
223 fwrite(fileID, antX_16, 'int16');
228 disp('Generate BF Weights per RB')
230 %seed to make it repeatable
233 %random channel matrix for single sym on syngle RB
234 H = (rand(trx,ant_num) + 1j*rand(trx,ant_num));
237 % W_dl = H^*(H^TH^*)^-1
238 % W_ul = ((H^H*H)^-1)H^H
239 % where H^* - conjugate
241 % H^H - conjugate transpose
242 W_dl = conj(H)*(transpose(H)*conj(H))^-1; %weights for DL
243 W_ul = ((ctranspose(H)*H)^-1)*ctranspose(H); %weights for UL
247 for ant = 1:1:ant_num
251 % adjust channel per each RB
252 for iPrb = 1:1:numRBs
253 bfw_per_sym = [ bfw_per_sym, [real((W_dl(:, ant).'))*iPrb; imag((W_dl(:, ant).'))*iPrb]];
257 %reuse channel for all symbols
258 for (slot_idx=1:1:nSlots*14)
259 bfw_all_slots = [bfw_all_slots, bfw_per_sym];
262 bfw_all_slots_int = int16(bfw_all_slots./max(max(abs((bfw_all_slots.')))).*2^15);
264 %write files for IQ samples
265 antX_16=bfw_all_slots_int.';
266 file_name = strcat(path_to_usecase,"dl_bfw_ue_", num2str(ant-1),".bin");
268 fileID = fopen(file_name,'w');
269 fwrite(fileID,antX_16, 'int16');
274 % adjust channel per each RB
275 for iPrb = 1:1:numRBs
276 bfw_per_sym = [ bfw_per_sym, [real((W_ul(:, ant).'))*iPrb; imag((W_ul(:, ant).'))*iPrb]];
280 %reuse channel for all symbols
281 for (slot_idx=1:1:nSlots*14)
282 bfw_all_slots = [bfw_all_slots, bfw_per_sym];
285 bfw_all_slots_int = int16(bfw_all_slots./max(max(abs((bfw_all_slots.')))).*2^15);
287 %write files for IQ samples
288 antX_16=bfw_all_slots_int.';
289 file_name = strcat(path_to_usecase,"ul_bfw_ue_", num2str(ant-1),".bin");
291 fileID = fopen(file_name,'w');
292 fwrite(fileID,antX_16, 'int16');
298 %% generate IQ file with valid constellation, for DL modulation compression
300 %constellation = [4096, -4096];
301 %constellation = [2590, 7770, -7770, -2590];
302 %constellation = [633, 1897, 3161, 4425, -4424, -3160, -1897, -633];
303 constellation_all = [628, 1885, 3141, 4398, 5654, 6911, 8167, 9424, -9424, -8167, -6911, -5654, -4398, -3141, -1885, -628;
304 633, 1897, 3161, 4425, -4424, -3160, -1897, -633, 633, 1897, 3161, 4425, -4424, -3160, -1897, -633;
305 2590, 7770, -7770, -2590, 2590, 7770, -7770, -2590, 2590, 7770, -7770, -2590, 2590, 7770, -7770, -2590;
306 4096, -4096, 4096, -4096, 4096, -4096, 4096, -4096, 4096, -4096, 4096, -4096, 4096, -4096, 4096, -4096;
313 "./usecase/cat_a/mu1_100mhz/";
314 "./usecase/cat_b/mu1_100mhz/";
315 "./usecase/cat_b/mu1_100mhz/";
316 "./usecase/cat_b/mu1_100mhz/";
318 path_all = cellstr(path_all)
326 modtype_all = cellstr(modtype_all)
329 path = path_all(test_num);
330 constellation=constellation_all(test_num,:);
331 modtype = modtype_all(test_num);
333 ant_in = rand(2*12*numRBs*14*nSlots,1); % random constellation
334 ant_in = 1+round(15 * ant_in);
335 ant_out = constellation(ant_in);
336 file_name = strcat(path,modtype, num2str(ant-1),".bin");
338 fileID = fopen(file_name,'w');
339 fwrite(fileID, ant_out, 'int16');