Adaptive Double-Threshold Cooperative Spectrum Sensing Algorithm Based on History Energy Detection

Spectrum sensing is one of the key technologies in the field of cognitive radio, which has been widely studied. Among all the sensing methods, energy detection is the most popular because of its simplicity and no requirement of any prior knowledge of the signal. In the case of low signal-to-noise ratio (SNR), the traditional double-threshold energy detection method employs fixed thresholds and there is no detection result when the energy is between high and low thresholds, which leads to poor detection performance such as lower detection probability and longer spectrum sensing time. To address these problems, we proposed an adaptive doublethreshold cooperative spectrum sensing algorithm based on history energy detection. In each sensing period, we calculate the weighting coefficient of thresholds according to the SNR of all cognitive nodes; thus, the upper and lower thresholds can be adjusted adaptively. Furthermore, in a single cognitive node, once the current energy is within the high and low thresholds, we utilize the average energy of history sensing times to rejudge. To ensure the real-time performance, if the average history energy is still between two thresholds, the single-threshold method will be used for the end decision. Finally, the fusion center aggregates the detection results of each node and obtains the final cooperative conclusion through “or” criteria. Theoretical analysis and simulation results show that the algorithm proposed in this paper improved detection performance significantly compared with the other four different double-threshold algorithms.


Introduction
With the popularization of mobile Internet and the Internet of things, the demand for spectrum resources increases dramatically. The spectrum fragmentation and existing fixed allocation strategies result in low utilization of available spectrum resources [1]. Therefore, a new communication paradigm is required to exploit the available wireless spectrum opportunistically. The cognitive radio technology is an effective solution to improve the utilization of spectrum resources, and the spectrum sensing is the core technology of cognitive radio [2]. In the cognitive radio network, the second user (SU) actively detects whether a primary user (PU) exists in the licensed spectrum; if a PU does not exist in a specific frequency band, then the SU can utilize these spectrum holes. As long as a PU appears, the SU should free up the spectrum immediately to reduce the interference to the PU. Therefore, the spectrum sensing algorithm should be reliable and fast [3]. Among the common spectrum sensing techniques, energy detection is widely used due to its flexibility and low complexity. It is a blind detection method that belongs to noncoherent detection of signals with the advantage that the detection process does not acquire the prior information of the signal, and there is no limitation on the signal type [4]. Nevertheless, its performance is easily affected by the uncertainty of the noise power. In the case of relatively low SNR, when the difference between noise and signal energy is not distinct, single-threshold detection methods are easy to cause SUs to perceive the existence of a PU incorrectly, which will reduce the detection probability of the entire system. There are some methods [5,6] that optimized the single threshold and history-based method as [7] named three-event ED (3EED), which decides in one sensing event, considering also the event immediately before and the one immediately after it, which all lead to improving the energy detection performance-based single threshold. Furthermore, to overcome the weakness of single-threshold detection, a lot of double-threshold detection schemes [8][9][10][11][12][13][14][15][16][17][18][19] are proposed to improve the performance of the system to a certain extent. Nowadays, many new methods are continuously proposed for energy detection in spectrum sensing. For example, in [20,21], a triple-threshold energy detection method is proposed to improve the spectrum sensing efficiency as well as addressing the smallscale primary users which are unreliable in cognitive radio systems. Under the framework of random matrix theory, Zhao et al. [22] firstly proposed two enhanced detection algorithms based on the maximum eigenvalue and energy of the signal to achieve performance improvement. In [23], a dynamic matching-based spectrum detection scheme is proposed, which can detect sensing data, reduce the impact of malicious data, and make final sensing results more accurate with dynamic threshold setting and data matching, especially in the mobile scenario. Utilizing kennel functionbased support vector machine (SVM), a spectrum mapping scheme is proposed in [24] and a boundary CR user searching algorithm is adopted to improve the performance of this scheme. The machine learning methods are all utilized in [25,26] to improve the spectrum sensing performance. Article [27] is aimed at improving CR spectrum sensing by utilizing techniques such as real-valued FFT, Sparse Fast Fourier Transform, and collaborative spectrum sensing. Similar works can be found in the domain of nonorthogonal multiple access for cooperative and noncooperative wireless networks [28][29][30][31][32].
1.1. Related Works. In this paper, we focus on the doublethreshold energy detection methods. The traditional doublethreshold spectrum sensing method compares the energy value with two fixed decision thresholds. If the energy is greater than the higher threshold, it indicates that the PU exists. If it is less than the lower threshold, it is determined that the PU does not exist. And if it is within the high and low thresholds, the decision is not made temporarily. A weighted-cooperative double-threshold spectrum sensing scheme and two adaptive double-threshold energy methods are proposed in [10][11][12], respectively, to improve the performance of energy detection. However, the doublethreshold methods mentioned above are all no-decision when the energy is between the high and low thresholds. To address this problem, a memory-based energy detection method is presented in [13] by using memory sticks to improve the performance with the cost of delay in secondary devices' communication. Moreover, in [14][15][16], the correlation coefficient of received signals, the two-state Markov chain model, and the historical sensing data are employed, respectively, to determine a result in case the energy lies between the two thresholds. In [17], when the energy is between two thresholds, the result of the previous sensing time is used as the result of this time, and if there is also no result in the previous time, then wait for the result of the next sensing time to update the current time until generating a result. Considering the cooperation of multiple SUs, in [18], the fusion center receives relevant information of all nodes and makes a global decision based on "OR" rules. Cooperative spectrum sensing along with a doublethreshold detection method is also proposed in [19], which utilized the history test statistic to compare with the high and low thresholds. If the test statistic is still within two thresholds, then increase the number of history energy to compare again until a result can be generated. It deserves to be mentioned that not all history-based methods can cope with this problem.
To sum up, the threshold value of many doublethreshold detection algorithms is fixed and inflexible, and there is usually no decision when the detected energy is between the upper and lower thresholds. Moreover, methods based on historical energy information often have higher complexity and poor real-time performance. According to the above shortcomings, we propose an adaptive doublethreshold cooperative spectrum sensing algorithm based on history energy detection.

