You are on page 1of 5

Efcient FPGA-based Implementation of a Novel

Dual Mode Spectrum Sensing Technique


Ahmed Badawy

Tamer Khattab

Electrical Engineering Dept.


Qatar University
Doha, Qatar 2713
Email: badawy@qu.edu.qa

Electrical Engineering Dept.


Qatar University
Doha, Qatar 2713
Email: tkhattab@qu.edu.qa

AbstractCognitive radio networks require an efcient and


reliable method of sensing the spectrum. In this paper, we
introduce and implement a new dual mode spectrum sensing
technique that is based on combining Quickest Detection with
Energy Detection. Our dual mode system introduces a compromise between speed and complexity. When the SNR goes
below the SNR wall for the low complexity energy detection, our
system switches to the more expensive quickest detection based
algorithm. A practical prototype of our system is implemented
on the WARP FPGA-based nodes to study its efciency and
complexity. In addition to practical experimental results, we
derive theoretical closed form expressions for the probability of
false alarm and the probability of detection for our new approach.
We also numerically compute the SNR wall for our quickest
detection based technique.
Keywordsspectrum sensing, quickest detection, energy detection, FPGA implementation, dual mode system.

I.

I NTRODUCTION

Deployment of different wireless communications systems


is rapidly growing. Consequently, the urge for designated bandwidths for the services supported by these systems is increasing
as well [1]. On the other hand, it is well known that the
spectrum is a scarce resource. The classic way of assigning the
spectrum is that service providers acquire exclusive licenses for
designated frequency bands and bandwidth. Cognitive radio
networks introduce the idea of dynamic spectrum allocation.
They allow for higher spectrum efciency through dynamically
assigning the spectrum access [2]. In cognitive radio networks,
secondary user (SU) access the spectrum whenever the primary
user (PU) is not using it. Therefore, reliable spectrum sensing
is the core for any cognitive radio network.
Several methods had been developed over the years to
sense the spectrum and different detectors have been implemented. The quality of the detector mainly depends on how
much information the SU knows about the PU signal. The
performance of the detector is evaluated using the receiver
operating characteristic (ROC) curves. Higher probability of
false alarm implies more interference with the PU signal while
lower probability of detection implies less utilization efciency
of empty spectrum slots. The SUs goal is then to achieve the
highest possible probability of detection while maintaining the
lowest probability of false alarm. In other words, achieving the
ROC constraints even at low signal to noise ratio (SNR) levels.
The optimum detector that provides the highest SNR is the
matched lter detector which requires a prior full knowledge



of the PUs transmitted signal [3]. This eventually leads to the


need for a designated receiver for each PUs signal. A simpler
approach to spectrum sensing is to perform non coherent
detection through energy detection (ED). Energy detectors
are easy to implement and best suited for a quick decision.
The measured energy is compared to a certain threshold to
decide whether or not the PU signal is present. The main
drawback is that the performance of detectors based on ED is
highly susceptible to varying background noise and interference levels. The fundamentals of ED were rst presented in the
classic paper by Urkowitz in 1967 [4]. A more sophisticated
technique that requires some information about the PUs signal
and can be used to detect random signals is cyclo-stationary
detection. Cyclo-stationary detectors take advantage of the
spectral redundancy or distinguished pattern of signals to
determine whether or not they are present. The fundamentals
of cyclo-stationary detection were presented in [5][7].
There are different approaches for signal detection which
are based on probabilistic models, one of which is maximum
likelihood ratio test (MLRT). MLRT is a measure of how
likely the data follow one probability model than the other.
If all the distribution parameters are known, the test is MLRT.
Otherwise the test is considered a general likelihood ratio test
(GLRT) [3] and [8][10], which we consider in our paper.
GLRT compares the best model under the rst hypothesis
to the best model under the second. Several GLRT based
approaches are introduced in [11][15] where all of them are
based on evaluating the sample covariance matrix as well as the
eigenvalue decomposition of the covariance matrix which has
high implementation complexity. In [11], the authors reported
that the optimal detector is a maximum ratio combining when
all the distribution parameters are known. Their simulated
results for the GLRT approach shows that with number of
antennas of 2 and 8 collected samples, to achieve a Pd of 90%
and a probability of false alarm (Pf ) of 10%, an SNR of almost
5 dB is required. The results in [14] are for an unreasonable
number of collected samples of 104 . A comparison between
the GLRT approach and ED, the arithmetic to geometric mean
(AGM) and maximum to minimum eigenvalue (MME) is
presented in [15]. The GLRT approach showed superior results
over the aforementioned approaches.
Our dual mode system compromises speed and complexity.
It can operate at low SNR yet does not require a long
processing time. Our study is based on both implementation
and simulation results as well as derivation of main theoretical

