Spectrum Sensing with Energy Detection in Multiple Alternating Time Slots

Energy detection (ED) represents a low complexity approach used by secondary users (SU) to sense spectrum occupancy by primary users (PU) in cognitive radio (CR) systems. In this paper, we present a new algorithm that senses the spectrum occupancy by performing ED in K consecutive sensing time slots starting from the current slot and continuing by alternating before and after the current slot. We consider a PU traffic model specified in terms of an average duty cycle value, and derive analytical expressions for the false alarm probability (FAP) and correct detection probability (CDP) for any value of K. Our analysis is corroborated with numerical results in which Monte-Carlo simulations are used to determine FAP and CDP to confirm the validity of the analytical expressions obtained and to illustrate that good receiver operating characteristic (ROC) performance is reached for reasonably small values of K.


I. INTRODUCTION
E MERGING generations of wireless communication systems such as 5G and beyond, will require significant spectrum resources in order to deliver high data rates and to enable connectivity for a very large number of wireless devices [1]. We note that the current spectrum allocation has been shown to be inefficient, as it results in underutilization of the frequency bands with fixed allocation [2], and dynamic spectrum access (DSA) has been identified as a possible solution to the spectrum scarcity problem, as it allows unlicensed secondary users (SU) to access licensed frequency bands, which are not actively used by the licensed primary users (PU) of the spectrum. We also note that DSA has been incorporated in wireless standards such as the IEEE 802.22, IEEE 802.11af, LTE-U, or LAA [3], and it is also considered in the implementation of the 5G wireless networks [4].
DSA requires that, prior to initiating a transmission, SUs sense the spectrum to determine if an active PU is present, and in this direction various spectrum sensing (SS) methods have been proposed in the literature [5]- [7]. These include cooperative SS [8], where multiple SUs exchange sensing information and a common decision is reached in a centralized manner, as well as non-cooperative SS, in which individual SUs decide if the spectrum is used by evaluating specific features of the PU signal. The latter approach includes SS methods based on energy detection (ED) [9], entropy and ED [10], matched filter detection [11], cyclostationary feature detection [12]- [14], covariance-based detection [15], [16], multitaper spectrum estimation [17] or filter bank spectrum estimation [18], with the choice determined by making a compromise between detection performance and computational complexity or sensing delay. We note that ED is by far the most widely used method in both cooperative and non-cooperative SS schemes, because of its simplicity and of the fact that it requires no knowledge of the PU signal parameters.
In recent years, several modified ED algorithms were proposed to improve the detection performance of the classical ED (CED) algorithm [9] in non-cooperative SS with a moderate increase in computational complexity. In this direction we note the improved ED (IED) algorithm in [19], which reduces the probability of missed detection of a PU signal by taking advantage of the history of ED results and averaging the energy measured in previous SS slots. However, the performance increase implied by the IED algorithm is limited and using more than three past slots for energy averaging will not result in significant performance increase over the three-slot averaging case [19]. We also note the three-event ED algorithm [20], which has similar complexity and performance to IED, but differs from the IED algorithm in that it performs the ED tests in three consecutive sensing slots in a conditional order using a common fixed threshold implied by a target value of the desired false alarm probability (FAP) in the three sensing slots.
In this paper, we present a new algorithm for spectrum sensing that performs ED in an arbitrary number K of consecutive sensing slots that alternate before and after the current sensing slot. We study its detection performance theoretically and by simulations. Our analysis shows that the ROC performance of the proposed algorithm increases with K, reaching almost ideal detection performance for reasonably small values of K.
The rest of the paper is structured as follows: in Section II we introduce the system model and formally state the problem, followed by a discussion of particular cases of the proposed algorithm in Sections III and IV. We continue with the analysis of the K-slot ED algorithm in Section V followed by presentation of numerical results obtained from simulations in Section VI, in which we compare the performance of the different versions of the K-slot ED algorithm through receiver operating characteristic (ROC) curves as well as through FAP and CDP plots that confirm the analytical results. We conclude the paper with final remarks and future research directions in Section VII.

