主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

将 5G 物理信道和信号映射到资源网格

此示例展示了如何使用 5G Toolbox™ 功能生成 5G NR (New Radio) 物理信道和信号并将其映射到资源网格。

简介

下图显示了此示例中在 5G 下行链路的环境下建模的链路元素。这些元素是:

  • 物理下行链路共享信道 (PDSCH) 及其解调参考信号 (DM-RS) 的生成

  • MIMO 预编码与 PDSCH 和 PDSCH DM-RS 到资源网格的映射

  • OFDM 调制

MappingToGridProcChain.png

载波配置

指定发射天线的数量并创建一个载波配置对象。此对象控制资源网格的大小。为简单起见,请使用默认的载波配置对象。

nTxAnts = 4;
carrier = nrCarrierConfig
carrier = 
  nrCarrierConfig with properties:

                NCellID: 1
      SubcarrierSpacing: 15
           CyclicPrefix: 'normal'
              NSizeGrid: 52
             NStartGrid: 0
                  NSlot: 0
                 NFrame: 0
    IntraCellGuardBands: [0×2 double]

   Read-only properties:
         SymbolsPerSlot: 14
       SlotsPerSubframe: 1
          SlotsPerFrame: 10

PDSCH 和 PDSCH DM-RS 的配置

创建一个 PDSCH 配置对象。此对象指定 PDSCH 相关参数。请指定 16-QAM 调制、两层和全频段分配。此配置将 PDSCH 映射到与载波大小相等的带宽部分 (BWP)。您还可以使用此对象指定其他时间分配参数和 DM-RS 设置。

pdsch = nrPDSCHConfig;
pdsch.Modulation = "16QAM";
pdsch.NumLayers = 2;
pdsch.PRBSet = 0:carrier.NSizeGrid-1; % Full band allocation

显示 PDSCH 和 PDSCH DM-RS 参数。

pdsch
pdsch = 
  nrPDSCHConfig with properties:

                NSizeBWP: []
               NStartBWP: []
             ReservedPRB: {[1×1 nrPDSCHReservedConfig]}
              ReservedRE: []
              Modulation: '16QAM'
               NumLayers: 2
             MappingType: 'A'
        SymbolAllocation: [0 14]
                  PRBSet: [0 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]
              PRBSetType: 'VRB'
    VRBToPRBInterleaving: 0
           VRBBundleSize: 2
                     NID: []
                    RNTI: 1
                    DMRS: [1×1 nrPDSCHDMRSConfig]
              EnablePTRS: 0
                    PTRS: [1×1 nrPDSCHPTRSConfig]

   Read-only properties:
            NumCodewords: 1

pdsch.DMRS
ans = 
  nrPDSCHDMRSConfig with properties:

      DMRSConfigurationType: 1
         DMRSReferencePoint: 'CRB0'
          DMRSTypeAPosition: 2
     DMRSAdditionalPosition: 0
                 DMRSLength: 1
            CustomSymbolSet: []
                DMRSPortSet: []
                   NIDNSCID: []
                      NSCID: 0
    NumCDMGroupsWithoutData: 2
            DMRSDownlinkR16: 0
            DMRSEnhancedR18: 0

   Read-only properties:
                  CDMGroups: [0 0]
                DeltaShifts: [0 0]
           FrequencyWeights: [2×2 double]
                TimeWeights: [2×2 double]
    DMRSSubcarrierLocations: [6×2 double]
                 CDMLengths: [2 1]

PDSCH 的生成

生成索引以将 PDSCH 映射到网格。

[pdschIndices,pdschInfo] = nrPDSCHIndices(carrier,pdsch);

生成随机 PDSCH 比特并将其映射到 PDSCH 符号。输入参量 pdschInfo.G 指定 PDSCH 的比特容量,这是信道编码阶段中码字的长度。pdschInfo.G 将可用于 PDSCH 发送的资源元素 (RE) 考虑在内。为简单起见,此示例未包括下行链路共享信道 (DL-SCH) 建模。

pdschBits = randi([0 1],pdschInfo.G,1);

生成 PDSCH 符号。PDSCH 符号存储在大小为 Ns×ν 的矩阵中,其中 Ns 是符号数,ν 是层数。

pdschSymbols = nrPDSCH(carrier,pdsch,pdschBits);
size(pdschSymbols)
ans = 1×2

        8112           2

PDSCH DM-RS 的生成

生成 DM-RS 符号和索引。

dmrsSymbols = nrPDSCHDMRS(carrier,pdsch);
dmrsIndices = nrPDSCHDMRSIndices(carrier,pdsch);

显示带有 PDSCH 和 PDSCH DM-RS 符号的星座图。

plot(pdschSymbols(:),"o");hold on
plot(dmrsSymbols(:),"xr");hold off
title("PDSCH and PDSCH DM-RS Symbols");xlabel("In-Phase Amplitude");ylabel("Quadrature Amplitude")
legend("PDSCH","PDSCH DM-RS")

Figure contains an axes object. The axes object with title PDSCH and PDSCH DM-RS Symbols, xlabel In-Phase Amplitude, ylabel Quadrature Amplitude contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent PDSCH, PDSCH DM-RS.

MIMO 的预编码与到资源网格的映射