*&&&

aspects. The rest of this paper is organized as follows: in


Section II we introduce our quickest detection algorithm. The
FPGA implementation of our algorithm is then presented in
section III. We investigate the SNR wall for our quickest
detection algorithm vs. the SNR wall for the conventional ED
algorithm in section IV. Section V presents our dual mode
system approach. The paper is then concluded in section VI.

Quickest Detection Algorithm, Different Approaches

120
Known P
Unknown P, known k
Unknown P, unknown k

100
80

gt

60

II.

40

Q UICKEST D ETECTION A LGORITHM

As the SU is listening to a specic frequency band, it


starts to collect samples y[i]. If the PU is not using this
frequency band, y[i] = w[i], where w[i] is white Gaussian
noise with variance 2 . 2 is receiver dependant and can be
estimated on average ahead of time. If the PU is transmitting,
y[i] = x[i] + w[i], where x[i] = gs[i] is the product of the
channel gain g and the PUs signal s[i]. x[i] is assumed to
be white and Gaussian with zero mean and variance P . The
value of P depends on the channel gain and the power of
the PU signal. When the PU signal is present, y[i] follows
N (0, 2 +P ). When there exists an empty frequency band, y[i]
follows N (0, 2 ) . When using the ED approach, the problem
is treated as a classical hypothesis test where n received
samples are processed and based on that, the decision is made.
The two hypotheses we have are:
H0 : y[i] = w[i]
H1 : y[i] = x[i] + w[i]

i = 0, 1, ..., 1
i = , 1, ..., N

(1)

When using the GLRT detection approach, the problem


is treated here as a sequential change detection where the
received samples are processed sequentially and the decision
is made after each sample. At rst, the collected samples
by the SU follow distribution F0 with density function f0 .
As the PU starts using the frequency band, the distribution
changes to F1 with density f1 . The scenario we investigate
is when 2 is known on average and P is within a range
Pmin < P < Pmax . When all the distributions parameters are
known, the log-likelihood ratio is estimated for each sample
sequentially:


f1 (y[i])
l(y[i]) = ln
(2)
f0 (y[i])


2
1
P y 2 [i]
+ ln
=
2
2
2(P + )
2
P + 2
On the other hand, the GLRT is given by [9]:

 N
 f1,P (y[i])
(3)
gN = max sup ln
kN P
f0 (y[i])
i=k+1



N

2
P y 2 [i]
1
= max sup
+ ln
kN P
2(P + 2 ) 2
2
P + 2
i=k+1

for a given k and N , let


P y 2 [i]
1
f (P ) =
+ (N k) ln
2
2
2(P + )
2

2
P + 2


(4)

To estimate the sup in (3), one has to solve for the P value
that maximizes f (P ) over the given P region. The authors
dened k as the sample where l(y) shows a consistent positive



20
0
20
0

50

100
Time (samples)

150

200

Fig. 1: Simulation results for the two approaches, known and


unknown k and compared to the known P case. The PU enters
the band at the 100th sample.
drift after. In order to apply the GLRT, one has to know both k
and N ahead of time, as stated by the authors. Its legitimate
to assume a prior knowledge of N since it can be assumed
that the received samples will be processed sequentially in
chunks of N samples. But, in implementation, k can not be
known ahead of time since its the sample when the detection
algorithm starts to act which implies the entrance of the PU
signal. Rather, we nd P for unknown k as:

2
y

(N i) Pmax

+ 2 ,
Pmax ,
2
y
2
y
2
y
2

(N

i) Pmin
P =
N i
Pmax + 2
+ 2 ,

2
y
Pmin ,
(N i) Pmin +2 ,
(5)
N
where y = i=1 y 2 [i]. A simulation result for our method is
shown in Fig.1. Its shown that the simulation results for our
approach is in agreement with the known k approach. Since the
algorithm is applied sequentially, a declaration of the existence
of the PUs signal can be done after any sample inside the N
samples. In other words, we do not have to wait until the
end of the N samples to declare the existence of the PUs
signal in case it happened during any of the N samples. After
the end of the N samples or the declaration of the existence
of the PUs signal, gi+1 is reset to zero. In other words, our
quickest detection algorithm reduces to the cumulative sum test
where the estimation of the decision statistic gi+1 is executed
recursively through:

gi+1

=
=

max max
it

N +1



l(y[i])


+ l(y[i + 1]), 0

i=1

max {gi + l(y[i + 1]), 0}

(6)

We derive a closed form expression for our new decision


statistic gi+1 as follows. gi+1 for the rst sample or the sample
after the reset to zero is equal to l(y[i]) :
l(y[i]) = k1 y 2 [i] + k2
where k1 =

P
2(P + 2 ) 2

and k2 =

1
2

(7)

P
ln P +
2 , which with some

mathematical manipulation, its Pf and Pd can be given by:


=

Pf

P r {l(y[i]) > h | H0 }
 
C
1 2Q

(8)
(9)


2
where C = hk
k1 . Likewise, the probability of detection can
be given by:


C
Pd = 1 2Q
(10)
P + 2
If l(y[i]) > 0, gi+1 in (6)
gi+1

max {l(y[i]) + l(y[i + 1]), 0}

(11)

which its Pf after some manipulations can be written as:





(12)
Pf = P r k1 y 2 [i] + k11 y 2 [i + 1] > hn |H0
where hn = hk2 k22 . (12) is a weighted sum of chi-square
random variables. Several methods were developed to obtain
a closed form expression as well as numerically estimate the
characteristic function of the distribution of a weighted sum
of chi-square random variables such as [16][19]. Our closed
form expression is based on a very good approximation for
the distribution function given in [20]:
Pf = P r {gi+1 > hn |H0 } = 1

incorporated with the WARP core les, it was simulated using


SIMULINKs Gaussian source as the input and the output was
plotted on a scope. The simulation results were in agreement
with the simulated MATLAB results above, only 32 samples
delayed.
Our design consists of several blocks. We rst compute
the square of the received signal. The output of this block
can be used to estimate the decision statistic for the ED
approach as well. We then estimate the value of P in the P
Estimation block by implementing equation (5). The GLRT
is then computed recursively in the Likelihood Ratio Calc
block by implementing equation (6).
A comparison of the resources used in ED and quickest
detection algorithm is shown in Table. I, as was taken from
our System Generator design to be downloaded to the FPGA
on the WARP nodes. Its shown clearly that the energy detector
consumes much less resources than our quickest detection
algorithm.
TABLE I: Resources Table

2
FXv+2j
(hn )P r[J = j]

Resources

Energy detection

Slices

985

6848

Flip ops

1471

10184

LUTs

1327

9532

Multipliers

IV.

Quickest detection

SNR WALL F OR QD VS . ED

j=0

(13)
where v = v1 + v2 is the summation of the degrees of freedom
and J = J1 + J2 and the the probability mass function of J
can be estimated as a twofold convolution of the corresponding
mass function of N B(i , i ), where i = (ki 1)/ki and
i = vi /2. Likewise the probability of detection can be written
as:


2
FXv+2j
(hn )P r[J = j].
(14)
Pd = 1
j=0

III.

FPGA I MPLEMENTATION OF O UR N EW S YSTEM

We introduce an implementation of our quickest detection