II. SYSTEM MODEL AND PROBLEM STATEMENT
Let y(n) be the signal at the SU receiver, which is given by the expression y(n) = w(n), H 0 hypothesis: PU is not active s(n) + w(n), H 1 hypothesis: PU is active (1) where s(n) denotes the transmitted PU signal with average power σ 2 s , w(n) denotes the additive white Gaussian noise (AWGN) with zero mean and variance σ 2 w , and n denotes the sample index. We denote by E i the value of the received signal energy estimated during the i-th sensing slot that consists of N samples, and we compare that against the ED sensing threshold λ, i.e.
where 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 implies setting q i = 1, that is channel is "busy", if E i > λ when y(n) is implied by the H 1 hypothesis, and q i = 0, that is channel is "idle", if E i ≤ λ when y(n) corresponds to H 0 hypothesis, with the corresponding FAP and CDP given by [19]: and respectively, where Q(·) denotes the complementary cumulative distribution function of the normal Gaussian random variable [21]. We note that expressions (3) and (4) are derived under the assumptions that the PU status (active/idle) does not change during the N samples of the sensing window, which in practical settings with dynamic PU may not always be satisfied, leading to a decrease in the performance of spectrum sensing when ED is used [19], [22], [23].
To alleviate the loss in spectrum sensing performance due to changes in the PU status, we consider a simple PU activity model with a specified average duty cycle value, and will introduce a spectrum sensing approach in which more than one sensing slot is considered by the SU when making the decision that the PU status is active/idle. We let the average value of the PU duty cycle be given by the ratio B/T , where B represents the average number of sensing slots in which the PU transmits over an interval of T sensing slots [24]- [26]. We assume that B and T are known and illustrate the principle of the proposed spectrum sensing algorithm in Figure. 1.
Specifically, the first energy test is performed in the current sensing slot i, and if no other energy test is performed, this scenario corresponds to CED. To improve accuracy with dynamic PU we will perform ED in K slots before making the decision on PU status active/idle by performing additional energy tests in sensing slots that alternate before and after the current sensing slot as shown in Figure 1.
In this context, we study the proposed K-slot ED approach and derive closed form expressions for the corresponding FAP and CDP that take into account the dynamic model of the PU considered. In addition, we illustrate the performance with numerical results obtained from simulations that confirm the validity of the closed form expressions derived.

III. TWO-SLOT ENERGY DETECTION
To gain insight into the behavior of the proposed K-slot ED approach we start by considering the case K = 2 sensing slots, which is a straightforward extension of the CED where energy tests are performed in the current sensing slot i as well as in the previous sensing slot i − 1. In the 2-slot ED approach, if the energy in the current spectrum sensing slot i exceeds the sensing threshold, E i > λ, then a preliminary decision in favor of hypothesis H 1 (PU is active) is made by setting q i −→ 1, while if E i ≤ λ, the energy value in the previous slot, E i−1 , is also checked, to make final decision in favor of hypothesis H 1 if E i−1 > λ and maintain q i = 1 (i.e. "channel is busy") or decide in favor of hypothesis H 0 if E i−1 ≤ λ and set q i −→ 0 (that is "channel is idle"). This process is formally stated 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: if E i−1 > λ then 8: Set q i = 1 −→ PU active/Channel "busy" 9: return q i 14: end for The FAP corresponding to the 2-slot ED algorithm is calculated as: where p 10 denotes the probability that in two consecutive sensing slots the last one corresponds to an "idle" PU and the one before it corresponds to a "busy" PU, and p 00 denotes the probabilities that the two consecutive sensing slots correspond to an "idle" PU. Given the PU duty cycle of B/T , the total number of sensing slot sequences with two consecutive slots corresponding to an "idle" PU in the last slot is T − B, and among these sequences there is one which implies {q i−1 = 1, q i = 0}, while the remaining ones imply {q i−1 = q i = 0}. Thus, we have that 1 Considering that in each sensing slot energy detection is an independent CED problem and using (6), we can rewrite the FAP expression (5) as: Similar to (5), the CDP for 2-slot ED can be written as where p 01 denotes the probability that in two consecutive sensing slots the last one corresponds to a "busy" PU and the one before it corresponds to an "idle" PU, and p 11 denotes the probabilities that the two consecutive sensing slots correspond to a "busy" PU. In this case we note that, similar to (6), for B ≥ 3 we have that which implies that the CDP expression (8) can be rewritten as:

IV. INCREASING THE NUMBER OF SENSING SLOTS FOR MORE ACCURATE DETECTION OF PU ACTIVITY
To improve the accuracy with which the activity of the PU is detected by SU that performs ED in multiple time slots, we will alternate the positions of these slots before and after the current sensing time slot. Thus, having performed ED in slots i and i−1 for the 2-slot ED, we should extend sensing to time slot i + 1 that follows the current sensing slot to perform 3slot ED. In this case, which has been studied in [20], if the PU signal is identified as active in any of the three consecutive sensing slots, i, i − 1, and i + 1, (in this order), 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 FAP and CDP expressions for the 3-slot ED algorithm, are given in terms of the FAP and CDP for CED by [20]: We note that FAP and CDP expressions (11) and (12) can be rewritten in terms of the FAP and CDP for the 2-slot ED as: We also note that, similar to the 2-slot ED approach, the CDP for 3-slot ED in (12) depends only on B, while its FAP in (11) depends both on B and T .
Following the sequence of ED tests outlined in Figure 1, the number of slots in which ED tests are performed can be further increased to 4 with an additional ED test in slot i − 2, for which the FAP and CDP expressions in terms of the those corresponding to CED are given by: and For K = 5-slot ED the additional test will be performed in slot i + 2, and the resulting FAP and CDP expressions, respectively, are given by: and We note that details on the derivations of the FAP and CDP expressions (15) and (16) corresponding to 4-slot ED, and expressions (17) and (18) for 5-slot ED, are given in Appendices A and B, respectively.

V. K-SLOT ENERGY DETECTION
In Sections III and IV, we presented spectrum sensing approaches that use 2, 3, 4, and 5 sensing slots for spectrum sensing, starting at the current slot i in which decision is made and alternating before and after it. We have also determined distinct expressions for the FAP and CDP for each of these cases in terms of the FAP and CDP for CED.
In this section we generalize the presented approach to an arbitrary number of consecutive sensing slots K that alternate before and after the current sensing slot i, and we determine closed-form expressions for the FAP and CDP for any value K. We begin by noting that for any value of K ≥ 2, the corresponding K-ED approach can be regarded as an extension of the (K − 1)-slot ED where the energy detected in an additional slot is considered in the spectrum sensing decision as follows: • If K is even, the extension from K−1 sensing slots to K sensing slots will add a new ED test in slot i − K/2 2 . • If K is odd, the extension from K − 1 sensing slots to K sensing slots will add a new ED test in slot i + K/2 We note that, when extending the number of sensing slots from K − 1 to K, adding a new ED test in a slot before the current slot i is always preferable, as it will result in a smaller delay in reaching the spectrum sensing decision than if the new test would be added to a sensing slot that comes after the current slot i. Thus, for K = 2 the second ED test is performed in slot i − 1, while for K = 3, the new ED test will be done in slot i+1, and so on, as outlined in in Figure 1. A formal statement of the proposed K-slot ED algorithm for spectrum sensing is given in Algorithm 2.

A. THE FAP AND CDP EXPRESSIONS FOR K-SLOT ED
Analyzing the FAP expressions (7), (11), (15), and (17), for K = 2, 3, 4, and 5-slot ED, respectively, we note that extending spectrum sensing from (K − 1)-slot ED to K-slot ED by adding a new ED test in either slot i − K/2 or slot i + K/2 , the FAP expression for K-slot ED can be written as where (K) = K/2 . Similarly, analyzing the CDP expressions (10), (12), (16), and (18), for K = 2, 3, 4, and 5-slot ED, respectively, we note that extending spectrum sensing from (K − 1)-slot ED to K-slot ED by adding a new ED test in either slot i− K/2 or slot i + K/2 , the CDP expression for K-slot ED can be written as Noting that the case K = 1 corresponds to CED, the iterative expressions (19), (20) for P K−ED f a and P K−ED d , respectively, can be written as:  . . .
lead to the following equivalent expressions for the FAP and CDP corresponding to the k-slot ED algorithm:

B. DETERMINING THE SENSING THRESHOLD FOR K-SLOT ED
To determine an analytical expression for the decision threshold, we consider the FAP as the target performance metric, which is usually the case with constant false alarm rate (CFAR) detectors [28], under the simplifying assumption that (T −B) → ∞, which, in the limit, corresponds to an inactive PU and implies a best case scenario for the SU. Under this assumption, we can write that which can be rewritten as

VOLUME 4, 2016
Using expression (3) for the FAP of the CED we determine the sensing threshold value We note that the threshold value λ implied by (28) does not depend on the parameters B and T describing the PU activity model, and that this simplifying assumption made to obtain the decision threshold expression (28) will result in a minor decrease of the sensing performance in the context of the PU activity with a B/T duty cycle, which will be discussed in Section VI. Furthermore, by using (28), one can ensure that a CFAR is maintained for any value of the number of sensing slots K, i.e.
which ensures a fair comparison of the sensing performance for the K-slot ED for different values of K.

VI. SIMULATIONS AND NUMERICAL RESULTS
To corroborate the analysis presented in the previous sections we have run Monte-Carlo simulations in Matlab to evaluate the performance of the K-slot energy detection for different values of K. The scenario considered in our simulations assumes that the PU transmits a binary phase-shift keying (BPSK) signal, N = 1000 samples per sensing slot are used, and a total of 1000 periods of T = 5000 sensing slots are simulated with an average busy period B = 1000 sensing slots corresponding to a duty cycle of 0.2 for the PU, which is a typical value for the current licensed spectrum utilization [7].
In a first simulation experiment we consider the signal-tonoise-ratio (SNR) of the PU signal at the SU receiver to be equal to −9.15 dB, which corresponds to a CED operating with a FAP (3) equal to 0.1 and a CDP (4) equal to 0.9, and we determine the receiver operating characteristic (ROC) curves for multiple values of K using the decision threshold implied by (28). Results of this experiment are shown in Figure 2, from which we note that the ROC performance increases with K, and that the FAP and CDP values obtained from simulations follow closely the analytical ones derived in Section V. The slight difference between the analytical and simulated values for the FAP and CDP, which is more noticeable for FAP values below 0.1, is due to the fact that the sensing threshold for the K-slot ED is calculated using equation (28), which was derived for an idealized scenario, as discussed in Section V.
To gain a better perspective on the difference between analytical and simulated ROC curves, we have also plotted in Figures 3 and 4 the FAP and CDP, respectively, for the Kslot ED algorithm versus the FAP and CDP for CED. From the FAP plots in Figure 3 we note that the analytical values of the FAP for the K-slot ED and CED coincide for all values K, which was expected as implied by equation (29). We also note that the difference between the FAP values obtained from simulations and the analytical FAP values is larger for higher values of K and it decreases when the target FAP increases. By contrast, from Figure 4 we note that the CDP values obtained from simulations for the K-slot ED algorithm closely match the analytical values implied by the CDP expression (25), which confirms its accuracy. Furthermore, the plots in Figure 4 show the significant increase in CDP when the K-slot ED algorithm is used compared to CED. Finally, we also note that the proposed K-slot ED algorithm outperforms the IED algorithm in [19] as its ROC curves approach an ideal ROC curve for increasing K, while the performance of the IED algorithm cannot exceed that of the 3-slot ED algorithm [20].
In a second simulation experiment we looked at the ROC performance of the K-slot ED algorithm for lower SNR values and considered the following scenarios: • SNR = −12.79 dB, which, when using the CED algorithm with N = 5000 samples per sensing slot, implies similar FAP and CDP values of equal to 0.1 and 0.9, respectively. • SNR = −19.39 dB, which, when using the CED algorithm with N = 100000 samples per sensing slot, implies similar FAP and CDP values of equal to 0.1 and 0.9, respectively. Similar to the first experiment, the average value of the PU duty cycle is 0.2 and 1000 periods of 5000 sensing slots are simulated. Results of this experiment are shown in Figures 5 and 6, from which we note that the ROC performance of the K-slot ED algorithm increases with K even at lower SNRs, although for the same value of K lower SNR implies lower performance, which should be expected. We also note that, while the difference between the FAP and CDP values obtained from simulations and their corresponding analytical values is smaller for the ROC curves shown in Figures 5 and 6 than for those in Figure 2, this is a consequence of the fact    that the sensing slots contains more samples N in these scenarios.
In a third and final simulation experiment we studied the performance of the K-slot ED algorithm with a more active PU signal. We considered SNR = −12.79 dB, with N = 5000 samples per sensing slot, as in the second experiment, but we simulated the activity of a PU with average value of the duty cycle equal to 0.7 3 . Results of this experiment are shown in Figure 7, from which we note that, while a slight decrease in the simulated ROC performance is visible for larger values of K, this is barely noticeable for smaller values of K. 3 We note that such a scenario is only hypothetical and not relevant to the current practical development of CR systems [7].

