Three-Event Energy Detection with Adaptive Threshold for Spectrum Sensing in Cognitive Radio Systems

Implementation of dynamic spectrum access (DSA) in cognitive radio (CR) systems requires the unlicensed secondary users (SU) to implement spectrum sensing to monitor the activity of the licensed primary users (PU). Energy detection (ED) is one of the most widely used methods for spectrum sensing in CR systems, and in this paper we present a novel ED algorithm with an adaptive sensing threshold. The three-event ED (3EED) algorithm for spectrum sensing is considered for which an accurate approximation of the optimal decision threshold that minimizes the decision error probability (DEP) is found using Newton’s method with forced convergence in one iteration. The proposed algorithm is analyzed and illustrated with numerical results obtained from simulations that closely match the theoretical results and show that it outperforms the conventional ED (CED) algorithm for spectrum sensing.


Introduction
The expansion of wireless communication systems in all sectors of modern society over the past decade has prompted an increased demand in spectrum resources. In this context, the traditional static allocation of the radio frequencies leads to inefficient use of the spectrum [1,2], and cognitive radio (CR) systems have emerged as a meaningful alternative for improving the efficiency of spectrum usage through dynamic spectrum access (DSA) [3]. DSA allows the access of secondary users (SU) to licensed frequency bands when these are not actively used by licensed primary users (PU), and relies on spectrum sensing, which is performed by the SU to detect the presence of active PU.
An important drawback of the ED method is implied by its sensitivity to noise uncertainty [17], which has led to improved ED algorithms that outperform the classical energy detection (CED) method [4]. These include the modified ED method for spectrum sensing in [18], which uses the average value of the ED test statistic over multiple sensing events, as well as the three-event ED (3EED) algorithm in [19], which decides that a PU is active if the ED test statistic exceeds the sensing threshold

Spectrum Sensing by Three-Event Energy Detection (3EED)
Let y(n) be the signal at the SU receiver, which consists of an active PU signal with average power σ 2 s corrupted by additive white Gaussian noise (AWGN) variable with variance σ 2 n when the channel is busy, or just of the AWGN when the channel is idle (PU is not active). We denote by E i the value of the received signal energy estimated during the i-th sensing slot that consists of N samples, λ the ED sensing threshold, and q i the binary decision variable {0,1} for the i-th spectrum sensing slot. With these notations, in CED correct detection of the PU signal (active/inactive) implies setting q i = 1, that is, the channel is "busy", if E i > λ when y(n) is implied by an active PU signal corrupted by noise, and q i = 0, that is, the channel is "idle", if E i ≤ λ when y(n) corresponds to a noise only term. We note that, when the number of samples N is sufficiently large, the tail region of the probability density function of the received signal energy E i for values above the sensing threshold is approximated by a normal distribution [25] such that the standard Q-function [26] can be used to approximate the probabilities of detection and false alarm for CED as [18] and As the name suggests, the 3EED algorithm [19] relies on ED in up to three consecutive sensing slots to decide if the signal y(n) at the SU receiver is implied by an active PU signal or not. Specifically, similar to CED, if the energy in the current spectrum sensing slot i exceeds the sensing threshold, E i > λ, then the 3EED algorithm decides that a PU is active and sets q i = 1. However, if E i ≤ λ, the algorithm checks the energy level estimated in the previous slot, E i−1 , to decide that a PU signal is active and set q i = 1 if E i−1 > λ, or to move on to the next time slot i + 1 to estimate E i+1 and make the final decision that PU signal is active setting Thus, if the PU signal is identified as active in any of the three consecutive sensing slots, i, i − 1, and i + 1, the algorithm returns q i = 1 corresponding to a "busy" channel, while if the PU signal is determined to be inactive in all three consecutive time slots the algorithm returns q i = 0 corresponding to an "idle" channel. The formal statement of the 3EED algorithm is given in Algorithm 1. Estimate received signal energy E i and save its value 3: if E i > λ then 4: Set q i = 1 −→ PU active/Channel "busy" 5: else 6: Read E i−1 (saved in slot i-1) 7: if E i−1 > λ then 8: Set q i = 1 −→ PU active/Channel "busy" 9: else 10: Estimate E i+1

