main content

nr srs configuration -凯发k8网页登录

this example shows how to generate sounding reference signals (srs), as defined in ts 38.211 section 6.4.1.4 [1], including srs configuration, symbol and indices generation, ofdm resource grid mapping, and srs waveform generation. the example demonstrates how to select the appropriate parameters to position the srs in frequency and to setup:

  • full-band transmissions: generate an srs spanning all the available bandwidth.

  • frequency-hopping transmissions: generate periodic and aperiodic srs transmissions with different frequency-hopping patterns.

  • multi-user transmissions: generate orthogonal srs using time, frequency, and cyclic shifts.

introduction

sounding reference signals are uplink physical signals employed by user equipment (ue) for uplink channel sounding, including channel quality estimation and synchronization. unlike demodulation reference signals (dm-rs), srs are not associated to any physical uplink channels and they support uplink channel-dependent scheduling and link adaptation. srs assist in:

  • codebook-based closed-loop spatial multiplexing.

  • control uplink transmit timing.

  • reciprocity-based downlink precoding in multi-user mimo setups.

  • quasi co-location of physical channels and reference signals.

frequency positioning

this section shows how to configure the srs position in frequency domain and determine the bandwidth allocated to the srs.

configure a 15 mhz bandwidth carrier with 15 khz subcarrier spacing (scs).

carrier = nrcarrierconfig;
carrier.nsizegrid = 79; % bandwidth in rb
carrier.subcarrierspacing = 15;

the bandwidth configuration parameters csrs and bsrs control the bandwidth allocated to the srs, which normally increases with csrs and decreases with bsrs. use these interactive controls to configure the srs bandwidth.

srs = nrsrsconfig;
srs.csrs = 10;  % bandwidth configuration c_srs (0...63)
srs.bsrs =  1;  % bandwidth configuration b_srs (0...3)

to modify the frequency position of the srs, change the values of frequencystart and nrrc. frequencystart specifies the frequency origin of the srs in rbs with respect to the carrier origin when nrrc = 0.

srs.frequencystart = 30; % frequency position of the srs in carrier in rb (0...271)
          srs.nrrc = 0; % frequency domain position in blocks of 4 prb (0...67)
hsrsgrid(carrier,srs,1,true); % create and display a single-slot resource grid containing srs
title(['resource grid containing srs. nrrc = ' num2str(srs.nrrc)]);
hsrsannotations(carrier,srs);

figure contains an axes object. the axes object with title resource grid containing srs. nrrc = 0, xlabel ofdm symbol, ylabel rb contains 4 objects of type image, line, text. this object represents srs 1.

this figure displays a single-slot ofdm resource grid containing an srs. for csrs = 10 and bsrs = 1, the frequency position of the srs (f0) shifts by nrbt when nrrc is in the range (3...5) and by 2nrbt when nrrc is in the range (6...8). the srs returns to the initial position (frequencystart) when nrrc is 9. nrbt is the number of resource blocks (rbs) allocated to the srs per transmission.

this figure illustrates the concepts introduced above for csrs = 10 and bsrs = 1.

nrrc is an additional frequency offset specified as a number of 4 rbs and it corresponds to the higher layer parameter freqdomainposition (see ts 38.331 section 6.3.2 srs-config [2]). for values of nrrc between k(nrbt/4) and (k 1)(nrbt/4)-1, the frequency position of the srs is shifted by knrbt, where k is an integer. ts 38.211 section 6.4.1.4 refers to nrbt as msrs.b with b=bsrs. for more information, see the nrbpertransmission property of the nrsrsconfig configuration object.

this equation determines the origin of the srs in frequency:

f0=frequencystart nrbtmod(4nrrcnrbt,nsb)

nsb denotes the number of srs subbands (frequency bands of size nrbt) where the srs can be positioned through the parameter nrrc. to calculate nsb, you can use the srs bandwidth configuration table (see ts 38.211 table 6.4.1.4.3-1). you can also access this table through the bandwidthconfigurationtable property of the nrsrsconfig object.

csrs = srs.csrs;
disp(nrsrsconfig.bandwidthconfigurationtable(csrs (0:2)   (csrs==0),:));
    c_srs    m_srs_0    n_0    m_srs_1    n_1    m_srs_2    n_2    m_srs_3    n_3
    _____    _______    ___    _______    ___    _______    ___    _______    ___
      9        32        1       16        2        8        2        4        2 
     10        36        1       12        3        4        3        4        1 
     11        40        1       20        2        4        5        4        1 

