Energy Detector with Baseband Sampling for Cognitive Radio : Real-Time Implementation

Cognitive radio (CR) is a technology that provides a promising new way to improve the efficiency of the use of the electromagnetic spectrum that available. Spectrum sensing helps in the detection of spectrum holes (unused channels of the band), and instantly move into vacant channels while avoiding occupied ones. An energy detector with baseband sampling for CR is presented with mathematical analyses for an additive white Gaussian noise (AWGN) channel. A brief overview of the energy detection based spectrum sensing for CR technology is introduced. Practical implementation issues on Texas Instruments TMS320C6713 floating point DSP board are presented. Novelties of this work came from a derivation of probability of detection and probability of false alarm for the baseband energy detector without including the sampling theorems and the associated approximation.


Introduction
The limited available spectrum and inefficiency in the use of the spectrum makes it necessary to establish the new communication model to benefit from the existing wireless spectrum professionally.
Mitola proposed a solution to the spectrum efficiency problem [1], where higher spectrum efficiency can be reached by dynamic spectrum access [2,3].The concept of cognitive radio (CR) allows detecting the unused spectrum (spectrum holes) of the primary user (PU) in order for the secondary user (SU) to share the spectrum without harmful interference.The accuracy of detection is the most important factor that determines the performance of the CR.Since the concept of CR is still at the stage of being developed, there is no agreement on what kind of wireless technologies to employ for realizing it.Currently, there are three different techniques which are commonly used in signal processing techniques for spectrum sensing [4]: matched filter, cyclostationary feature detection and energy detection.
In [5], the matched filter also referred to as coherent detector, it can improve detection performance if the primary transmitted signal is deterministic and known a priori.This technique can be applied only when we choose to detect specific signals, and it is very accurate since it maximizes the SNR for the signal.
In [6,7], a signal is said to be cyclostationary if its mean and autocorrelation are a periodic function.Com-munication signals may have special statistical features.Feature detection denotes to extracting features from the received signal and performing the detection based on the extracted features.Cyclostationary feature detection can distinguish PU signal from noise, and used at very low signal to noise ratio (SNR) detection by using the information embedded in the PU signal that is not presented in the noise.The main drawback of this method is the complexity of calculation.Also, it must deal with all the frequencies in order to generate the spectral correlation function, which makes it a very large calculation.The benefit of feature detection compared to energy detection is that it typically allows differences among dissimilar signals or waveforms.
Energy detection (also denoted as noncoherent detection), is the signal detection mechanism using an energy detector (also known as radiometer) to specify the presence or absence of signal in the band.The most often used approaches in the energy detection are based on the Neyman-Pearson (NP) lemma.The NP detection criterion enlarges the probability of detection for a given probability of false alarm It is an essential and a common approach to spectrum sensing since it has moderate computational complexities, and can be implemented in both time domain and frequency domain [8,9].In [10], to adjust the threshold of detection, energy detector requires knowledge of the power of noise in the band to be sensed.The signal is detected by comparing the output of energy detector with threshold which depends on the noise floor.
The TMS320C6713 kit was chosen as it provides a properly low cost access into the real-time implementation of energy detection algorithms.This DSP card has the following features: It evaluates 1350 million floating point operations per second (MIPS), a processor running at 225 MHz, programmed by C and assembly languages.
The paper is organized as follows: Section 2 describes detection techniques.Section 3 lists the main issues of previous works.Section 4 presents the baseband energy detector model.Section 5 drives probability equations for baseband energy detector over AWGN Channel.Section 6 describes how to generate noisy PU signal.Section 7 implemented using a DSP kit.Discussed in Section 8 presented.Finally, in Section 9 the conclusions are mentioned .

Detection Techniques
Fundamental to the theory of detecting the signal in noise is the theory of statistical decision, where the decision-making depends on the hypothesis testing.In binary hypothesis testing, the problem resides in defining a decision rule that indicates which of two hypotheses should be chosen: the null hypothesis ( 0 H ) or the alternative hypothesis ( 1H ).If the null and alternative hypotheses are defined in terms of signal(s), hypothesis 0 H (signal absent) and hypothesis 1 H (signal present).In [11], the decision rule can be represented as where  is the threshold and

 
Λ y is a function that depends on the measurements.If it exceeds the threshold, then 1 H is selected; otherwise, 0 H is decided.The aim of the detection theory is, hence, to design the most effective detector by definition   Λ y and In [12], define two main approaches to test the hypothesis: NP and Bayesian.The method used depends on our readiness to merge previous knowledge about the probability of a different hypothesis.If we were able to assign prior probabilities to hypotheses, we can use the approach of Bayesian.However, in most detection problems we cannot say how probable an event is and we have used the NP approach instead.

