-
Notifications
You must be signed in to change notification settings - Fork 14
/
CheckPUCCHF0Conformance.m
378 lines (352 loc) · 15.4 KB
/
CheckPUCCHF0Conformance.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
%CheckPUCCHF0Conformance Battery of conformance for the PUCCH Format 0.
% This class, based on the matlab.unittest.TestCase framework, performs a battery
% of conformance tests on the PUCCH Format 0. Specifically, the tests are a
% subset of those described in TS38.104 Section 8.3.2 and TS38.141 Section 8.3.1.
% The tests consist in running a short simulation and ensuring that some metrics
% (i.e. ACK detection rate or false ACK detection rate, depending on the case)
% meet their target value.
%
% CheckPUCCHF0Conformance Properties (TestParameter):
%
% TestConfig - PUCCH Format 0 test configurations.
%
% CheckPUCCHF0Conformance Methods (Test, TestTags = {'conformance'}):
%
% checkPUCCHF0detection - Estimates the ACK detection rate for the given
% PUCCH Format 0 configuration.
% checkPUCCHF0falseack - Estimates the false ACK detection rate for the given
% PUCCH Format 0 configuration.
%
% Example
% runtests('CheckPUCCHF0Conformance')
%
% See also matlab.unittest, PUCCHBLER.
% Copyright 2021-2024 Software Radio Systems Limited
%
% This file is part of srsRAN-matlab.
%
% srsRAN-matlab is free software: you can redistribute it and/or
% modify it under the terms of the BSD 2-Clause License.
%
% srsRAN-matlab is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% BSD 2-Clause License for more details.
%
% A copy of the BSD 2-Clause License can be found in the LICENSE
% file in the top-level directory of this distribution.
classdef CheckPUCCHF0Conformance < matlab.unittest.TestCase
properties (TestParameter)
%PUCCH Format 0 test configurations.
% Defines, for each test, the bandwidth, the subcarrier spacing, the number
% of receive antennas and the target SNR.
TestConfig = generateTestConfig()
end % of properties (TestParameter)
methods (Test, TestTags = {'conformance'})
function checkPUCCHF0detection(obj, TestConfig)
%Estimates the ACK detection rate for the given PUCCH Format 0 configuration.
% The probability of ACK detection is defined as the probability of detecting an
% ACK bit when the signal is present. For more information, see TS38.104 Section 8.3.2.1
% and TS38.141 Section 8.3.1.1.
import matlab.unittest.fixtures.CurrentFolderFixture
obj.applyFixture(CurrentFolderFixture('../apps/simulators/PUCCHBLER'));
pp = obj.preparePUCCH(TestConfig);
pp.TestType = 'Detection';
mu = TestConfig.SubcarrierSpacing / 15 - 1;
nFrames = 2000 / 2^mu;
try
pp(TestConfig.SNR, nFrames);
catch ME
obj.assertFail(['PUCCHBLER simulation failed with error: ', ME.message]);
end
obj.verifyGreaterThanOrEqual(pp.ACKDetectionRateSRS, 0.99, 'WARNING: The PUCCH F0 ACK detection rate should not be lower than 99%.');
obj.assertGreaterThanOrEqual(pp.ACKDetectionRateSRS, 0.95, ...
'ERROR: The PUCCH F0 ACK detection rate is below the hard acceptance threshold of 95%.');
% TODO: export Detection Rate (and possibly other metrics) to grafana.
end % of function checkPUCCHF0detection(obj, TestConfig)
function checkPUCCHF0falseack(obj, TestConfig)
%Estimates the false ACK detection rate for the given PUCCH Format 0 configuration.
% The probability of false detection of the ACK is defined as the probability of
% erroneous detection of an ACK bit when the input is only noise. For more
% information, see TS38.141 Sections 8.3.1.1.
import matlab.unittest.fixtures.CurrentFolderFixture
obj.applyFixture(CurrentFolderFixture('../apps/simulators/PUCCHBLER'));
pp = obj.preparePUCCH(TestConfig);
pp.TestType = 'False Alarm';
mu = TestConfig.SubcarrierSpacing / 15 - 1;
nFrames = 2000 / 2^mu;
try
pp(TestConfig.SNR, nFrames);
catch ME
obj.assertFail(['PUCCHBLER simulation failed with error: ', ME.message]);
end
obj.verifyLessThanOrEqual(pp.FalseACKDetectionRateSRS, 0.01, ...
'WARNING: The PUCCH F0 false ACK detection rate should not be higher than 1%.');
obj.assertLessThanOrEqual(pp.FalseACKDetectionRateSRS, 0.05, ...
'ERROR: The PUCCH F0 false ACK detection rate is above the hard acceptance threshold of 5%.');
% TODO: export False Detection Rate (and possibly other metrics) to grafana.
end % of function checkPUCCHF0falseack(obj, TestConfig)
end % of methods (Test, TestTags = {'conformance'})
methods (Access = private)
function pp = preparePUCCH(obj, TestConfig)
%Configures a PUCCHBLER object.
import matlab.unittest.constraints.IsFile
try
pp = PUCCHBLER;
catch ME
obj.assertFail(['Could not create a PUCCHBLER object because of exception: ', ...
ME.message]);
end
obj.assertClass(pp, 'PUCCHBLER', 'The created object is not a PUCCHBLER object.');
obj.assertThat('../../../+srsMEX/+phy/@srsPUCCHProcessor/pucch_processor_mex.mexa64', IsFile, ...
'Could not find PUCCH processor mex executable.');
pp.PUCCHFormat = 0;
pp.SubcarrierSpacing = TestConfig.SubcarrierSpacing;
pp.NSizeGrid = TestConfig.NSizeGrid;
pp.PRBSet = 0;
if (TestConfig.NSymbols == 1)
pp.SymbolAllocation = [13 1];
pp.FrequencyHopping = 'neither';
else
pp.SymbolAllocation = [12 2];
pp.FrequencyHopping = 'intraSlot';
% The PUCCHBLER object already uses the last PRB in the band for the second hop.
end
pp.NumACKBits = 1;
pp.NRxAnts = TestConfig.NRxAnts;
pp.DelayProfile = 'TDLC300';
pp.MaximumDopplerShift = 100;
pp.ImplementationType = 'srs';
pp.QuickSimulation = false;
pp.DisplaySimulationInformation = true;
end % of function pp = preparePUCCH(obj, TestConfig)
end % of methods (Access = private)
end % of classdef CheckPUCCHF0Conformance < matlab.unittest.TestCase
function TestConfig = generateTestConfig()
TestConfig = { ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 25, ... 5 MHz ...
'NSymbols', 1, ...
'SNR', 9.4 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 52, ... 10 MHz ...
'NSymbols', 1, ...
'SNR', 8.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 106, ... 20 MHz ...
'NSymbols', 1, ...
'SNR', 9.3 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 25, ... 5 MHz ...
'NSymbols', 2, ...
'SNR', 2.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 52, ... 10 MHz ...
'NSymbols', 2, ...
'SNR', 3.7 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 106, ... 20 MHz ...
'NSymbols', 2, ...
'SNR', 3.3 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 25, ... 5 MHz ...
'NSymbols', 1, ...
'SNR', 3.0 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 52, ... 10 MHz ...
'NSymbols', 1, ...
'SNR', 2.9 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 106, ... 20 MHz ...
'NSymbols', 1, ...
'SNR', 3.2 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 25, ... 5 MHz ...
'NSymbols', 2, ...
'SNR', -1.0 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 52, ... 10 MHz ...
'NSymbols', 2, ...
'SNR', -0.5 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-1', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 15, ...
'NSizeGrid', 106, ... 20 MHz ...
'NSymbols', 2, ...
'SNR', -0.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 24, ... 10 MHz ...
'NSymbols', 1, ...
'SNR', 9.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 51, ... 20 MHz ...
'NSymbols', 1, ...
'SNR', 9.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 106, ... 40 MHz ...
'NSymbols', 1, ...
'SNR', 9.5 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 273, ... 100 MHz ...
'NSymbols', 1, ...
'SNR', 9.2 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 24, ... 10 MHz ...
'NSymbols', 2, ...
'SNR', 4.2 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 51, ... 20 MHz ...
'NSymbols', 2, ...
'SNR', 3.6 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 106, ... 40 MHz ...
'NSymbols', 2, ...
'SNR', 3.8 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 2, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 273, ... 100 MHz ...
'NSymbols', 2, ...
'SNR', 3.5 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 24, ... 10 MHz ...
'NSymbols', 1, ...
'SNR', 3.4 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 51, ... 20 MHz ...
'NSymbols', 1, ...
'SNR', 3.4 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 106, ... 40 MHz ...
'NSymbols', 1, ...
'SNR', 3.0 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 273, ... 100 MHz ...
'NSymbols', 1, ...
'SNR', 3.3 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 24, ... 10 MHz ...
'NSymbols', 2, ...
'SNR', -0.3 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 51, ... 20 MHz ...
'NSymbols', 2, ...
'SNR', -0.4 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 106, ... 40 MHz ...
'NSymbols', 2, ...
'SNR', -0.5 ...
), ...
struct( ...
'Table', 'TS38.104 V15.19.0 Table 8.3.2.2-2', ...
'NRxAnts', 4, ...
'SubcarrierSpacing', 30, ...
'NSizeGrid', 273, ... 100 MHz ...
'NSymbols', 2, ...
'SNR', -0.8 ...
), ...
};
end % of function TestConfig = generateTestConfig()