algorithm on a Field-Programmable Gate Array (FPGA). The
design is implemented on the WARP kits [21]. We use two
WARP nodes, one is set as the transmitter and the second
as the receiver. Our design is implemented on the receiver
nodes FPGA for online processing. The FPGA on each node
is Xilinx Virtex-4 FX100. Each WARP node has two RF
daughter cards that operate as a transceiver in the WiFi band.
Our design presented in Fig.2 is carried out in ISE System
Generator for DSP. The design is then incorporated with the
WARP core les using Xilinx Platform Studio (XPS) and
Xilinx Software Development Kit (SDK). After successful
generation of the bit stream le, its downloaded to the FPGA
using iMPACT. Our design is represented in the Fix 16 15
format. Our design has a series combination of two bit-division
procedures. The minimum achievable sample delay for each
bit-division calculation is the number of the bits divided, which
in our case is 16 bits. This means that an excess delay of 32
samples is added to the algorithm detection time. Our design
is for the unknown P unknown k case. Before the design is

When using the ED algorithm, the decision statistic


TED (y) can be given by:
TED (y) =

N

i=1

H1

y 2 [i]

(15)

H0

where is the threshold. Under H0 , TED (y) follows a central


chi-square distribution with 2u degrees of freedom, where
u = T W is the time bandwidth product. Under H1 , TED (y)
follows a non-central chi-square distribution with 2u degrees
of freedom and non-centrality parameter , where is the
SNR. The Pf and Pd for a given threshold are then given
by:
Pf

=
=

Pd

=
=

Pr (TED (y) > |H0 )


(u, 2 )
(u)
Pr (TED (y) > |H1 )


Qu ( 2, )

(16)

(17)

According to the central limit theorm, as N increases, TED (y)


follows a Gaussian distribution. The SNR wall for the ED
is presented in [22]. The number of samples (sensing time)
required for a reliable ED estimation if the noise variance is
completely known is given by:

2
N = 2 Q1 (Pf ) Q1 (Pd )(1 + SN R) SN R2 (18)
In real implementation, one should consider uncertainty in
the noise model. In other words, the noise variance lies in
a region 2 [(1/)n2 , n2 ], where n2 is the nominal noise



Fig. 2: FPGA design for our quickest detection design


ROC Curves for SNR = 0 dB for different number of samples

ROC Curves for SNR = 3 dB for different number of samples


1

0.9

0.9
0.8

Probability of detection

Probability of detection

0.8
0.7
0.6
0.5
0.4

0.7
0.6
0.5
0.4
0.3

0.3

u=4
u=8
u = 128

0.2
u=1
u=2
u=4

0.2
0.1

0.1
0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Fig. 3: Implementation results for the energy detection method


for SNR = 3 dB for different number of collected samples.
variance and > 1 is a parameter that quanties the size of
the uncertainty. This yields the SNR wall for the ED as:
2 1
=

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Probability of false alarm

Probability of false alarm

energy
SN Rwall

Fig. 4: Implementation results for the energy detection method


for SNR = 0 dB for different number of collected samples.
can infer that as the number of samples increases, the ROC
curves improve.
Probability of Detection vs. Number of Samples for Different SNR Values
1

(19)

Fig. 3 shows the ROC curves for the implementation results


for the ED algorithm for SN R = 3dB for different number of
collected samples (2, 4, and 8). Its shown that for an SN R =
3dB, using a total of 8 samples, the technique provides a Pd =
0.98 for Pf = 0.1, which is excellent. But when the SNR is
dropped to zero as shown in Fig. 4, the algorithm fails to
achieve a decent Pd for a given Pf = 0.1. Its shown that
increasing the sensing time to 256 samples did not even solve
the problem. We simulate our quickest detection algorithm for
the P range of P/2 < P < 2P . Fig. 5 shows that the SNR
wall for our quickest detection algorithm is 6 dB. Its shown
that with number of samples of 256, we were to achieve almost
Pd = 90% for Pf = 10% at SNR = 6dB. At medium and
low level SNR (< 3dB), our quickest detection algorithm has
a superior performance over the ED algorithm. For example
for SNR = 0dB, our quickest detection algorithm requires and
average of 50 sample to achieve Pd = 90% for Pf = 10%.
Unlike the ED algorithm that required much more samples yet
achieved much lower Pd at this SNR level. The ROC curves
for our quickest detection algorithm is presented in Fig. 6. One