11:
if E i+1 > λ then 12: Set q i = 1 −→ PU active/Channel "busy" 13: else 14: Set q i = 0 −→ PU not active/Channel "idle" 15: return q i The probabilities of false alarm and detection for the 3EED algorithm for spectrum sensing are expressed in terms of the probabilities of false alarm and detection for the CED algorithm, P CED f a and P CED d , respectively as [19]: where T represents the total duration of the transmission cycle that consists of B consecutive slots during which the channel is busy followed by a number of T − B slots in which the channel is idle. We note that the ratio α = B/T represents the spectrum utilization ratio of the PU (that is the fraction of time the channel is actively used by the PU).
The decision threshold λ is determined based on a desired performance level that is specified in terms of a target probability of false alarm value, P f a , as it is usually the case with constant false alarm rate (CFAR) detectors [19], We note that the threshold must be adapted when changes in the noise variance occur, in order to keep the probability of false alarm at the desired value. We also note that, by considering only the probability of false alarm in setting the sensing threshold, the SU is favored, since by setting the value of P f a low the SU has more chances of utilizing the spectrum. However, in the case of a mis-detection, when the PU is active but the channel is incorrectly detected as "idle", the SU transmission will interfere with the active PU signal and will negatively affect the PU performance. Thus, in order for spectrum sensing to be beneficial to both PU and SU, threshold setting should consider both the probability of false alarm and the probability of mis-detection.

Optimizing the 3EED Sensing Threshold to Minimize the Decision Error Probability
To optimize the decision threshold of the 3EED algorithm for spectrum sensing we use the DEP as the performance metric, which is formally defined as [22]: Analyzing expression (6) we note that the DEP is a function of the sensing threshold λ, the PU spectrum utilization ratio α, the average power of the PU signal σ 2 s , and the noise variance σ 2 n . Furthermore, both terms in the DEP expression (6) are related to decision errors in the spectrum sensing process:

•
The first term in (6) is implied by the probability of false alarm and corresponds to the case when a given sensing slot is found busy without an active PU transmission in this slot. False alarms occur only when the channel is idle and the term is weighted by the 1 − α factor corresponding to the fraction of time when the PU is not active.

•
The second term in (6) corresponds to the probability of mis-detection and is associated with the case when a given sensing slot is found idle while an active PU transmission is actually in progress in this slot. Mis-detections occur when the channel is busy and the term is weighted by the α factor corresponding to the fraction of time when the PU is active.
Thus, the DEP provides a trade-off between the false alarm and mis-detection performance, and allows optimization of the decision threshold for the 3EED algorithm by setting it to minimize the DEP (6), that is Introducing (3) and (4) in (6), we rewrite the expression of DEP as For the sake of simplicity, let us introduce two variables denoted as a(λ, σ 2 n ) and b(λ, σ 2 s , σ 2 n ), which are the arguments of the Q-function in (1) and (2), respectively, and expressed as Using the expressions (9) and (10), we can rewrite the DEP function from (8) as following: We note that finding an accurate closed-form expression for λ opt is elusive as the expression of the DEP metric to be optimized has already been approximated when expressions of P 3EED f a and P 3EED d in terms of the Q-functions have been used to obtain (11), and resorting to further approximations of the Q-function in terms of simpler elementary functions will affect the accuracy of the optimal threshold value obtained. Thus, we focus on numerical optimization of the DEP metric (11), which takes advantage of its convexity properties.
Specifically, we notice that the DEP function has four variables, i.e., λ, α, σ 2 s , and σ 2 n . However, the optimization aims only at the threshold variable, λ. Therefore, the other three variables are assumed to be constant for this optimization. In order to perform the threshold optimization, the DEP function from (6) and (11) has to be a convex function in λ. Therefore, we provide the next theorem.

