5g nr prach configuration -凯发k8网页登录
this example shows how to configure the 5g new radio (nr) physical random access channel (prach), as defined in ts 38.211 sections 5.3.2 and 6.3.3. you can learn about prach time resources, their relation to prach preambles, and learn how to generate prach preambles without the need to look up configuration tables. this example also shows how to map prach symbols to the resource grid, and how to generate a time-domain waveform for a single prach preamble.
configure carrier and prach
supported combinations of subcarrier spacing
table 6.3.3.2-1 in ts 38.211 lists the supported combinations of subcarrier spacing for the prach and the physical uplink shared channel (pusch) during initial access. you can access this table directly from the prach configuration object.
disp(nrprachconfig.tables.supportedscscombinations)
lra prachsubcarrierspacing puschsubcarrierspacing nrballocation kbar ____ ______________________ ______________________ _____________ ____ 839 1.25 15 6 7 839 1.25 30 3 1 839 1.25 60 2 133 839 5 15 24 12 839 5 30 12 10 839 5 60 6 7 139 15 15 12 2 139 15 30 6 2 139 15 60 3 2 139 30 15 24 2 139 30 30 12 2 139 30 60 6 2 139 60 60 12 2 139 60 120 6 2 139 120 60 24 2 139 120 120 12 2 139 120 480 3 1 139 120 960 2 23 139 480 120 48 2 139 480 480 12 2 139 480 960 6 2 139 960 120 96 2 139 960 480 24 2 139 960 960 12 2 571 30 15 96 2 571 30 30 48 2 571 30 60 24 2 571 120 120 48 2 571 120 480 12 1 571 120 960 7 47 571 480 120 192 2 571 480 480 48 2 571 480 960 24 2 1151 15 15 96 1 1151 15 30 48 1 1151 15 60 24 1 1151 120 120 97 6 1151 120 480 25 23 1151 120 960 13 45
the system information block 1 (sib1) contains the radio resource control (rrc) information element uplinkconfigcommonsib (ts 38.331 section 6.3.2) that defines the subcarrier spacing for the pusch. the user equipment (ue) needs this information to transmit the prach preamble during the random-access procedure.
carrier configuration
because the pusch is not defined at the prach preamble transmission, to configure the pusch subcarrier spacing and the frequency-domain dimensions of the resource grid, use the object.
carrier = nrcarrierconfig;
carrier.subcarrierspacing = 15; % subcarrier spacing in khz (15, 30, 60, 120, 480, 960)
because the prach preamble is modulated with respect to the carrier, changing the carrier subcarrier spacing leads to a different prach waveform. to see how a different carrier affects the generated waveform, check the information associated with prach ofdm modulation
output for several carriers in the generate waveform for single prach preamble section, .
prach configuration
you can configure prach parameters by setting property values of the object. according to ts 38.211, not all prach parameter combinations are valid. for more information on how the properties of nrprachconfig
reflect these limitations, see .
prach = nrprachconfig; prach.frequencyrange = 'fr1'; % frequency range ('fr1', 'fr2') prach.duplexmode = 'fdd'; % duplex mode ('fdd', 'tdd', 'sul') prach.configurationindex = 27; % configuration index (0...262). this value is automatically updated in the next section. prach.subcarrierspacing = 15; % subcarrier spacing in khz (1.25, 5, 15, 30, 60, 120, 480, 960) prach.sequenceindex = 0; % logical root sequence index (0...1149) prach.preambleindex = 0; % scalar preamble index within the cell (0...63) prach.restrictedset = 'unrestrictedset'; % type of restricted set ('unrestrictedset','restrictedsettypea','restrictedsettypeb') prach.zerocorrelationzone = 0; % cyclic shift configuration index (0...15) prach.rboffset = 0; % starting resource block index of the initial uplink bandwidth part (bwp) relative to carrier resource grid (0...274) prach.frequencystart = 0; % frequency offset of lowest prach transmission occasion in frequency domain with respect to physical resource block 0 of the initial uplink bwp (0...274) prach.frequencyindex = 0; % index of the prach transmission occasions in frequency domain (0...7) prach.timeindex = 0; % index of the prach transmission occasions in time domain (0...6) % for formats b2 and b3, this value is automatically updated in the next section. prach.activeprachslot = 0; % active prach slot number within a subframe or a 60 khz slot (0, 1, 3, 7, 15) prach.nprachslot = 0; % prach slot number
you can also modify prach.lra
to use a value of the zadoff-chu preamble sequence length introduced in release 16 of the 3gpp specifications.
the configurationindex
and timeindex
properties depend on the prach format. the subcarrierspacing
, activeprachslot
, and nprachslot
properties determine whether the prach preamble is active. the next two sections discuss how to set these properties.
how to set configurationindex
based on preferred format
tables 6.3.3.2-2 to 6.3.3.2-4 in ts 38.211 define all possible prach configurations in the time domain. the combination of frequency range and duplex mode specifies which configuration table to use. valid combinations are:
fr1 and fdd (paired spectrum): table 6.3.3.2-2
fr1 and sul (supplementary uplink): table 6.3.3.2-2
fr1 and tdd (unpaired spectrum): table 6.3.3.2-3
fr2 and tdd (unpaired spectrum): table 6.3.3.2-4
for more information on how paired and unpaired spectrums relate to duplex mode, see the field fdd-orsul of the rrc information element frequencyinfoul in ts 38.331 section 6.3.2.
you can access these configuration tables through the tables
property of the nrprachconfig
object. for example:
nrprachconfig.tables.configurationsfr1pairedsul % ts 38.211 table 6.3.3.2-2 nrprachconfig.tables.configurationsfr1unpaired % ts 38.211 table 6.3.3.2-3 nrprachconfig.tables.configurationsfr2 % ts 38.211 table 6.3.3.2-4
ts 38.211 defines and categorizes 13 prach formats as long or short preambles. long preambles have a sequence of length , whereas short preambles have a sequence of length . the values 571 and 1151 are associated with shared spectrum channel access that is introduced in release 16 of the 3gpp specifications. the formats associated with long preambles are: 0, 1, 2, 3. the formats associated with short preambles are: a1, a2, a3, b1, b2, b3, b4, c0, c2, including mixed formats a1/b1, a2/b2, and a3/b3.
the configuration indices in tables 6.3.3.2-2 to 6.3.3.2-4 define the time resources in which each preamble format can be transmitted. each preamble format is associated with several configuration indices. you can choose a prach format without the need to look up the configuration tables by setting the value of configurationindex
based on the preferred format. this value corresponds to the largest range of time resources in which you can transmit the preferred preamble format.
format = 'b2'; % prach preamble format ('0','1','2','3','a1','a2','a3','b1','b2','b3','b4','c0','c2')
select the configuration table based on frequencyrange
and duplexmode
.
if strcmpi(prach.frequencyrange,'fr1') if strcmpi(prach.duplexmode,'tdd') % ts 38.211 table 6.3.3.2-3 configtable = nrprachconfig.tables.configurationsfr1unpaired; else % ts 38.211 table 6.3.3.2-2 configtable = nrprachconfig.tables.configurationsfr1pairedsul; end else % ts 38.211 table 6.3.3.2-4 configtable = nrprachconfig.tables.configurationsfr2; end
among all configurations corresponding to the same short preamble format in table 6.3.3.2-2, the second to last configuration has the largest number of time resources for transmitting the prach preamble. in all the other cases, including mixed formats in table 6.3.3.2-2, the last configuration has the largest number of time resources for transmitting the prach preamble. this example uses this information to set the value of the configurationindex
property. if you select format b2 or b3, this example sets the maximum value of timeindex
.
if strcmpi(prach.frequencyrange,'fr1') && strcmpi(prach.duplexmode,'fdd') && ... any(strcmpi(format,{'a1','a2','a3','b1','b4','c0','c2'})) prach.configurationindex = find(strcmpi(configtable.preambleformat,format),1,'last') - 2; else if ~any(strcmpi(format,{'b2','b3'})) prach.configurationindex = find(strcmpi(configtable.preambleformat,format),1,'last') - 1; else % format b2 and b3 only appear in mixed formats, so select an % appropriate mixed format and set the maximum value of timeindex prach.configurationindex = find(endswith(configtable.preambleformat,format),1,'last') - 1; prach.timeindex = prach.numtimeoccasions - 1; end end
how to select subcarrierspacing
, activeprachslot
, and nprachslot
to generate active prach preamble
tables 6.3.3.2-2 to 6.3.3.2-4 in ts 38.211 describe which prach slot corresponds to an active prach preamble. the third and fourth columns of these tables represent the system frame numbers that correspond to an active prach preamble. depending on the selected frequency range, fr1 or fr2, the fifth column represents the slot numbers for 15 khz or 60 khz subcarrier spacing, respectively, corresponding to an active prach preamble. if a prach preamble is not active in the current time resources, no time transmission can take place.
for example, the selected prach configuration is active in any system frame and subframe if prach subcarrier spacing is set to 15 khz, as shown in table 6.3.3.2-2.
disp(configtable(prach.configurationindex 1,:))
configurationindex preambleformat x y subframenumber startingsymbol prachslotspersubframe numtimeoccasions prachduration __________________ ______________ _ _____ _______________________ ______________ _____________________ ________________ _____________ 146 {'a2/b2'} 1 {[0]} {[0 1 2 3 4 5 6 7 8 9]} 0 2 3 4
to verify that the prach preamble is active in the current slot, check the prachsymbols
output of the function. this output is empty if the prach preamble is not active in the current slot. to generate an active prach preamble, loop through the values of the nprachslot
property until prachsymbols
becomes nonempty.
the cases presented in this section show how to check whether the current prach short preamble is active. both cases consider a prach short preamble format b2. if you change the format, the prach preamble may be active for values of the nprachslot
and activeprachslot
properties different from those shown in this example.
case 1: typical prach subcarrier spacing configuration
set up a prach preamble for the selected format with a typical subcarrier spacing configuration. this example considers a 15 khz subcarrier spacing, which is the typical value for short preambles in fr1. if you change the value of the subcarrier spacing or the format, you may need to change the values of activeprachslot
and nprachslot
to get an active prach slot.
% store the user-defined configuration subcarrierspacing = prach.subcarrierspacing; activeprachslot = prach.activeprachslot; nprachslot = prach.nprachslot; % set values of subcarrierspacing, activeprachslot, and nprachslot for this % case if any(strcmpi(format,{'0','1','2'})) prach.subcarrierspacing = 1.25; elseif strcmpi(format,'3') prach.subcarrierspacing = 5; else % short preambles if strcmpi(prach.frequencyrange,'fr1') prach.subcarrierspacing = 15; % valid values: 15, 30 else % fr2 prach.subcarrierspacing = 60; % valid values: 60, 120, 480, 960 end end prach.activeprachslot = 0; prach.nprachslot = 0;
according to table 6.3.3.2-2 in ts 38.211, the ue can transmit prach in any slot.
prachsymbols = nrprach(carrier,prach);
active = ~isempty(prachsymbols);
disp(['active: ' num2str(active)])
active: 1
case 2: alternative prach subcarrier spacing configuration
set the prach subcarrier spacing to 30 khz and use the default value of 15 khz for the carrier subcarrier spacing. this means that each carrier slot contains two prach slots. this case does not consider prach long preambles and frequency range fr2 because they are not compatible with 30 khz subcarrier spacing.
in the case of 30 khz prach subcarrier spacing, only one of the two prach slots within a 15 khz subcarrier spacing can be active. according to table 6.3.3.2-2 in ts 38.211, either the first or the second prach slots can be active for prach preamble format b2. the value of prach.activeprachslot
property defines which prach slot is active within the current carrier subframe. this property is the parameter defined in ts 38.211 section 5.3.2.
this case shows four combinations of the nprachslot
and activeprachslot
property values and tests whether the prach preamble is active. this case displays the plot of the time-domain structure of the prach preamble for both combinations. the plot shows that the active prach preamble occupies the first half of the carrier slot when activeprachslot
is 0
and occupies the second half of the carrier slot when activeprachslot
is 1
. for more details on this plot, see the plot time-domain structure of selected prach preamble section.
if ~any(strcmpi(format,{'0','1','2','3'})) && strcmpi(prach.frequencyrange,'fr1') % short preamble formats and fr1 only % set subcarrier spacing to 30 khz for this case prach.subcarrierspacing = 30; % define all combinations of nprachslot and activeprachslot to check nprachslotcase2 = [0, 1, 2]; activeprachslotcase2 = [0, 1]; [nprachslotcase2, activeprachslotcase2] = meshgrid(nprachslotcase2,activeprachslotcase2); prachactivitytable = table(nprachslotcase2(:),activeprachslotcase2(:),false*ones(numel(nprachslotcase2),1), ... 'variablenames',{'nprachslot','activeprachslot','active'}); % loop over all combinations for i = 1:numel(nprachslotcase2) prach.nprachslot = nprachslotcase2(i); prach.activeprachslot = activeprachslotcase2(i); prachsymbols = nrprach(carrier,prach); active = ~isempty(prachsymbols); % check if the prach preamble is active in the current slot prachactivitytable.active(i) = active; if active && prach.nprachslot < 2 % plot the time-domain structure of the prach preamble for % active prach preambles in the first two slots hprachpreambleplot(carrier,prach); end end else % display a message for the filtered cases if any(strcmpi(format,{'0','1','2','3'})) disp(['prach long preamble format ' format ' is not compatible with 30 khz subcarrier spacing.']) else % fr2 disp('frequency range fr2 is not compatible with 30 khz subcarrier spacing.') end end
for short preamble formats with a 30 khz subcarrier spacing, this table shows whether the prach preamble is active for each combination of the chosen values of the nprachslot
and activeprachslot
properties.
if ~any(strcmpi(format,{'0','1','2','3'})) && strcmpi(prach.frequencyrange,'fr1') % short preamble formats and fr1 only disp(prachactivitytable) end
nprachslot activeprachslot active __________ _______________ ______ 0 0 1 0 1 0 1 0 0 1 1 1 2 0 1 2 1 0
set the prach configuration object back to the user-defined configuration
prach.subcarrierspacing = subcarrierspacing; prach.activeprachslot = activeprachslot; prach.nprachslot = nprachslot;
inspect prach configuration
the prach configuration object also has read-only properties that provide additional information about the current configuration:
preamble format:
format
maximum number of allowed prach time occasions:
numtimeoccasions
number of ofdm symbols in the prach slot grid corresponding to one transmission occasion:
prachduration
location of the first ofdm symbol of the current prach occasion:
symbollocation
number of subframes spanned by a nominal prach slot:
subframesperprachslot
number of prach slots per overall period:
prachslotsperperiod
disp(prach)
nrprachconfig with properties: frequencyrange: 'fr1' duplexmode: 'fdd' configurationindex: 146 subcarrierspacing: 15 lra: 139 sequenceindex: 0 preambleindex: 0 restrictedset: 'unrestrictedset' zerocorrelationzone: 0 rboffset: 0 frequencystart: 0 frequencyindex: 0 timeindex: 2 activeprachslot: 0 nprachslot: 0 read-only properties: format: 'b2' numtimeoccasions: 3 prachduration: 4 symbollocation: 8 subframesperprachslot: 1 prachslotsperperiod: 10 constant properties: tables: [1x1 struct]
plot time-domain structure of selected prach preamble
this plot shows all the possible prach occasions (in the current carrier slot) in light colors and the current prach occasion (corresponding to the selected timeindex
) in dark colors. this plot contains the cyclic prefix (cp), the prach active sequence periods, and a final guard period (gp) in red, blue, and green, respectively. if the prach preamble is not active in the current slot, the plot is empty. the plot shows time-related properties of the selected prach configuration and the prach position in the carrier slot. if the prach subcarrier spacing is smaller than the carrier subcarrier spacing, the plot shows the minimum number of carrier slots needed to transmit the prach preamble. the last prach occasion in time does not always correspond to the end of the carrier slot. the plot is empty for those time values in which no prach transmission is allowed for the current prach configuration.
hprachpreambleplot(carrier,prach);
generate and map prach symbols to resource grid
the prach resource grid shows the location of the prach preamble in both time and frequency domain. using this resource grid, you can:
inspect the prach preamble visually in both time and frequency domain
generate the prach waveform, which is obtained by modulating the resource grid
the prach resource grid generation consists of these steps:
generate an empty grid
generate the symbols to be transmitted in the prach waveform
generate the frequency indices and time indices in which the prach symbols are located
map the prach symbols to the prach resource grid
generate an empty prach resource grid.
prachgrid = nrprachgrid(carrier,prach); size(prachgrid)
ans = 1×2
624 14
generate the prach symbols. the number of symbols depends on the prach configuration. the prachsymbols
output is empty if the prach preamble is not active in the current slot.
prachsymbols = nrprach(carrier,prach);
generate the prach indices. the value in each element of prachindices
is the linear index of the location of each element of prachsymbols
in the prach resource grid.
prachindices = nrprachindices(carrier,prach);
map the prach symbols to the prach resource grid using the indices. to represent in ts 38.211 section 6.3.3.2, the mapping applies a scaling factor of 1 to the prach symbols.
prachgrid(prachindices) = 1 * prachsymbols;
the hprachresourcegridplot
helper function plots the prach resource grid to show the location of the active prach. the plot shows all the time occasions in which the prach can be transmitted. the plot shows all the possible prach occasions in the current carrier slot in light blue and the current prach occasion (corresponding to the selected timeindex
) in dark blue. the plot is empty for ofdm symbols not used by any prach occasion for the current configuration. if the prach preamble is not active in the current slot, the plot is empty.
hprachresourcegridplot(carrier,prach);
the prach resource grid contains 14 ofdm symbols except for these cases:
for long preamble format 0, each preamble has one active sequence period that spans one subframe. therefore, the slot grid related to format 0 has one ofdm symbol.
for long preamble format 1, each preamble has two active sequence periods that span two subframes. therefore, the slot grid related to format 1 has two ofdm symbols.
for long preamble format 2, each preamble has four active sequence periods that span four subframes. therefore, the slot grid related to format 2 has four ofdm symbols.
for long preamble format 3, each preamble has four active sequence periods that span one subframe. therefore, the slot grid related to format 3 has four ofdm symbols.
for short preamble format c0, each preamble has one active sequence period. however, because of the guard and the cyclic prefix, the preamble spans two ofdm symbols. therefore, the slot grid related to format c0 has seven ofdm symbols.
you can retrieve the number of active sequence periods from the value of the prachduration
property of the prach configuration object.
generate waveform for single prach preamble
generate a time-domain waveform for a single prach preamble by modulating the prach resource grid. to set the number of time-domain samples over which to apply windowing and overlapping of ofdm symbols, use windowing
. this example uses the default value for windowing. for more details about windowing, see .
windowing = [];
[prachwaveform,prachinfo] = nrprachofdmmodulate(carrier,prach,prachgrid,'windowing',windowing);
the output prachwaveform
is a column vector corresponding to the time-domain waveform. the output prachinfo
is a structure that provides dimensional information related to the prach. this example displays this information by using the hprachinfodisplay
helper function. the function displays the information related to the number of samples corresponding to cp, prach active sequence period , and gp for each ofdm symbol in a tabular format. the table lists all the ofdm symbols that fit in the resource grid. for short preamble formats, the values marked with *
correspond to all possible prach occasions except the current one (marked light blue in the resource grid plot). for short preamble formats, the values within angle brackets represent ofdm symbols not used by any prach occasion for the current configuration (corresponding to an empty space in time in the resource grid plot).
check the information related to the ofdm symbols against the prachduration
, symbollocation
, and numtimeoccasions
properties. these properties show that:
each prach occasion lasts 4 ofdm symbols
the current prach occasion starts at ofdm symbol 8
3 prach occasions are possible in time
hprachinfodisplay(carrier,prach,windowing);
information associated with prach: subcarrierspacing: 15 khz number of subcarriers: 624 information associated with prach ofdm modulation: nfft: 1024 windowing: 72 offset: 0 samples symbol tcp tseq gp ------ ------ ------ ----- 0* 296* 1024* 0* 1* 0* 1024* 0* 2* 0* 1024* 0* 3* 0* 1024* 0* 4* 296* 1024* 0* 5* 0* 1024* 0* 6* 0* 1024* 0* 7* 0* 1024* 0* 8 180 1024 0 9 0 1024 0 10 0 1024 0 11 0 1024 108 <12> < 0> <1024> < 0> <13> < 0> <1024> < 0> * : ofdm symbols for unused prach time occasions <#> : ofdm symbols not used by any prach time occasion for the current configuration total samples: 15360 sample rate: 15.360 mhz duration: 1.000 ms total number of subframes: 1
summary and further exploration
this example shows how to configure the prach, set the configuration index based on the selected format, and determine whether a prach preamble is active in the current time resources. this example guides you through prach resource grid and time-domain waveform generation. plotting the time-domain structure of the prach preamble displays all the available prach occasions for the selected configuration within one subframe. plotting the resource grid displays all the available prach occasions for the selected configuration in both the time and frequency domain.
this example shows how to generate a waveform for a single prach preamble. for an example that generates a waveform for multiple prach preambles, see 5g nr prach waveform generation.
selected bibliography
3gpp ts 38.211. "nr; physical channels and modulation." 3rd generation partnership project; technical specification group radio access network.
3gpp ts 38.331. "nr; radio resource control (rrc); protocol specification." 3rd generation partnership project; technical specification group radio access network.
see also
functions
- | |