Main Contributions.
The main contributions of this paper are as follows: (1) We proposed an adaptive double-threshold cooperative spectrum sensing algorithm based on history energy detection, which excellent performance is verified by simulation especially in the case of low SNR (2) Based on the traditional double-threshold detection, plus in the weighted coefficient obtaining from SNR values of SUs, the two decision thresholds are adjusted adaptively to improve the performance of energy detection (3) To ensure the real-time performance, utilizing the average energy of history sensing times to complete subsequent judgment when the detected energy is between the high and the low threshold, and if the average history energy is still between two thresholds, the single-threshold method will be utilized as the end decision to guarantee that there will be at most only two rounds of detection, thereby enhancing the low complexity (4) We derivated the exact closed-form expressions of the detection probability, the false alarm probability, and the missed detection probability base on the proposed scheme, respectively The remainder of the paper is organized as follows. In Section 2, we briefly review the principle of energy detection and describe the traditional double-threshold method in the AWGN model. Moreover, the cooperative spectrum sensing method applied in this paper is introduced. In Section 3, we propose a novel adaptive double-threshold cooperative spectrum sensing algorithm based on history energy detection and present the scheme in detail. In Section 4, we derive the exact closed-form expressions of the detection probability, the false alarm probability, and the missed detection probability in our proposed scheme. In Section 5, the performances of the proposed method are shown with the 2 Wireless Communications and Mobile Computing simulation and analysis. Finally, the conclusion of this paper is given in Section 6.