Theorem 1. The DEP function given by (11) is a convex function in λ.
Proof. Let us introduce the following notations for the functional terms from (11): Analyzing the second derivative of both functions from (12) with respect to a and b, respectively, one can notice that both have a unique and identical inflection point (i.e., the solution of T 1 (a) = 0 and T 2 (b) = 0). The value of this common inflection point is the solution of the following transcendental equation for x = a or x = b: An approximate value for the solution of the Equation (13) can be obtained using numerical methods or graphically, i.e., x 0 = 0.76527.... Considering this approximate value of x 0 and using the relations in (9) and (10), we can determine the values of the inflection point values of λ (1) in f lec and λ (2) in f lec for the functions T 1 (a) and T 2 (b), respectively, from (12): In order to evaluate the convexity of the functions from (12), we have to estimate the values in the inflection points, given by (14), of the first derivative of these functions with respect to λ, respectively, denoted as T 1 λ = λ (1) in f lec and T 2 λ = λ (2) in f lec . Analyzing these first derivative functions, we noticed that T 1 λ (1) in f lec < 0 and T 2 λ in f lec . Also, we note that the DEP expression from (11), with the notations from (12), is a linear combination of the two convex functions T 1 (λ) and T 2 (λ) for the intersection set λ (1) in f lec ≤ λ ≤ λ (2) in f lec : We also know that the spectrum utilization ratio of the PU is a positive number, i.e., α ∈ [0, 1] and therefore, both coefficients of the linear expression from (15) are positive numbers.
Finally, Theorem 2.10 from page 52 in [27] states that a linear combination of two convex functions on a set, with non-negative coefficients, is also a convex function. Hence, we can conclude that the DEP expression from (11) is a convex function in λ on the set λ (1) in f lec ≤ λ ≤ λ (2) in f lec . Now, because the DEP function is convex as stated by Theorem 1, we can determine the optimum threshold from (7) by solving the following equation to find the critical points of the DEP (6): Next, using the DEP expression from (11) we obtain where a(λ, σ 2 n ) and b(λ, σ 2 s , σ 2 n ) were previously introduced in (9) and (10). Using the expression of the first derivative of the Q-function the threshold optimization Equation (16) becomes where γ = σ 2 s /σ 2 n is the signal-to-noise ratio (SNR) and We note that Equation (19) is transcendental, which makes it difficult to find a closed-form solution for the optimal threshold λ opt , and the alternative is to obtain a numerical solution for it as discussed in the following section.

Numerical Approach to Finding the Optimal 3EED Sensing Threshold
The numerical approach used to find λ opt , the optimal threshold for the 3EED spectrum sensing, is based on the application of Newton's iterative method [28] for Equation (19) rewritten as As the rate of convergence for Newton's method is quadratic, with proper initialization, a solution to (21) that approximates well the optimal sensing threshold λ opt can be found in only a few iterations of the type [28] Furthermore, the proposed approach uses the Q-function approximation [29] Q to rewrite the Q(a) and Q(b) terms in (21). We have to note that the initialization of Newton's iterative method, used to solve the optimization equation from (21), and its convergence are strongly related to the convexity of the DEP function. According to the DEP function's convexity demonstrated in Theorem 1, we know that the best initialization values of λ should be the values of the inflection points, i.e., either λ (1) in f lec or λ (2) in f lec given in (14). However, for the analytical derivation of the optimum value of λ, the use of λ (1) in f lec or λ (2) in f lec in the expressions of the optimization function from (21) and its derivative function would have complex expressions. Instead, we prefer to use the values of λ for which the argument variables a and b in the optimization Equation (21) take null values, i.e., a = 0 or b = 0. Hence, all terms multiplied by a or b will be eliminated from the final expressions. The λ values that are the solutions for the equations a(λ, σ 2 n ) = 0 and b(λ, σ 2 s , σ 2 n ) = 0, denoted as λ a,0 and λ b,0 , respectively, result from (9) and (10) as and It is important to note that the difference between the values of λ a,0 and λ b,0 and the values of λ (1) in f lec and λ (2) in f lec is almost neglectable. Using the expressions from (14), (24) and (25), it can be easily demonstrated that the relative difference between these values is given by: Considering that x 0 = 0.76527... and N takes values of the order of tens of thousands samples, then it results in a value for the relative difference in (26) that is less than 1%.
Hence, considering all the above, we will use the values of λ a,0 and λ b,0 as initial values for Newton's method.
Since (23) is valid only for positive arguments of the Q-function and the arguments a(λ, σ 2 n ) and b(λ, σ 2 s , σ 2 n ) in (21) can take both positive and negative values, as can be observed from (9) and (10), the approximation is applied in conjunction with the symmetry property of the Q-function, Q(−x) = 1 − Q(x). Specifically, the following three distinct cases will be analyzed separately to provide a numerical solution for Equation (21) We have to note that the domain of λ values is separated into these three sub-domains ((i), (ii), and (iii)), where the value of λ a,0 delimits cases (i) and (ii) and λ b,0 delimits cases (ii) and (iii). Therefore, λ a,0 will be used as the initial value for the iterative method in case (i) and λ b,0 will be used as the initial value for the iterative method in case (iii). Instead, for case (ii), we can use either λ a,0 or λ b,0 as the initial value, because the minimum DEP can be reached from either side of the interval with a similar accuracy.

