## 4 Proposed mmWave Assisted CR-IoV
### 3D-Beamforming in Massive MIMO  
For legitimate SUs, CBS produces beams in an optimal manner which is achieved by the 3D-beamforming approach. We considered Massive MIMO with a set of \(M\times N\) isotropic array elements, i.e., CBS has \(M\) antenna elements in \(x\)-axis and \(N\) antenna elements in \(y\)-axis. The manifold vector of the antenna array in both coordinates is represented as \(\mathcal{F}_{x}\) and \(\mathcal{F}_{y}\) and can be computed as follows,  
\[\mathcal{F}_{x}=\left[b_{0},b_{1}e^{i(\phi_{1}+\eta_{x})},..,b_{m}e^{jm(\phi_{ 1}+\eta_{x})},\ldots,b_{M-1}e^{i(M-1)(\phi_{1}+\eta_{x})}\right] \tag{18}\]  
\[\mathcal{F}_{y}=\left[p_{0},p_{1}e^{i\left(\phi_{2}+\eta_{y}\right)},..,p_{n} e^{jn\left(\phi_{2}+\eta_{y}\right)},\ldots,b_{N-1}e^{i(N-1)\left(\phi_{2}+ \eta_{y}\right)}\right] \tag{19}\]  
Here, \(a_{m},p_{n}\) are the weight value of the \(m\)th and \(n\)th antenna elements in \(x\) and \(y\) coordinates, respectively. Similarly, \(\eta_{x},\eta_{y}\) are the function of the direction of angle (DOA) at a determined location, \(\phi_{1},\phi_{2}\) are the DOA of intended SU or SUs. The expression for these constraints are expressions for these constraints are,  
\[\phi_{1}=\mathfrak{A}\mathfrak{I}_{x}sin\theta cos\varphi \tag{20}\]  
\[\phi_{2}=\mathfrak{A}\mathfrak{I}_{y}sin\theta sin\varphi \tag{21}\]  
Here, \(\mathfrak{I}=2\pi/\lambda\) and \(\eta_{x}=-\mathfrak{A}\mathfrak{I}_{x}sin\theta_{0}cos\varphi_{0}\), \(\eta_{y}=-\mathfrak{A}\mathfrak{I}_{y}sin\theta_{0}sin\varphi_{0}\). We need to calculate the array factor (AF) for optimal beamforming by summing up all elements in the vector. For AF computation, we can consider either \(\mathcal{F}_{x}\) or \(\mathcal{F}_{y}\), or we can also use the radiation factor of the equivalent element as follows,  
\[\mathcal{F}_{xy}\ =\ \mathcal{F}_{x}^{T}\ \times\mathcal{F}_{y} \tag{22}\]  
Thus, the AF for the considered Massive MIMO antenna is given as,  
\[AF=\sum_{m=0}^{M-1}\sum_{n=0}^{N-1}\gamma_{mm}e^{i\left[m(\phi_{1}+\eta_{x})+ n\left(\phi_{2}+\eta_{y}\right)\right]} \tag{23}\]  
The weight value of the antenna array \(\gamma_{mm}=b_{m}\times p_{n}\). From the AF, the beampattern function is derived. The beampattern function is the envelope of the radiation of electromagnetic wavefront in the spatial domain. In general, the beampattern function is equal to the amplitude of AF that can be defined as,  
\[BP=|AF|=\frac{sin\left(\frac{M}{2}\phi_{x}\right)sin\left(\frac{N}{2}\phi_{y} \right)}{M\ Nsin\left(\frac{\phi_{x}}{2}\right)sin\left(\frac{\phi_{y}}{2}\right)} \tag{24}\]  
Based on this BP function, optimal beams are produced for SUs. The maximum gain of an array antenna is,  
\[\left|MNsin\left(\frac{\phi_{x}}{2}\right)sin\left(\frac{\phi_{y}}{2}\right) \right|=0 \tag{25}\]The mainlobe Half Power Beamwidth (HPBW) is obtained as the function of \(\frac{1}{\sqrt{2}}\) as follows,  
\[\left|\frac{sin\left(\frac{M}{2}\phi_{x}\right)sin\left(\frac{N}{2} \phi_{y}\right)}{MNsin\left(\frac{\phi_{x}}{2}\right)sin\left(\frac{\phi_{y}}{2 }\right)}\right|=\frac{1}{\sqrt{2}} \tag{26}\]  
Based on the above calculations, CBS forms beams for SUs. The formation of beams in 3D is illustrated in Figure 5.  
Once the beams are formed and directed to the SUs, then the SUs are allowed to access the CBS. As only valid SUs are considered in beamforming, the overhead and time consumption are decreased.