Bayes Test
The aim of the Bayes test is to minimize the mean cost or "risk", whose expression can be evaluated as [13]         the probability  ,

H H P H P H P y H P H P y H P H
Also, when     0

Neyman-Pearson Test
In [12], the NP test follows a different philosophy than that of the Bayes test.The NP test can be expressed in terms of the LRT as where  is the Lagrange multiplier and equals to value of detector threshold. is chosen to satisfy the constraint where fa as defined as the type I error or probability of false alarm, which is the probability that the LRT is larger than the threshold when the observation is composed entirely of noise, is the probability that the likelihood ratio is larger than the threshold when the observation is composed of the signal of interest and noise.
If the signal under hypothesis 0 H is assumed to be , and under 1 H is assumed to be taking logarithm, and removing all constants that are independent of vector , and merging with threshold, we obtain Hence, the optimal detector, in the NP sense, is in this case the energy detector.
A test of the hypotheses which is optimal in the NP and Bayes test can be expressed as

Previous Works
Energy detector has been widely used for signal detection due to its simple circuit in practical implementation.
The most important preliminary work for the general analysis of energy detector was presented in the landmark paper [10], the authors proposed the model as shown in Figure 1.
In [10], his classic work was based on detection of a deterministic signal in an additive white Gaussian noise (AWGN), and exact noise variance is known a priori.The input signal is first passed through an ideal bandpass filter (BPF) with center frequency ( ) y t 0 f and bandwidth W, with transfer function where 0 is the one-sided noise power spectral density, this normalizes it found convenient to compute the false alarm and detection probabilities using the related transfer function.After that the signal squared, and integrated in the observation interval T to produce a test statistic, is compared to a threshold N , V  .The receiver makes a decision that the target signal has been detected if and only if the threshold is exceeded.
In [14], the received signal   y t of SU under the binary hypotheses testing can be represented as where 0 H represents the hypothesis corresponding to "no signal transmitted", and 1 H to "signal transmitted",

 
x t is the unknown deterministic transmitted signal, and   w t  assumed to be an AWGN with zero mean and variance is known a priori.The SNR is denoted as By using Shannon's sampling formula, we can obtain the reconstructed noise signal where is the normalized sinc function and is the i-th noise sample.The test statistic under hypothesis 0 H as follows If we take the BPF effect and simplify, the decision rule which is employed by the energy detector can be obtained as The same approach can be applied under hypothesis 1 H when the signal   x t is presented, by replacing each by  where The test statistic for both cases can be expressed as where chi-square distribution with the degree of freedom (DOF), and In [15], present several classical models of energy detector, which can be used to evaluate the energy detector performance instead of using the accurate results.These models are easily available for theoretical analysis when one takes advantage of the energy detector for spectrum sensing [16].
In [17], Lehtomaki has done a lot of research work in signal detection based on the ideal energy detector.His main goal was to develop energy based detectors.Different possibilities for setting the detection threshold for a quantized total power energy detector are analyzed.
Energy detector has discussed the existence of signals with random amplitude and channel fading in [18] and [14].The average probability of detection over a fading channel also derived.
The improved performance of the energy detector for random signals corrupted by Gaussian noise is derived.The derivation is based on a simple modification to the conventional energy detector in [10,14,18] by replacing the squaring operation of the signal amplitude with an arbitrary positive power operation [19].
In [20], in order to solve both the interference avoidance and the spectrum efficiency problem, an optimal spectrum sensing framework is based on the maximum a posteriori probability (MAP) energy detection and its decision criterion based on the primary user activities.The PU activities can be assumed as a two state birthdeath process, death rate  and birth rate  .Where each transition follows the Poisson arrival process meaning that the length of ON (Busy) and OFF (Idle) intervals of primary network are exponentially distributed.We can estimate the a posteriori probability as fol- on off where on is the probability of the period used by primary users and off is the probability of the idle period.
From the definition of MAP detection, the detection probability d and false alarm probability can be expressed as follows 0 fa off where  is a decision threshold of MAP detection.