Case
Using the symmetry property of the Q-function, Equation (21) can be rewritten as: which, upon using the approximation (23) becomes: Denoting the function in the left-hand side of (28) by f i (λ), and initializing Newton's iteration with the value λ a,0 from (24) we obtain The derivative f i (λ a,0 ) is given by the expression (30), which, together with (29), can be used to start Newton's iterations (22) to obtain a numerical solution for the optimal sensing threshold λ Following a similar approach as in the previous case but in which the symmetry property of the Q-function is used only for the Q(b) term, Equation (21) is rewritten in this case as: for which approximation (23) implies that Denoting the function in the left-hand side of (32) by f ii (λ), and initializing Newton's iteration with the value λ b,0 from (25) we obtain The derivative f ii (λ b,0 ) is given by expression (34), which, together with (33), can now be used to start Newton's iterations (22) to obtain a numerical solution for the optimal sensing threshold λ In case (ii), we have used λ b,0 as the initial value, but we can obtain similar expressions for f ii (λ) and f ii (λ) with λ a,0 as the initial value, as in (33) and (34), respectively, with similar performance results for Newton's method.

Case
In this case, the approximation from (23) can be used directly in (21) to rewrite it as expression (35). Denoting the function in the left-hand side of (35) by f iii (λ) and initializing it in this case with the same value λ b,0 in (25) we obtain the expressions for f iii (λ b,0 ) and f iii (λ b,0 ) as shown in (36) and (37), respectively, which can be used to start Newton's iterations (22) to obtain a numerical solution for the optimal sensing threshold λ (iii) opt .

One-Step Numerical Solution and the 3EED Algorithm with Adaptive Threshold
The rate of convergence for Newton's iterations and the number of steps n needed to find a numerical solution λ opt to the optimal sensing threshold for each of the three cases outlined in the previous sections depend on the monotonicity of the corresponding f j (λ) function, as well as on the initialization In order to improve convergence and minimize the overhead associated with finding the optimal sensing threshold, we propose to use the alternative function having the derivative expressed as which yields a good approximation for the optimal sensing threshold in only one iteration This approach was prompted by empirical observations that are discussed in Section 5.1 and takes advantage of the monotonicity of f j (λ), which, along with proper choice of the initial value λ (j) 0 , amount essentially to a linearization of the function that yields the optimal threshold around its root.
Noting that the functions f j (λ), j ∈ {i, ii, iii}, that approximate f (λ) in (21) are all monotonically decreasing, and that they overlap at the edges of the definition intervals for a and b, that is the proposed approach identifies first which approximation case j is applicable ({i, ii, or iii}), and determines the one-step numerical solution for the optimal sensing threshold λ opt using (42). Once the sensing threshold is found, the 3EED Algorithm 1 is applied with the value λ opt to make a decision on the PU activity and channel availability. The approach is formally stated as Algorithm 2.