the first column contains possible values of the parameter csrs. for csrs = 10 and bsrs = 1, the number of unique srs subbands is nsb=n0nbsrs=3, where n0=1 and n1=3.

% calculate and display the number of srs subbands configurable by nrrc
nsbtable = hsrsnumberofsubbandsorhoppingpatterns(srs);
fprintf('number of srs subbands (nrrc < %d):  %d', nsbtable*srs.nrbpertransmission/4,nsbtable);
number of srs subbands (nrrc < 9):  3
% calculate the frequency origin of the first srs symbol
f0 = hsrsfrequencyorigin(srs);
fprintf('the frequency origin of the srs is f0 = %d rb.', f0);
the frequency origin of the srs is f0 = 30 rb.

confirm the frequency position of the srs using the info output of nrsrsindices

[~,info] = nrsrsindices(carrier,srs);
display(info.prbset(1))
    30

for a given value of csrs, the frequency band where the srs can be allocated using nrrc is frequencystart (0nsbnrbt-1). for csrs = 10, the srs wraps around when nrrc=nsbnrbt/4=n0nbsrsmsrs,b/4=msrs,0/4=9 , which results into the same frequency position as that of nrrc=0.

fprintf('the srs frequency range is limited to the range (%d,%d) rb for the current value of csrs (%d).',srs.frequencystart,srs.frequencystart   nsbtable*srs.nrbpertransmission,srs.csrs);
the srs frequency range is limited to the range (30,66) rb for the current value of csrs (10).

when intra-slot frequency hopping is enabled, the calculation of frequencyorigin is only valid for the first srs symbol in the slot. for frequency-hopping srs, use the outputs info.prbset or info.subcarrieroffset of the nrsrsindices function to determine the frequency position of subsequent symbols.

fprintf('the frequency origin of the srs is f0 = %d rb.',info.prbset(1));
the frequency origin of the srs is f0 = 30 rb.

full-bandwidth configuration

this section shows how to configure and generate a full-band srs transmission by calculating the appropriate srs bandwidth parameters for a carrier.

configure a 10 mhz bandwidth carrier with 15 khz scs.

carrier = nrcarrierconfig;
carrier.nsizegrid = 52;
carrier.subcarrierspacing = 15;

the bandwidth configuration parameters csrs, bsrs, and bhop control the bandwidth allocated to the srs. to configure a full-band srs, set csrs = 14 and bsrs = 0.

srs = nrsrsconfig;
srs.csrs = 13; % bandwidth configuration c_srs (0...63)
srs.bsrs =  1; % bandwidth configuration b_srs (0...3)
hsrsgrid(carrier,srs, 1, true); % create and display a single-slot resource grid containing srs
title(['resource grid with full-band srs. csrs = ' num2str(srs.csrs)]);
hsrsannotations(carrier,srs);

figure contains an axes object. the axes object with title resource grid with full-band srs. csrs = 13, xlabel ofdm symbol, ylabel rb contains 3 objects of type image, line, text. this object represents srs 1.

for an srs frequency allocation, you can find the appropriate values of csrs, bsrs, and bhop in the srs bandwidth configuration table (see ts 38.211 table 6.4.1.4.3-1). alternatively, nrsrsconfig.bandwidthconfigurationtable provides an easy way to access and display this table.

% to display relevant rows of the bandwidth configuration table, calculate the value of csrs for a full band srs
[csrs,bsrs] = hsrsbandwidthconfiguration(srs,carrier.nsizegrid);
% display bandwidth configuration table
disp(nrsrsconfig.bandwidthconfigurationtable(csrs (0:2)   1*(csrs==0),:));
    c_srs    m_srs_0    n_0    m_srs_1    n_1    m_srs_2    n_2    m_srs_3    n_3
    _____    _______    ___    _______    ___    _______    ___    _______    ___
     13        48        1       24        2       12        2        4        3 
     14        52        1        4       13        4        1        4        1 
     15        56        1       28        2        4        7        4        1 

the columns labeled as m_srs_b with b = 0...3 contain the number of rbs allocated to the srs for the parameter b = bsrs and non-hopping configurations. the row corresponding to c_srs = 14 contains a number of rbs m_srs_0 = 52, which is the closest value to the carrier bandwidth. therefore, the parameters csrs = 14 and bsrs = 0 configure a full-band srs transmission for the current carrier configuration. this example uses the bandwidth configuration table to calculate the values of csrs and bsrs that maximize the srs bandwidth within the carrier.

