Cell-Free Massive MIMO System with an Adaptive Switching Algorithm between Cooperative NOMA, non-Cooperative NOMA, and OMA modes

Non-orthogonal multiple access (NOMA) aided cell-free massive multiple-input multiple-output (CF mMIMO) systems have gained great attention over the past few years to be employed in the sixth generation of the wireless network. With distributed antennas over a large area, CF mMIMO systems have much better cell coverage and higher achievable sum-rate compared to the conventional cellular and small-cell networks. This paper will propose a novel cooperative NOMA-aided CF mMIMO system. The proposed scheme will increase the achievable sum-rate and improve the system reliability by creating additional data streams between users within the same NOMA cluster. Also, we will suggest an adaptive switching algorithm between non-cooperative NOMA, cooperative NOMA, and orthogonal multiple access (OMA) modes in order to maximize the power efficiency and achievable sum-rate. We will derive closed-form expressions for the achievable downlink data rates of the mentioned modes. Lastly, we will offer a special user clustering algorithm that needs no complex optimization and ensures the existence of reliable cooperative links between the users. The simulation results will prove the superiority of the proposed scheme over the conventional NOMA-based and OMA-based CF mMIMO systems.


I. INTRODUCTION
T HE fifth generation of the wireless network (5G) was full of novel and enabling technologies, like the use of millimeter-wave bands and massive multiple-input multiple-output (mMIMO) technique. However, it has some serious drawbacks, such as uneven cell coverage and a trade-off between battery life and data rate. The sixth generation of the wireless network (6G) is planning to remove all of those barriers that exist in 5G. Many papers are presented to address the key indicators and introduce the enabling technologies for 6G [1]- [5]. New technologies such as virtual and augmented reality (VAR), real-time remote health care, autonomous transportation, and intellectual industry systems need ultra-reliable high-speed connections. For holographic teleportation, we will need a data rate up to 5 Tbit/s [1]. Remote surgery needs an ultra-reliable link with extremely low latency [6] to guarantee patients' lives. An autonomous transportation system needs a lot of connected sensors [7] with above 1 Tbit/s links at a speed of up to 1000 km/h in order to ensure passengers' safety. For handling those demands, 6G has a long way. It should manage massive connectivity with ultrareliable connections and low latency at a data rate above 1 Tbit/s. Table 1 shows some of the key performance indicators (KPIs) for 6G and compares it to 5G [1]- [3].
Achieving the mentioned aims with the conven-VOLUME x, 2021 tional cellular and small-cell network topologies is pretty challenging. CF mMIMO [8] is one of the most advantageous network topologies for 6G. In CF mMIMO network, a large number of singleantenna access points (APs) are distributed over a large area instead of placing many antennas on a single base station. The APs employ conjugate beamforming to transmit all users' data over the same time-frequency resources. CF mMIMO networks have many benefits, such as removing cell boundaries and a low distance between the users and APs. Terahertz frequency band (between 100 GHz and 10 THz) is one of the promising candidates for 6G. However, these kinds of ultra-high frequency waves have a very high path loss. CF mMIMO is the best network scheme for matching the terahertz communication due to the low distance between users and APs. In [9], the authors proposed normalized-conjugate beamforming, which has a better achievable data rate than the conventional conjugate beamforming. A user-centric approach, in which only a limited number of APs transmit each user's data, is introduced in [10]. [11] studied the benefits and challenges of the CF mMIMO system. [12] offered an iterative robust minimum mean-square error precoder in order to mitigate the interference caused by imperfect channel state information. [13] analyzed achievable data rate of the CF mMIMO systems considering the limitations of backhaul connection. [14] proposed a power control algorithm for the pilot transmission in order to minimize the interference caused by non-orthogonal pilot signals. [15] studied the positive effects of downlink pilot transmission in CF mMIMO systems. The authors in [16] have studied channel hardening in CF mMIMO systems. [17] proposed a generalized benders decomposition based algorithm to solve the power and user grouping problems. In [18], the authors proposed an efficient pilot assignment scheme using a weighted graphic framework to mitigate the effect of pilot contamination. In CF mMIMO systems, uplink pilot transmission is necessary for conjugate beamforming. Users transmit data and pilot signals using the time-division duplexing (TDD) technique in the same coherence time. However, wireless channels have limited coherence time, and hence, the users have a limited number of orthogonal pilot sequences, which is not enough for massive connectivity. NOMA [19] is one of the leading multiple access techniques that transmits different users' data over the same time-frequency resources but with different power levels. At the receiver, each user employs successive interference cancelation (SIC) to decode its data. [20] proposed NOMA-aided CF mMIMO system in which users within the same NOMA cluster employ the same orthogonal pilot sequence. This approach can considerably solve the orthogonal pilot sequence shortage problem, and the network can support more connected users. However, due to the errors like intra-cluster interference, pilot contamination, and imperfect SIC in the NOMA-based approach, OMA-aided CF mMIMO has better performance than the NOMA-aided one when there are only a few connected users. In [21], the authors proposed an adaptive switching mode between NOMA and OMA to maximize the achievable sum-rate. [22] investigated the uplink performance of a NOMAaided CF mMIMO system and offered a novel total spectral efficiency maximization algorithm. In [23], the authors suggested an optimal backhaul combining process, which maximizes the uplink signal-to-interference-plus-noise ratio (SINR). [24] studied the achievable rate of NOMA-aided CF mMIMO underlaid below a primary mMIMO network and proposed a sub-optimal user-clustering method. [25] analyzed the impact of the type of precoders used at the APs. A closed-form expression for the achievable downlink data rate of a NOMAaided CF mMIMO system over spatially correlated Rician fading channel is derived in [26]. [27] modeled the location of users and APs as homogeneous Poisson point processes (PPPs). [28] analyzed the impact of hardware mismatches on the performance of NOMA-aided CF mMIMO systems. [29] studied the performance of NOMA-aided CF mMIMO system for future communication networks under stochastic AP and user locations.
In each NOMA cluster, users with better channel conditions (stronger users) get a lower fraction of power than users with weaker channels (weaker users). Stronger users need to perform SIC in order to decode their data. Firstly, they have to decode the weaker users' data and then subtract it from the received signal. In cooperative NOMA [30], stronger users re-transmit the decoded data of prior users (weaker users). Those additional links be-tween users within the same NOMA cluster can considerably guarantee the connectivity of all users, even if their direct link connections are unreliable.
In this paper, we will investigate the performance of a cooperative NOMA-aided CF mMIMO network. The addition of cooperative links will increase the achievable sum-rate and improve the system reliability. However, some of those retransmissions are unnecessary because the weaker user might have an acceptable direct link connection. Hence, the re-transmission in that cases will degrade the energy efficiency of the system. We will propose an adaptive switching algorithm between non-cooperative NOMA, cooperative NOMA, and OMA modes in order to solve the previous problem and maximize the system performance. We will derive closed-form expressions for the achievable downlink data rates of non-cooperative NOMAaided, cooperative NOMA-aided, and OMA-aided CF mMIMO systems. One of the main challenges in NOMA-based systems is user clustering. Most of the previous works, such as [23] and [31], used complicated algorithms for solving the user clustering problem. We will offer a simple user clustering technique that guarantees the existence of reliable channels between users within the same NOMA cluster. Lastly, we will use computer simulations to prove the performance of the proposed method and compare it to the conventional ones.