Simulations and Numerical Results
In this section, we present numerical results obtained from simulations that support the proposed approach for one-step threshold calculation and illustrate the performance of the 3EED algorithm with an adaptive threshold. The algorithm is also compared to the adaptive CED algorithm in [22] as well as with the "Brute-force" adaptive 3EED algorithm [24] in which an exhaustive search is implemented in Matlab to obtain the value of λ opt instead of the proposed one-step approach.
The parameter values used in the simulations are: the number of samples in a sensing slot N = 65, 537, the SNR γ is between −25 dB and −15 dB, and T = 500 slots. The signal transmitted by the PU is implemented using binary phase shift keying (BPSK) modulation, and 2500 sensing slots were considered in each transmission sequence in all simulations. Figure 1 shows the values of the optimal sensing threshold λ opt that minimizes the DEP, as a function of α, the spectrum utilization ratio, for SNR values of −25 and −20 dB, corresponding to the proposed approach discussed in Section 4, the "Brute-force" approach in [24], and the adaptive CED approach in [22]. From this figure we note that the values of the sensing threshold obtained using the proposed approach closely match those obtained using the "brute-force" approach [24] for values of α between 0.2 and 0.7, in particular for α around 0.5, and support the application of the numerical approach presented in Section 4 for threshold calculation with minimal overhead. We also note that, according to studies performed on GSM channels [30] or in the industrial, scientific and medical (ISM) bands [31], this is the range of values for the spectrum utilization ratio α that is of practical interest for SU access to licensed spectrum.  Figure 2 shows the values of the DEP P e as a function of the SNR γ for different values of the spectrum utilization ratio α, for the proposed 3EED algorithm with an adaptive threshold as well as for the adaptive CED algorithm in [22]. Based on the plots shown in Figure 2 we first note that the values of the DEP obtained through Monte Carlo simulations closely match the analytical values of the DEP implied by (6) for the proposed 3EED algorithm with an adaptive threshold or by the corresponding DEP expression in [22], for all SNR and α values. We also note that the proposed 3EED algorithm with an adaptive threshold outperforms the adaptive CED algorithm in cases of practical interest corresponding to spectrum utilization ratios above 0.2 and below 0.7, with maximum gain of the proposed algorithm in terms of the DEP of about 1 dB achieved for α around 0.5. Furthermore, for both the proposed 3EED algorithm with an adaptive threshold and the adaptive CED algorithm, the value of the DEP becomes less sensitive to changes in the spectrum utilization ratio α as the SNR values increase.  Figure 3 shows the dependence of the DEP on the spectrum utilization ratio α for two different SNR values γ = −23 dB and −20 dB. As it can be observed, the DEP decreases with increasing SNR for both the proposed 3EED algorithm with an adaptive threshold and the adaptive CED algorithm. Furthermore, the proposed algorithm outperforms the adaptive CED one for all values of the spectrum utilization ratio α. We note that, for each value of α, the corresponding DEP values are minimum since the optimal sensing threshold is used for that α, as discussed in Section 3.

Conclusions
A new ED algorithm for spectrum sensing in CR systems is presented in the paper. The proposed algorithm employs an adaptive sensing threshold that is optimized to minimize the DEP and has minimal overhead, since the value of the optimal threshold is found through a one-step iterative method.
Numerical results obtained from simulations are presented to illustrate the performance of the proposed algorithm and to compare it to the adaptive CED algorithm. The results show that the proposed algorithm outperforms the CED algorithm for spectrum sensing, resulting in lower values for the DEP for all values of the spectral utilization ratio that are of practical interest for CR systems providing SU access to licensed spectrum.
We intend to implement and validate the proposed algorithm using SDR platforms from the USRP family. In this context, we will also focus on the optimization of the expressions used in the algorithm to estimate the decision threshold for minimizing the computational complexity and the sensing time.