VII. CONCLUSION
In this paper we presented a novel algorithm for spectrum sensing that performs ED in K consecutive sensing slots that alternate before and after the current sensing slot. Analytical expressions for the FAP and CDP for the proposed algorithm are derived, which are also confirmed with numerical results obtained from simulations. The sensing performance of the proposed algorithm increases rapidly with increasing K, reaching a high performance level at low SNRs for moderate values of K 12.
In future research, we plan to study the performance of the K-slot ED algorithm in conjunction with cooperative spectrum sensing and to test it in a realistic cognitive radio environment. .

APPENDIX A 4-SLOT ED
Increasing the number of ED tests to 4 requires adding one more test in slot i − 2 beyond the ED tests performed for the 3-slot ED. Therefore, if the PU signal is identified as active in any of the four consecutive sensing slots i, i − 1, i + 1, and i − 2, the algorithm returns q i = 1 corresponding to a "busy" channel, while if the PU signal is determined to be inactive in all four consecutive time slots the algorithm returns q i = 0 corresponding to an "idle" channel.
Using the same procedure outlined in [20] that has also been applied in Section III for the 2-slot ED algorithm, the FAP of the PU signal detection for the 4-slot ED can be calculated as: For B ≥ 3 and T − B ≥ 2, the following expressions can be derived for the probabilities of the four consecutive sensing slots with a signal absence in previous to last position in (30): where the subscripts x and y denote that any value may be detected, i.e., x, y ∈ {0, 1}.
Considering that decisions on ED in distinct slots are independent CED problems and using (31), we can rewrite (30) in terms of the FAP of CED as shown in (15).
Similarly, the CDP for 4-slot ED can be determined from: where for B ≥ 3, as in (31), the probabilities of the four consecutive sensing slots with a signal presence in previous to last position: Noting again that decisions on ED in distinct slots are considered independent CED problems and using (33), we can rewrite (32) in terms of the FAP and CDP for CED as shown in (16).

APPENDIX B 5-SLOT ED
To extend the 4-slot ED to 5-slots the next ED test is added in slot i + 2 as shown in Fig. 1 to the four tests performed in slots i, i − 1, i + 1, and i − 2, and following the same procedure as before the FAP for 5-slot ED is given by: For B ≥ 3 and T − B ≥ 2, the following expressions can be derived for the probabilities of the five consecutive sensing slots with a signal absence in the middle position in (34): where the subscripts x, y and z denote that any value may be detected, i.e., x, y, z ∈ {0, 1}.
Considering that each energy detection event is an independent CED problem and using (35), we can rewrite (34) in terms of the FAP and CDP for CED as shown in (17).
For B ≥ 3, as in (35), the probabilities of the five consecutive sensing slots with a signal presence in the middle position are given by: Similar to the 4-slot ED case, the CDP for 5-slot ED can be expressed as shown in (37).