Notations
Matrices and vectors are defined with upper-case boldface and lower-case boldface letters. An Italic letter denotes a scalar variable. (.) T , (.) H , and (.) * mean the transpose, conjugate transpose, and conjugate of (.), respectively. a ∼ CN (µ, σ) indicates a complex normal random variable with a mean of σ and covariance of µ. E{.} and |.| represent expectation and absolute operators. Finally, a.b T indicates the inner product of vectors a and b with an equal length of n, which defines as Figure 1 depicts a NOMA-aided CF mMIMO network in which M single-antenna APs are serving 2L single-antenna users simultaneously, where L is the total number of NOMA clusters. Since having more than two users in each NOMA cluster is not practical and causes so much complexity in SIC, we assume there are only two users in each NOMA cluster. All APs are connected to the central processing unit (CPU) via a perfect backhaul connection. within the l th cluster and the m th AP, and g lk k indicates the channel between user k and user k within the l th cluster. h mlk can be modeled as

II. SYSTEM MODEL
where β mlk and α mlk are the large-scale and smallscale fading coefficients, respectively. The largescale fading changes about 40 times slower than the small-scale fading [32]. Hence, we assumed largescale fading values have already been estimated, and are known to the users and APs. α mlk ∼ CN (0, 1) is considered to be a circularly-symmetric complex normal random variable with zero mean and unit covariance, which is independent for different mlk. Thus, h mlk ∼ CN (0, β mlk ) is a complex normal random variable with zero mean and covariance of β mlk . Also, users within the same NOMA cluster are arranged according to their channel conditions: The location of users and APs is modeled with homogeneous PPP [27]. The following equation shows the probability of having V APs or users with a density of λ within an area of B [33]: If λ u is the density of users and λ a is the density of APs, then λ a ≥ λu K . K is the total number of VOLUME x, 2021 users within the same NOMA cluster, which is equal to 2 for the considered NOMA-aided CF mMIMO network and 1 for the OMA-aided one.