0.9

Probability of detection Pd

0.8
0.7
0.6
0.5
0.4
0.3

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0.1

50

100

150

200

250

300

Number of samples

Fig. 5: Our quickest detection algorithm: Pd vs. number of


samples for different SNR values for Pf = 10%.
V.

O UR D UAL M ODE SYSTEM T ECHNIQUE

Our dual mode system compromises speed and complexity.


It can operate at low SNR yet does not require a long
processing time. Our new approach is SNR based; the SU
uses the quick and easy ED method as long as the received
SNR is above the SNR wall for the ED which is from our



laboratory measurements on the WARP kit is 3dB. Once the


received SNR goes lower than the SNR wall for the ED
(3dB), the SU uses our quickest detection algorithm to make
the decision since the SNR wall for our quickest detection
technique is 6dB, as we obtained from our simulation results.
Our approach increases the dynamic range of the system by
9dB.
At high level SNR (> 3dB), the ED algorithm performs
better than our quickest detection algorithm. Not only it is
much easier to implement but also it requires less samples to
achieve a decent Pd . For example for SNR = 3dB, the ED
algorithm needed 8 samples to achieve Pd = 98%. Unlike the
quickest detection algorithm that required an average of 50
samples to achieve same Pd . So, at SN R > 3dB, the energy
detection algorithm is used since it exhausts way less resources
and less required number of samples. When the SN R < 3dB,
we switch to the more expensive quickest detection algorithm.

that an excess of 32 samples are required as processing cost


to implement our quickest detection algorithm.
ACKNOWLEDGMENT
This work was supported by the Qatar National Research
Fund (QNRF) under Grant NPRP 09-1168-2-455.
R EFERENCES
[1]
[2]

[3]
[4]
[5]

N = 8 Samples

N = 16 Samples

0.8

0.8

0.6

0.6

[6]
[7]

Pd

0.4

0.4
SNR = 3 dB
SNR=0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.1

0.2

0.3

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.4

0.1

0.2

0.3

[8]

0.4

N = 32 Samples

[9]

N = 64 Samples

0.8

0.8

0.6

0.6

[10]

Pd

0.4

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.4

0.1

0.2

0.3

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.4

0.1

0.2

0.3

N = 128 Samples

N = 256 Samples

0.8

0.8

0.6

0.6

[12]

[13]

Pd

0.4

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.1

0.2

[11]

0.4

0.3

0.4

0.4

SNR = 3 dB
SNR = 0 dB
SNR = 3 dB
SNR = 6 dB

0.2
0

0.1

Pf

0.2

0.3

0.4

[14]

Pf

Fig. 6: ROC curves for the quickest detection algorithm for


different number of samples, N = 8, 16, 32, 64, 128 and 256
VI.

C ONCLUSION

Our quickest detection algorithm is a technique that minimizes the sensing time which allows for a higher spectrum
efciency. But, it has a higher implementation complexity
than the conventional ED approach. We rst derived a closed
form expression for the probability of false alarm as well
the probability of detection for our our quickest detection
algorithm. We then numerically computed its SNR wall. We
then presented a new technique that compromises speed and
complexity based on FPGA implementation results. Our dual
mode spectrum sensing system uses ED as long as the SNR is
higher than the EDs SNR wall, which in our case is 3dB.
Once the received SNR is dropped below the EDs SNR
wall, our technique automatically switches to the quickest
detection algorithm that can operate efciently all the way to
SN R = 6dB. We also found out from our FPGA design,

[15]

[16]
[17]

[18]

[19]

[20]

[21]
[22]