fprintf('for a full-band srs in a carrier bandwidth of %d rb, set csrs = %d and bsrs = %d.',carrier.nsizegrid,csrs,bsrs);
for a full-band srs in a carrier bandwidth of 52 rb, set csrs = 14 and bsrs = 0.

you can use the srs read-only property nrbpertransmission to confirm that the generated srs fits into the carrier bandwidth.

fprintf('the srs bandwidth (%d rb) is lower than or equal to the carrier bandwidth (%d rb).',srs.nrbpertransmission,carrier.nsizegrid);
the srs bandwidth (24 rb) is lower than or equal to the carrier bandwidth (52 rb).

frequency-hopping configuration

you can configure intra-slot and inter-slot frequency hopping for multi-symbol and multi-slot srs transmissions, respectively. the instantaneous bandwidth per ofdm symbol is constant across srs ofdm symbols and is smaller than the bandwidth over which the srs hops.

configure a 15 mhz bandwidth carrier with 15 khz scs.

carrier = nrcarrierconfig;
carrier.nsizegrid = 79;
carrier.subcarrierspacing = 15;

create a four-symbol srs located at the end of the slot. select the repetition factor to indicate the number of equal consecutive srs transmissions (ofdm symbols) in a slot. for frequency-hopping configurations, repetition must be lower than the number of srs symbols.

srs = nrsrsconfig;
srs.numsrssymbols = 4;
   srs.repetition = 1;
  srs.symbolstart = 10; % time-domain position of the srs in the slot. (8...13) for normal cyclic prefix (cp) and (6...11) for extended cp

downlink control information (dci) can trigger aperiodic srs transmissions using the higher layer parameter resourcetype (see ts 38.331 section 6.3.2 srs-config). as the frequency hopping pattern is reset for aperiodic srs resource types at each slot, select periodic or semi-persistent srs resource types to enable inter-slot frequency hopping or aperiodic to disable it. you can configure the slot-wise periodicity and offset of the srs transmissions by using the property srsperiod. for aperiodic resource types, the parameter srsperiod controls the periodicity and offset of dci signals triggering aperiodic srs transmissions.

srs.resourcetype =  "periodic";
   srs.srsperiod = [2 0]; % periodicity in slots (1,2,4,5,8,10,...)
srs.srsperiod(2) = 0; % offset in slots must be smaller than the periodicity

use these interactive controls to select a hopping configuration and observe the changes to the ofdm resource grid.

srs.csrs = 19; % bandwidth configuration c_srs (0...63)
srs.bsrs = 2;  % bandwidth configuration b_srs (0...3)
srs.bhop = 0;  % frequency hopping configuration (0...3). set bhop >= bsrs to disable frequency hopping
srs.nrrc = 14; % frequency domain position in blocks of 4 prb (0...67)
% create and display a multi-slot resource grid containing srs
duration = 2*srs.srsperiod(1); % transmission length in slots
hsrsgrid(carrier,srs, duration, true);
title('carrier grid containing frequency-hopping srs')

figure contains an axes object. the axes object with title carrier grid containing frequency-hopping srs, xlabel ofdm symbol, ylabel rb contains 2 objects of type image, line. this object represents srs 1.

the bandwidth over which the srs symbols hop increases with the value of csrs and decreases with bhop (until bhop = bsrs disables hopping). increasing bsrs reduces the allocated bandwidth per ofdm symbol (property nrbpertransmission) and can reduce the intra-slot frequency hopping as well. to disable frequency hopping, set bhop >= bsrs. for non-hopping configurations, the roles of csrs and bsrs are analogous, as the allocated bandwidth increases with csrs and decreases with bsrs.

you can use the bandwidth configuration table (ts 38.211 table 6.4.1.4.3-1) to calculate the number of different frequency-hopping patterns configurable by the srs parameter nrrc as nfhp=nbhop 1nbsrs. the frequency-hopping patterns repeat when nrrc>nfhpnrbt/4.

n = hsrsnumberofsubbandsorhoppingpatterns(srs);
if srs.bhop < srs.bsrs && srs(1).nrb > 16 % number of unique frequency-hopping patterns
    fprintf('number of unique frequency-hopping patterns (configurable by nrrc < %d): %d.',n*srs.nrbpertransmission/4,n);
else % number of unique srs subbands 
    fprintf('number of unique srs subbands (configurable by nrrc < %d):  %d.',n*srs.nrbpertransmission/4,n);
end
number of unique frequency-hopping patterns (configurable by nrrc < 18): 6.

