# Model DL-SCH and PDSCH

This example shows how to construct the physical downlink shared channel (PDSCH). It also demonstrates how to generate a transport block, perform downlink shared channel (DL-SCH) coding to create a codeword, perform physical channel coding to create the physical channel, and map the complex symbols to the resource grid.

Specify cell-wide settings as fields in the structure `enb`. Many of the functions used in this example require a subset of these settings.

```enb.NDLRB = 9; enb.CyclicPrefix = 'Normal'; enb.PHICHDuration = 'Normal'; enb.CFI = 3; enb.Ng = 'Sixth'; enb.CellRefP = 4; enb.NCellID = 1; enb.NSubframe = 0; enb.DuplexMode = 'FDD';```

Configure the PDSCH. In addition to the cell-wide settings specified in `enb`, you must define other parameters related to the modulation and channel transmission configuration, `pdsch`, such as the radio network temporary identifier (RNTI), to generate the PDSCH.

```pdsch.NTxAnts = 4; pdsch.NLayers = 4; pdsch.TxScheme = 'TxDiversity'; pdsch.Modulation = {'QPSK'}; pdsch.RV = 0; pdsch.RNTI = 1;```

In this example, you use a single codeword to form the PDSCH symbols. However, in LTE, up to two codewords can be combined to form the PDSCH. Each codeword can be modulated with a different scheme. Use a cell array to indicate the modulation scheme for each codeword.

Determine how the PDSCH is mapped to resource elements by allocating the physical resource blocks (PRBs). A column vector containing the indices of PDSCH allocated PRBs is required. In this example, assume full allocation; all resource blocks are allocated to the PDSCH. Specify this full subframe resource allocation using a column vector.

`prbs = (0:enb.NDLRB-1).';`

The allocation specified in `prbs` is zero-based. In this case, assume that both slots in the subframe share the same resource allocation. To have different allocations for each slot, specify a two-column matrix where each column refers to each slot in the subframe.

Generate the PDSCH indices. To do so, call the `ltePDSCHIndices` function for the cell-wide settings `enb`, the channel transmission configuration `pdsch`, and the physical resource block allocation `prbs`.

`[pdschIndices,pdschIndInfo] = ltePDSCHIndices(enb,pdsch,prbs,{'1based'});`

The first output, `pdschIndices`, specifies the PDSCH indices. The second output, `pdschIndInfo`, provides additional information related to the PDSCH capacity.

Determine DL-SCH payload and coded transport block size. These items are required for creating the PDSCH payload due to the rate matching portion of the DL-SCH transport block coding. There are the following two methods of determining coded transport block size and the DL-SCH payload size.

• Using the PDSCH indices information output, as shown in this example

• Using the reference measurement channel (RMC) transport block sizes as a guide

The coded transport block size is one of the fields of the PDSCH indices information output, `pdschIndInfo`.

`codedTrBlkSize = pdschIndInfo.G;`

In this example, `codedTrBlkSize `is 480. Alternatively, you could read the coded transport block size for a given modulation scheme, PRB allocation, and number of antennas from the RMC tables in TS 36.101, Annex A.3.3 and A.3.4. Once you know the coded transport block size, calculate the DL-SCH payload using the rules in TS 36.101, Annex A.2.1.2, titled, "Determination of payload size", with target code rate, $\mathit{R}$, equal to $1/3$, and the number of bits per subframe given by `codedTrBlkSize`. Determine the payload size, $\mathit{A}$, such that the resulting coding rate is as close as possible to the desired coding rate, $\mathit{R}$, for a given coded transport block size, ${\mathit{N}}_{\mathrm{ch}}$, as shown in the following equation.

`$\mathrm{min}\text{\hspace{0.17em}}|\mathit{R}-\left(A+24\right)/{\mathit{N}}_{\mathrm{ch}}|$`

In this example, the payload size for 6 RBs calculated using the preceding equation is A=152. This is the value at which the error between the desired code rate and actual code rate is minimized.