System Model
2.1. Principle of Energy Detection. The principle of energy detection technology is to determine whether a signal exists based on the power of the received signal. The specific method is to sum the energy of the signal after a series of changes in a certain range to obtain the power of the signal and then compare the obtained power value with the decision threshold to determine whether there is a user. At present, although energy detection through the frequency domain will add additional calculation time due to FFT, nowadays FFT is widely used, its overhead on the detection time can be ignored, and it does not need to provide corresponding detection channels for each high-performance filter, so the implementation is more flexible, and it is more widely used in energy detection algorithms. The schematic diagram of energy detection based on the frequency domain is shown in Figure 1.
The radio frequency signal enters the receiving end of the energy detection, and after filtering, A/D conversion, and FFT conversion, the square sum is determined as the decision statistics and then sent to the threshold mechanism for judgment.
The energy detection algorithm establishes a model based on the statistical value of the signal energy received by the cognitive user, which can be represented by where sðnÞ is the PU signal, ωðnÞ is the channel noise, YðnÞ is the signal received by the cognitive node, H 0 indicates that the channel is idle, and H 1 indicates that the channel is occupied by the PU. Then, the energy statistics value E can be expressed as where N presents the number of detection sampling points.

Traditional Double-Threshold Energy Detection Method.
The basic idea of the double-threshold energy detection method is to make a decision by comparing the statistical energy value of the sampled signal with the decision threshold value, assuming λ H and λ L as the high and low decision thresholds, respectively. The decision rules are as follows: Assuming that the channel environment is AWGN, when the number of sampling points is large, the energy statistics can approximately obey the Gaussian distribution [33] shown in where σ 2 ω is the noise variance and σ 2 s is the average power of the main user signal, and the corresponding detection probability P d , the false alarm probability P f , and the missed detection probability P m can be obtained from equation (4), respectively: In formulas (5), (6), and (7), Q is the standard Gauss complementary cumulative distribution function. The detection probability P d is the probability of correct decision when a PU exists, i.e., the state H 1 . And the false alarm probability P f is the probability of determining PU existence when the channel is idle actually, i.e., the state H 0 when the channel is idle, while the missed probability P m is the probability of wrong decision when a PU exists, i.e., the state H 1 .

AWGN noise Signal
Bandpass filter

Wireless Communications and Mobile Computing
In the case of low SNR, when the false alarm probability P f and the missed detection probability P m are determined, from (6) and (7), the double threshold can be expressed in the following form: 2.3. Cooperative Spectrum Sensing. In the actual communication environment, factors such as multipath fading and shadowing of buildings are inevitable, which will lead to a high probability of misjudgment of the licensed frequency band in a specific area for a single node. In this case, utilizing cooperative spectrum sensing technology can minimize the effects of multipath and shadow fading, thereby improving the detection performance of the algorithm. The centralized cooperative network coordinates the information of cognitive users through a control center, which is called a fusion center. First, each cognitive user employs the single-node spectrum sensing method to perform local spectrum sensing and then sends the results to the fusion center. Finally, the fusion center analyzes the aggregated information and makes a decision based on certain judgment criteria to complete a spectrum sensing process. Different from the distributed cooperative scheme, which requires users to communicate with each other, the centralized cooperative scheme mainly utilizes the fusion center to make decisions, and each cognitive user is independent of each other. For the entire system, adding a new cognitive user requires only adding one communication link from the user to the fusion center, which is more flexible and simple. Therefore, the centralized cooperative scheme is the most suitable for cooperative spectrum sensing. Furthermore, the quality of its decision result is closely related to the fusion algorithm of the fusion center. But this is not the focus of this study. We employ a simple "or" criterion for multiuser cooperation in the fusion center, that is, the fusion center performs an "or" operation on all the received decision results from SUs. As long as the cognitive result of a cognitive SU is 1, the channel is determined to be occupied. Only when all the sensing results are 0, the fusion center determines the channel is idle and available.