set the bandwidth configurations parameters as csrs = 20, bsrs = 2, and bhop = 1. the condition bhop < bsrs does not guarantee frequency hopping. however, the opposite is true: bhop >= bsrs always disables frequency hopping. you can determine when an srs bandwidth configuration (csrs,bsrs,bhop) produces frequency hopping using the nb parameter from the bandwidth configuration table and evaluating the condition nfhp=nbhop 1nbsrs>1.

isfreqhoppingconfiguration = hsrsnumberofsubbandsorhoppingpatterns(srs) > 1;
disp(['frequency hopping is' repmat(' not',1,~isfreqhoppingconfiguration) ' enabled.'])
frequency hopping is enabled.

in frequency-hopping cases, the read-only property nrb specifies the bandwidth over which the srs hops and nrbpertransmission specifies the instantaneous bandwidth allocated per srs ofdm symbol.

t = table([srs.nrb; srs.nrbpertransmission],'rownames', {'freq-hopping bandwidth','instantaneous bandwidth'},'variablenames',"nrb");
disp(t)
                               nrb
                               ___
    freq-hopping bandwidth     72 
    instantaneous bandwidth    12 

multi-user configurations

this section explains how to configure multiple srs transmissions suitable for multi-user setups. you can use time-domain, frequency-domain, and sequence-domain parameters to create sets of orthogonal (interference-free) srs transmissions.

time-domain orthogonal srs

you can create time-domain orthogonal srs transmissions in multiple ways, for example:

  • configure different slot periodicity and offset for different srs by using the property srsperiod.

  • configure different symbol-wise time domain allocations for different srs by using the property symbolstart.

configure a 10 mhz bandwidth carrier with 15 khz scs.

carrier = nrcarrierconfig;
carrier.nsizegrid = 52;
carrier.subcarrierspacing = 15;

specify the slot periodicity and offset to create orthogonal srs transmissions.

first srs configuration:

srs = nrsrsconfig;
srs(1).srsperiod = [1 0];
srs(1).srsperiod(1) = 4; % slot periodicity and offset
srs(1).srsperiod(2) = 0; % slot offset of first srs

second srs configuration:

srs(2) = srs(1); % create a copy of the configured srs
srs(2).srsperiod(1) = 2; % periodicity in slots
srs(2).srsperiod(2) = 1; % offset in slots

this figure displays an ofdm resource grid containing the configured srs transmissions.

hsrsgrid(carrier,srs,srs(1).srsperiod(1)*2, true); % generate a multi-slot resource grid containing srs
title('srs with different slot offsets (srsperiod)')
ylim([0 srs(1).nrbpertransmission]);

figure contains an axes object. the axes object with title srs with different slot offsets (srsperiod), xlabel ofdm symbol, ylabel rb contains 3 objects of type image, line. these objects represent srs 1, srs 2.

specify the number of srs symbols and location in the slot to create orthogonal srs transmissions.

first srs configuration:

srs = nrsrsconfig;
srs(1).numsrssymbols = 1;  % number of srs symbols in a slot (1,2,4)
srs(1).symbolstart = 12; % time-domain position of the srs in the slot. (8...13) for normal cyclic prefix (cp) and (6...11) for extended cp

second srs configuration:

srs(2) = srs(1); % create a copy of the configured srs
srs(2).numsrssymbols = 2;
srs(2).symbolstart = 9;

this figure displays the ofdm resource grid containing the srs transmissions.

hsrsgrid(carrier,srs, 2, true); % generate and display a 2-slot resource grid containing srs
title('srs with different symbol locations (symbolstart)');
ylim([0 srs(1).nrbpertransmission]);

figure contains an axes object. the axes object with title srs with different symbol locations (symbolstart), xlabel ofdm symbol, ylabel rb contains 3 objects of type image, line. these objects represent srs 1, srs 2.

frequency-domain orthogonal srs

you can create frequency-domain orthogonal srs transmissions in multiple ways:

  • configure different comb offsets for different srs by using the property kbartc.

  • configure different frequency-hopping patterns using csrs, bsrs, bhop and nrrc.

configure a 10 mhz bandwidth carrier with 15 khz scs.

carrier = nrcarrierconfig;
carrier.nsizegrid = 52;
carrier.subcarrierspacing = 15;

specify the comb numbers and offsets to create orthogonal srs transmissions.

first srs configuration:

srs = nrsrsconfig;
srs(1).ktc    = 2; % comb number (2,4). it indicates the allocation of the srs every ktc subcarriers
srs(1).kbartc = 1; % comb offset (0...ktc-1)