The payload size, $\mathit{A}$, must be one of a specific set for a specific number of resource blocks given in TS 36.213, Table 7.1.7.2.1 1 or 7.1.7.2.2 1 (in Section 7.1.7.2). These tables are represented by the `lteTBS` function. In this example, the payload size for 6 RBs that minimizes the error between the desired code rate and the actual code rate is $A=152$. This value was selected from table 7.1.7.2.2 1. Therefore, the payload size, `transportBlkSize`, is 152.

### Alternative Method: Use RMCs to Determine Transport Block Sizes

Alternatively, you could determine suitable payload size and coded transport block size from the tables in TS 36.101, Annex A.3.3 and A.3.4, titled "Reference Measurement Channels for PDSCH performance requirements." Despite the advantage of simply being able to read values from the tables, the channel bandwidths and PDSCH allocations are restricted to the RMCs available. For example, you can use Table A.3.3.2.2-1, titled "Fixed Reference Channel four antenna ports."

To generate a PDSCH for a 1.4MHz channel bandwidth, four-antenna transmission with QPSK modulation, and a coding rate of , use the highlighted rows titled "Information Bit Payload" to find the DL-SCH payload size for each subframe, and "Binary Channel Bits," to find the coded transport block size for each subframe.

`$\begin{array}{llllllll}Parameter& Unit& Value& & & & & \\ \begin{array}{l}Reference\phantom{\rule{0.5em}{0ex}}Channel\end{array}& & \begin{array}{l}R.12\phantom{\rule{0.5em}{0ex}}FDD\end{array}& \begin{array}{l}R.13\phantom{\rule{0.5em}{0ex}}FDD\end{array}& \begin{array}{l}R.14\phantom{\rule{0.5em}{0ex}}FDD\end{array}& \begin{array}{l}R.14-1\phantom{\rule{0.5em}{0ex}}FDD\end{array}& \begin{array}{l}R.14-2\phantom{\rule{0.5em}{0ex}}FDD\end{array}& \begin{array}{l}R.36\phantom{\rule{0.5em}{0ex}}FDD\end{array}\\ \begin{array}{l}Channel\phantom{\rule{0.5em}{0ex}}bandwidth\end{array}& MHz& 1.4& 10& 10& 10& 10& 10\\ \begin{array}{l}Allocated\phantom{\rule{0.5em}{0ex}}resource\phantom{\rule{0.5em}{0ex}}blocks\end{array}& & 6& 50& 50& 6& 3& 50\\ \begin{array}{l}Allocated\phantom{\rule{0.5em}{0ex}}subframes\phantom{\rule{0.5em}{0ex}}per\phantom{\rule{0.5em}{0ex}}Radio\phantom{\rule{0.5em}{0ex}}Frame\end{array}& & 9& 9& 9& 8& 8& 9\\ \begin{array}{l}Modulation\end{array}& & QPSK& QPSK& 16QAM& 16QAM& 16QAM& 64QAM\\ \begin{array}{l}Target\phantom{\rule{0.5em}{0ex}}Coding\phantom{\rule{0.5em}{0ex}}Rate\end{array}& & 1/3& 1/3& 1/2& 1/2& 1/2& 1/2\\ \begin{array}{l}Information\phantom{\rule{0.5em}{0ex}}Bit\phantom{\rule{0.5em}{0ex}}Payload\end{array}& & & & & & & \\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frames\phantom{\rule{0.5em}{0ex}}1,\phantom{\rule{0.5em}{0ex}}2,\phantom{\rule{0.5em}{0ex}}3,\phantom{\rule{0.5em}{0ex}}4,\phantom{\rule{0.5em}{0ex}}6,\phantom{\rule{0.5em}{0ex}}7,\phantom{\rule{0.5em}{0ex}}8,\phantom{\rule{0.5em}{0ex}}and\phantom{\rule{0.5em}{0ex}}9\end{array}& Bits& 408& 4392& 12960& 1544& 744& 18336\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}5\end{array}& Bits& n/a& n/a& n/a& n/a& n/a& n/a\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}0\end{array}& Bits& 152& 3264& 11448& n/a& n/a& 18336\\ \begin{array}{l}Number\phantom{\rule{0.5em}{0ex}}of\phantom{\rule{0.5em}{0ex}}Code\phantom{\rule{0.5em}{0ex}}Blocks\end{array}& & & & & & & \\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frames\phantom{\rule{0.5em}{0ex}}1,\phantom{\rule{0.5em}{0ex}}2,\phantom{\rule{0.5em}{0ex}}3,\phantom{\rule{0.5em}{0ex}}4,\phantom{\rule{0.5em}{0ex}}6,\phantom{\rule{0.5em}{0ex}}7,\phantom{\rule{0.5em}{0ex}}8,\phantom{\rule{0.5em}{0ex}}and\phantom{\rule{0.5em}{0ex}}9\end{array}& & 1& 1& 3& 1& 1& 3\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}5\end{array}& & n/a& n/a& n/a& n/a& n/a& n/a\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}0\end{array}& & 1& 1& 2& n/a& n/a& 3\\ \begin{array}{l}Binary\phantom{\rule{0.5em}{0ex}}Channel\phantom{\rule{0.5em}{0ex}}Bits\phantom{\rule{0.5em}{0ex}}per\phantom{\rule{0.5em}{0ex}}Sub-Frame\end{array}& & & & & & & \\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frames\phantom{\rule{0.5em}{0ex}}1,\phantom{\rule{0.5em}{0ex}}2,\phantom{\rule{0.5em}{0ex}}3,\phantom{\rule{0.5em}{0ex}}4,\phantom{\rule{0.5em}{0ex}}6,\phantom{\rule{0.5em}{0ex}}7,\phantom{\rule{0.5em}{0ex}}8,\phantom{\rule{0.5em}{0ex}}and\phantom{\rule{0.5em}{0ex}}9\end{array}& Bits& 1248& 12800& 25600& 3072& 1536& 38400\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}5\end{array}& Bits& n/a& n/a& n/a& n/a& n/a& n/a\\ \begin{array}{l}For\phantom{\rule{0.5em}{0ex}}Sub-Frame\phantom{\rule{0.5em}{0ex}}0\end{array}& Bits& 480& 12032& 24064& n/a& n/a& 36096\\ \begin{array}{l}Max.\phantom{\rule{0.5em}{0ex}}Throughput\phantom{\rule{0.5em}{0ex}}averaged\phantom{\rule{0.5em}{0ex}}over\phantom{\rule{0.5em}{0ex}}1\phantom{\rule{0.5em}{0ex}}frame\end{array}& Mbps& 0.342& 3.876& 11.513& 1.235& 0.595& 16.502\\ \begin{array}{l}UE\phantom{\rule{0.5em}{0ex}}Category\end{array}& & \ge 1& \ge 1& \ge 2& \ge 1& \ge 1& \ge 2\end{array}$`

Define a transport block of information bits, using the payload size, `transportBlkSize`, calculated in the last step.

`dlschTransportBlk = round(rand(1,152));`

Create the PDSCH payload. To encode the transport block bits into a single codeword, call the `lteDLSCH` function for the cell-wide settings and channel transmission configuration. This process includes CRC calculation, code block segmentation and CRC insertion, turbo coding, rate matching, and code block concatenation.

`codeword = lteDLSCH(enb,pdsch,codedTrBlkSize,dlschTransportBlk);`

Generate the PDSCH complex symbols by calling the `ltePDSCH` function for the specified cell-wide settings, channel transmission configuration, and codeword. This function applies scrambling, modulation, layer mapping, and precoding operations to the coded transport block.

`pdschSymbols = ltePDSCH(enb,pdsch,codeword);`

The resulting matrix, `pdschSymbols`, has four columns. Each column contains the complex symbols to map to each antenna port.

Generate the subframe resource grid by calling the `lteDLResourceGrid` function. This function creates an empty resource grid for one subframe.

`subframe = lteDLResourceGrid(enb);`

Map the PDSCH symbols to the resource grid using the generated indices.

`subframe(pdschIndices) = pdschSymbols;`