Proposed Energy Detection Algorithm
The traditional double-threshold detection algorithm can solve the problem that the single-threshold detection algorithm is easily affected by noise and also can reduce the false alarm probability and the missed alarm probability. However, when the energy value is between the high and low thresholds, this sensing time is invalid, and the existence of the PU cannot be determined. Many methods improve the detection accuracy by optimizing the high and low thresholds, such as weighted double-threshold methods and adaptive double-threshold methods, but the case of no decision result during one sensing period still exists. To solve this problem, another type of method performs spectrum sensing multiple times until a decision can be made, which can make every sensing period have a decision. However, these methods increase the length of one spectrum sensing period, which further reduces the opportunity for SU to access idle frequency bands.
In this case, we proposed a new spectrum sensing algorithm based on historical energy to solve the problem that there is no detection result when the energy statistic value is in the middle threshold. At the same time, our scheme can reduce detection time relatively and improve detection accuracy effectively by adjusting the double-threshold adaptively. Figure 2 is the proposed algorithm detection flowchart of a single node at one sensing period. Considering the energy of the signal will not change too much in a short period, we calculate the average energy value in the recent limited sensing periods as the history energy. So we set a queue with the length of M to save the history energy of past M sensing periods. In one sensing period at the single cognitive node, if the current energy is between the double thresholds, we will calculate the average energy of past M sensing periods from the history queue to substitute the current energy value and start the second round detection. Furthermore, if the average energy is still between two thresholds, we will calculate the single threshold and make the final decision by comparing the average energy with it. Therefore, there would be a decision at every sensing period in our scheme.
The pseudocode for our proposed algorithm has been described in Algorithm 1. To eliminate the differences between cognitive SUs, it is assumed that the parameters of each cognitive node are the same within a certain period.
(1) According to formulas (8) and (9), the high and low threshold of single SU is calculated by the false alarm probability, the missed detection probability, the variance of noise, and the received signal. At this time, the decision threshold of each user is the same. Next, each cognitive SU sends the SNR value of the received signal to the fusion center to calculate the weight factor of each user, as shown in formula (10): where ξ i is the weight factor of the i-th cognitive user, L is the number of cognitive SUs, and SNR i is the signal-to-noise ratio of each cognitive user's received signal. Thus, every cognitive SU can adaptively adjust their own decision threshold through the weight factor calculated by formula (10) to improve the credibility, namely,  (2) Each cognitive SU obtains the energy statistical value E through formula (2) and updates the history energy queue simultaneously. Then, the SU compares the current energy E with its decision threshold. If it is higher than λ H i , it is determined that there is a primary user. And if it is lower than λ L i , it is determined that the channel is idle. In case it is between λ L i and λ H i , the average value of the history energy queue is taken as the current energy and start the next round of detection. Meanwhile, the "Flag" is set to 1, it means the first round of detection is over (3) Next, in the second round, which is identified by the value of "Flag" being equal to 1, if the average history energy is also between λ L i and λ H i , then calculate the single threshold λ S i , which is used to compare with the average energy to make the final decision (4) At last, each cognitive SU sends its own decision result to the fusion center which would use the "or" criterion to make the final decision, that is, as long as one cognitive node detects a signal, it is determined that there is a PU. Therefore, we can get the detection probability P d and false alarm probability P f as follows:

Wireless Communications and Mobile Computing
where P di and P f i is the detection probability and false alarm probability of the i-th cognitive SU, respectively

Theory Performance of the Algorithm
In this section, we derive the probability of detection, false alarm, and missed detection in the proposed algorithm, respectively.
According to the flow description in Section 3, there are three situations to determine the existence of the primary user: (1) The current energy value is greater than λ H i in the first round of detection procedure (2) When the current energy in the first round is between λ L i and λ H i , the average history energy calculated in the second round exceeds the upper threshold (3) When the current energy of the first round and the average history energy of the second round are both within λ L i and λ H i , the average history energy is greater than the calculated single threshold λ S i Hence, the detection alarm probability of single node is given by where λ Si is the single threshold, which can be expressed as Then, every part of formula (15) is derivated as follows.
From (6), we can get Similar to (4), according to the properties of the Gaussian distribution, once the number of sampling points is sufficient, the mean value of the past M sensing history energy also obeys the Gaussian distribution, which is expressed exactly as follows: Then, we can get the remaining part of (15): return R i 29: end procedure Algorithm 1: Adaptive double-threshold spectrum sensing algorithm of single node i based on history energy detection. 6 Wireless Communications and Mobile Computing Substituting equations (16), (18), (20), (22), and (23) into equation (14), the detailed expression for the detection probability is shown in In a similar way, the false alarm probability of the proposed algorithm is as follows: Then, every part of formula (26) is derivated as follows.
From (6), we can get