Baseband Energy Detector Model
In practical implementation of the energy detector, transmission and sensing cannot be performed at the same time.Thus, during observation time, all CR users should stop their transmissions.Due to this hardware constraint, CR users should sense the spectrum cyclically with sensing period s T and transmission time , as described in Figure 2. r T A large number of signal processing applications function in real-time systems.Because most signal processing is nowdays implemented with DSP methods, it is suitable for understanding EDs as discrete time (DT) systems.The input signal of the DT system is denoted by a sequence as where x nT is analogue continuous time signal that is sampled in order to produce the DT signal   x n , the time index n is an integer, and sa is the sampling interval, which is reciprocal to the sampling frequency and is given by A system model of energy detector with baseband sampling for CR can be shown in Figure 3.
In order to measure the energy of the received signal, the output signal of codec is squared and integrated over Senting Time:Ts  the sensing interval s T .The sensing interval s T is usually assumed to be small enough so that the PU signal can span over the whole sensing interval.According to the Nyquist sampling theorem, the minimum sampling rate should be sa 2  F W  , where W is the highest frequency of the original signal, hence, the minimum sample size N collected by the energy detector can be represented as 2  .In real-time equal to sampling frequency TW 2W sa F of the DSP card, hence as sensing time s T is chosen such that N is an integer

