5g nr prach detection and false alarm test -凯发k8网页登录
this example implements the physical random access channel (prach) missed detection and false alarm conformance tests, as defined in ts 38.141-1. you can measure the probability of correct detection of the prach preamble in the presence of a preamble signal or switch the prach transmission off to measure the false alarm probability.
introduction
the prach is an uplink transmission used by user equipment (ue) to initiate synchronization with the gnodeb. ts 38.141-1 section 8.4.1.5 defines the probability of prach detection to be greater than or equal to 99% at specific snr values for a set of prach configurations and propagation conditions. there are several detection error cases:
detecting an incorrect preamble
not detecting a preamble
detecting the correct preamble but with the wrong timing estimation
ts 38.141-1 states that a correct detection is achieved when the estimation error of the timing offset of the strongest path is less than the time error tolerance given in table 8.4.1.1-1. for channel propagation conditions tdlc300-100 and prach preamble format 0, the time error tolerance is 2.55 microseconds.
in this example, a prach waveform is configured and passed through an appropriate channel. at the receiver side, the example performs prach detection and calculates the prach detection probability. the example considers the parameters defined in ts 38.141-1 table 8.4.1.5-1 and table a.6-1. these are: normal mode (i.e., unrestricted set), 2 receive antennas, tdlc300-100 channel, normal cyclic prefix, burst format 0, snr -6.0 db. if you change the prach configuration to use one of the other prach preamble formats listed in table a.6-1, you need to update the values of the time error tolerance and the snr, according to ts 38.141-1 table 8.4.1.1-1 and tables 8.4.1.5-1 to 8.4.1.5-3, respectively.
simulation configuration
the example considers 10 prach slots at a number of snrs. you should use a large number of numprachslots
to produce meaningful results. you can set snrdb
as an array of values or a scalar. for an explanation of the snr definition that this example uses, see . table 8.4.1.5-1 in ts 38.141-1 specifies the frequency offset foffset
that is modeled between the transmitter and receiver. the timeerrortolerance
variable specifies the time error tolerance, as defined in table 8.4.1.1-1 in ts 38.141-1. you can set the detection threshold to a value in the range [0,1] or to empty to use the default value in the function. to simulate a false alarm test, disable the prach transmission by setting prachenabled
to false
instead.
numprachslots = 10; % number of prach slots to simulate at each snr snrdb = [-21, -16, -11, -6, -1]; % snr range in db foffset = 400.0; % frequency offset in hz timeerrortolerance = 2.55; % time error tolerance in microseconds threshold = []; % detection threshold prachenabled = true; % enable prach transmission. to simulate false alarm test, disable prach transmission.
carrier configuration
use the configuration object carrier
to specify the carrier settings. the example considers a carrier characterized by a subcarrier spacing of 15 khz and a bandwidth of 5 mhz. that is, the carrier spans 25 resource blocks, according to table 5.3.2-1 in ts 38.104.
carrier = nrcarrierconfig;
carrier.subcarrierspacing = 15;
carrier.nsizegrid = 25;
% compute the ofdm-related information
ofdminfo = nrofdminfo(carrier);
prach configuration
table a.6-1 in ts 38.141-1 specifies the prach configurations to use for the prach detection conformance test.
set the prach configuration by using the configuration object prach
, according to table a.6-1 and section 8.4.1.4.2 in ts 38.141-1.
% set prach configuration prach = nrprachconfig; prach.frequencyrange = 'fr1'; % frequency range prach.duplexmode = 'fdd'; % frequency division duplexing (fdd) prach.configurationindex = 27; % configuration index for format 0 prach.subcarrierspacing = 1.25; % subcarrier spacing prach.sequenceindex = 22; % logical sequence index prach.preambleindex = 32; % preamble index prach.restrictedset = 'unrestrictedset'; % normal mode prach.frequencystart = 0; % frequency location % define the value of zerocorrelationzone using the ncs table stored in % the nrprachconfig object switch prach.format case {'0','1','2'} ncstable = nrprachconfig.tables.ncsformat012; ncstablecol = (string(ncstable.properties.variablenames) == prach.restrictedset); case '3' ncstable = nrprachconfig.tables.ncsformat3; ncstablecol = (string(ncstable.properties.variablenames) == prach.restrictedset); otherwise ncstable = nrprachconfig.tables.ncsformatabc; ncstablecol = contains(string(ncstable.properties.variablenames), num2str(prach.lra)); end ncs = 13; zerocorrelationzone = ncstable.zerocorrelationzone(ncstable{:,ncstablecol}==ncs); prach.zerocorrelationzone = zerocorrelationzone; % cyclic shift index
propagation channel configuration
use the object to configure the tapped delay line (tdl) propagation channel model channel
as described in ts 38.141-1 table 8.4.1.1-1.
channel = nrtdlchannel; channel.delayprofile = "tdlc300"; % delay profile channel.maximumdopplershift = 100.0; % maximum doppler shift in hz channel.samplerate = ofdminfo.samplerate; % input signal sample rate in hz channel.mimocorrelation = "low"; % mimo correlation channel.transmissiondirection = "uplink"; % uplink transmission channel.numreceiveantennas = 2; % number of receive antennas channel.normalizepathgains = true; % normalize delay profile power channel.seed = 42; % channel seed. change this for different channel realizations channel.normalizechanneloutputs = true; % normalize for receive antennas % get the channel characteristic information channelinfo = info(channel);
loop for snr values
use a loop to run the simulation for the set of snr points given by the vector snrdb
. the snr vector configured here is a range of snr points including a point at -6.0 db, the snr at which the test requirement for prach detection rate (99%) is to be achieved for preamble format 0, as discussed in table 8.4.1.5-1 in ts 38.141-1.
hnrprachwaveformgenerator
generates an output signal normalized to the same transmit power as for an uplink data transmission within the 5g toolbox™. therefore, the same normalization must take place on the noise added to the prach. the noise added before ofdm demodulation will be amplified by the ifft by a factor equal to the square root of the size of the ifft (). to ensure that the power of the noise added is normalized after demodulation, and thus to achieve the desired snr, the desired noise power is divided by . in addition, as real and imaginary parts of the noise are created separately before being combined into complex additive white gaussian noise, the noise amplitude is scaled by so the generated noise power is 1.
at each snr test point, calculate the detection probability on a slot by slot basis using these steps:
prach transmission: use
hnrprachwaveformgenerator
to generate a prach waveform. send the prach preambles with the timing offsets defined in ts 38.141-1 figure 8.4.1.4.2-2. set a timing offset base value to 50% of the number of cyclic shifts for prach generation. this offset is increased for each preamble, adding a step value of 0.1 microseconds, until the end of the tested range, which is 0.9 microseconds for prach preamble format 0. this pattern then repeats.noisy channel modeling: pass the waveform through a tdl channel and add additive white gaussian noise. add additional samples to the end of the waveform to cover the range of delays expected from the channel modeling (a combination of implementation delay and channel delay spread). this implementation delay is then removed to ensure the implementation delay is not interpreted as an actual timing offset in the preamble detector.
application of frequency offset: apply the frequency offset to the received waveform as defined by the specification.
prach detection: perform prach detection using the
nrprachdetect
function for all cell preamble indices (0:63). use the detected prach index and offset returned bynrprachdetect
to determine where a detection was successful according to the constraints discussed in the introduction section.
% initialize variables storing detection probability at each snr pdetection = zeros(size(snrdb)); % store the configuration parameters needed to generate the prach waveform waveconfig.numsubframes = prach.subframesperprachslot; waveconfig.windowing = []; waveconfig.carriers = carrier; waveconfig.prach.config = prach; waveconfig.prach.enable = prachenabled; % the temporary variables 'prach_init', 'waveconfig_init', 'ofdminfo_init', % and 'channelinfo_init' are used to create the temporary variables % 'prach', 'waveconfig', 'ofdminfo', and 'channelinfo' within the snr loop % to create independent instances in case of parallel simulation prach_init = prach; waveconfig_init = waveconfig; ofdminfo_init = ofdminfo; channelinfo_init = channelinfo; for snridx = 1:numel(snrdb) % comment out for parallel computing % parfor snridx = 1:numel(snrdb) % uncomment for parallel computing % to reduce the total simulation time, you can execute this loop in % parallel by using the parallel computing toolbox. comment out the 'for' % statement and uncomment the 'parfor' statement. if the parallel computing % toolbox(tm) is not installed, 'parfor' defaults to normal 'for' statement % display progress in the command window timenow = char(datetime('now','format','hh:mm:ss')); fprintf([timenow ': simulating snr = % 5.1f db...'], snrdb(snridx)); % set the random number generator settings to default values rng('default'); % initialize variables for this snr point, required for initialization % of variables when using the parallel computing toolbox prach = prach_init; waveconfig = waveconfig_init; ofdminfo = ofdminfo_init; channelinfo = channelinfo_init; % reset the channel so that each snr point will experience the same % channel realization reset(channel); % normalize noise power to account for the sampling rate, which is a % function of the ifft size used in ofdm modulation. the snr is defined % per carrier resource element for each receive antenna. snr = 10^(snrdb(snridx)/10); n0 = 1/sqrt(2.0*channel.numreceiveantennas*double(ofdminfo.nfft)*snr); % detected preamble count detectedcount = 0; % loop for each prach slot numactiveprachslots = 0; for nslot = 0:numprachslots-1 % generate prach waveform for the current slot prach.nprachslot = nslot; waveconfig.prach.config.nprachslot = nslot; [waveform,~,winfo] = hnrprachwaveformgenerator(waveconfig); % set prach timing offset in microseconds as per ts 38.141-1 figure % 8.4.1.4.2-2 and figure 8.4.1.4.2-3 if prach.lra==839 % long preamble, values as in figure 8.4.1.4.2-2 baseoffset = ((winfo.waveformresources.prach.resources.prachsymbolsinfo.numcyclicshifts/2)/prach.lra)/prach.subcarrierspacing*1e3; % (microseconds) timingoffset = baseoffset mod(nslot,10)/10; % (microseconds) else % short preamble, values as in figure 8.4.1.4.2-3 baseoffset = 0; % (microseconds) timingoffset = baseoffset mod(nslot,9)/10; % (microseconds) end sampledelay = fix(timingoffset / 1e6 * ofdminfo.samplerate); % generate transmit waveform txwave = [zeros(sampledelay,1); waveform]; % pass data through channel model. append zeros at the end of the % transmitted waveform to flush channel content. these zeros take % into account any delay introduced in the channel. this is a mix % of multipath delay and implementation delay. this value may % change depending on the sampling rate, delay profile and delay % spread rxwave = channel([txwave; zeros(channelinfo.maximumchanneldelay, size(txwave,2))]); % add noise noise = n0*complex(randn(size(rxwave)), randn(size(rxwave))); rxwave = rxwave noise; % skip this slot if the prach is inactive. % skip the detection of this slot after advancing the channel to % make sure that the channel is always synchronized with the % current slot. % if the prach is inactive in this slot, the receiver should not % expect any prach transmission and thus should not even try to % detect a prach. skipping the detection of an inactive slot is % particularly important when performing a conformance test. if the % prach is inactive, the reference waveform computed internally in % the |nrprachdetect| function is empty. this leads to an empty % correlation and thus to an empty detected preamble. this empty % preamble leads to an incorrect value of the detection % probability. if isempty(winfo.waveformresources.prach.resources.prachsymbols) continue; end numactiveprachslots = numactiveprachslots 1; % remove the implementation delay of the channel filter rxwave = rxwave((channelinfo.channelfilterdelay 1):end, :); % apply frequency offset t = ((0:size(rxwave, 1)-1)/channel.samplerate).'; rxwave = rxwave .* repmat(exp(1i*2*pi*foffset*t), 1, size(rxwave, 2)); % prach detection for all cell preamble indices [detected, offsets] = nrprachdetect(carrier, prach, rxwave, 'detectionthreshold', threshold); % test for preamble detection if (length(detected)==1) if ~prachenabled % for the false alarm test, any preamble detected is wrong detectedcount = detectedcount 1; else % test for correct preamble detection if (detected==prach.preambleindex) % calculate timing estimation error trueoffset = timingoffset/1e6; % (s) measuredoffset = offsets(1)/channel.samplerate; timingerror = abs(measuredoffset-trueoffset); % test for acceptable timing error if (timingerror<=timeerrortolerance/1e6) detectedcount = detectedcount 1; % detected preamble end end end end end % of nslot loop % compute final detection probability for this snr pdetection(snridx) = detectedcount/numactiveprachslots; % display the detection probability for this snr fprintf('detection probability: %d%%\n', pdetection(snridx)*100); end % of snr loop
13:39:31: simulating snr = -21.0 db...detection probability: 0% 13:39:33: simulating snr = -16.0 db...detection probability: 40% 13:39:34: simulating snr = -11.0 db...detection probability: 80% 13:39:35: simulating snr = -6.0 db...detection probability: 100% 13:39:36: simulating snr = -1.0 db...detection probability: 100%
results
at the end of the snr loop, the example plots the calculated detection probabilities for each snr value against the target probability.
% plot detection probability figure('name','detection probability'); plot(snrdb,pdetection,'b-o','linewidth',2,'markersize',7); title(['detection probability for ', num2str(numprachslots) ' prach slot(s)'] ); xlabel('snr (db)'); ylabel('detection probability'); grid on; hold on; % plot target probability if prachenabled % for a missed detection test, detection probability should be >= 99% ptarget = 99; else % for a false alarm test, detection probability should be < 0.1% ptarget = 0.1; %#okend plot(-6.0,ptarget/100,'rx','linewidth',2,'markersize',7); legend('simulation result', ['target ' num2str(ptarget) '% probability'],'location','best'); minp = 0; if(~isnan(min(pdetection))) minp = min([pdetection(:); ptarget]); end axis([snrdb(1)-0.1 snrdb(end) 0.1 minp-0.05 1.05])
references
3gpp ts 38.141-1. "nr; base station (bs) conformance testing. part 1: conducted conformance testing." 3rd generation partnership project; technical specification group radio access network.
3gpp ts 38.104. "nr; base station (bs) radio transmission and reception." 3rd generation partnership project; technical specification group radio access network.
see also
functions
- | | |