second srs configuration:

srs(2) = srs(1); % create a copy of the configured srs
srs(2).ktc    = 4;
srs(2).kbartc = 0;

this figure displays the ofdm resource grid containing the srs transmissions.

hsrsgrid(carrier,srs,2,true);
title('srs with different comb offsets (kbartc)')
ylim([0 srs(1).nrbpertransmission]);

figure contains an axes object. the axes object with title srs with different comb offsets (kbartc), xlabel ofdm symbol, ylabel rb contains 3 objects of type image, line. these objects represent srs 1, srs 2.

create frequency-domain orthogonal srs configurations using different frequency-hopping patterns.

srs = nrsrsconfig;
srs.numsrssymbols = 4;  % number of srs symbols in a slot
srs.symbolstart =8; % allocate srs in ofdm symbols 10:13

select the desired bandwidth configuration parameters, resource type and repetition factor.

srs.csrs = 10;  % bandwidth configuration c_srs (0...63)
srs.bsrs =  2;  % bandwidth configuration b_srs (0...3)
srs.bhop =  0;  % frequency hopping configuration (0...3). set bhop >= bsrs to disable frequency hopping
srs.resourcetype = "periodic"; % ('periodic','semi-persistent','aperiodic')
srs.repetition   = 1; % number of equal consecutive srs transmissions (1,2,4). it must be lower than numsrssymbols

this example calculates the number of orthogonal srs sequences that can be configured by nrrc and creates frequency non-overlapping srs configurations. the figure displays the ofdm resource grid containing the srs transmissions.

nrrc = num2cell(hnrrcset(srs));
srs(2:length(nrrc)) = srs(1); % create n-1 copies of the configured srs
[srs(:).nrrc] = deal(nrrc{:}); % assign the appropriate nrrc to each srs configuration
hsrsgrid(carrier,srs, 3, true); % generate and display a 3-slot resource grid containing srs
title('srs with different frequency-hopping patterns');
ylim([0 srs(1).nrbpertransmission*hsrsnumberofsubbandsorhoppingpatterns(srs(1))]);

figure contains an axes object. the axes object with title srs with different frequency-hopping patterns, xlabel ofdm symbol, ylabel rb contains 10 objects of type image, line. these objects represent srs 1, srs 2, srs 3, srs 4, srs 5, srs 6, srs 7, srs 8, srs 9.

n = hsrsnumberofsubbandsorhoppingpatterns(srs(1));
if srs(1).bhop < srs(1).bsrs % frequency-hopping cases
    fprintf('number of unique frequency-hopping patterns (configurable by nrrc < %d): %d.', n*srs(1).nrbpertransmission/4, n);
else
    fprintf('number of unique subbands (configurable by nrrc < %d):  %d.', n*srs(1).nrbpertransmission/4,n);
end
number of unique frequency-hopping patterns (configurable by nrrc < 9): 9.

note that the srs transmissions are never overlapping regardless of the repetition factor and resourcetype (aperiodic disables inter-slot frequency hopping). disable frequency hopping by setting bhop >= bsrs and observe that the different srs are still allocated to different subbands.

cyclic-shift orthogonal srs

this section generates multiple srs allocated to the same time and frequency resources (ofdm symbols and subcarriers) but different time-domain cyclic shifts. due to the properties of zadoff-chu sequences, this configuration produces orthogonal srs. to demonstrate the orthogonality among the configured srs, this section performs cp-ofdm modulation and calculates the cross-correlation of the time-domain waveforms.

% configure a 10 mhz bandwidth carrier with 15 khz scs.
carrier = nrcarrierconfig;
carrier.nsizegrid = 52;
carrier.subcarrierspacing = 15;
% create a full-band srs
srs = nrsrsconfig;
srs.csrs = hsrsbandwidthconfiguration(srs,carrier.nsizegrid);
% all srs share the same physical resources, but they are configured with
% different cyclic shifts.
for i = 1:8
    srs(i) = srs(1);
    srs(i).cyclicshift = i-1;
end
% create a resource grid containing srs
numslots = 1; % number of slots to generate
for ich = length(srs):-1:1
    slotgrid{ich} = hsrsgrid(carrier,srs(ich),numslots);