Baseband Energy Detector over AWGN Channel
In a binary hypothesis test, the received signal after codec can be given as where N denotes the number of samples collected during the signal sensing period.The test statistic for the energy detector with predetermined threshold  is defined as When the received signal contains the noise only under 0 H hypothesis, the test statistic can be written as: Since V is a square sum of N AWGN with zero mean, , thus the distribution of the test statistic is a chi-square with N degrees of freedom (DOF) ~N V  [21], can be evaluated as follows where 2 k N  , is an integer, is the gamma function, which is defined as From the definition of false alarm probability, the CR decides in favor of 1 H while the band is idle, thus, the false alarm probability can be expressed as To solve this equation, we must apply some variable (incomplete gamma functionis given by [22] , therefore (35) becomes In [23, Equation (2.5), p. 24], the incomplete gamma function can be expressed as based on (37), can be evaluated as The same approach is applied when the signal of PU,

 
x n is presented hence, the test statistic under hy- We can observe that V consists of two terms: a fixed (non-random) component   x n and a noise component

 
w n obey the Gaussian distribution.More specifically, V is a noncentral chi-square distribution with non-central parameter in particular, the PDFs of V under 1 H hypothesis takes the form [21]   where n I is the n order modified Bessel function.The probability of detection is The d can be expressed in term of the generalized Marcum Q-function, which is defined as [21] Where m is a nonnegative integer, and  and  are nonnegative real numbers.If we change variable of integration (41), v to x, where the Marcum Q-function is difficult to calculate or to take its inverse, thus, we can use the central limit theorem (CLT), for the large number of sample, we can use the Gaussian distribution to approximate the chi-square distribution, under 0 100, k  200, N  H hypothesis, and non-central chi-square distribution, under 1 H hypothesis, thus, the CLT can therefore be employed to approximate the test statistic as Gaussian If only AWGN is considered, fa and d of energy detector can be derived in terms of the Q function as follows where the [22].The decision threshold  is determined by the pdf of the noise only signal, thus, by using (44), we get where denote the inverse Q-function [22].In [20], fa should be kept as small and d should be large as possible to avoid underutilization of transmission opportunities.Note that from (45) and (47), the fa and P P  can be set even without the knowledge of the signal power.The curve represents the performance of the energy detector, which is called the receiver operating curve (ROC), for a given  pair of fa and d representing the point in the ROC.We can plot another curve give an energy detector performance, for a given fa it's convenient to display the d with  .In addition to using the ROC curve for performance comparison, one can also resort to the so-called deflection coefficient [12], especially when the statistical properties of the signal and noise are limited to moments up to a given order.The deflection coefficient is defined as

Generating Received Signal
The energy detection is used when the CR knows the signal of PU (deterministic) or their probabilities (random).It requires a good model of PU signal and noise is accurately known.
In the process of implementing an energy detector with DSP processor, often we are stymied by the problem of getting a received noisy signal with required amount of SNR i.e. under 1 H .To obtain an expression for receiving signals, the PU signal is modeled as being deterministic, by definition of SNR, the variance of signal is Thus, All we have to do is to scale the signal   x n appropriately, the received signal expressed as Also PU signal can be modeled as being random, the received signal takes the form of a zero mean Gaussian process with known variance   s n    Most methods for generating white Gaussian noise are based on transformations or operations on white uniform noise.There are several algorithms to generate white uniform noise which is generated by generating a pseudo random number.In this paper, we focus on a particular class of generators suitable for real-time applications.Making choices among generators requires specific crite-ria.We used two criteria to choose a good generator, are the length of the generation as well as the short implementation period to fit with the real-time environment.
The most widely used techniques for generating pseudo random number have approximately uniform distribution.Such generators, introduced by D. H. Lehmer in 1951, which is known as the linear congruential method [24]   c is an additive constant , The case of is called a mixed-congruential generator while is referred to as a multiplicative-congruential generator., ,  m a c x are integers, then this technique will produce a sequence of integers with each integer in the range 0≤x n <m.
In [25], many versions of linear congruential generators set the constant c to zero.The resulting multiplicative congruential generator is Park and Miller give suitable choices for and , this yields a full period generator.The Park Miller generator was implemented using David G. Carta's optimization which needs only 32 bit integer math, and no division.The last two algorithms generating white uniform noise zero mean and variance equal to 1/12.
In this implementation, we present white Gaussian noise generator based on the CLT (Sum-of-uniforms) method.Therefore, approximation of a white Gaussian noise with zero mean and unit variance, can be gained by realizing the sum of 12 uniform random variables.

Implementation of Energy Detector on TMS320C6713
A PU transmitter and SU receiver for CR is implemented on a C6713 DSP board.Figure 4 shows the equipment used in this paper.From (45-47), the energy detector is strongly depending on knowledge of noise power.Thus, accurate estimation of noise power plays an important role in performance of energy detector.We proposed the auxiliary energy detector connected to primary energy detector, which can be used for the detection process of noise power, give an accurate detection as noise power changes.We determined the DSP card cycle numbers of the two algorithms evaluation units to be 392 and 279 respectively, due to this constraint, we are able to fit the algorithm 2 into the signal used under 0 H . Figure 5 shows the time domain plot of white Gaussian noise signal with zero mean and unit variance.
Two scenarios for signal under 1 H can be implemented, in (51)   x n isa (deterministic) sinusoid signal generated using eight points a table lookup method as in  (54) as as in Figure 7.
we take the F sa at four different values 8, 16, 32 and 96 kHz and and its number of samples 80, 160, 320 and 960 respectively.From the figure it is observed that the detection performance improved by increasing SNR and with increase samples point i.e. sampling frequency.To ensure that the fa is accurately estimated, we will compare the theoretical value and the implementation results.The is calculated using the following formula [26] P fa P Since we set the fa , this is to say that we observe test statistic under hypothesis 1 H for 100 times to yield 99 realizations of detections in theory.We change SNR from -20 dB to 0, and repeat the 100 observations for each to calculate the number of detections.figure shows when SNR is between -3 dB and 0, the fa = 0.01, 0.0 and 0 which are almost the same and confirm the estimated we used.Thus, it can be concluded when SNR between -3 dB to 0, the energy detector can offer significant detections.

Discussion
The energy detector of 100 observations is implemented, the d and fa are calculated.fa is different from the estimated value.The SNR plays an important factor that influences the detections.By changing the value of the SNR from -20 to 0 dB, we get the relationship between the SNR and the detections Figure 9, from that figure, we can see from -3 dB to 0, the energy detector gives best performance.We also calculate the relation between SNR and as, as shown in Figure 10.

Conclusion
The energy detection is worldwide in the sense that it can detect any type of signal, and does not need any knowledge about the signal to be detected.Moreover, the noise power needs to be known to set the determination threshold.The main advantages of energy detection based spectrum sensing are its simplicity, low computational and implementation costs as well as its ability to work regardless of the actual signal to be detected.In the present work, without involving the sampling theorems and the accompanying approximation, we derive the expressions for probability of detection and false alarm over AWGN.Therefore, the calculation is progressively precise.Also, the performance of the energy detector in real-time is analyzed.

Figure 1 .
Figure 1.Classical model of energy detector.


variance of signal and 2 n  variance of noise.

Figure 2 .
Figure 2. Sensing and transmission structure for energy detector.

Figure 3 .
Figure 3. Energy detector with baseband sampling using a DSP kit.
40) Copyright © 2012 SciRes.WET Energy Detector with Baseband Sampling for Cognitive Radio: Real-Time Implementation 234

Figure 4 .
Figure 4.The TMS320C6713 and the equipment.

Figure 6 .
Figure 6.Time domain and FFT of 10 kHz signal at 5 dB SNR.

Figure 8 Figure 10 Figure 9 PFigure 7 .
Figure 10 illustrates the values of which are calculated for different values of SNRs at fa P