A. CHANNEL ESTIMATION
In the studied NOMA-aided CF mMIMO network, APs perform downlink channel estimation using the received pilot signals from the users. Users rely on channel statistics as a real channel and do not perform any extra channel estimation. They utilize the TDD technique to transmit data and pilot signals in the same coherence time. Due to the limited channel coherence interval τ c (in samples), a limited number of orthogonal pilot sequences is available (τ c ≥ τ upp , where τ upp is the length of the pilot sequence).
In order to overcome the mentioned problem, we use the same pilot sequence for the users within the same NOMA cluster [34]. The received pilot signal at the m th AP will be as follows: where n m ∼ CN (0 τupp×1 , 1 τupp×1 ) is the additive white gaussian noise (AWGN) vector at the m th AP, and P upp is the normalized uplink pilot signal-tonoise ratio (SNR). ϕ l is the assigned pilot sequence to the l th cluster, which satisfies the following conditions: The m th AP multiplies the received pilot signal with ϕ H l in order to estimate the channel: The users within the same NOMA cluster are using the same pilot sequence. Hence, the APs can only estimate a linear combination of their channels. Using (5),r upp ml becomes a sufficient statistic. Therefore, the minimum mean square error (MMSE) estimation of h mlk can be written as [35] Sincer upp ml is a complex normal random variable with zero mean and covariance of 1 + τ upp P upp 2 k=1 β mlk ,ĥ mlk can be written as a complex normal random variable with zero mean and covariance of where b ml ∼ CN (0, 1), and γ mlk is as follows:

B. SIGNAL MODEL
Using the estimated channel state information (CSI) in (8), APs employ normalized-conjugate beamforming [9] to transmit users' data. The beamforming vector can be defined as β mlk , τ upp , and P upp are positive real numbers.
Using (8) and (10), the beamforming vector can be re-written as Consider P mlk as the allocated power to the k th user within the l th cluster from the m th AP. We can define the power allocation matrix as follows: Via multiplying the power allocation matrix by the beamforming vector, the following power control vector defines: (13) Using normalized-conjugate beamforming, the transmitted signal from the m th AP to all users within L clusters is given by This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. where P dl is the normalized downlink SNR, P ml = 2 k=1 P mlk is the total allocated power to the l th cluster from the m th AP, andq l is the superposition coded signal of all users within the l th cluster in which E |q l | 2 = 1. Short-term power constraint [36] prevents the transmit power from exceeding a predetermined value in order to avoid interference and environmental problems. If the predetermined value is P dl , then the short-term power constraint can be written as Using 14 and 15, the short-term power constraint defines as An efficient selection of P mlk is a max-min power control problem, which is beyond the scope of this paper.