end
% get ofdm modulation related information
ofdminfo = nrofdminfo(carrier);
% ofdm modulation
nsrs = length(srs); % number of srs waveforms
numsamples = numslots*ofdminfo.samplerate/1000/carrier.slotspersubframe;
txwaveform = zeros(numsamples,srs(1).numsrsports,nsrs);
for i = 1:nsrs
    txwaveform(:,:,i) = nrofdmmodulate(carrier,slotgrid{i});
end
% cross correlation of srs waveforms generated with different cyclic shifts
txwaveform = reshape(txwaveform,[],nsrs*srs(1).numsrsports);
c = txwaveform'*txwaveform;
srscorr = c./diag(c);

this figure shows the time-domain cross-correlation of the srs waveforms with different cyclic shifts.

imagesc(abs(srscorr))
title('correlation of srs with different cyclicshift')
xlabel('srs configuration'); ylabel('srs configuration');
colorbar

figure contains an axes object. the axes object with title correlation of srs with different cyclicshift, xlabel srs configuration, ylabel srs configuration contains an object of type image.

the low correlations among srs waveforms generated using different time-domain cyclic shifts show their orthogonality.

disp('absolute value of correlation matrix: '); disp(' '); disp(abs(srscorr));
absolute value of correlation matrix: 
 
    1.0000    0.0027    0.0021    0.0008    0.0003    0.0010    0.0007    0.0038
    0.0027    1.0000    0.0030    0.0006    0.0006    0.0001    0.0006    0.0005
    0.0021    0.0030    1.0000    0.0041    0.0007    0.0008    0.0003    0.0008
    0.0008    0.0006    0.0041    1.0000    0.0040    0.0004    0.0009    0.0000
    0.0003    0.0006    0.0007    0.0040    1.0000    0.0039    0.0002    0.0009
    0.0010    0.0001    0.0008    0.0004    0.0039    1.0000    0.0039    0.0003
    0.0007    0.0006    0.0003    0.0009    0.0002    0.0039    1.0000    0.0039
    0.0038    0.0005    0.0008    0.0000    0.0009    0.0003    0.0039    1.0000

summary and further exploration

this example describes how to generate and map srs sequences into an ofdm carrier resource grid, and how to generate the corresponding waveform for multiple carrier and srs configurations. the example highlights the relationship between srs configuration parameters and their effects on both the resource grid and srs waveform properties. for example:

  • the bandwidth allocated to the srs generally increases with csrs and decreases with bsrs. for frequency-hopping configurations, the instantaneous bandwidth and hopping bandwidth decrease with bsrs and bhop, respectively.

  • the frequency position of the srs depends on the frequencystart and nrrc parameters. nrrc allows to select different srs subbands and frequency-hopping patterns.

  • bhop < bsrs generally produces frequency hopping, but it is not guaranteed. however, bhop >= bsrs is sufficient to disable frequency hopping.

  • inter-slot frequency hopping is active only for periodic and semi-persistent resource types.

  • time-, frequency-, and sequence-related parameters can be used to create orthogonal srs transmissions.

the example also demonstrates how to extract useful information from both the srs bandwidth configuration table and read-only properties, such as, the number of unique srs subbands and frequency-hopping patterns configurable by nrrc.

the srs sequence generation for multiport configurations employs the orthogonalization mechanism presented in cyclic-shift orthogonal srs. to verify the orthogonality across multiple ports, configure a multi-port srs, generate the symbols and indices, map the symbols into a resource grid, generate the srs waveforms, and compute the cross-correlation between waveforms generated for different ports.

references

[1] 3gpp ts 38.211. “nr; physical channels and modulation.” 3rd generation partnership project; technical specification group radio access network.

[2] 3gpp ts 38.331. “nr; radio resource control (rrc) protocol specification.” 3rd generation partnership project; technical specification group radio access network.

local functions

this example uses these local functions:

function [csrs,bsrs] = hsrsbandwidthconfiguration(srs, nrb)
% [csrs,bsrs] = hbandwidthconfiguration(srs, nrb) returns the srs
% bandwidth configuration parameters csrs and bsrs required to transmit an
% srs in a bandwidth specified by nrb. the function calculates csrs and
% bsrs considering the srs properties frequencystart and nrrc, so the
% available bandwidth nrb is reduced by the frequency origin of the srs.
% for frequency hopping cases, the value of bsrs returned is equal to that
% of the bsrs property in the input srs configuration object.
    f0 = hsrsfrequencyorigin(srs);
    nrb = nrb - f0;
    if nrb < 4
        error('the available bandwidth is not sufficient to allocate an srs transmission. increase the carrier bandwidth or configure the srs in a lower frequency.' )    
    end
    
    % for frequency hopping configurations
    if srs.bhop >= srs.bsrs && nargout == 2 % no frequency hopping and bsrs is requested
        bsrs = 0:3;
    else
        bsrs = 0;
    end
    
    % initialize gap between srs frequency allocation and carrier bandwidth
    nrbgap = nrb; 
    
    % find the appropriate csrs for each bsrs that minimizes the gap only
    % in non-hopping cases. for freq. hopping, find the value of csrs only.
    for b = bsrs
        % nrb allocated to the srs for bsrs = b and all csrs
        srsnrbb = srs.bandwidthconfigurationtable{:,2*(b 1)};
        msrsbmax = max( srsnrbb( srsnrbb <= nrb ));
        
        % calculate gap between srs allocation and carrier bandwidth
        gap = nrb - msrsbmax;
        if gap < nrbgap
            csrs = srs.bandwidthconfigurationtable{ srsnrbb == msrsbmax ,1};
            bsrs = b;
            nrbgap = gap;
        end
    end
    csrs = csrs(1);
    
    if srs.bhop < bsrs
        bsrs = srs.bsrs;
    end
end
function out = hsrsnumberofsubbandsorhoppingpatterns(srs)
% n = hsrsnumberofsubbandsorhoppingpatterns(srs) returns the number of
% unique srs subbands or frequency-hopping patterns n configurable by the
% srs property nrrc. an srs subband is the frequency band allocated for srs
% in a given ofdm symbol (see srs property nrbpertransmission). n is
% calculated using ts 38.211 table 6.4.1.4.3-1 for the bandwidth
% configuration parameters csrs, bsrs, and bhop specified in the srs
% configuration object srs.
    bwct = nrsrsconfig.bandwidthconfigurationtable{:,:};
    if srs.bhop < srs.bsrs % number of unique frequency-hopping patterns
        b0 = srs.bhop 1;
    else % number of unique srs subbands
        b0 = 0;
    end
    out = prod(bwct(srs.csrs 1,2*(b0:srs.bsrs) 3));