应用预编码。信道测量值用于确定预编码权重(也称为波束成形权重)。不过,此示例没有对传播信道进行建模。此示例假设预编码权重是已知的。

% Precoding weights
W = fft(eye(nTxAnts))/sqrt(nTxAnts);              % Unitary precoding matrix
w = W(1:pdsch.NumLayers,:)/sqrt(pdsch.NumLayers); % Normalize by number of layers

预编码矩阵 w 必须是大小为 ν×Ntx 的矩阵,其中 ν 是层数,Ntx 是发射天线的数量。

MappingToGridArraySizes.png

size(pdschSymbols)
ans = 1×2

        8112           2

size(w)
ans = 1×2

     2     4

对 PDSCH 符号进行预编码。

pdschSymbolsPrecoded = pdschSymbols*w;

pdschSymbolsPrecoded 矩阵的行数对应于 PDSCH 符号的数量,而列数对应于天线的数量。

size(pdschSymbolsPrecoded)
ans = 1×2

        8112           4

生成一个空的资源网格。此网格跨一个时隙。

pdschGrid = nrResourceGrid(carrier,nTxAnts);

将 PDSCH 符号映射到资源网格时,请注意 nrPDSCHIndices 函数生成的 PDSCH 索引指的是层而不是天线。当您将 PDSCH 符号直接映射到层时,此格式可能非常有用。在这种情况下,生成的资源网格没有进行预编码。

MappingToGridLayers.png

因为此示例在将 PDSCH 符号映射到资源网格之前对这些符号应用预编码,所以经预编码的 PDSCH 符号映射到天线而不是层。要将层索引转换为天线索引,请使用 nrExtractResources 函数。

MappingToGridAntennas.png

[~,pdschAntIndices] = nrExtractResources(pdschIndices,pdschGrid);
pdschGrid(pdschAntIndices) = pdschSymbolsPrecoded;

显示第一个天线的资源网格。蓝色间隙是留给 DM-RS 的。

imagesc([0 carrier.SymbolsPerSlot-1],[0 carrier.NSizeGrid*12-1],abs(pdschGrid(:,:,1)));
axis xy;title("Resource Grid (First Antenna) - PDSCH");xlabel("OFDM Symbol");ylabel("Subcarrier")

Figure contains an axes object. The axes object with title Resource Grid (First Antenna) - PDSCH, xlabel OFDM Symbol, ylabel Subcarrier contains an object of type image.

对 DM-RS 符号进行预编码并将其映射到网格。与 PDSCH 索引类似,DM-RS 索引指的是层。要将这些层转换为多天线索引,请再次使用 nrExtractResources 函数。

% PDSCH DM-RS precoding and mapping
for p = 1:size(dmrsSymbols,2)
    [~,dmrsAntIndices] = nrExtractResources(dmrsIndices(:,p),pdschGrid);
    pdschGrid(dmrsAntIndices) = pdschGrid(dmrsAntIndices) + dmrsSymbols(:,p)*w(p,:);
end

显示第一个天线的资源网格。

imagesc([0 carrier.SymbolsPerSlot-1],[0 carrier.NSizeGrid*12-1],abs(pdschGrid(:,:,1)));
axis xy;title("Resource Grid (First Antenna) - PDSCH and PDSCH DM-RS");
    xlabel("OFDM Symbol");ylabel("Subcarrier")

Figure contains an axes object. The axes object with title Resource Grid (First Antenna) - PDSCH and PDSCH DM-RS, xlabel OFDM Symbol, ylabel Subcarrier contains an object of type image.

在资源网格中显示单个资源块 (RB)。此视图可放大到单个 RB,并提供 RE 内容的详细视图。

imagesc(abs(pdschGrid(1:12,:,1)));view(2)
axis xy;title("Resource Block - PDSCH and PDSCH DM-RS");ylabel("Subcarrier");xlabel("OFDM Symbol")

Figure contains an axes object. The axes object with title Resource Block - PDSCH and PDSCH DM-RS, xlabel OFDM Symbol, ylabel Subcarrier contains an object of type image.

OFDM 调制

对资源网格进行 OFDM 调制并显示第一个天线的时域波形。

[txWaveform,waveformInfo] = nrOFDMModulate(carrier,pdschGrid);
plot(abs(txWaveform(:,1)));title("Time Domain Waveform (First Antenna)");xlabel("Sample Number");ylabel("Magnitude")

Figure contains an axes object. The axes object with title Time Domain Waveform (First Antenna), xlabel Sample Number, ylabel Magnitude contains an object of type line.

waveformInfo 输出包含有关时域波形的信息,例如采样率。

waveformInfo
waveformInfo = struct with fields:
                   Nfft: 1024
             SampleRate: 15360000
    CyclicPrefixLengths: [80 72 72 72 72 72 72 80 72 72 72 72 72 72]
          SymbolLengths: [1104 1096 1096 1096 1096 1096 1096 1104 1096 1096 1096 1096 1096 1096]
              Windowing: 36
           SymbolPhases: [0 0 0 0 0 0 0 0 0 0 0 0 0 0]
         SymbolsPerSlot: 14
       SlotsPerSubframe: 1
          SlotsPerFrame: 10

另请参阅

主题