A. NON-COOPERATIVE NOMA AIDED CELL-FREE MASSIVE MIMO
In a non-cooperative NOMA-aided CF mMIMO network, the received signal at the k th user within the l th cluster will be as follows: where n lk ∼ CN (0, 1) indicates the AWGN noise at the k th user within the l th cluster, T is the channel coefficient vector, and q lk is the message signal for the k th user within the l th cluster in which E |q lk | 2 = 1.
The second user does not need to perform SIC in order to decode its message. It simply takes the first user's data as noise. We can re-write the received signal at the second user as where (DS) lk indicates the desired signal for the k th user within the l th cluster and (BU ) lk denotes beamforming uncertainty for the k th user within the l th . (ICI) l1 represents intra-cluster interference caused by the first user within the same cluster. (IU I) l k expresses inter-user interference caused by the users within the different clusters.
The first user has to perform SIC to get its data. In this regard, it should firstly decode the second user's data and then subtract it from the received signal. After the SIC process, we can express the received signal of the first user within the l th cluster as follows: where (ISIC) l2 denotes the interference caused by imperfect SIC of the second user's data. Now we can define the signal-to-interferenceplus-noise ratios (SINRs) of the first and second users within the l th cluster as (20), shown on the top of the next page. q l1 , q l2 , and BU are independent of each other [8]. Hence, BU, ICI, ISIC, and IUI are uncorrelated with DS. Considering uncorrelated noise as the worstcase [37], the achievable downlink data rate of the VOLUME x, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2021.3124816, IEEE Access k th user within the l th cluster can be written as follows: where BW direct is the allocated bandwidth to the direct link transmission and ρ is a pre-log factor, which is inserted to model the effect of pilot and data transmission in the same coherence time. ρ can be defined as The downlink achievable sum-rate for the described non-cooperative NOMA-aided CF mMIMO network is given by Theorem 1: In a non-cooperative NOMA-aided CF mMIMO network with two users in each NOMA cluster, the achievable downlink data rates can be written as follows: where Proof: See Appendix A.

B. COOPERATIVE NOMA AIDED CELL-FREE MASSIVE MIMO
In the proposed cooperative NOMA-aided CF mMIMO network, the first user within each cluster utilizes short-range communication to re-transmit the second user's data after decoding it for the SIC process. Using short-range communication avoids the interference between the direct and cooperative links because their data are being transmitted over different time-frequency resources. Table 2 shows some of the possible technologies and network types to be used in the cooperative data transmission.
Considering an ultra-dense network for 6G, the existence of a line of sight (LOS) between the users within the same cluster is a reasonable assumption. Therefore, visible light communication, which needs LOS for connection, and terahertz communication, which has high path-loss, can be the possible candidates to be employed in cooperative links.
WiFi and Bluetooth are the other available technologies to be used in cooperative data transmission. The addition of cooperative links helps users who are facing severe fading to receive their data from different channels. The received signal for the second user within the l th cluster from the cooperative link will be as follows: where P cl is the normalized cooperative link SNR and s l2 is the second user's decoded data by the first user within the l th cluster in which E |s lk | 2 = 1.
Using (1) and (26), the cooperative link SINR of the second user can be defined as whereβ l12 indicates the large-scale fading coefficient between the first and second users within the l th cluster.
Also, the SINR of the second user's data for the first user within the l t h cluster can be defined as follows: wherė (29c) can be written as wherë Proof: Similar to Appendix A. Now we can define the achievable data rate for the cooperative link within the l th cluster as (32), shown on the top of the next page, where BW cl indicates the allocated bandwidth to the cooperative link transmission. Finally, the downlink achievable sum-rate of the proposed cooperative NOMA-aided CF mMIMO network can be written as follows:

C. OMA AIDED CELL-FREE MASSIVE MIMO
OMA-aided CF mMIMO is a special type of noncooperative NOMA-aided CF mMIMO network in which there is only one user in each NOMA cluster. In this case, the received signal at the u th user, which is equal to the l th cluster in the NOMA, can be written as follows:  (32) where h u = h l1 ,h u =h l1 , q u = q l1 , U = L, and n u ∼ CN (0, 1) indicates the AWGN noise at the u th user.
The SINR of the u th user can be written as (35) Now we can define the achievable downlink data rate of the u th user as Ultimately, the achievable sum-rate of an OMAaided CF mMIMO network can be defined as Theorem 3: In an OMA-aided CF mMIMO network, the achievable downlink data rate of the u th user can be written as follows: where ... ...
where γ mu = γ ml1 , and β mu = β ml1 is the largescale fading coeeficient between the m th AP and the u th user. Proof: Similar to Appendix A.

A. ADOPTIVE SWITCHING ALGORITHM
Due to the lack of errors caused by imperfect SIC and intra-cluster interference, OMA-aided CF mMIMO has better performance than the NOMAaided one when there are few users connected to Request re-transmision from the first user within the l th cluster ; for k = 1 do if any re-transmission request is received from the l th cluster ; then Re-transmit the second user's data using short-range communication else Operate in non-cooperative NOMA mode the network. On the other hand, when there are more connected users, NOMA-aided CF mMIMO has better performance than the OMA-aided one because of using a single orthogonal pilot sequence for all users within the same NOMA cluster. In cooperative NOMA-aided CF mMIMO, users with better channel conditions re-transmit the weaker ones' data. This re-transmission increases the system reliability and improves the system performance. However, blind re-transmission reduces the energy efficiency of the system. In this section, we will offer an adaptive switching algorithm between OMA, non-cooperative NOMA, and cooperative NOMA modes to solve the mentioned problems. The proposed algorithm maximizes the achievable sum-rate and energy efficiency of the system. In the proposed algorithm, the system initially operates in OMA mode. If the achievable sum-rate of the NOMA mode exceeds the achievable sumrate of the OMA mode, the system switches to NOMA mode. In other words, while R dl,OM A sum is greater than R dl,N OM A sum , the system works in OMA mode. Otherwise, it switches to NOMA mode. The optimal point for switching between OMA and NOMA modes depends on the channel coherence time. This relation will be more clear in section V. When the system is operating in NOMA mode, if the SNR of the second user is below a predetermined threshold, the user requests re-transmission from the first user within the same NOMA cluster. This process prevents unnecessary data transmissions and improves the energy efficiency of users. Algorithm 1 illustrates the explained procedure. Note that switching between OMA and NOMA modes depends only on the number of connected users and channel coherence time. The variation of fading coefficients will not alter it because those changes increase or decrease the sum-rate in both modes. On the other hand, switching between cooperative and non-cooperative NOMA modes in each cluster depends only on the second user's SNR and its channel fading coefficient.

B. USER GROUPING
User grouping is one of the main challenges in NOMA-based systems. This problem is even more challenging in NOMA-aided CF mMIMO networks because users within the same cluster share the same pilot sequence. More distance between the users within the same cluster will result in high channel estimation error and weak beamforming. Unlike conventional cellular networks, users within the same NOMA cluster do not need to have a noticeable channel gain difference because there is no cell-edge user in cell-free networks. In recent papers, this problem has mostly been solved via complicated optimization problems. In this part, we will propose a novel user clustering algorithm using the cooperative links between the users. The proposed method does not need any complex optimization. Additionally, it guarantees the existence of reliable channels among the users within the same NOMA cluster. Hence, this method can considerably help the system to reach the ultra-reliability goal.
Consider there are τ upp available orthogonal pilot sequences. First, the system specifies τ upp virtual points (VPs) on the area, which are equally distributed (as depicted in figure 2). VPs are imaginary points used to help the system evenly divide the region into τ upp clusters. The position of VPs is fixed, and their distance from each AP is clear.
whereβ mp is the large-scale fading coefficient between the m th AP and p th VP. Note that β mu values have already been estimated and are known to the users and APs. Now each of the non-selected users broadcasts a pilot sequence using short-range communication. The primary users select the user of the strongest received signal to be in the same NOMA cluster. Note that being a primary user does not necessarily mean being the first user in the NOMA cluster.