FCC, Spectrum policy task force, vol. ET Docket No., no. 02-135,
Nov, 2002.
S. Haykin, Cognitive radio: brain-empowered wireless communications, Selected Areas in Communications, IEEE Journal on, vol. 23,
no. 2, pp. 201220, 2005.
S. M. Kay, Fundamentals of Statistical Signal Processing: Detection
Theory. Englewood Clifs, NJ: Prentice Hall, 1998.
H. Urkowitz, Energy detection of unknown deterministic signals,
Proceedings of the IEEE, vol. 55, no. 4, pp. 523 531, april 1967.
W. Gardner, Signal interception: a unifying theoretical framework for
feature detection, Communications, IEEE Transactions on, vol. 36,
no. 8, pp. 897 906, aug 1988.
, Exploitation of spectral redundancy in cyclostationary signals,
Signal Processing Magazine, IEEE, vol. 8, no. 2, pp. 14 36, april 1991.
W. Gardner and C. Spooner, Signal interception: performance advantages of cyclic-feature detectors, Communications, IEEE Transactions
on, vol. 40, no. 1, pp. 149 159, jan 1992.
H. V. Poor and O. Hadjiliadis, Quickest Detection.
Cambridge
University Press, 2008.
L. Lai, Y. Fan, and H. Poor, Quickest detection in cognitive radio: A
sequential change detection framework, in Global Telecommunications
Conference, 2008. IEEE GLOBECOM 2008. IEEE, 2008, pp. 15.
L. Lai, H. Poor, Y. Xin, and G. Georgiadis, Quickest search over multiple sequences, Information Theory, IEEE Transactions on, vol. 57,
no. 8, pp. 53755386, 2011.
A. Taherpour, M. Nasiri-Kenari, and S. Gazor, Multiple antenna
spectrum sensing in cognitive radios, Wireless Communications, IEEE
Transactions on, vol. 9, no. 2, pp. 814823, 2010.
E. Axell and E. Larsson, Comments on multiple antenna spectrum
sensing in cognitive radios, Wireless Communications, IEEE Transactions on, vol. 10, no. 5, pp. 16781680, 2011.
E. Soltanmohammadi, M. Orooji, and M. Naraghi-Pour, Spectrum
sensing over mimo channels using generalized likelihood ratio tests,
Signal Processing Letters, IEEE, vol. 20, no. 5, pp. 439442, 2013.
R. Zhang, T. J. Lim, Y.-C. Liang, and Y. Zeng, Multi-antenna based
spectrum sensing for cognitive radios: A glrt approach, Communications, IEEE Transactions on, vol. 58, no. 1, pp. 8488, 2010.
P. Wang, J. Fang, N. Han, and H. Li, Multiantenna-assisted spectrum
sensing for cognitive radio, Vehicular Technology, IEEE Transactions
on, vol. 59, no. 4, pp. 17911800, 2010.
J. P. IMHOF, Computing the distribution of quadratic forms in normal
variables, Biometrika, vol. 48, no. 3-4, pp. 419426, 1961.
M. Yilmaz, Edgeworth series approximation for chi-square type chance
constraints, Communications Series A1 Mathematics & Statistics,
vol. 56, no. 2, pp. 2737, 2007.
H. Liu, Y. Tang, and H. H. Zhang, A new chi-square approximation to
the distribution of non-negative denite quadratic forms in non-central
normal variables, Computational Statistics & Data Analysis, vol. 53,
no. 4, pp. 853 856, 2009.
P. Moschopoulos and W. Canada, The distribution function of a
linear combination of chi-squares, Computers & Mathematics with
Applications, vol. 10, no. 45, pp. 383 386, 1984.
S. D. Oman and S. Zacks, A mixture approximation to the distribution
of a weighted sum of chi-squared variables, Journal of Statistical
Computation and Simulation, vol. 13, no. 3-4, pp. 215224, 1981.
Warp project. [Online]. Available: http://warpproject.org
R. Tandra and A. Sahai, Snr walls for signal detection, Selected Topics
in Signal Processing, IEEE Journal of, vol. 2, no. 1, pp. 417, 2008.

You might also like