## 2 NB-IoT System Detailed Design and Implementation
### NPDSCH Receiver Chain Implementation
#### 2.2.5 Channel Estimation  
The channel estimation process attempts to define the effect of the channel on transmitted signals. In NPDSCH, the pilot-based channel estimation is used by generating some symbols, known as pilots at the transmitter and generating the same symbols at the receiver to find the relation between the received and original symbols and get a rough estimation of the channel. These pilots are carried by the narrowband reference signal (NRS), which exists in all the subframes transmitted, except the NPSS subframes and the narrowband secondary synchronization signal (NSSS) subframes [5]. The values of the NRS pilots are calculated as follows [9]:  
\[r_{(l,n_{s})}(m)=1/\sqrt{2}(1-2c(2m))+j1/\sqrt{2}(1-2c(2m+1)) \tag{26}\]  
where \(l\) defines the number of NRS symbols, as it can be 5 or 6 symbols. \(n_{s}\) is the time slot number, taking values from 0 to 9. \(m\) equals 0, 1, \(\ldots\), \(2N_{RB}^{maxDL}\) as the \(N_{RB}^{maxDL}=1\) so, m is just equal to 0 or 1. Moreover, \(c\) refers to pseudo-random sequence generation defined by a length-31 gold sequence as follows:  
\[c(n)=(x_{1}(n+N_{c})+x_{2}(n+N_{c}))mod(2) \tag{27}\]  
\[x_{1}(n+31)=(x_{1}(n+3)+x_{1}(n))mod(2) \tag{28}\]  
\[x_{2}(n+31)=(x_{2}(n+3)+x_{2}(n+2)+x_{2}(n+1)+x_{2}(n))mod(2) \tag{29}\]  
The first m-sequence has a constant initialization as follows:  
\[x_{1}\;\text{{initialized}\;\;\text{with}\;\;x_{1}(0)=1,\;\text{and}\;x_{1}(n)= 0,\;n=1,2,\cdots,30 \tag{30}\]  
while the second m-sequence is based on the application. Therefore, the NRS generation \(x_{2}\) has the following initialization, \(C_{init}\):  
\[C_{init}=2^{10}(7(n_{s}+1)+l+1)\left(2N_{ID}^{cell}+1\right)+2N_{ID}^{cell}+N_{ CP} \tag{31}\]  
where \(N_{ID}^{cell}\) is an input, \(n_{s}\) is the time slot number, \(N_{c}\) equals 1600 clock cycles, and \(N_{CP}=1\) for the normal CP. Moreover, the locations of the NRS symbols can be determined as follows [9]:  
\[k=6m+\left(v+v_{shift}\right)mod(6)\;\;,\;\;\;\;v= \begin{cases}0&\text{if}\; \;\;l=5\\ 3&\text{if}\;\;\;l=6\end{cases}  \tag{32}\]  
where \(k\) refers to the place of a pilot to be in which row, ranged from 0 to 11, as the row refers to the subcarrier and the variables, and \(v\) and \(v_{shift}\) define the position in the frequency domain for the reference signal as \(v_{shift}\) is equal to \(N_{ID}^{cell}\;mod(6)\). There are many channel estimation algorithms used in NB-IoT receiver but there is a trade-off between the complexity of the design and its performance. Accordingly, the least square (LS) channel estimation algorithm [30] is selected to be adopted in the implemented chain, and to compensate the performance, the interpolation process is deployed to obtain better performance with low complexity. The used interpolation is linear interpolation, which is calculated every subframe, as the channel estimation gets 12 different outputs, \(H_{LS}\), and each is used by the equalizer with one of the 12 subcarriers [31]. Furthermore, the extended typical urban (ETU) model is deployed according to the 3 GPP standard [32]. The specification for the channel model used in simulation is a Rayleigh fading channel with an extended typical urban delay profile, maximum Doppler frequency shift equal to 5 Hz, and a sampling frequency equal to 1.92 MHz. Let the signal at the receiver after the channel effect be \(y\), as \(y=xH+n\). Here, \(x\) is the transmitted signal, \(H\) is the channel frequency response, and \(n\) is the AWGN. Then, the least square channel estimation algorithm is \(H_{LS}=x^{-1}y\), as the channel estimation block aims to divide the received pilots over the transmitted pilots to get the channel effect on the transmitted symbols [30]. Figure 11 depicts the block diagram of the channel estimation block. The transmitted/generated pilots are extracted out of the NRS generator and the received pilots are determined from the resource mapper. Then, the channel frequency response is calculated, and the four channel frequency responses obtained from the eight pilots are stored.