V. SIMULATION RESULTS
In this section, we will analyze the performance of the proposed scheme using computer simulations. For modeling the large-scale fading, a three-slope path loss model [39] has been employed in which β mlk = (P L) mlk . (P L) mlk denotes path loss between the m th AP and k th user within the l th cluster VOLUME x, 2021 where h AP and h U are the AP's and user's antenna height, f (MHz) represents the carrier frequency, and d mlk indicates the distance between the m th AP and k th user within the l th cluster.
We assumed M = 200 uniformly distributed single-antenna APs are transmitting users' data within an area of size 1 × 1 km 2 . Figure 3 shows the topology diagram of the simulated network. VPs are equally distributed over the area. The users are clustered according to the user grouping method discussed in section IV-B. As can be seen, the selection of primary users with the help of VPs has helped the network to have evenly distributed clusters. The APs employ conjugate beamforming to transmit all users' data over the same time-frequency resources. In each NOMA cluster, if the SNR of the weaker user is below a predetermined value, it asks the stronger user to retransmit the data after decoding it for SIC. The system model and channel estimation used in this simulation have been modeled in section II. Channel coherence internal (τ c ) is set to 196 symbols unless otherwise specified. Table 3 summarises the used parameters in this simulation.P dl ,P upp andP cl represent the downlink data transmission, pilot transmission and cooperative link data transmission power values, respectively. For having a fair comparison among the methods, we do not consider any max-min power control algorithm. Hence, equal power allocation is used in the simulations. The power allocation ratio inside the NOMA clusters is 3:7, which means that the first user gets 30% and the second user gets 70% of the total transmit power in each NOMA cluster. Figure 4 shows the achievable sum-rate versus the number of users for the proposed cooperative NOMA-aided CF mMIMO system and compares it with the conventional OMA and NOMA aided CF mMIMO systems. Also, it presents the performance of a CF mMIMO system with the suggested adaptive switching algorithm. As can be seen, NOMAbased CF mMIMO systems can support two times more users than the OMA-based one because of sharing the same pilot sequence between the users within the same NOMA cluster. On the other hand, when there are a small number of users connected to the network, the OMA-aided system has better performance than the NOMA-aided one due to the lack of errors caused by imperfects SIC and intra-cluster interference. The proposed cooperative NOMAaided CF mMIMO system has a much higher sumrate compared to the non-cooperative one. For the studied system, the optimal point for switching between OMA and non-cooperative NOMA modes is  when the number of users is 118. Also, the optimal point for switching between OMA and cooperative NOMA modes is when the number of users is 90. By employing the recommended adaptive switching algorithm, the system can always reach the highest possible sum-rate. Figure 5 and figure 6 show cumulative distribution functions (CDFs) of the per-user downlink achievable data rate for the OMA, non-cooperative NOMA, and cooperative NOMA aided CF mMIMO systems. In figure 5, there are 150 users connected to the network. As can be seen, the proposed cooperative NOMA-aided CF mMIMO system has the best performance compared to the conventional OMA and NOMA aided CF mMIMO systems. The 90%likely per-user achievable rate for the cooperative NOMA-aided CF mMIMO system is 20 Mbit/s while the 90%-likely per-user achievable rate for the conventional OMA and NOMA aided CF mMIMO systems are 10 Mbit/s and 15 Mbit/s, respectively. Figure 6 illustrates CDFs of the per-user downlink achievable rate for the compared systems when there are 100 users connected to the network. Due to the lack of errors like imperfect SIC, the OMA mode has better performance than the non-cooperative NOMA mode. However, the proposed cooperative NOMA mode still has the best performance. The 90%-likely per-user achievable rate for the cooperative NOMA-aided CF mMIMO is 27.5 Mbit/s, which is about 2.2 Mbit/s and 5 Mbit/s more than the OMA and non-cooperative NOMA modes. Figure 7 demonstrates CDFs of the downlink peruser achievable data rate for CF mMIMO systems with the proposed switching algorithm and different  threshold values. As can be seen, by increasing the threshold value, the system acts as a cooperative NOMA-aided one because the second user frequently asks for re-transmission. On the other hand, by decreasing the threshold value, the system functions as a non-cooperative NOMA-aided one because the second user's received SNR is usually higher than the threshold value.
Optimal user grouping is a challenging problem in NOMA-based systems. According to [40], for solving such a problem, the system must search over (4L)! 2 2L possibilities, which is impractical in a network with a large number of users and we are unable to VOLUME x, 2021 simulate it. For solving this problem, we simplified the optimization and used a suboptimal method. In this method, instead of maximizing the network sum rate by grouping users, we select two users that have the maximum sum rate when grouped together. Note that being the optimal pair for maximizing the paired user's data rate is not always equal to being the optimal pair for maximizing the network sum rate. Hence, this suboptimal user grouping method will be less effective than the optimal one. Figure  8 compares our proposed user grouping method with the mention suboptimal one. As can be seen, our proposed user grouping method performs better with less complexity than the mentioned suboptimal method. This indicates that our proposed user clustering algorithm is closer to the optimal. Figure 9 shows CDFs of the downlink per-user achievable data rate for the proposed cooperative NOMA-aided CF mMIMO system with 200 APs and 150 users within different areas. As can be seen, by increasing the area size, the achievable rate decreases because the large-scale fading between users and APs increases. Also, due to the enlargement of clusters, the distance between users within the same cluster increases, which leads to lower data rates in cooperative links.

