## 4 Proposed QL GF RA Massive MIMO Protocol  
Given the importance of designing pilot collision avoidance strategies for the investigated scenario and the unrealistic assumptions made by the available strategies described in Section 3, we propose in this section a two-step QL GF RA protocol operating in a realistic B5G system model, as illustrated in Figure 1. The evaluation in the realistic scenario allows us to leverage the massive number of antennas available at the BS to improve the operation of the proposed protocol. When the device \(k\) transmits data, it randomly selects one of the \(\tau_{p}\) pilot sequences and transmits it followed by its UL payload data packet \(\mathbf{d}_{k}\in\mathbb{C}^{\tau_{d}\times 1}\), with a non-zero transmit power \(\rho_{k}>0\), where \(\tau_{d}\) is the data length. We can denote the chosen pilot as \(c(k)\in\{1,2,\ldots,\tau_{p}\}\), and define the UL signal as \(\mathbf{x}_{k}=[\mathbf{s}_{\varepsilon(k)}^{T},\mathbf{d}_{k}^{T}]^{T}\in \mathbb{C}^{(\tau_{p}+\tau_{d})\times 1}\). Thus, the BS receives the signal  
\[\mathbf{Y}=[\mathbf{Y}_{p},\mathbf{Y}_{d}]=\sum_{k\in\mathcal{K}}\sqrt{\rho_ {k}}\mathbf{h}_{k}\mathbf{x}_{k}^{T}+\mathbf{N}, \tag{6}\]  
where \(\mathbf{Y}\in\mathbb{C}^{M\times(\tau_{p}+\tau_{d})}\), \(\mathbf{Y}_{p}\in\mathbb{C}^{M\times\tau_{p}}\), \(\mathbf{Y}_{d}\in\mathbb{C}^{M\times\tau_{d}}\), and \(\mathbf{N}\in\mathbb{C}^{M\times(\tau_{p}+\tau_{d})}\) is the receiver noise with entries drawn from \(\mathcal{CN}(0,\sigma^{2})\). Besides, we have  
\[\mathbf{Y}_{p}=\sum_{k\in\mathcal{K}}\sqrt{\rho_{k}}\mathbf{h}_{k}\mathbf{s}_ {\varepsilon(k)}^{T}+\mathbf{N}_{p},\text{ and } \tag{7}\]  
\[\mathbf{Y}_{d}=\sum_{k\in\mathcal{K}}\sqrt{\rho_{k}}\mathbf{h}_{k}\mathbf{d}_ {k}^{T}+\mathbf{N}_{d}, \tag{8}\]  
with \(\mathbf{N}=[\mathbf{N}_{p},\mathbf{N}_{d}]\). Hence, the BS correlates (7) with each pilot to generate channel estimates. For the case of an arbitrary pilot \(\mathbf{s}_{t}\), with \(t\in[1,\tau_{p}]\), it yields:  
\[\mathbf{y}_{t}=\mathbf{Y}_{p}\frac{\mathbf{s}_{t}^{*}}{\|\mathbf{s}_{t}\|}= \sum_{i\in\mathcal{S}_{t}}\sqrt{\rho_{i}\tau_{p}}\mathbf{h}_{i}+\mathbf{n}_{t}, \tag{9}\]  
where \(\mathbf{n}_{t}=\mathbf{N}_{p}\frac{\mathbf{s}_{t}^{*}}{\|\mathbf{s}_{t}\|}\) is the effective receiver noise, so that \(\mathbf{n}_{t}\sim\mathcal{CN}(0,\sigma^{2}\mathbf{I}_{M})\). As a result, the BS tries to decode the payloads in (8) using the channel estimates \(\mathbf{y}_{t}\), evaluating:  
\[\widehat{\mathbf{d}}_{k}^{T}=\frac{\mathbf{y}_{t}^{H}}{\sqrt{\tau_{p}}} \mathbf{Y}_{d}. \tag{10}\]  
The signal-to-interference-plus-noise ratio (SINR) of \(\widehat{\mathbf{d}}_{k}\) in (10) can be obtained following the SINR analysis of [32], adapting the results to our scenario, as follows:  
\[\gamma_{k}^{\text{ul}}=\frac{M\rho_{k}^{2}\hat{P}_{k}^{2}}{M\sum\limits_{i \in\mathcal{S}_{t}}\rho_{i}^{2}\,\hat{\rho}_{i}^{2}+\left[\sum_{i\in\mathcal{ S}_{t}}\rho_{i}\hat{\rho}_{i}+\frac{\sigma^{2}}{\tau_{p}}\right]\left[\sum_{j\in \mathcal{K}}\rho_{j}\hat{\rho}_{j}+\sigma^{2}\right]}. \tag{11}\]  
We assume that the decoding of \(\widehat{\mathbf{d}}_{k}\) in (10) is always successful when \(k\) is the unique competitor for the pilot \(t\) (without pilot collisions). The BS responds with an ACK feedback message if the decoding of (10) is successful, together with the transmission of a precoded DL pilot signal \(\mathbf{V}\in\mathbb{C}^{M\times\tau_{p}}\), with power \(q\), according to:  
\[\mathbf{V}=\sqrt{\frac{q}{\tau_{p}}}\sum\limits_{t=1}^{\tau_{p}}\frac{\mathbf{ y}_{t}^{*}}{||\mathbf{y}_{t}||}\mathbf{s}_{t}^{T}. \tag{12}\]In (12), one can note that the BS uses the estimated channel of each pilot, \(\mathbf{y}_{t}\), as a precoding vector to transmit such pilot, \(\mathbf{s}_{t}\), in the DL. By normalizing each precoding vector and dividing by the total number of transmitted pilots, the BS ensures the average transmitted power is equal to \(q\).