end
function [grid,dispgrid] = hsrsgrid(carrier,srs,duration,displaygrid,chplevels)
% [grid,dispgrid] = hsrsgrid(carrier,srs,duration,displaygrid,chplevels)
% returns a multi-slot ofdm resource grid grid containing a set of sounding
% reference signals in a carrier, as specified by the configuration objects
% carrier and srs. this function also returns a scaled version of the grid
% used for display purposes. the optional input duration (default 1)
% specifies the number of slots of the generated grid. the resource grid
% can be displayed using the optional input displaygrid (default false).
% chplevels specifies the channel power levels for display purposes only
% and it must be of the same size as srs.
    numsrs = length(srs);
    if nargin < 5
        chplevels = 1:-1/numsrs:1/numsrs;
        if nargin < 4
            displaygrid = false;
            if nargin < 3
                duration = 1;
            end
        end
    end
    
    symbolsperslot = carrier.symbolsperslot;
    emptyslotgrid = nrresourcegrid(carrier,max([srs(:).numsrsports])); % initialize slot grid
    
    % create the srs symbols and indices and populate the grid with the srs symbols
    grid = repmat(emptyslotgrid,1,duration);
    dispgrid = repmat(emptyslotgrid,1,duration); % frame-size grid for display
    for ns = 0:duration-1
        slotgrid = emptyslotgrid;
        dispslotgrid = emptyslotgrid; % slot-size grid for display
        for ich = 1:numsrs
            srsindices = nrsrsindices(carrier,srs(ich));
            srssymbols = nrsrs(carrier,srs(ich));
            slotgrid(srsindices) = srssymbols;
            dispslotgrid(srsindices) = chplevels(ich)*srssymbols; % scale the srs for display only
        end
        ofdmsymidx = ns*symbolsperslot   (1:symbolsperslot);
        grid(:,ofdmsymidx,:) = slotgrid;
        dispgrid(:,ofdmsymidx,:) = dispslotgrid;
        carrier.nslot = carrier.nslot 1;
    end
    
    if displaygrid
        plotgrid(dispgrid(:,:,1),chplevels,"srs "   (1:numsrs)'); 
    end
end
    
function varargout = plotgrid(grid,chplevels,leg)
% plotgrid(grid, chplevel,leg) displays a resource grid grid containing
% channels or signals at different power levels chplevel and create a
% legend for these using a cell array of character vector leg
    if nargin < 3
        leg = {'srs'};
        if nargin < 2
            chplevels = 1;
        end
    end
    
    cmap = colormap(gcf);
    chpscale = length(cmap); % scaling factor
    
    h = figure;
    image(0:size(grid,2)-1,(0:size(grid,1)-1)/12,chpscale*abs(grid(:,:,1))); % multiplied with scaling factor for better visualization
    axis xy;
    
    title('carrier grid containing srs')
    xlabel('ofdm symbol'); ylabel('rb');
    
    clevels = chpscale*chplevels(:);
    n = length(clevels);
    l = line(ones(n),ones(n),'linewidth',8); % generate lines
    
    % index the color map and associate the selected colors with the lines
    set(l,{'color'},mat2cell(cmap( min(1 fix(clevels),length(cmap) ),:),ones(1,n),3)); % set the colors according to cmap
    
    % create legend
    legend(leg(:));
    
    if nargout > 0 
        varargout = {h};
    end
end
function hsrsannotations(carrier,srs)
% hsrsannotations(carrier,srs) adds annotation to the current figure
% indicating the frequency origin of the srs and the number of rb used per
% ofdm symbol for the configuration objects carrier and srs.
    % calculate the frequency origin of the first srs symbol
    f0 = hsrsfrequencyorigin(srs);
    
    hold on;
    hfig = gcf;
    set(hfig,'units','normalized');
    sym0 = srs.symbolstart-0.5;
    if isnumeric(srs.srsperiod)
        sym0 = srs.srsperiod(2)*carrier.symbolsperslot   srs.symbolstart-0.5;
    end
    
    ip = get(gca,'position');
    
    % y-coordinate in the current axes of the srs freq position f0
    yf0 = f0/carrier.nsizegrid*ip(4) ip(2);
    xc = sym0/((carrier.nslot 1)*carrier.symbolsperslot)*ip(3) ip(1);
    
    % add annotation to the figure including f0 in rb
    if f0/carrier.nsizegrid > 0.08 % only plot f0 when there is enough space in the y-axis
        % create doublearrow for f0
        ymin = ip(2);
        annotation(hfig,'doublearrow',xc*[1 1], [ymin yf0],...
            'color',[1 0.4 0.15]);
        
        % text for f0
        str = sprintf('$$f_0 = %d $$ rb', f0);
        ystr = f0/carrier.nsizegrid/2;
        text(gca,(xc-ip(1))/ip(3)-0.25, ystr,str,...
            'color',[1 0.4 0.15],'fontsize',14, ...
            'units','normalized','interpreter','latex');
    end
    
    % create doublearrow from f0 and spanning the srs bandwidth
    yf1 = yf0   srs.nrbpertransmission/carrier.nsizegrid*ip(4);
    annotation(hfig,'doublearrow',xc*[1 1], [yf0 yf1],...
        'color',[1 0.4 0.15]);
    
    % text for nrbt
    str = sprintf('$$\\textrm{nrb}_t = %d $$ rb', srs.nrbpertransmission);
    ystr = (f0   0.5*srs.nrbpertransmission)/carrier.nsizegrid;
    text(gca,(xc-ip(1))/ip(3)-0.32, ystr ,str,...
        'color',[1 0.4 0.15],'fontsize',14, ...
        'units','normalized','interpreter','latex');
end
function f0 = hsrsfrequencyorigin(srs)
% calculate the frequency origin of the first srs symbol in a slot
    nsbtable = hsrsnumberofsubbandsorhoppingpatterns(srs);
    nrbt = srs.nrbpertransmission;
    
    % origin of the srs in frequency in rb
    f0 = srs.frequencystart   nrbt*mod(floor(4*srs.nrrc/nrbt),nsbtable);
end
function [nrrc,nrb] = hnrrcset(srs)
% calculate the values of nrrc that generate a unique set of orthogonal srs in frequency
    if srs.bhop < srs.bsrs % frequency-hopping cases
        nrb = srs(1).nrb;  % hopping bandwidth
    else 
        nrb = nrsrsconfig.bandwidthconfigurationtable{srs(1).csrs 1,2}; 
    end
    
    % number of frequency-hopping patterns or srs subbands depending on the values of bsrs and bhop
    n = hsrsnumberofsubbandsorhoppingpatterns(srs);
    
    nrrc = nrb/4*(0:n-1)/n; 
end

references

[1] 3gpp ts 38.211. “nr; physical channels and modulation.” 3rd generation partnership project; technical specification group radio access network.

see also

functions

  • |

objects

related topics

网站地图