VI. CONCLUSION
Cell-free massive MIMO systems are one of the most prominent candidates to be employed in the sixth generation of the wireless network. However, due to the limited channel coherence interval, they mostly suffer from the orthogonal pilot  sequence shortage problem. By employing NOMA in CF mMIMO systems, we can assign a single orthogonal pilot sequence to all users within the same NOMA cluster. This approach can considerably dwindle the orthogonal pilot sequence shortage problem. However, when there are a small number of users connected to the network, the OMA-aided CF mMIMO systems outperform the NOMA-aided ones in the term of achievable sum-rate due to the lack of errors caused by imperfect SIC and intracluster interference. In this paper, we proposed a novel CF mMIMO scheme based on the cooperative NOMA technique. The suggested method can significantly increase the achievable sum-rate and improve the system reliability by creating extra data streams between users within the same NOMA cluster. Also, we derived closed-form expressions for the achievable downlink data rates of the OMA, non-cooperative NOMA, and cooperative NOMA aided Cf massive MIMO systems. We suggested an adaptive switching algorithm between OMA, noncooperative NOMA, and cooperative NOMA modes to maximize the efficiency and performance of the system. Finally, we offered a special user clustering procedure, which needs no complex optimization and guarantees the existence of reliable links between the users within the same cluster. Simulation results prove that our proposed method has a much better performance than the previous ones and can be one of the leading candidates for the next generation of wireless networks.

APPENDIX. A
In this appendix, we will derive closed-form expressions for |DS lk | 2 , E |BU lk | 2 , E |ICI lk | 2 , E |ISIC lk | 2 , and E |IU I l k | 2 in order to prove theorem 1.
The power of the desired signal for the k th user within the l th cluster is given by Let's define e mlk = h mlk −ĥ mlk as the channel estimation error, whereĥ mlk and e mlk are independent. Using (8) we have where (I) is Now let's write the intra-cluster interference from the k th user to the k th user within the l th cluster as follows: (48) VOLUME x, 2021