Simulation Results
In this section, to evaluate the performance of the proposed history-based adaptive double-threshold energy detection algorithm (HBADT-ED), we present numerical results and compare with the traditional double-threshold energy detection algorithm (TDT-ED) in [10], the weighted doublethreshold energy detection method (WDT-ED) modified from [11], the adaptive double-threshold energy detection scheme (ADT-ED) in [17], and the three consecutive time double-threshold energy detection method (TCTDT-ED) improved based on [7], respectively. On the basis of the original weighted coefficient of [11], the algorithm WDT-ED added the ratio of the current user SNR value to the average SNR value to increase the accuracy of the thresholds. And the TCTDT-ED scheme utilized the double threshold the same in TDT-ED to replace the single threshold in [7]. In the following simulations, we assume that the SNR range of the received signal is from -20 dB to 10 dB in the AWGN channel. The number of sampling N = 150, and the variance of noise σ ω is set to be 1. We also assume that all the SUs use the "or" criterion to make the final decision in the fusion center and the number of SUs L = 5. In the proposed algorithm, we set the false alarm probability P f = 0:05 and the missed detection probability P m = 0:01. Moreover, the size of history energy queue M = 5 [34]. All the simulation results are obtained by averaging 10 5 Monte Carlo independent experiments in MATLAB.
First, we investigate the impact of different SNR conditions of the received signal on the detection probability P d . It can be seen from Figure 3 that the proposed algorithm has the most obvious advantages than other methods. When the SNR grows to -9 dB, the detection probability of the proposed algorithm (HBADT-ED) in this paper is close to 1, while for the three consecutive time double-threshold energy detection method (TCTDT-ED) and the adaptive doublethreshold energy detection scheme (ADT-ED), the SNR value is required to reach -7 dB and -5 dB, respectively, and for the traditional double-threshold algorithm (TDT-ED) and weighted double-threshold algorithm (WDT-ED), the SNR value needs to grow to 2 dB to keep the detection probability close to 1.
Among these methods, our proposed HBADT-ED scheme has the highest value of detection probability and the most slowly rising with increasing SNR value. Even when the SNR is low to -20 dB, the detection probability is very high. Although the double threshold is fixed in the TCTDT method, because the energy both before and after current sensing time is taken into account, it gets the second-best performance. The ADT-ED algorithm uses the average SNR value of all SUs to adjust the decision threshold of every user adaptively; it performs better than the WDT-ED and TDT-ED distinctly. The WDT-ED only improves the detection results according to the weight factors but does not deal with the decision threshold; therefore, as the SNR value increases, the advantage of the WDT-ED over the TDT-ED becomes smaller and smaller. Figure 4 is a comparison of the detection probability of each algorithm with the number of cooperative detective 8 Wireless Communications and Mobile Computing SUs changed to 10 under the same false alarm probability compared with Figure 3. Because the signal is affected by multipath effect and shadow fading in the actual transmission scenario, the SNR of each cognitive user must be different. Considering the "or" strategy adopted for the cooperative decision, using more cognitive nodes can effectively overcome the environmental impact and improve the detection performance of the system. As expected, the detection probabilities of all algorithms have been improved, and the overall performance comparison is consistent with Figure 3. Figures 5 and 6 show the change of detection probabilities of five methods with false alarm probability under SNR = −15 dB and SNR = −10 dB, respectively. The higher the SNR is, the higher the detection probability is. When the SNR is determined, the detection probability P d goes up with the increase of false alarm probability. Moreover, under the same false alarm probability, the HBADT-ED algorithm proposed in this paper performs better than the other four methods, which can ensure a higher detection probability under the condition of lower false alarm probability. And the detection probability can approach 1 under a particularly small false alarm probability. Figures 7 and 8 show the comparison of the number of cooperative nodes required as the detection probability of each algorithm is close to 1 when the SNR is -15 dB and -10 dB, respectively. Comparing Figures 7 and 8, it can be seen that the higher the SNR value, the fewer cognitive nodes required by the same algorithm. The algorithm HBADT-ED  Wireless Communications and Mobile Computing proposed in this paper only needs 11 (SNR = −15 dB) and 6 (SNR = −10 dB) cognitive nodes to make the detection probability close to 1. Moreover, the performance ranking of the five algorithms is consistent with the analysis from Figure 3. As a conclusion, the algorithm with good performance only needs fewer sensing nodes to achieve the expected detection probability, so the complexity of the system can be greatly simplified.
Furthermore, we observe the effect of the missed detection probability on the performance of the proposed algorithm. Figure 9 shows that no matter the value of SNR is, the probability of detection P d always decreases with the increase of the missed detection probabilityP m . Meanwhile, the decline degree of the detection probability becomes smaller and smaller with the increase of the SNR value gradually. For example, when P m increases from 0.05 to 0.55, the value of P d drops by 0.11 as SNR = −20 dB, while it decreases by 0.06 as SNR = −10 dB. Thus, we can conclude that the lower the value of SNR, the greater the effect on the performance byP m . We also find that at any P m value, when the value of SNR is greater than -10db, the rise degree of P d value decreases. This means when the SNR reach to a certain value, the effect on the performance by SNR will be a little decline. The reason is that when the SNR reaches a certain value, the probability of detection of each node will already be very close to 1, so even when the SNR increases continuously, the rise of the probability of detection will slow down.
At last, we also examine the impact of different sampling number N on the performance of the proposed algorithm. From Figure 10, it can be seen that no matter what is the value of SNR with the restraint, when the sampling number N grows up, the probability of detection P d always increases except when it has already reached 1. Moreover, the improvement extent of the detection probability gets smaller and smaller with the growth of the SNR value. For example, when $ N $ increases from 100 to 500, the value of P d is up by 0.17 under SNR = −20 dB and grows 0.6 under SNR = −10 dB. Therefore, it can be summarized that as the SNR is lower, the sampling number N would have a larger impact on the detection performance. Finally, the same reason as in Figure 9, at any fixed value of N, when the value of SNR reaches a certain value, the effect on the performance by SNR will be a little decline.

Conclusion
In this paper, based on history energy detection, an adaptive double-threshold energy detection cooperative spectrum sensing algorithm is proposed. The values of the double threshold are optimized adaptively according to the weighting coefficient calculating by the SNR value of SUs. In the single cognitive node sensing process, when the detected energy is between the high and low thresholds, we utilize the average energy of history sensing times to complete subsequent judgment, which ensures that there must be an accurate decision in this situation of each sensing period. At last, the fusion center aggregates the detection results of each SU and obtains the final cooperative conclusion through the "or" criteria. In addition, we derivate the exact closed-form expressions of the detection probability, the false alarm probability, and the missed detection probability base on the proposed scheme, respectively. Compared with the TDT-ED, WDT-ED, ADT-ED, and TCTDT-ED algorithms, the simulation result shows that the performance of the proposed HBADT-ED algorithm is the best especially in the case of low SNR. Moreover, the low complexity of the proposed algorithm ensured realtime performance simultaneously. In the future, we will pay more attention to the research of spectrum sensing methods under Rayleigh or other channel conditions which are closer to the actual situation.

Data Availability
No data were used to support this study.

Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this paper.