## 4 Architecture of Software Receiver
### Software Architecture
#### 4.1.4 ICP Initialization and Calculation of Differential ICP  
The ICP is obtained by integrating IF carrier frequency over time as follows:  
\[\varphi_{p}[k]=\int_{0}^{t_{k}}\omega dt+\phi_{0}\approx\sum_{i=0}^{k-1} \omega[i]T_{i}+\phi_{0} \tag{12}\]  
where \(\phi_{0}\) is the initial phase, \(\omega\) is the Doppler frequency and \(T_{I}\) is the PRN code period which is one msfor C/A code. [PERSON] and [PERSON] [23] derived the phase of correlator outputs as:  
\[\theta_{c}[k]=\text{atan2}\big{(}CQ[k],CI[k]\big{)}=\frac{\big{(}\omega_{R}- \omega\big{)}T_{I}}{2}-\omega_{k-1}-\phi_{0} \tag{13}\]  
where \(\theta_{c}[k]\) is the phase at \(k\) ms based on the correlator outputs and the rounded Doppler frequency, \(\omega_{R}\). The correlator outputs, \(CI[k]\) and \(CQ[k]\), are calculated using the carrier table which has limited frequency resolution. \(\omega_{R}\) is the frequency after rounding the Doppler frequency \(\omega\) to the nearest frequency grid of the carrier table. Hence, the compensated phase of incoming signal at time \(t_{k}\) can be obtained by:  
Figure 9: **(a)** IF data buffer architecture **(b)** correlation window **(c-e)** three cases for correlation operation which avoid performing correlation with data bit transition.  
\[\varphi_{p}[k]=\omega_{k-1}+\phi_{0}+\omega T_{{}_{I}}=-\theta_{c}[k]+\frac{\big{(} \omega_{{}_{B}}+\omega\big{)}T_{{}_{I}}}{2} \tag{14}\]  
The effect from the rounded frequency in \(\theta_{c}[k]\) is compensated in \(\varphi_{p}[k]\) by Equation (14). Since this compensated phase is noisy, an averaging filter is used to reduce the noise for estimating initial phase \(\phi_{0}\) :  
\[\begin{split}\phi_{p}[1]&=\varphi_{p}[1]\\ \phi_{p}[k]&=\frac{k}{M_{{}_{a}}}\Big{(}\text{mod} \big{(}\phi_{p}[k-1]+\omega[k-1]\cdot T_{{}_{I}},2\pi\big{)}\Big{)}+\Bigg{(}1- \frac{k}{M_{{}_{a}}}\Bigg{)}\varphi_{p}[k],2\leq k\leq M_{{}_{a}}\end{split} \tag{15}\]  
where \(\phi_{p}[k]\) is the averaged phase with less noise, and \(M_{{}_{a}}\) is the number of ms to perform the initialization. \(k\) denotes \(k^{\text{th}}\) ms. After the initialization process, the residual of \(\phi_{p}\big{[}M_{{}_{a}}\big{]}\) is set as the initial phase \(\phi_{0}\) as follows:  
\[\phi_{0}=\text{mod}\Big{(}\phi_{p}\big{[}M_{{}_{a}}\big{]}2\pi\Big{)} \tag{16}\]  
Once the initial phase is obtained, the ICP is calculated every ms by adding \(\omega[i]T_{{}_{I}}\) as in Equation (12). In order to build the steering vector, differential ICPs between antennas are calculated for every channel. Then, the differential ICPs of several ms are averaged to obtain the steering vectors as follows:  
\[\begin{split}\Delta\phi_{{}_{n}}^{{}^{\prime}}=\sum_{i=1}^{L} \Big{(}\phi_{n}^{{}^{\prime}}[i]-\phi_{{}_{I}}^{{}^{\prime}}[i]\Big{)}\\ t_{{}_{n}}^{{}^{\prime}}=\exp\Big{(}-j\Delta\phi_{{}_{n}}^{{}^{ \prime}}\Big{)}\end{split} \tag{17}\]  
where \(L\) is the number of ms to average the differential ICP. \(l\) and \(n\) stand for \(l^{\text{th}}\) channel and \(n^{\text{th}}\) antenna. \(t_{{}_{n}}^{{}^{\prime}}\) is \(l^{\text{th}}\) channel and \(n^{\text{th}}\) antenna element of the steering vector.