Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum...

109
Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos´ e Pinheiro de Almeida Alvarez Dissertation submitted for obtaining the degree of Master in Electrical and Computer Engineering Jury Members President: Prof. Jos´ e Bioucas Dias Supervisor: Prof. Ant´ onio Rodrigues Prof. Jos´ e Sanguino Vowels: Prof. Neeli R. Prasad Prof. Fernando Duarte Nunes December 2011

Transcript of Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum...

Page 1: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Experimental Study on Spectrum Sensing forCognitive Radio Networks

Pedro Jose Pinheiro de Almeida Alvarez

Dissertation submitted for obtaining the degree of

Master in Electrical and Computer Engineering

Jury Members

President: Prof. Jose Bioucas Dias

Supervisor: Prof. Antonio Rodrigues

Prof. Jose Sanguino

Vowels: Prof. Neeli R. Prasad

Prof. Fernando Duarte Nunes

December 2011

Page 2: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

ii

Page 3: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Acknowledgements

I would like to thank my supervisors, Professor Antonio Rodrigues and Professor Jose San-

guino for their guidance and valuable counsel throughout this work.

I would like as well to give my thanks to Eng. Nuno Pratas and Professor Neeli Prasad for

their assistance and access to the facilities used in this work.

I would also like to leave a kind word to my lab partners, namely: Joao Mestre, Andrei Stefan,

Bayu Anggorojati e Oana Barbu for their support and stimulating discussions.

Finally I would like to thank my mother, my father and my sister, for without their love and

support it would have been impossible, for me to be in Denmark and write this dissertation.

iii

Page 4: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

iv

Page 5: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Agradecimentos

Gostaria de agradecer aos meus supervisores, Professor Antonio Rodrigues e Professor Jose

Sanguino pelo o seu apoio, disponibilidade e sabedoria.

Gostaria tambem de agradecer ao Eng. Nuno Pratas e a Professora Neeli Prasad pela sua

ajuda e pelas facilidades disponibilizadas para a realizacao deste trabalho.

Gostaria ainda de dar uma palavra de apreco aos meus colegas de laboratrio, nomeadamente:

Joao Mestre, Andrei Stefan, Bayu Anggorojati e Oana Barbu pelo seu apoio e discussoes

estimulantes.

Por fim, gostaria de agradecer aos meus pais e a minha irma por todo o apoio que me deram

nestes ultimos meses, pois sem a sua ajuda e encorajamento nao me seria possivel realizar

esta tese.

v

Page 6: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

vi

Page 7: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Abstract

Traditionally, spectrum has been allocated in a fixed manner, being all unlicensed users pro-

hibited from transmitting on a licensed band. Recent measurements have shown that this

can lead to spectrum inefficiency, since there are times and places where the spectrum is not

being utilized by the licensed user. For this reason new policies are being investigated that

allow unlicensed devices to access the vacant spectrum.

Cognitive radio is a technology that allows radios to use unused spectrum. To do this without

causing harmful interference, spectrum sensing plays a key role. Various spectrum sensing

techniques have been proposed in the literature to identify vacant spectrum. However since

cognitive radio is a recent technology there are not many experimental studies available.

The objective of this thesis was then to implement and evaluate the performance of various

spectrum sensing techniques. This would allow verifying the validity of theoretical expressions

and the feasibility of the detectors. Also these detectors could then later be used in cognitive

radio networks.

In this thesis an energy detector and an eigenvalue detector were developed. To their de-

velopment, GNU Radio in combination with the Universal Software Radio Peripheral 2 was

used.

The performance of the detectors was evaluated through the measurement of the empirical

cumulative distribution functions, in the presence and absence of signal. Both these results

were compared with theoretical values. Also it was evaluated the evolution of probabilities of

detection with the increase of sensing time and the increase of the signal to noise ratio.

Keywords: Cognitive Radio, Spectrum Sensing, GNU Radio, Eigenvalues, Energy

Detection

vii

Page 8: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

viii

Page 9: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Resumo

Tradicionalmente, espectro e alocado de uma maneira fixa, sendo todos os utilizadores nao

licenciados proibidos de transmitir em bandas licenciadas. No entanto, medidas recentes

mostram que isto causa ineficiencia na utilizacao do espectro, pois existem momentos no

espaco e no tempo em que o espectro nao esta a ser usado pelos utilizadores licenciados,

mas este nao pode ser utilizado por outros utilizadores. Por esta razao novas polıticas de

alocacao de espectro que permitam utilizadores nao licenciados aceder a espectro vago estao

a ser investigadas.

Radio cognitivo e uma tecnologia que permite radios utilizar espectro livre. Para fazer isto

sem causar interferencia o spectrum sensing tem um papel muito importante. Varias tecnicas

de spectrum sensing foram propostas na literatura para identificar espectro livre. No entanto

como radio cognitivo uma tecnologia recente nao existem muitos estudos experimentais.

O objectivo desta tese foi entao implementar e avaliar o desempenho de varias tecnicas de

spectrum sensing. Isto permite verificar a validade das expressoes teoricas e viabilidade dos

detectores.

Nesta tese foram desenvolvidos dois detectores, um detector de energia e um detector de

valores proprios. Para desenvolver os detectores o software GNU Radio foi usado juntamente

com o Universal Software Radio Peripheral 2.

O desempenho dos detectores foi avaliado atraves da medicao das funcoes de distribuicao

cumulativa empıricas, na presenca e ausencia de sinal. Estes resultados foram comparados

com valores teoricos. Foi tambem avaliado a evolucao das probabilidades de deteccao com o

aumento do tempo de observao e o aumento da relacao sinal ruıdo.

Palavras Chave: Radio Cognitivo, Spectrum Sensing, GNU Radio, Valores Proprios,

Detecao de Energia

ix

Page 10: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

x

Page 11: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Contents

Abstract vii

Resumo ix

List of Figures xiv

List of Tables xviii

List of Abbreviations xxii

1 Introduction 1

1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Motivation and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.4 Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Cognitive Radio and Spectrum Sensing 5

2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 White Spaces Identification Methods . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Non-Cooperative Spectrum Sensing . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 Detection Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.2 Energy Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.3.3 Matched Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.3.4 Cyclostationary Detectors . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3.5 Covariance based Detection . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.3.6 Wavelet based Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.4 Cooperative Spectrum Sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

xi

Page 12: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xii CONTENTS

2.4.1 Why cooperate? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.2 Cooperation Classification . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.3 Data Fusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.4.4 Sensing Time, Sensing Delay . . . . . . . . . . . . . . . . . . . . . . . . 22

2.4.5 Control Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.4.6 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2.5 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 GNU Radio & the USRP2 25

3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.2 USRP2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.3 GNU Radio Architecture & Guidelines . . . . . . . . . . . . . . . . . . . . . . . 27

3.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4 Spectrum Sensing Implementation 31

4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.2 Architecture and Accessing the Information . . . . . . . . . . . . . . . . . . . . 31

4.3 Energy Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.4 Eigenvalue Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5 Energy Detection Measurements 37

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.2 Environment Characterization and Transmitter . . . . . . . . . . . . . . . . . . 37

5.3 Chosing an FFT bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

5.3.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

5.3.2 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

5.4 Measurements using GNU Radio . . . . . . . . . . . . . . . . . . . . . . . . . . 40

5.4.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

5.4.2 Measurments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

5.5 Measurements with post processing . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.5.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.5.2 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Page 13: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

CONTENTS xiii

6 Eigenvalue Detection Measurements 49

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

6.2 Effect of the filtering done in the USRP . . . . . . . . . . . . . . . . . . . . . . 49

6.3 Whitening of the matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

6.3.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

6.3.2 Measurements without withening . . . . . . . . . . . . . . . . . . . . . . 53

6.3.3 Measurements with theoretical whitening . . . . . . . . . . . . . . . . . 53

6.3.4 Measurements with experimental whitening . . . . . . . . . . . . . . . . 54

6.4 Probabilities of detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

6.5 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

7 Small Network Implementation 61

7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7.2 Interferer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7.3 Transmitter and receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

7.4 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

8 Conclusion and Future Work 67

A Dial Tone Script 69

B Energy detection CDFs using GNU Radio 73

C Energy Detection CDFs using Offline Processing 77

D Eigenvalue Threshold Mathematica Script 81

Bibliography 82

Page 14: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xiv CONTENTS

Page 15: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

List of Figures

1.1 Architecture of traditional, software defined and cognitive radio . . . . . . . . . 2

2.1 Cognitive radio considers its location, location error and interference range in

deciding if the channel is usable . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2 Classification of cooperative sensing . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3 Hidden node problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.4 Signal processing in a energy detector . . . . . . . . . . . . . . . . . . . . . . . 9

2.5 Illustration of noise uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.6 Spectral density of three users . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.7 Classification of cooperative sensing . . . . . . . . . . . . . . . . . . . . . . . . 21

2.8 Softened decision with three thresholds: T1, T2, T3 . . . . . . . . . . . . . . . . 22

3.1 Picture of a USRP2 node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.2 Decimation of the signal in the FPGA by decimation factor N . . . . . . . . . . 27

3.3 Simplified schematic of the XCVR2450 daughterboard . . . . . . . . . . . . . . 28

3.4 Simplified schematic of the motherboard . . . . . . . . . . . . . . . . . . . . . . 28

3.5 Dial tone flow graph created using GRC . . . . . . . . . . . . . . . . . . . . . . 29

4.1 Energy detector that computes the metric on demand . . . . . . . . . . . . . . 32

4.2 Energy detector that continuously computes the metric . . . . . . . . . . . . . 32

4.3 Flow graph used to implement the energy detector . . . . . . . . . . . . . . . . 33

4.4 Flow graph used to implement the energy detector . . . . . . . . . . . . . . . . 33

4.5 Flow graph used to implement the eigenvalue detector . . . . . . . . . . . . . . 34

4.6 Flow graph used to implement the eigenvalue detector . . . . . . . . . . . . . . 34

4.7 Calculation of tmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

xv

Page 16: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xvi LIST OF FIGURES

5.1 Flow graph used to generate the DQPSK signal . . . . . . . . . . . . . . . . . . 38

5.2 Flow graph to measure probabilities using a moving average . . . . . . . . . . . 39

5.3 Energy detection flow graph to measure received power . . . . . . . . . . . . . 39

5.4 Estimated noise power spectrum density with a decimation of 8 . . . . . . . . . 40

5.5 Energy detection flow graph to measure probabilities using a decimating average 41

5.6 Cascaded decimating average . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

5.7 Measured empirical CDFs of noise in energy detection . . . . . . . . . . . . . . 42

5.8 Empirical CDFs for M=1000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5.9 Influence of averaging time in probabilities of detection on the energy detector 44

5.10 Influence of the SNR in probabilities of detection on the energy detector . . . . 44

5.11 Empirical CDFs for M=1000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.12 Influence of averaging time in probabilities of detection on the energy detector 46

5.13 Influence of the SNR in probabilities of detection on the energy detector . . . . 47

6.1 Flow graph to measure probabilities on the first methodology of eigenvalues

detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.2 Sectrum in the absence of signal. Red with a decimation of 32, purple 64 and

blue 128. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

6.3 Estimated noise power spectrum density at different decimations . . . . . . . . 52

6.4 Flow graph to grab samples to be post-processed . . . . . . . . . . . . . . . . . 52

6.5 Flow graph to compute eigenvalue ratio from recorded samples . . . . . . . . . 53

6.6 Measured and simulated CDFs of eigenvalue detector for a matrix size of 3 . . 56

6.7 Measured and simulated CDFs of eigenvalue detector for a matrix size of 3

using theoretical whitening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

6.8 Measured and simulated CDFs of eigenvalue detector for a matrix size of 3

using experimental whitening . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

6.9 Probabilities of detection of the eigenvalue detector for a matrix size of 3 . . . 59

6.10 Probabilities of detection of the eigenvalue detector for a matrix size of 5 . . . 59

7.1 Energy detector used in the interferer . . . . . . . . . . . . . . . . . . . . . . . 62

7.2 Spectrum analyzed between the 2.501 GHz and 2.510 GHz in the abcesnse of

a signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Page 17: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

LIST OF FIGURES xvii

7.3 Spectrum analyzed between the 2.501 GHz and 2.510 GHz in the presence of

a signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

7.4 Implementation of TDD without synchronization messages . . . . . . . . . . . . 64

7.5 Implementation of TDD with synchronization messages . . . . . . . . . . . . . 65

B.1 Empirical CDFs for M=100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

B.2 Empirical CDFs for M=200 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

B.3 Empirical CDFs for M=500 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

B.4 Empirical CDFs for M=1000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

B.5 Empirical CDFs for M=2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

C.1 Empirical CDFs for M=100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

C.2 Empirical CDFs for M=200 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

C.3 Empirical CDFs for M=500 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

C.4 Empirical CDFs for M=1000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

C.5 Empirical CDFs for M=2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Page 18: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xviii LIST OF FIGURES

Page 19: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

List of Tables

5.1 Transmitter Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

5.2 Energy detector characteristics in first methodology . . . . . . . . . . . . . . . 38

5.3 Measured probabilities of false alarm under various bins . . . . . . . . . . . . . 40

5.4 Energy detector characteristics in second methodology . . . . . . . . . . . . . . 41

6.1 Measured probabilities of false alarm of the eigenvalue detector under various

averaging sizes for a decimation of 220 . . . . . . . . . . . . . . . . . . . . . . . 50

6.2 Effect of sampling frequency on probabilities of false alarm . . . . . . . . . . . 51

6.3 Effect of different decimation filters on the probabilities of false alarm . . . . . 51

6.4 Receiver characteristics of the receiver to record samples . . . . . . . . . . . . . 53

xix

Page 20: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xx LIST OF TABLES

Page 21: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

List of Abbreviations

ADC Analog to Digital Converter

AWGN Additive White Gaussian Noise

CAF Cyclic Autocorrelation Function

CDF Cumulative Distribution Function

CIC Cascaded Integrator Comb

CR Cognitive radio

DAC Digital to Analog Converter

DDC Digital Down Conversion

DFT Discrete Fourier Transform

DSP Digital Signal Processor

DUC Digital Up Conversion

FFT Fast Fourier Transform

FPGA Field Programmable Gate Array

GbE Gigabit Ethernet

GPP General Purpose Processor

GRC GNU Radio Companion

HB Half band

IF Intermediate Frequency

xxi

Page 22: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

xxii LIST OF TABLES

PC Personal Computer

PER Packet Error Rate

PU Primary user

RF Radio-frequency

SDR Software Defined Radio

SNR Signal to Noise Ratio

SU Secondary user

SWIG Simplified Wrapper and Interface Generator

USRP2 Universal Software Radio Peripheral 2

Page 23: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 1

Introduction

1.1 Introduction

Although spectrum is seen as a scarce natural resource, measurements show that often, there

are moments in time and space where it is not being utilized by the services that have allocated

it [38]. This means that spectrum could be used more efficiently and to address this issue,

regulatory entities are now considering more flexible spectrum management policies than the

traditional fixed frequency allocation [11]. Policies that allow the access of secondary users

(SU) to the spectrum of incumbents, also called primary users (PU), can then improve the

spectrum usage efficiency.

Cognitive radio (CR) is a technology whose main idea is to endow the radio terminal with

some form of artificial intelligence. This will enable the CR to autonomously detect which

is the best service the user needs and what radio resources to use based on the context of

utilization.

One promising application of cognitive radio is dynamic spectrum access, in which a CR

utilizes information about the spectrum utilization to access vacant spectrum.

To achieve this goal without causing harmful interference to the PUs, spectrum sensing plays

a crucial role. By sensing the spectrum a CR can decide if a frequency band is or is not being

used and therefore available for is own use.

In order to adapt to its environment a CR must be capable of transmitting and receiving

in different bands, using different modulation schemes, coding, etc. This requires a lot of

flexibility from the radio, which can be achieved using software defined radio (SDR).

The philosophy of SDR is to bring the software as close as possible to the antenna. Ideally,

1

Page 24: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2 CHAPTER 1. INTRODUCTION

Modulation Coding Framing ProcessingRF

Modulation Coding Framing ProcessingRF

Modulation Coding Framing ProcessingRF

HardwareSoftware

SoftwareHardware

Intelegence (Sense, Learn, Optimize)

SoftwareHardware

Traditional

Radio

Software

Defined Radio

Cognitive

Radio

Figure 1.1: Architecture of traditional, software defined and cognitive radio (Adapted from[23])

the signal would be converted from analogical to digital and vice-versa still in the radio-

frequency (RF) domain, but this would impose very strict requirements on the analog to

digital converters (ADC) and digital to analog converters (DAC). For this reason, in SDR

usually the signal is first transposed from RF to an intermediate frequency (IF) by hardware,

just like traditional radios. However, the baseband processing is done by software through

the use of reconfigurable hardware like field programmable gate arrays (FPGA), digital signal

processors (DSP) or general purpose processors (GPP).

In Figure 1.1 is possible to see a comparative view of traditional, software defined and cognitive

radio .

Page 25: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

1.2. MOTIVATION AND GOALS 3

1.2 Motivation and Goals

In order to a cognitive radio be able to use spectrum of a primary user without causing harmful

interference it must be able to detect signals under very low signal to noise ratio. To do this

various types of detectors are suggested in the literature and their performance is commonly

evaluated through probabilities of detection and false alarm.

Since cognitive radio is a recent technology there are not many experimental studies in the

literature.

The goal of this thesis is to implement an energy detector and an eigenvalue detector. This

will allow to verify the validity of theoretical expressions, show the implementability of this

detectors and provide detectors that can later be used in CR networks.

1.3 Scope

This dissertation is organized as follows: In chapter 2 an overview of the state of the art in

spectrum sensing is presented. In chapter 3 an overview of the software defined radio system

used is given. In chapter 4 the algorithms used in the implementation of the detectors are

described. In chapter 5 the performance of the implemented energy detector is evaluated

through the measurements of experimental probabilities of false alarm and detection. In this

chapter the methodology used to perform the measurements is described, the results presented

and discussed. In chapter 6 is done the same thing for the eigenvalue detector. Chapter 7 is

discussed the implementation of a small network that avoids interference. Finally chapter 8

will conclude the dissertation and present the future work.

1.4 Publications

During the work of this thesis an article was submitted to the 14th International Symposium

on Wireless Personal Multimedia Communications and accepted for publication [1]. The title

of this article was Energy Detection and Eigenvalue Based Detection: An Experimental Study

Using GNU Radio and it summarized the results obtained in this thesis.

Page 26: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

4 CHAPTER 1. INTRODUCTION

Page 27: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 2

Cognitive Radio and Spectrum

Sensing

2.1 Introduction

Due to today current allocation policies, the spectrum might be unused by the incumbent in

a certain point of time, space or code, but other users cannot access it. This unused spectrum

can be called a white space. In this chapter an important method to detect white spaces will

be discussed: spectrum sensing.

Firstly, it will be over viewed some techniques used to find white spaces. A review on the

state of the art of spectrum sensing will then be presented. This will consider uncooperative

spectrum sensing, where a node independently decides if the channel is empty, and cooperative

spectrum sensing, where nodes help other nodes in the detection.

2.2 White Spaces Identification Methods

For a cognitive radio to be able to use the white spaces, first it must detect the vacant

spectrum.

There are three main techniques to detect channel usage: the use of a database, the use of

beacons signals and spectrum sensing.

In the use of database, a device checks his location and then queries a database to know the

nearby channel usage. Then, from the estimate of his position, position error and interference

range, the unlicensed device can decide whether the channel is usable or not. This is depicted

5

Page 28: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

PU

PU

CR

Potencial conflit

Can not use channel

No conflit

Can use channel

Position

error

Interference

Range

Figure 2.1: Cognitive radio considers its location, location error and interference range indeciding if the channel is usable

in Figure 2.1.

This method has the disadvantage that the CR needs a geolocation scheme. Also, a CR

needs to access the database which limits the independence of the network. In addition, it

requires changes in the legacy systems, since the database needs to be updated with channel

information. On top of this, it is necessary someone that would provide the database service

[3].

In the identification method that uses beacons, signals known to the CR are transmitted by

the primary user. The cognitive radio then uses this signal to decide on the usability of the

channel. These beacons can be transmitted in a one beacon per transmitter or in a one beacon

per area manner.

In the former, if the CR receives a beacon it will defer from using the channel. In the latter

manner the beacon will transport information about the used channels in the area, much like

a database with wireless access. Both of this manners are depicted in Figure 2.2.

In the spectrum sensing method, the unlicensed transmitter monitors the bandwidth of in-

terest and tries to detect transmissions done by the PU in their normal operation. If a

transmission is detected then the channel is in use and the CR defers from using it.

Page 29: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.2. WHITE SPACES IDENTIFICATION METHODS 7

Beacon

Range

Beacon

Range

PU1

PU2

CR

Detects PU1

but not PU2

(a) Beacon transmitted per transmitter

PU

CR

Potencial conflit

Can not use channel

No conflit

Can use channel

Position

error

Interference

Range

PU

Beacon Transmitter

Beacon Range

(b) Beacon transmitted per area

Figure 2.2: White space identification using beacons

Page 30: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

8 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

CR2

CR1

CR3

PU Rx

PU Tx

Primary

Network

CR

Network

Receiver

Uncertainty

Multipath &

Shadowing Fading

Figure 2.3: Hidden node problem

The disadvantage of this method is that a CR must be able to detect signals under very

low signal to noise ratio (SNR) in order to not create harmful interference with the PU. One

reason for this is the hidden node problem. This problem occurs when a CR can interfere with

the licensee receiver but to detect the licensee transmitter is difficult, either due to fading,

shadowing or because it is far from the transmitter, but still near the receiver. This is depicted

in Figure 2.3. However, this method has the advantage of not requiring changes in the legacy

networks, a very desirable feature.

2.3 Non-Cooperative Spectrum Sensing

2.3.1 Detection Model

We model the signal detection problem as a hypothesis testing problem, given by:

y(t) =

w(t), H0

s(t) + w(t), H1

(2.1)

where y(t) represents the complex baseband received signal, s(t) the signal to detect and w(t)

additive white Gaussian noise (AWGN). Here the hypothesis H0 means the absence of signal

and H1 the presence.

The decision on the presence or absence of a signal will be done by evaluating if a certain

random variable Θ, is above or below a certain threshold T . This variable is defined by the

Page 31: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 9

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|² SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

source

S/P FFT |(.)|²SelectorDecimating

Average

USRP

source

S/P FFTDecimating

Average|(.)|²

USRP

sourceSelector

File

Sink

S/P FFT Average|(.)|² ThresholdA/Dy(t)

Figure 2.4: Signal processing in a energy detector

chosen test statistics.

The performance of a detector is evaluated by the probability of false alarm and probability

of detection given by equations (2.2) and (2.3) respectively.

PF = P (Θ > T |H0) (2.2)

PD = P (Θ > T |H1) (2.3)

2.3.2 Energy Detection

The basic principle of energy detection is to decide whether a channel is occupied or not by

computing the received energy (or mean square power) in the channel of interest and with

that decide if a signal present.

In order to evaluate only the energy on the desired channel and to reduce noise power, filtering

is necessary. In Figure 2.4 we can see a scheme of a simple energy detector where a fast Fourier

transform (FFT) is used to do the filtering.

After the channelization, it is necessary to estimate the energy in the desired channels. This

is usually done by averaging the square magnitude of the signal. Finally, a decision whether

the channel is occupied or not is done by comparing the result with a threshold T .

Considering an additive white Gaussian noise channel (AWGN), we can create the metric Θ

using equation (2.4), where Sk (m) is the spectral components of the signal to detect at the

kth frequency, Wk (m) white Gaussian noise and M the number of samples used to do the

temporal average.

Θ =

M∑m=1|Wk (m)|2 , H0

M∑m=1|Sk (m) +Wk (m)|2 , H1

(2.4)

Let us first consider that the signal is unknown but deterministic and lets also consider that

Page 32: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

10 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

covariance matrix of the vector Z =[<{Wk} ={Wk}

]is given by,

E[ZZT

]=

E [<{Wk}<{Wk}] E [<{Wk}={Wk}]

E [<{Wk}={Wk}] E [={Wk}={Wk}]

=

σ2 0

0 σ2

(2.5)

Then Θ, under the hypothesis of H0, will have a central χ2 distribution with 2M degrees of

freedom. Under the hypothesis of H1, Θ will have a non-central χ2 distribution, also with

2M degrees of freedom, with a non-centrality parameter of µ =M∑m=1|Sk (m)|2 [29],i.e.,

fΘ (Θ) ∼

χ2

2M

χ22M (µ)

(2.6)

Then one can get the probability of false alarm, from equations (2.2) and (2.6), as:

PF =Γ(M, T

2σ2

)Γ (M)

(2.7)

where Γ (.) is the gamma function and the Γ (., .) is the upper incomplete gamma function,

defined by equations (2.8) and (2.9) respectively [29]. Given a target probability of false alarm

the threshold can be set based solely on equation (2.7)

Γ(p) =

∞∫0

tp−1e−tdt (2.8)

Γ(p, x) =

∞∫x

tp−1e−tdt (2.9)

Combining equation (2.3) with equation (2.6) we can get the probability of the signal being

detected as [29]1:

PD = QM

(õ

σ2,

√T

σ2

)(2.10)

where QM (., .) is the generalized Marcum-Q function, defined by equation (2.11), where Iα(.)

1Note equation (2.10) is only valid for a even number of degrees of freedom. However, 2M is always a evennumber

Page 33: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 11

is the Bessel function of the first kind.

QM (a, b) =

∞∫b

x(xa

)M−1e−(x2+a2)/2IM−1(ax)dx (2.11)

Under channels that suffer fading one can compute an average probability of detection by using

equation (2.13), where γ is the SNR and fγ its probability density function that represents the

channel fading. This equation bears in mind that we can relate the non-centrality parameter

µ with the SNR through equation (2.12)

µ

2σ2= Mγ (2.12)

PD =

∞∫0

QM

(√2Mγ,

√T

σ2

)fγ (γ) dγ (2.13)

Using (2.13), we can find the average detection probability in Rayleigh channels [8]2. We can

see this expression in equation (2.14), where γ is the average SNR. In [17], an expression for

the average probability of detection in Ricean and Nakagami channels was developed3.

Pd = e−T

2σ2

M−2∑i=0

(T

2σ2

)ii!

+

(2σ2 + 2Mγ

2Mγ

)e− T2σ2+2Mγ − e−

T2σ2

M−2∑i=0

(T2Mγ

2σ2(2σ2+2Mγ)

)ii!

(2.14)

It can be seen in equations (2.7) and (2.10) that in order to select a threshold based on the

probabilities of detection and false alarm, it is necessary an estimation of the ambient noise

power. This is a problem since it is not possible to know exactly the noise power at the receiver

at a given time. This creates a limit on the detection sensitivity of the energy detector.

Suppose that the noise estimated power is σ2e , the actual noise power is σ2

n and that there

is an uncertainty in the noise power estimation of x dB, i.e. σ2e ∈

[σ2n10−

x10 , σ2

n10x10

]. This

means that the signal cannot be unambiguously detected unless the received power is above

the threshold σ2T = σ2

e10x10 . Under the worst condition that σ2

e = σ2n10

x10 the signal can only

be unambiguously detected if the received power is larger then σ2T = σ2

n102x10 . This is depicted

in figure 2.5.

2In [9] and [18] similar expressions for Rayleigh fading were developed but these contain typos3In [8] was also found an expression for Nakagami channels but this is restricted to an integer m

Page 34: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

12 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

n 10x/10 2

n10-x/10 2

n

e max 10x/10 2

e max10-x/10 2

e max

2T

2n

Figure 2.5: Illustration of noise uncertainty

A SNR wall is then created under which one cannot say for certain if there is a signal or just

noise. This wall is given by equation (2.15)

snrwall =σ2T − σ2

n

σ2n

= 102x10 − 1 (2.15)

2.3.3 Matched Filtering

Pilot signals and preambles are frequently used in communication systems in order to aid the

receiver to perform timing synchronization, channel estimation, etc.. If the cognitive radio

has knowledge of this periodical patterns he can use them in order to detect the presence of a

primary signal by correlating the received signal with the known pattern. This is equivalent

to apply the matched filter to the signal and sample the output it at its maximum.

The metric used then for the decision is given by equation (2.16), where p(m) denotes the

known pilot.

Θ =M∑m=1

<{y (m) p (m)∗} =

M∑m=1<{w (m) p (m)∗}, H0

M∑m=1|p (m)|2 + <{w (m) p (m)∗}, H1

(2.16)

This metric will have a Gaussian distribution with a variance of σ2match = σ2

M∑m=1|p (m)|2,

mean ν = 0 under H0 and ν =M∑m=1|p (m)|2 under H1.

However equation (2.16) assumes a perfect synchronization between the cognitive radio and

the transmitter, which might be difficult to accomplish. Another metric that can be used to

take this effect into account would be to make a thorough search of the time offset. Suppose

Page 35: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 13

that an maximum offset of lmax samples is considered. Then the following metric can be used:

Θ = max0≤l≤lmax

M∑m=1

<{y (m+ l) p (m)∗} (2.17)

The waveform based detector has a better performance than the energy detector, since the

matched filter is optimal in AWGN channel, but it has the disadvantage that it requires a

priori information of the PU transmitted signal and timing synchronization. Also this detector

still requires a estimation of the noise power to select a threshold.

2.3.4 Cyclostationary Detectors

Most of man-made signals are not wide sense stationary processes, i.e. their statistics vary

with time. The periodicity induced by the modulation, sampling and coding often embeds the

signals with periodically time-varying statistics. Processes with periodic mean and periodic

autocorrelation function are denominated second-order wide sense cyclostationary processes

[14].

Since the signal statistics are periodical we can use Fourier series to characterize them. Namely

the autocorrelation function, with period T0, can be given by:

R(τ ;t) = E[x(t+

τ

2

)x(t− τ

2

)∗]=

∞∑n=−∞

Rαn(τ)ej2παnt (2.18)

where Rαn(τ) are the Fourier coefficients and αn = nT0

are called the cyclic frequencies.

The Fourier coefficients, which can be calculated through equation (2.19), are referred to as

cyclic autocorrelation functions (CAF) [14]. These CAF are interesting since they show the

correlation of the signal x (t) with itself, but shifted in frequency by the cyclic frequency αn,

that is x (t) ej2παnt [12].

Rαn (τ) =1

T0

T02∫

−T02

E[x(t+

τ

2

)x(t− τ

2

)∗]e−j2παntdt (2.19)

Like in the wide sense stationary processes, the Fourier transform of the cyclic autocorrelation

functions has interesting properties. It can be shown that this transform, depicted in equation

(2.20), is equal to the spectral correlation density function given by equation (2.21), where

Page 36: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

14 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

XT is given by equation (2.22) [13].

Sαn (f) =

∞∫−∞

Rαn (τ) e−j2πfτdτ (2.20)

Sαn (f) = limT→+∞

1

T0

T02∫

−T02

E

[1

TXT (t, f)X∗T (t, f − αn)

]dt (2.21)

XT (t, f) =

t+T2∫

t−T2

x(u)e−j2πfudu (2.22)

This means that the cyclic spectrum Sαn (f) gives the time-averaged correlation of the spectral

components at frequencies f and f − αn. Note that the stationary power spectral density is

a special case in which αn = 0.

We can now see how cognitive radios can use cyclostationarity properties to detect cyclo-

stationary signals. Noise is usually modeled as stationary process and as such its cyclic

autocorrelation functions and cyclic spectrum will be zero for an αn different than zero. This

allows the cognitive radio to detect signals in low SNR regimes if he has information about

the cyclic frequencies of the signal.

In [7] an algorithm to detect the presence of cyclostationarity is derived. This algorithm is

based on the CAF and therefore its first step is to estimate the CAF in the time domain, by

creating the vector r through equations (2.23) and (2.24)

Rαn [l] =1

M

M−1∑m=0

x (m)x (m− l)∗ e−j2παnmM , 0 ≤ l ≤ L− 1 (2.23)

r =[<{Rαn [1]} ... <{Rαn [L]} ={Rαn [1]} ... ={Rαn [L]}

](2.24)

This estimation will seldom be zero and therefore a decision must be made whether the channel

is occupied or not based on the estimated CAF. We can then model the hypotheses testing

Page 37: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 15

problem as:

r = ε (αn) , H0

r = r + ε (αn) , H1

(2.25)

An asymptotic distribution for ε (αn) is derived in [7] under the condition that samples are

sufficiently separated in time to be considered approximately independent. With this an

algorithm to detect cyclostationary signals is developed.

The advantage of this technique is the capability of detecting signals in lower SNR regimes

than the energy detector and being capable of distinguishing the PU from received interference.

However it has the disadvantage of requiring information about the PU and greater complexity

than the energy detector.

2.3.5 Covariance based Detection

The main idea in covariance based detection is that due to over sampling, multi path or

multiple receive antennas, the observed signal samples will be correlated [45]. This correlation

will be reflected on eigenvalues of the covariance matrix which can then be used to formulate

a detection metric.

Let y(n) = s(n) + w(n) be a vector of observed samples with length L, where y(n), s(n) and

w(n) are given by equations (2.26) and (2.27).

y(n) =[y1(n) ... yL(n)

]Ts(n) =

[s1(n) ... sL(n)

]Tw(n) =

[w1(n) ... wL(n)

]T (2.26)

yi(n) = y(nL+ i− 1)

si(n) = s(nL+ i− 1)

wi(n) = w(nL+ i− 1)

(2.27)

Then the covariance matrix of y(n), is given by:

Ry(n) = E[y(n)y(n)H ] =

σ2c IL, H0

Rs(n) + σ2c IL, H1

(2.28)

Where Rs(n) is the covariance matrix of s(n), IL the identity matrix of dimension L and

Page 38: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

16 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

σc = E[w(n)w(n)∗].

If there is correlation between the signal samples, due to oversampling, then Rs(n) will be

different from the identity.

The eigenvalues ρ of the matrix Rs will then be given by

Rsx = ρx (2.29)

By adding σ2c IL to (2.29) we get

Ryx =(Rs + σ2

c IL)x =

(ρ+ σ2

c

)x = λx (2.30)

Thus the eigenvalues λ of Ry are equal to the eigenvalues of Rs plus σ2c . Then the maximum

and minimum eigenvalues of covariance matrix will be given by (2.31),

(λmax, λmin) =

(σ2c , σ

2c ), H0

(ρmax(n) + σ2c , ρmin(n) + σ2

c ), H1

(2.31)

where ρmax(n) and ρmin(n) are respectively the maximum and minimum eigenvalues of Rs(n).

Thus, if there is no signal the ratio of maximum and minimum eigenvalues should be one and

in the presence of signal the ratio should be greater than one. A metric for the detection of

the signal can be defined as:

Θ =λmaxλmin

(2.32)

In practice the covariance matrix has to be estimated. This can be done using the sample

covariance matrix given by:

Ry(n) =1

M

M−1∑i=0

y(n− i)y(n− i)H (2.33)

To select a threshold based on the probabilities of false alarm it is necessary to know the

statistical distribution of the eigenvalues of the matrix Ry(n) under H0, which is a complex

Wishart random matrix and shall be denoted as Rη(n) [36]. There are three main manners

to do this: Asymptotic [6], semi-asymptotic [44] and exact [25].

The first is based on the following theorem:

Theorem 1 Let

R′η (n) = Mσ2cRη (n)

Page 39: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 17

And assume that

limM→∞

LM = y (0 ≤ y ≤ 1) .

Then the minimum eigeinvalue λ′min and the maximum eigenvalue λ′max of R′η (n) have the

following limits

limM→∞

λ′min =(1−√y

)2limM→∞

λ′max =(1 +√y)2

[2]

By assuming that number of averages M and matrix size L is large enough one can then select

a threshold

T =

(1 +√y)2(

1−√y)2 (2.34)

This manner has the disadvantage that it assumes very large matrices and number of samples.

Also it cannot be tuned based on the probabilities of false alarm or detection.

The semi-asymptotic manner makes use of the following theorem:

Theorem 2 Let

R′η (n) = Mσ2cRη (n)

u =(√

M +√L)2

v =(√

M +√L)(

1√M

+ 1√L

) 13

and assume that limM→∞

LM = y (0 ≤ y ≤ 1).

Thenλmax(R′η(n))−u

v converges with probability one to the Tracy-Widom distribution of order

2.

Then by replacing λmin in equation (2.35) by the asymptotic value of Theorem 1 and con-

sidering the asymptotic distribution of λmax a threshold can be found by equation (2.36),

where F2 is the cumulative distribution function (CDF) of the second order Tracy-Widom

distribution.

Pfa = P (λmax > Tλmin) (2.35)

Page 40: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

18 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

T =

(1 +√y)2(

1−√y)21 +

(√M +

√L)− 2

3

(ML)16

F−12 (1− Pfa)

(2.36)

This manner allows to tune the threshold in function of the probability of false but it still

assumes very large matrices and number of samples.

In [25], the joint distribution of maximum and minimum eigenvalue is used to find the proba-

bility density function of the eigenvalue ratio without resorting to asymptotic approximations.

This exact manner however can be too computationally complex to compute. For this reason

also in [25] an approximated expression is given.

This manner allows to select good thresholds even for small matrices and small number of

samples.

The advantage of the eigenvalue based detector is that it does not require an estimate of the

received noise power, and also does not require a priori knowledge of the received signal.

However this method has the disadvantage of a high computational complexity due to the

computation of the eigenvalues.

It should be noted that usually noise is narrow band filtered at the receiver. This means that

the received noise will no longer be white. In [41] it is suggested to compensate for this in the

following manner:

Let h(k) for k = 0, ...,K − 1 be the filter and w(n) the filtered noise given by equation (2.37)

w(n) =

K−1∑k=0

h(k)w(n− k) (2.37)

Then the covariance matrix will be given by σ2cHHH where H is

H =

h(0) h(1) ... h(K − 1) 0 ... 0

0 h(0) ... h(K − 2) h(K − 1) ... 0

... ... ... ... ... ... ...

0 0 ... h(0) h(1) ... h(K − 1)

(2.38)

To regain a matrix without correlation under H0 it is then possible to use equation (2.39)

where Q is given by Q =(HHH

) 12 [41]

Q−1Rw(n)Q−1 = σ2c I (2.39)

Page 41: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.3. NON-COOPERATIVE SPECTRUM SENSING 19

f

S(f)

Figure 2.6: Spectral density of three users

2.3.6 Wavelet based Detection

On a wide band sensing scenario multiple entities might be using different portions of the

spectrum. If one assumes that spectrum occupancy is smooth within the occupied band-

widths and that there are discrepancies between the power used by each entity, then channel

occupancy detection becomes a threefold problem: Estimate the PSD, estimate the location

of the discrepancies and estimate power within the occupied bands so it can be compared

with a threshold. In Figure 2.6 the assumed spectrum occupancy is depicted.

To estimate the spectrum it is possible to use the periodogram as:

S (fk) =1

M

1

Nfft

M−1∑m=0

∣∣∣∣∣∣Nfft−1∑n=0

y (mNfft + n) e−j 2πfkn

Nfft

∣∣∣∣∣∣2

(2.40)

One way to detect the discrepancies is the use of wavelets [35].

Let φ (f) be a wavelet smoothing function with compact support and m times differentiable.

The wavelet scaling function is then given by equation (2.41) and the wavelet continuous

transformation of the PSD is given by equation (2.42).

φs (f) =1

(f

s

)(2.41)

WsS (f) = φs (f) ∗ S (f) (2.42)

Then by computing the the wavelet transform of the estimated PSD we obtain the PSD

Page 42: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

20 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

smoothed by the smoothing function φs (f). One way to compute the edges in this function

is to look for local maxima in the module of its first derivative or look for zeros in its second

derivative.

With the location of the discrepancies, the power present in the sub-band of interest can then

be computed through equation (2.43) and compared to a threshold.

PBk =

∫ fk

fk−1

ˆS (f) (2.43)

This method of sensing is very similar to energy detection. The advantage of this method is

that it can allow a reduced complexity of the receiver which can perform first coarse scanning,

followed by fine scanning performed by more sophisticated techniques.

2.4 Cooperative Spectrum Sensing

2.4.1 Why cooperate?

Sometimes due to multipath fading and shadowing, the effectiveness of the spectrum sensing

can be degraded. One way of addressing this issue is by having the CR nodes sharing infor-

mation about their individual spectrum sensing. In this way a node that suffers shadowing

might receive information by another node that does not suffer from this problem.

This will improve the detectors sensitivity requirements since it will be easier to detect signals

with low SNR due to multi path fading and shadowing. However, the overhead of the network

is increased since messages are necessary to be interchanged to share the individual sensing

information.

2.4.2 Cooperation Classification

Cooperation can be classified as centralized or distributed. In the centralized approach there

is a central node that is responsible for receiving the spectrum sensing information from the

other nodes and, based on that, makes a decision on behalf of the network.

In the decentralized manner there is no central node. In this approach the nodes will commu-

nicate amongst themselves and converge to a unanimous decision on the presence or absence

of a PU through iterations.

An illustration of both classifications can be viewed on Figure 2.4.2.

Page 43: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.4. COOPERATIVE SPECTRUM SENSING 21

PU

CR1

CR2

CR3

CR4CR0

CR1

CR2

CR3

CR4

CR5

PU

Reporting

Channels

Reporting

Channels

(a) Centralized

PU

CR1

CR2

CR3

CR4CR0

CR1

CR2

CR3

CR4

CR5

PU

Reporting

Channels

Reporting

Channels

(b) Distributed

Figure 2.7: Classification of cooperative sensing

2.4.3 Data Fusion

In cooperative spectrum sensing it is necessary to combine the data from the various nodes in

order to make a cooperative decision. This can be done in a hard, soft or quantized soft way.

In the hard combining schemes the cognitive radios only share their individual binary decisions

whether the channel is occupied or not. The fusion center (FC) will then combine the decisions,

normally using linear fusion rule such as AND, OR, or M out of N rules. In the AND rules

the FC will decide that the channel is occupied if all CR that have decided so. In OR rules

its is only necessary that one of the users says that the channel is occupied in order to the

fusion center to decide the channel is occupied. M out of N rules are a middle ground between

the OR and the AND rules, where the FC decides that the channel is occupied if M out of N

users say so.

In the soft combining schemes the whole information of the samples obtained or of the test

statistic is shared. The data can be combined using receiver diversity techniques such as equal

gain combining or maximum gain combining. This method is more efficient than the hard

combining since the fusion center has more information to process. However it has an increased

overhead since it is necessary to use more resources to transmit the extra information.

In the quantized soft combing schemes, a middle ground is found. Instead of sharing the

whole test statistic or local samples the test statistic is quantized into N bits dividing the test

statistic into 2N levels. This is depicted in figure 2.8 where N = 2. The combination can then

be done by a weighted linear combination of the number of users on each level [21] . This

Page 44: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

22 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

00

01

10

11

T1 T3T2

Figure 2.8: Softened decision with three thresholds: T1, T2, T3

is depicted in equation (2.44) where Ni represents the number of users on each level and wi

the weight given to each level. The result is then compared with a threshold to decide on the

absence or presence of the primary signal. This scheme allows for better detection probability

then the hard decision method with less overhead then the soft one.

Nc =

2N−1∑i=0

wiNi (2.44)

2.4.4 Sensing Time, Sensing Delay

When designing a CR network that uses spectrum sensing one important factor to consider

is the sensing time required by the detector.

Increasing the sensing time will increase the probabilities of detection for a given SNR, but

due to the hardware limitations, it might not be possible to transmit and sense simultaneously.

This creates a trade-off between the achievable throughput of the network and the detection

sensitivity of PU.

By using cooperation the sensitivity requirements may relax, which translates into a reduced

sensing time. However, cooperation introduces reporting delay, which is the time needed for

the nodes to share information and make a cooperative decision.

Therefore in cooperative sensing both the sensing time of the individual CR and the report

delay time should be taken into account.

2.4.5 Control Channel

In order for the CR to cooperate a control channel is necessary.

Page 45: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

2.5. CONCLUSIONS 23

The throughput of this channel is one of the key factors of cooperative sensing since it limits

the amount of cooperation possible. To cope with this limited bandwidth requirement schemes

of censoring and hard combining fusion have been proposed [33].

Also this channel must be reliable. Multi path fading and shadowing can impede a CR to

communicate and hence, reduce the cooperative gain [30].

2.4.6 Security

A small word should be given on security issues in cognitive radio. In cognitive radio networks

new security issues arise that go beyond normal wireless networks. Since cognitive radios adapt

to their environment and can learn from their past experiences, a malicious user can modify

the environment in order to influence the behavior of cognitive radios. E.g., a malicious user

can emulate a primary signal in order to create a denial of service attack. Also a malicious

user can forge an environment in order to influence the learning of the cognitive radio and

hence affect the long term behavior of the same.

This means that the CR must be able to identify if his sensing is real or forged. This goes be-

yond the normal authentication of messages, it means that the observed physical phenomenas

must be authenticated. [5].

2.5 Conclusions

In this chapter white spaces identification techniques were discussed, with a special focus on

spectrum sensing. Several individual spectrum sensing techniques were described. It was seen

that the energy detector suffered from the limitation of the SNR wall, which can stop him

from detecting signals in low SNR regimes. Other detectors were described that do not suffer

from this problem, but that have added complexity and require knowledge of the primary

signal characteristics.

Cooperative spectrum sensing was also reviewed. It was seen that cooperation helps detect

signals that suffer from fading and shadowing but increases the overhead on the network,

namely time to exchange messages.

Page 46: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

24 CHAPTER 2. COGNITIVE RADIO AND SPECTRUM SENSING

Page 47: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 3

GNU Radio & the USRP2

3.1 Introduction

The experimental work of this thesis was performed in the Real Network module of the S-

Cogito testbed [28]. This module consists of a software defined radio platform, where the

nodes RF front end is given by the Universal Software Radio Peripheral 2 (USRP2) and the

baseband processing is done on a personal computer (PC).

To develop the baseband processing software GNU Radio version 3.3.0 and version 3.4.0

were used. GNU radio is a open source software development toolkit for signal processing

applications.

In this chapter a brief description of the USRP2 and the GNU Radio architecture is given. It

is also described how to create simple applications in GNU Radio and how to create our own

signal processing blocks.

3.2 USRP2

The USRP2 was developed by Ettus Inc. and consist of two main boards, a mother board

and a daughter board [32]. The daughterboard is the actual RF front-end that can be tuned

by software. The motherboard is comprised by a field programmable gate array (FPGA) that

does high rate signal processing. The interconnection of the USRP2 with the PC is done

through a Gigabit Ethernet (GbE) connection. In Figure 3.1 we can see a picture of the

USRP2.

To perform the conversion of the baseband signal to RF frequency and vice-versa, the daugh-

terboard is tuned as close as possible to desired center frequency. To fine tune, digital down

25

Page 48: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

26 CHAPTER 3. GNU RADIO & THE USRP2

Figure 3.1: Picture of a USRP2 node

conversion (DDC) or digital up conversion (DUC) is performed in the motherboard. Also

in the motherboard decimation and interpolation is performed, so one can work at a desired

sampling frequency.

The daughterboard used was the XCVR2450 [31]. This daughterboard works in the 2.4 GHz

and 5 GHz bands in half-duplex mode only.

In the motherboard there are two digital to analog converters (DAC) and two analog to digital

converters (ADC), each for the I and Q channel. They communicate with the FPGA at a

sampling frequency of 100 Ms/s with 14 and 16 bit resolution respectively. This means that

in order for the signal to pass through the GbE cable, without losing quantization resolution,

a minimum decimation/interpolation of 4 is necessary. The maximum allowed is 512. This

means that the USRP2 in conjunction with the XCVR2450 has maximum of 25 MHz processed

RF bandwidth.

It is relevant to detail further in the decimation process since it influences the performance of

the detectors, as we will see latter on. The decimation done in the FPGA can be done in 3

stages, 2 stages or one stage depending on the decimation factor being a multiple of four, two

or an odd number. This is because if the decimation is an odd number a cascaded integrator

comb (CIC) filter is used to prevent aliasing, followed by the decimation. If the decimation

factor is a multiple of 2, the decimation done by the CIC stage is followed by a half band

(HB) filter stage that performs a decimation by 2. If the decimation factor is a multiple of 4

then CIC stage is followed by 2 HB filters stage. This is illustrated in Figure 3.2. The process

is similar in the transmission.

Page 49: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

3.3. GNU RADIO ARCHITECTURE & GUIDELINES 27

CIC %N/4 HB %2 HB %2

CIC %N/2 HB %2

CIC %N

(a) Odd decimation factor

CIC %N/4 HB %2 HB %2

CIC %N/2 HB %2

CIC %N

(b) Decimation factor multiple of 2

CIC %N/4 HB %2 HB %2

CIC %N/2 HB %2

CIC %N

(c) Decimation factor multiple of 4

Figure 3.2: Decimation of the signal in the FPGA by decimation factor N

In Figure 3.3 a simplified schematic of the XCVR2450 daughterboard is depicted. On Figure

3.4 the main functions of the motherboard are illustrated.

3.3 GNU Radio Architecture & Guidelines

GNU Radio is a open source software package for designing and implementing SDR systems.

In the GNU Radio architecture, the signal processing blocks are developed in C++ for best

performance. The interconnections of the blocks and other non performance critical tasks are

developed in Python programing language. GNU Radio comes with many already developed

signal processing blocks, such as a USRP Sink that provides the connection to the USRP2.

To interconnect the C++ code and the Python code the the Simplified Wrapper and Interface

Generator (SWIG) interface is used [40]. This allows to create a one to one relationship of

the C++ classes with Python classes.

To create applications it is possible write the Python scripts or use the GNU Radio Companion

(GRC). The GRC is a graphical user interface that allows to develop flow graph oriented

applications quicker and with more ease than creating Python scripts. However GRC is more

limited than writing the scripts where the full capabilities of Python are available. In Figure

3.5 we can see a simple dial-tone flow graph created using GRC.

In GNU Radio the signal processing blocks are C++ classes that can be instantiated into

objects. This classes are typically derived from gr block or gr sync block classes of GNU

Radio. These contain a general work or a work virtual function that we overwrite. In this

function is where the actual signal processing occurs. This function receives the signal samples

in a input buffer, processes them and copies them into a output buffer.

Page 50: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

28 CHAPTER 3. GNU RADIO & THE USRP2

Switch

Band

Pass

Band

PassBand

Pass

90º

TX

Path

RX

Path

I Tx

Q Tx

Q Rx

I Rx

Figure 3.3: Simplified schematic of the XCVR2450 daughterboard

ADC DDCAnti Aliasing

FilterDecimation

ADC DUC Anti Image

FilterInterpolation

ADC DDCAnti Aliasing

FilterDecimation

ADC DUCAnti Image

FilterInterpolation

Gigabit

Ethernet

Interface Chip

I Rx

Q Rx

I Tx

Q Tx

Figure 3.4: Simplified schematic of the motherboard

Page 51: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

3.3. GNU RADIO ARCHITECTURE & GUIDELINES 29

Figure 3.5: Dial tone flow graph created using GRC

To connect and disconnect the blocks, run and stop the flow graph, etc. it is necessary to

instantiate a top block. All the flow graphs will lie inside the top block and there can be

only one top block per application. In Appendix A we can see a simple dial tone script where

two sinusoids are connected to an audio sink. This script was obtained from the dial tone.py

example from GNU Radio with added comments for clarity.

GNU Radio allows us to create our own signal processing blocks in C++. To do this it is

necessary to create three files:

newblock xx.cc In this file the actual implementation of the block is performed.

newblock xx.h Declaration of the class.

newblock xx.i Defines which methods are to be wrapped by SWIG.

These blocks are developed in the build tree and then installed into the install tree so it can

be possible to import them as a Python module.

The easiest way to create the build tree is to use the create-out-of-tree-project command that

comes with the version 3.3.0 of GNU radio. This command copies and renames the contents

of the howto folder, which is a example folder used to illustrate how to create your own block.

Page 52: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

30 CHAPTER 3. GNU RADIO & THE USRP2

Then it is only necessary to add our .cc .h and .i files and change the Makefile.am in topdir/lib

and topdir/swig. To actualy install the new block created is necessary to run the commands:

./boostrap

./configure

make

make check

sudo make install

3.4 Conclusion

In this chapter a short description of the SDR system was given. The principal characteristics

of the USRP2 such as the maximum processed RF bandwidth and the the decimation/inter-

polation process where described. Also, a small description of the GNU Radio architecture

was done. Simple GNU Radio applications were presented to illustrate how to create and

interconnect flow graphs using GNU radio and a brief description of what is necessary to

create our own blocks was given.

Page 53: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 4

Spectrum Sensing Implementation

4.1 Introduction

In this chapter aspects of the implementation of spectrum sensing are considered. This in-

cludes the implementation of the detectors and considerations on how the MAC layer can

access the information of the detectors.

Two detectors were implemented: an energy detector and an eigenvalue detector. The flow

graphs used to do this are presented and the signal processing blocks developed are described.

4.2 Architecture and Accessing the Information

Spectrum sensing is a functionality of the physical layer and as such in order to use spectrum

information in upper layers, it is necessary to access the information. This can be done in

three manners:

• The MAC uses a blocking primitive

• The MAC uses a non-blocking primitive

• The PHY calls a callback into the MAC

The way that the information is accessed can be relevant in the implementation of the detectors

in the physical layer.

This is because the metric can be computed on demand or continuously depending on the

MAC layer. In Figure 4.1 we can see an implementation of an energy detector where the

metric is computed on demand.

31

Page 54: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

32 CHAPTER 4. SPECTRUM SENSING IMPLEMENTATION

USRP |(.)|2Grab

SamplesAccess

Information

Demodulation

and Decoding

USRPLow Pass

Filter|(.)|

2 Access

Information

Demodulation

and Decoding

Average

all

Samples

Figure 4.1: Energy detector that computes the metric on demand

USRP |(.)|2Grab

SamplesAccess

Information

Demodulation

and Decoding

USRPLow Pass

Filter|(.)|

2 Access

Information

Demodulation

and Decoding

Average

all

Samples

Figure 4.2: Energy detector that continuously computes the metric

In Figure 4.2 we can see an implementation of an energy detector where the metric is computed

continuously. The advantage of this type architecture is that the metric can be accessed

asynchronously while at the expense of the use of extra computational resources.

In this thesis was developed the following block to grab samples:

grab samples cc Grabs a specified number of samples after discarding another specified

number of samples.

To access the information the block bin statistics f, that comes with GNU Radio, was used.

This block calls a callback from the C++ level to the Python level.

4.3 Energy Detector

To implement the energy detector the flow graphs depicted in Figure 4.3 and Figure 4.4 were

considered. In this flow graphs a FFT is used to filter various sub-bands of interest. Then,

a certain contiguous bandwidth of interest is selected and the square magnitude of the bins

within it are averaged.

To implement the flow graph it was necessary to create the following blocks:

Page 55: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

4.3. ENERGY DETECTOR 33

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|² SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

source

S/P FFT |(.)|²SelectorDecimating

Average

USRP

source

Figure 4.3: Flow graph used to implement the energy detector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|² SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

source

S/P FFT |(.)|²SelectorDecimating

Average

USRP

source

Figure 4.4: Flow graph used to implement the energy detector

selector vcc Selects a contiguous bandwidth of interest

moving average vff Computes the moving average of a vector composed by floats.

decimating average vff Computes the decimating average of a vector composed by floats.

The vector moving average block, moving average vff, was adapted from the moving average ff

block that computes the moving average of a float and comes with GNU Radio.

The algorithm used to compute the moving average was based on equation (4.1). To avoid

the propagation of rounding errors the sum counter is reset every time the work function is

called or after a certain number of iterations.

sum[n] = sum[n− 1]− in[n−M ] + in[n] (4.1)

The vector decimating average block, decimation average vff, was derived from the gr sync decimator

class that enables to create decimating blocks.

In this block there would be M input samples for one output sample and so averaging is done

simply by summing the samples as depicted in equation (4.2).

out[n] = (in[n] + in[n− 1] + ...+ in[n− (M − 1)])/M (4.2)

It should be noted the buffer requirements of the detectors. Since in both manners of averaging

is necessary to look back in M samples, this means that is necessary to buffer those samples.

If the FFT size is large then quickly the buffers can be large since buffersize = FFTsize ×

M × sizeof(float). Different types of low pass filtering can be interesting to compute the

averaging with less computational complexity.

Page 56: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

34 CHAPTER 4. SPECTRUM SENSING IMPLEMENTATION

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Decimation

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

source

Figure 4.5: Flow graph used to implement the eigenvalue detector

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Decimation

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

source

Figure 4.6: Flow graph used to implement the eigenvalue detector

4.4 Eigenvalue Detector

To compute the eigenvalue ratio of the Ry(n) the flow graphs in Figure 4.5 and Figure 4.6

were considered.

Since Ry(n) is a Hermitian matrix it is only necessary to compute the upper triangular part.

In this flow graph we first compute the vector

v =[y1y∗1 ... y1y

∗L y2y

∗2 y2y

∗3 ... yLy

∗L

](4.3)

This vector is then averaged to obtain the upper triangular elements of Ry(n). With this

elements, the matrix is created and its eigenvalues computed. Before computing the eigen-

values the matrix can be whitened,by computing Q−1Ry(n)Q−1, if the user decides to do so

when instantiating the block. The eigenvalues are then sorted and the maximum-minimum

eigenvalue ratio computed.

To do this it was necessary to create four blocks:

compute vector vcc Computes the vector v

moving average vcc Computes the moving average of a vector composed by complex num-

bers

decimating average vcc Computes the decimating average of a vector composed by com-

plex numbers

eigen ratio vcf Creates the matrix, computes the eigenvalues and calculates the ratio of the

maximum minimum eigenvalues

The moving average vcc and decimating average vcc blocks are similar to the previous

Page 57: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

4.4. EIGENVALUE DETECTOR 35

YLYL*

YL-1YL-1*

YL-1YL*

YL-2YL-2*

YL-2YL-1*

YL-2YL*

Y1Y1*

... ...

123

(L+1-i)(L-i)/2tmp

Figure 4.7: Calculation of tmp

averaging blocks with the only difference that now the averaging is computed for complex

numbers.

The compute vector vcc receives a vector of samples of size L, and computes the vector v

of length vlen = (L+1)L2 .

To do this the Algorithm 1 was used. This algorithm first computes into the variable tmp a

indicator of where we are in the vector v. The position of tmp is obtained by subtracting vlen

with the arithmetic sum given by (L+1−i)(L−i)2 as depicted in Figure 4.7.

With this is then computed yiy∗i , ..., yiy

∗L and saved into the vector.

Algorithm 1 Computation of the vector v

for i = 0→ L− 1 dotmp← vlen − (L+1−i)(L−i)

2out [tmp]← in [i]× in [i]∗

for j = i+ 1→ L− 1 doout [tmp+ j − i]← in [i]× in [j]∗

j ← j + 1end fori← i+ 1

end for

The eigen ratio vcf block uses the Algorithm 2 to compute the eigenvalues ratio. In this

algorithm first the matrix filled with the elements of the averaged vector v. This is done in a

similar manner of Algorithm 1. If the user chooses to whiten the matrix, then Q−1Ry(n)Q−1

is first computed. After this the eigenvalues of matrix are calculated. To compute the eigen-

values, this block uses the GNU Scientific Library (GSL) [39]. This library uses the symmetric

bidiagonalization followed by QR reduction method to compute the eigenvalues of a Hermitian

matrix. A description of this method can be found in [16]. The eigenvalues are then sorted

using a bubble sort algorithm and the ratio between the maximum and minimum eigenvalue

Page 58: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

36 CHAPTER 4. SPECTRUM SENSING IMPLEMENTATION

computed.

Algorithm 2 Computation of eigenvalues ratio

for i = 0→ L− 1 dotmp← vlen − (L+1−i)(L−i)

2matrix [i] [i]← in [tmp]for j = i→ L− 1 domatrix [i] [j]← in [j − i+ temp]matrix [j] [i]← in [j − i+ temp]∗

j ← j + 1end fori← i+ 1

end forif whitening==1 thenmatrixgsl matrix multiply (matrix, q inv)matrixgsl matrix multiply (q inv,matrix)

end ifeigenv ← gsl comput eigenvalues (matrix)order eigenvalues(eigenv)

ratio← eigenv[L−1]eigenv[0]

4.5 Conclusion

In this chapter the implementation of the detectors was considered. It was seen that the

metric can be computed on demand or continuously, depending on the MAC layer. Also the

blocks and flow graphs necessary to implement the detectors were described. To be able to

compute the metric on demand a block was developed to grab a certain number of samples

after discarding a few samples first.

To implement the detectors it was implemented two types of averaging blocks, a decimating

average and a moving average. The difference between the two is that the moving average

computes the metric at an higher rate at the expense of added computational complexity. It

was seen that both these block have high buffer requirements.

To compute the eigenvalues of the covariance matrix the GSL library was used. It was also

necessary to enable the whitening of the covariance matrix before the computation of the

eigenvalues.

Page 59: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 5

Energy Detection Measurements

5.1 Introduction

In this chapter the performance of the implemented energy detector is evaluated. This is done

through the measurement of the decision metric, in the presence and absence of a signal.

To evaluate the detector performance it was necessary to choose a FFT bin to be analyzed.

To do this the probabilities of false alarm were evaluated for various bins.

After a bin is chosen, the behavior of the detector was evaluated by measuring the empir-

ical CDFs for various SNR and various averaging times. These were then compared with

theoretical values to verify the validity of the theoretical expressions.

It was also analyzed the effect of increasing the averaging time and the SNR on the probabil-

ities of detection.

5.2 Environment Characterization and Transmitter

In order to do the measurements, two nodes were set across a room at an approximated

distance of ten meters and in line of sight of each other. One node transmitted a DQPSK

signal and the other ran the detectors to measure the decisions on the presence or absence of

signal.

The transmitted signal was generated by modulating a pseudo random sequence of bits. The

flow graph and the characteristics of the transmitter can be found in Figure 5.1 and Table

5.1, respectively. To obtain various SNRs the numerical amplifier would be varied.

It should be noticed that the USRP2 is not designed as a measuring device. Therefore the

measured signals are proportional to the received voltage, but the proportionality constant

37

Page 60: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

38 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

Gain Interpolation Baseband Bandwidth RRC excess bandwith α

15 dB 500 33.75 KHz 0.35

Table 5.1: Transmitter Characteristics

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Figure 5.1: Flow graph used to generate the DQPSK signal

varies from device to device and from central frequency to central frequency. This means that

to obtain measurements in dBm the device needs to be calibrated. However to perform our

experiments this is not necessary and was not done.

When starting a flow graph it is necessary to wait for the RF synthesizer to settle and right

samples to propagate trough the pipeline. Therefore in all experiments the first 50 ms of data

were discarded.

5.3 Chosing an FFT bin

5.3.1 Methodology

To choose a bin to be analyzed, probabilities of false alarm were evaluated in various bins

using GNU Radio version 3.3.0.

To do this the flow graph in Figure 5.2 was used to measure the probabilities of false alarm

in various bins and the receiver was set according to Table 5.2.

The following values of M were considered for the moving average: M = 100, 200, 500, 1000,

2000.The decimator would keep one sample in M in order to eliminate decisions that are

Center Frequency Decimation Sample Frequency Nfft FFT Frequency Resolution

5 GHz 8 12.5 Ms/s 128 97.656 kHz

Table 5.2: Energy detector characteristics in first methodology

Page 61: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

5.3. CHOSING AN FFT BIN 39

S/P FFT

|(.)|²

Selector

Moving

AverageThreshold

A/D

y(t)

S/P FFT

|(.)|²

Selector

File sink

USRP source

S/P FFT

|(.)|²

Selector

Moving

AverageThreshold

USRP source

Decimator File sink

Figure 5.2: Flow graph to measure probabilities using a moving average

S/P FFT

|(.)|²

Selector

Moving

AverageThreshold

A/D

y(t)

S/P FFT

|(.)|²

Selector

File sink

USRP source

S/P FFT

|(.)|²

Selector

Moving

AverageThreshold

USRP source

Decimator File sink

Figure 5.3: Energy detection flow graph to measure received power

highly correlated.

To measure each probability at least 2000 decisions would be saved into a file and averaged.

Each measurement would be repeated 5 times to get a better estimative.

In order to select a threshold to make a decision σ2 had to be estimated. This was done using

the equation (5.1) where Pr|H0is the estimated noise power.

σ2 =Pr|H0

2(5.1)

To estimate the received noise power in a bin the flow graph in Figure 5.3 was used. The

graph would be kept running for 5 seconds generating approximately 480000 samples that

would be saved in to a file. This process was repeated 5 times to get a better estimative.

5.3.2 Measurements

In Table 5.3 we can see the the estimated σ2 on the bins 0 to 5 and the measured probabilities

of false alarm with M = 1000 for a target probability of false alarm of 5%. One can see

that in the lower bins the probabilities are higher then expected. This is explained because

the USRP2 creates a DC offset which increases the probabilities of false alarm. This can be

viewed in Figure 5.4 where is an estimate of the spectrum done with a 1024 FFT exponentially

Page 62: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

40 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

Bin 0 1 2 3 4 5

σ2 × 106 0.99 0.92 0.85 0.835 0.83 0.84

Pf 41.5% 25.9% 20.2% 6.8% 7.3% 6.17%

Table 5.3: Measured probabilities of false alarm under various bins

Figure 5.4: Estimated noise power spectrum density with a decimation of 8

averaged with α = 0.020.

This indicates that DC offset can influence the performance of the detector and that this

should be taken into account when designing a detector.

5.4 Measurements using GNU Radio

5.4.1 Methodology

To make the measurements in this section GNU Radio version 3.4.0 and the flow graph of

Figure 5.5 were used. The flow graph was ran to save 3000 samples of the decision metric

into a file. To do this the receiver was set with the characteristics found in Table 5.4. Before

actually measuring the metric the received power would be estimated with flow graph from

Figure 5.3 by saving 48000 samples into 300 files.

To estimate the received power all samples from all files would be averaged. To estimate the

Page 63: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

5.4. MEASUREMENTS USING GNU RADIO 41

Center Frequency Decimation Sample Frequency Nfft FFT Frequency Resolution

5 GHz 16 6.25 Ms/s 128 48.828 kHz

Table 5.4: Energy detector characteristics in second methodology

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|² SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold Selector

S/P FFT |(.)|²SelectorMoving

Average

USRP

sourceThreshold

S/P FFT |(.)|²SelectorMoving

Average

USRP

source

S/P FFT |(.)|²SelectorDecimating

Average

USRP

source

S/P FFTDecimating

Average|(.)|²

USRP

sourceSelector

File

Sink

Figure 5.5: Energy detection flow graph to measure probabilities using a decimating average

SNR equation (5.2) was used, where Pr|H1is the estimated power received in the presence of

signal and Pr|H0the estimated noise power.

ˆSNR =Pr|H1

− Pr|H0

Pr|H0

(5.2)

The main difference, between this methodology and the previous one, is that now GNU Radio

version 3.4.0 and the corresponding newer firmware and FPGA images was used. These new

images contain DC Offset compensation which reduce the effect seen in the previous section.

Also in Figure 5.5 all FFT bins are averaged which is more realist. This has the disadvantage

off added computer complexity and added buffer requirements.

The buffers to save previous samples were implemented using GNU Radio functionality

set history(). However this imposes a limit on the size of buffers per block which impeded

averaging sizes bigger than 500 for the used FFT size of 128. This was circumvented by using

two cascaded blocks, as depicted in Figure 5.6.

Another difference in the methodologies is that, in the one used in this section, the metric

was saved instead of the decisions, which contains more information.

5.4.2 Measurments

To make the measurements in this section the bin chosen to be analyzed was then the 20th

to avoid DC offset and therefore the transmitter was set to 5.001 GHz.

We can see in Figure 5.7 the measured empirical CDFs in the absence of signal compared

with the theoretical CDFs.

We can see that the CDFs are similar, which means that the white Gaussian noise model is

a good model to select the threshold.

In the Figure 5.8 we can see the empirical CDF of the metric when a signal is being received

Page 64: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

42 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

Decimating

Average

%M1

Decimating

Average

%(M/M1)

Decimating Average

%M

Figure 5.6: Cascaded decimating average

1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

CDF of metric under H0

Exp CDF M=100Teo CDF M=100Exp CDF M=200Teo CDF M=200Exp CDF M=500Teo CDF M=500Exp CDF M=1000Teo CDF M=1000Exp CDF M=2000Teo CDF M=2000

Figure 5.7: Measured empirical CDFs of noise in energy detection

Page 65: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

5.4. MEASUREMENTS USING GNU RADIO 43

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=1000

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure 5.8: Empirical CDFs for M=1000

for various SNRs with M = 1000. In Appendix B we can see the CDFs for M = 100, 200,

500, 1000, 2000.

We can see that this CDFs are not so close to theoretical values as in the case of false alarm.

This can be caused by the measurements not being made with enough samples, the channel

not being AWGN or the noise and SNR not being accurately estimated.

In Figure 5.9 we can see the evolution of the probabilities of detection when the averaging

time is increased. The probabilities were computed using a threshold with a target probability

of false alarm of 5%. Again we can see that the measured probabilities of detection are not so

close to the theoretical values. Also we can see the that increasing the sensing time increases

the probabilities of detection.

In Figure 5.10 we can see the effect of increasing the SNR on the probabilities of detection.

Again we can see that the measured values are considerably different then the theoretical ones

and that increasing the SNR increased the probabilities of detection.

Page 66: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

44 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

0 200 400 600 800 1000 1200 1400 1600 1800 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Averaging Size

Pd

Pd vs Sensing time

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure 5.9: Influence of averaging time in probabilities of detection on the energy detector

−20 −18 −16 −14 −12 −10 −8 −6 −4 −2 00

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

SNR (dB)

Pd

Pd vs SNR

Exp M=100Teo M=100Exp M=200Teo M=200Exp M=500Teo M=500Exp M=1000Teo M=1000Exp M=2000Teo M=2000

Figure 5.10: Influence of the SNR in probabilities of detection on the energy detector

Page 67: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

5.5. MEASUREMENTS WITH POST PROCESSING 45

0 0.2 0.4 0.6 0.8 1 1.2

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=1000

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure 5.11: Empirical CDFs for M=1000

5.5 Measurements with post processing

5.5.1 Methodology

In this section the experiment was repeated but using a different methodology. Here 18000

samples were saved into 6000 files using the flow graph of Figure 5.3.

To obtain an estimate of the received power, all samples in all files would be averaged. To

obtain the metric the first M samples of each file would be averaged, thus obtaining 6000

decision metrics.

5.5.2 Measurements

We can see the measured CDFs for various SNRs and M=1000 in Figure 5.11. The measured

CDFs for other averaging sizes are shown in Appendix C. We can see that this CDFs are closer

to the theoretical values then the previous experiment in lower SNRs. This can possibly be

explained because more samples are being used to obtain the metric. In higher SNRs however

the measured metric is not so close the the theoretical values. This may be because of the

effect of the channel not being AWGN.

In Figure 5.12 we can see the influence of increasing the averaging time on the probabilities

of detection. Here we see that the probabilities detection are closer to theory. The efect of

Page 68: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

46 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

0 200 400 600 800 1000 1200 1400 1600 1800 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Averaging Size

Pd

Pd vs Sensing time

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure 5.12: Influence of averaging time in probabilities of detection on the energy detector

the CDFs being different in higher SNRs is not observed since in higher SNRs the probability

of detection is closer to 1.

In Figure 5.13 we can see the evolution of the probabilities of detection when the SNR is

increased. Again we can see that this measurements are closer to theory.

5.6 Conclusions

In this chapter the performance of the energy detector was evaluated and the methodology

used in the measurements was described.

It was seen that in lower bins DC offset generated by the USRP2 affected the performance

of the detector. Also, it was evaluated the influence of the sensing time and SNR in the

probabilities of detection.

With this it was observed that the performance of the energy detector in the absence of signal

was not far from the theoretical values. However in the presence of signal the theoretical

expressions could not predict accurately the behavior of the detector. This could be because

the channel is not AWGN, erroneous measurements from USRP, the fact that noise changes

Page 69: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

5.6. CONCLUSIONS 47

−20 −15 −10 −5 0 5 100

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

SNR (dB)

Pd

Pd vs SNR

Exp M=100Teo M=100Exp M=200Teo M=200Exp M=500Teo M=500Exp M=1000Teo M=1000Exp M=2000Teo M=2000

Figure 5.13: Influence of the SNR in probabilities of detection on the energy detector

with time or not enough samples were used in the experiment.

For this reason the experiment was repeated using more samples. Here in lower SNRs it was

seen that the probabilities of detection were closer to the theoretical values. However, in

higher SNRs the empirical CDFs would diverge from the theoretical values, possibly because

the channel is not AWGN. This would not have much effect on the probabilities of detection

however since in higher SNRs the probabilities of detection were close to 1.

These last measurements were evaluated by post processing samples. It is left as future work

to perform these measurements in real-time.

Page 70: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

48 CHAPTER 5. ENERGY DETECTION MEASUREMENTS

Page 71: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 6

Eigenvalue Detection Measurements

6.1 Introduction

In this chapter the performance of the eigenvalue detector was evaluated. This is done through

the measurements of the eigenvalue ratio in the presence and absence of signal.

In absence of signal the empirical CDFs were compared with simulations. This was done

for an eigenvalue ratio computed without compensation of the filters and with a theoretical

compensation of the filters. As will be seen, the theoretical compensation was not enough

and so experimental compensation was also used.

To evaluate the probabilities of detection, the metric was also evaluated in the presence of

signal for various sensing times, matrix sizes and SNR.

6.2 Effect of the filtering done in the USRP

In order to evaluate the performance of the detector first the probabilities of false alarm were

evaluated without whitening the covariance matrix.

In this section, the detector was implemented using GNU Radio version 3.3.0 and the flow

graph from Figure 6.1. The receiver was set with a center frequency of 5 GHz and a gain of

30 dB.

To measure a probability 2000 decisions would be saved into a file and averaged. The exper-

iment would be repeated at least 5 times for a better estimate.

The threshold of the detector is selected using the approximated equation in [25] with a target

probability of false alarm of 5%. In Apenddix D one can see the Mathematica script used to

compute the threshold for the eigenvalue detector.

49

Page 72: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

50 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Decimation

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

sourceThreshold

File

sink

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

sourceFile

sink

Figure 6.1: Flow graph to measure probabilities on the first methodology of eigenvaluesdetection

M 100 200 500 1000

τ 1.8 1.5 1.3 1.2

Pfexp 71.5% 79.5% 91.5% 94.8%

Pfsim 3.4% 3.9% 3.2% 4.4%

Table 6.1: Measured probabilities of false alarm of the eigenvalue detector under variousaveraging sizes for a decimation of 220

A table of the thresholds for a target false alarm of 5% and measured probabilities of false

alarm can be found in Table 6.1. This table was obtained by seting the USRP with a deci-

mation of 220 and using a matrix size L=3. Also in this table some simulated probabilities

of false alarm are presented. To simulate this results the USRP source block was substituted

by a Gaussian noise source provided by GNU Radio.

As shown in Table 6.1, while the simulated probabilities are not far from theoretical ones,

the experimental results are much higher than theory. The reason for this is that while the

simulated noise is white, the observed one is not. There are two main reasons for this fact:

one is that the signal is filtered to prevent aliasing when it is decimated. This alters the shape

of the spectrum, which is no longer flat. The other is that the USRP2 creates a DC offset

that results in a spike on the spectrum.

Also in Table 6.1 we can see that increasing the sensing time increases the probability of

false alarm. This can be explained by the fact that increasing the sensing time increases the

sensibility of the detector to the correlation of signals.

In Figure 6.2 we can see the estimated spectrum at a decimation of 32, 64 and 128, in the

absence of a signal. Here we can see at low-frequencies the DC spike and at high frequencies the

effect of the filtering. The spectrum was estimated using a 1024 point,rectangular windowed

FFT, that was exponentially averaged with α = 0.055. All the estimated spectra is normalized

to the sampling frequency.

We can see the effect of changing the decimation on the probability of false alarm in Table

6.2. Here we can see that increasing the sampling frequency decreases the probability of false

Page 73: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6.2. EFFECT OF THE FILTERING DONE IN THE USRP 51

Figure 6.2: Sectrum in the absence of signal. Red with a decimation of 32, purple 64 and blue128.

Decimation 32 64 128 256

Pf 34.4% 44.4% 58.2% 66.9%

Table 6.2: Effect of sampling frequency on probabilities of false alarm

alarm. This can be explained by the fact that increasing the decimation increases the filtering

effort of the CIC filter.

In Figure 6.2 we can see the effect on the received spectrum when a decimation of 62, 63 and

64 is used. We can see that when using only the CIC the spectrum is much less flat then

when using the CIC with one or two half band filters.

In table 6.3 we can see the effect this has on the probabilities of false alarm. It is observed

that on odd decimations, since the noise is less white, the probabilities of false alarm much

higher than with a decimation factor of multiple of 4 or 2.

Decimation 62 63 64

Pf 84.4% 100% 44.4%

Table 6.3: Effect of different decimation filters on the probabilities of false alarm

Page 74: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

52 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

(a) Spectrum at decimation of 62 (b) Spectrum at decimation of 63

(c) Spectrum at decimation of 64

Figure 6.3: Estimated noise power spectrum density at different decimations

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Decimation

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Decimating

Average

File

source

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

sourceThreshold

File

sink

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

sourceFile

sink

File

sink

USRP

source

File

sink

Figure 6.4: Flow graph to grab samples to be post-processed

6.3 Whitening of the matrix

6.3.1 Methodology

To evaluate the effect of whitening the covariance matrix the CDFs of the metric in the

absence of signal were evaluated.

To do this, first 30 × 106 samples were recorded into a file using GNU Radio version 3.4.0

and the flow graph of figure 6.4. The receiver was set with the characteristics of Table 6.4.

To obtain the eigenvalue ratio from the recorded samples the flow graph from Figure 6.5 was

used generating at least 2000 decision metrics.

Page 75: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6.3. WHITENING OF THE MATRIX 53

Center Frequency Receive Gain Decimation

5.5 GHz 46 dB 128

Table 6.4: Receiver characteristics of the receiver to record samples

DQPSK

Modulation

Numerical

AmplifierUSRP Sink

Pseudo

Random

Source

S/P AutocorrelationEigenvalue

ratio

Moving

Average

File

sink

USRP

source

S/P yi y*kEigenvalue

ratio

Moving

AverageFile

sink

USRP

source

Bytes to

Chunks

Gray

Mapping

Differential

encoding

Root Raised

Cosine Filter

DQPSK Modulation

Chunks to

Symbol

Decimation

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

source

S/P yi y*kEigenvalue

ratio

Decimating

Average

File

source

S/P yi y*kEigenvalue

ratio

Moving

Average

USRP

sourceThreshold

File

sink

S/P yi y*kEigenvalue

ratio

Decimating

Average

USRP

sourceFile

sink

File

sink

Figure 6.5: Flow graph to compute eigenvalue ratio from recorded samples

6.3.2 Measurements without withening

In Figure 6.6 we can see the measured metric compared with Monte Carlo simulations. Even

though there is a manner to compute the exact CDF I have found that the computational

complexity to compute the CDF at reasonable values for matrix and averaging size was too

high and for that reason Monte Carlo simulations were used. Again we see the fact that

measured metric is much higher then theoretical values and that increasing the sensitivity of

the detector increases the difference between the measured and theoretical values.

6.3.3 Measurements with theoretical whitening

To whiten the matrix first is necessary to accurately model the reception filters of the USRP.

As explained in Section 3.2 the decimation in the USRP is a three stage process where the

signal first is affected by a CIC filter, followed by two HB filters.

The CIC filter is a 4 stage CIC and therefore can be modeled as 4 cascaded moving average

filters where the length of the averaging windows is equal to the decimation factor. The

impulse response of CIC hCIC is then given by convoluting 4 moving averages filter.

To model the decimation process we can use a decimation matrix. In equation (6.1) is depicted

a decimation matrix for a decimation of 3.

To model the half band filters we can use equation (2.38) where h will have the taps of the

half band filters.

This allows us to model the matrix H as (6.2) where Dn is a decimation matrix with a

decimation factor of n, N CIC the decimation factor of the CIC stage, HCIC is the matrix

that models the CIC, HHB1 and HHB2 the matrix that models the first half band and the

Page 76: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

54 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

second, respectively.

D3 =

1 0 0 0 0 0 0 0 . . .

0 0 0 1 0 0 0 0 . . .

0 0 0 0 0 0 1 0 . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . .

(6.1)

H = D2HHB2D2HHB1DN CICHCIC (6.2)

Using this to compute the matrix Q−1 through equation (2.39) it was possible to whiten the

matrix before computing the eigenvalues. In Figure 6.7 we can see that the whitening of

matrix considerably reduced the difference between the experimental and simulated values.

However we can see that the difference is still considerable and also that difference continuous

to increase with the increase of averaging time. This can be because of bad characterization

of the filters, either due to non-linearities on the reception, the presence of DC Offset or spurs,

or because the effect of the analogic filters on the daughterboard were despised.

6.3.4 Measurements with experimental whitening

Since it was observed that whitening the matrix with a theoretical model of the USRP was

not enough an experimental model was used. Here the matrix HHH was first estimated by

saving 7.7 × 106 samples into 5 files using the flow graph in 6.4. After this Ry would be

estimated using all samples.

In Figure 6.8 we can see the empirical CDFs using this experimental whitening. We can see

that by using this method the empirical CDFs are now similar to the simulated ones.

6.4 Probabilities of detection

To evaluate the probabilities of detection of the eigenvalue detector the two nodes were set

equally to Section 5.2 of the previous chapter.

To obtain the eigenvalue ratio the methodology used was equal to the one in Section 6.3.1.

In Figures ?? and ?? we can see the evolution of the probabilities of detection with the aver-

aging time for different matrix sizes. The measurements were obtained using the experimental

whitening and the threshold was selected from Monte Carlo simulations with a target prob-

ability of false alarm of 5%. Here we can see that increasing the matrix size and increasing

Page 77: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6.5. CONCLUSIONS 55

the averaging size increases the probabilities of detection, as expected.

6.5 Conclusions

In the eigenvalue detector it was observed that received noise is not white, which severely com-

promises the performance of the detector. It was also seen that choosing different decimations

affects the detector since different anti-aliasing filters are used.

To compensate this it was tried to whiten the covariance matrix considering the anti-aliasing

filters of the USRP. It was seen that this was not enough to obtain a good performance of the

detector in the absence of signal. To circumvent this problem the covariance matrix was first

estimated and this estimation used to whiten the covariance matrix. It was seen that this can

be used to obtain a good performance of the detector in the absence of signal.

It was also observed the performance of the detector in the presence of signal and verified

that increasing the number of samples used increases the probabilities of detection.

Page 78: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

56 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.80

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

Offline filtered noise L=3 M=100

ExperimentalSimulated

(a) Averaging size of 100 samples

1 1.2 1.4 1.6 1.8 2 2.2 2.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

Offline filtered noise L=3 M=200

ExperimentalSimulated

(b) Averaging size of 200 samples

1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.90

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

Offline filtered noise L=3 M=500

ExperimentalSimulated

(c) Averaging size of 500 samples

1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.80

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

Offline filtered noise L=3 M=1000

ExperimentalSimulated

(d) Averaging size of 1000 samples

1 1.1 1.2 1.3 1.4 1.5 1.6 1.70

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

fa

Offline filtered noise L=3 M=2000

ExperimentalSimulated

(e) Averaging size of 2000 samples

Figure 6.6: Measured and simulated CDFs of eigenvalue detector for a matrix size of 3

Page 79: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6.5. CONCLUSIONS 57

1 1.2 1.4 1.6 1.8 2 2.2 2.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline whitened noise L=3 M=100

Threshold

1−P

fa

ExperimentalSimulated

(a) Averaging size of 100 samples

1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.80

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline whitened noise L=3 M=200

Threshold

1−P

fa

ExperimentalSimulated

(b) Averaging size of 200 samples

1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.50

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline whitened noise L=3 M=500

Threshold

1−P

fa

ExperimentalSimulated

(c) Averaging size of 500 samples

1 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline whitned noise L=3 M=1000

Threshold

1−P

fa

ExperimentalSimulated

(d) Averaging size of 1000 samples

1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.20

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline whitened noise L=3 M=2000

Threshold

1−P

fa

ExperimentalSimulated

(e) Averaging size of 2000 samples

Figure 6.7: Measured and simulated CDFs of eigenvalue detector for a matrix size of 3 usingtheoretical whitening

Page 80: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

58 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

1 1.2 1.4 1.6 1.8 2 2.2 2.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline exp whitened noise L=3 M=100

Threshold

1−P

fa

ExperimentalSimulated

(a) Averaging size of 100 samples

1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.80

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline exp whitened noise L=3 M=200

Threshold

1−P

fa

ExperimentalSimulated

(b) Averaging size of 200 samples

1 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline exp whitened noise L=3 M=500

Threshold

1−P

fa

ExperimentalSimulated

(c) Averaging size of 500 samples

1 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline exp whitned noise L=3 M=1000

Threshold

1−P

fa

ExperimentalSimulated

(d) Averaging size of 1000 samples

1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.220

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1Offline exp whitened noise L=3 M=2000

Threshold

1−P

fa

ExperimentalSimulated

(e) Averaging size of 2000 samples

Figure 6.8: Measured and simulated CDFs of eigenvalue detector for a matrix size of 3 usingexperimental whitening

Page 81: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

6.5. CONCLUSIONS 59

0 200 400 600 800 1000 1200 1400 1600 1800 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Averaging Size

Pd

SNR=−5SNR=−11SNR=−14SNR=−17SNR=−20

Figure 6.9: Probabilities of detection of the eigenvalue detector for a matrix size of 3

0 200 400 600 800 1000 1200 1400 1600 1800 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Averaging Size

Pd

SNR=−5SNR=−11SNR=−14SNR=−17SNR=−20

Figure 6.10: Probabilities of detection of the eigenvalue detector for a matrix size of 5

Page 82: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

60 CHAPTER 6. EIGENVALUE DETECTION MEASUREMENTS

Page 83: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 7

Small Network Implementation

7.1 Introduction

In this chapter a unidirectional link between two USRPs was developed. This link tried to

avoid interference by changing channel when the packet error rate (PER) was higher than a

threshold. To do this the receiver periodically send control messages in a control channel that

would not be interfered. Both the transmitter and the receiver were based on tunnel.py code

that comes as an example in GNU Radio.

To interfere with the communication, an interferer was developed that uses spectrum sensing

to detect where the transmission is and interfere on that frequency. This interferer will observe

a larger bandwidth than the one allowed by its sampling rate, by changing the center frequency

where it senses.

7.2 Interferer

The interferer was adapted from the spectrum sense.py script that comes with GNU Radio.

The flow graph used to do the spectrum sensing is depicted in Figure 7.1. Here instead of

a normal average, an exponential average was used to reduce the buffer requirements. The

exponential average is based on equation (7.1).

y[n] = αx[n] + (1− α)y[n− 1] (7.1)

In this flow graph the grab samples block lets a certain amount of samples pass, after

discarding some of them to take into account the tune delay. The bin statistics block will

61

Page 84: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

62 CHAPTER 7. SMALL NETWORK IMPLEMENTATION

USRPGrab

SamplesS/P FFT |(.)|

2 Exponential

Average

Bin

Statistics

Figure 7.1: Energy detector used in the interferer

call a callback from C++ to the Python world where the USRP will be re-tuned and the

information of the decision metric will be passed to a vector in Python. When all the desired

bandwidth is analyzed, the interferer will plot the vector and search for its maximum. In the

frequency where the estimated received power is maximum is where the interferer will start

to interfere.

In Figure 7.2 and 7.3 we can see a plot of the spectrum sensing in the presence and absence

of a signal.

After the sensing, the interferer starts to transmit noise in the selected frequency for a certain

amount of time. When it is done transmitting it returns to sensing, after waiting some time

for the USRP to switch from transmit to receive.

7.3 Transmitter and receiver

The transmitter and receiver were based on the script tunnel.py of GNU Radio which im-

plements a physical layer and a rudimentary MAC layer. The MAC layer was modified to

implement a time division duplex scheme (TDD). Using this link video would be transmitted

from one node to another.

In this link the receiver would decide on what frequency to transmit. It would do so by

changing the channel if the packet error rate was too high. To change channel it needed to

inform the transmitter what channel to change to. This was done by transmitting feedback

in a more reliable control channel that does not suffer from interference.

To implement the TDD, first an algorithm as depicted in Figure 7.4 was implemented. Here

the receiver would block waiting for the first packet before starting his timer. After each node

counted the Data time, the receiver would wait a Small guard time to have time to change

frequency and the transmitter would wait for a Big guard time to take into account jitter and

round trip time.

However, this algorithm would get unsynchronized after a few minutes and so the algorithm

in Figure 7.5 was implemented.

Page 85: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

7.3. TRANSMITTER AND RECEIVER 63

Figure 7.2: Spectrum analyzed between the 2.501 GHz and 2.510 GHz in the abcesnse of asignal

Page 86: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

64 CHAPTER 7. SMALL NETWORK IMPLEMENTATION

Figure 7.3: Spectrum analyzed between the 2.501 GHz and 2.510 GHz in the presence of asignal

Sync

TimeData Tx

Big

Guard

Feedback

Time

Data Tx

Tx

Rx

Data RxSmall

Guard

Feedback

Time

Sync

Time

End of

Loop

GuardSync

Time

Sync

Time

...

...

...

...

Waiting

Big

Guard

...

Feedback

Time

...

Data Tx

Data RxSmall

GuardFeedback

Time

Data Rx ...Big Guard

Small

Guard

...

...

Tx

Rx

Figure 7.4: Implementation of TDD without synchronization messages

Page 87: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

7.3. TRANSMITTER AND RECEIVER 65

Sync

TimeData Tx

Big

Guard

Feedback

Time

Data Tx

Tx

Rx

Data RxSmall

Guard

Feedback

Time

Sync

Time

End of

Loop

GuardSync

Time

Sync

Time

...

...

...

...

Waiting

Big

Guard

...

Feedback

Time

...

Data Tx

Data RxSmall

GuardFeedback

Time

Data Rx ...Big Guard

Small

Guard

...

...

Tx

Rx

Figure 7.5: Implementation of TDD with synchronization messages

Here the transmitter timer would be the master and synchronization messages would be sent

at the beggining of each transmission loop on the control channel. This messages did not

carry any information and the receiver would only wait for the first one to start its timer at

the beginning of each loop. This would give more stability to the link at the cost of extra

guard times.

However the the guard times achieved were not low enough, and the interruption of the video

stream was visible. We can see the used times below:

• Sync Time: 0.1 seconds

• Data Time: 15 seconds

• Small Guard Time: 0.1 seconds

• Big Guard Time: 1 seconds

• Feedback Time: 2 seconds

• End of Loop Guard: 1.6 seconds

It should be noted some flaws in the algorithm used to avoid interference. The first problem

is that the PER, computed from the packets error correcting codes, was used to avoid inter-

ference. This means that if the interference was to high, the packets would not be recognized

and the PER would not be correctly computed, which means that data channel would not be

changed. A more interesting solution would be having the nodes to actually spectrum sense.

Page 88: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

66 CHAPTER 7. SMALL NETWORK IMPLEMENTATION

7.4 Conclusions

In this chapter the implementation of a small network is described. A simple interferer that

uses spectrum sensing was implemented. Also a transmitter and a receiver that tried to avoid

interference were implemented. These transmitter and receiver did not perform well enough to

stream video due to very large guard times. As a future work these times should be optimized.

Also the manner how the interference is detected should be different since if the interference

is to high the channel will not be changed.

Page 89: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Chapter 8

Conclusion and Future Work

In this thesis an experimental study of the energy detector and the eigenvalue detector was

performed.

It was seen that imperfections in the USRP2 such as DC Offset, spurs, filtering and the fact

that the channel is not AWGN can create results different from the theory.

Specifically in the energy detector it was seen an increase of the probabilities of false alarm

in lower bins of the FFT due to DC offset. It was also seen that if the analyzed bin is chosen

carefully the probabilities of false alarm are close to the theory. It was observed as well that

in this test environment the probabilities of detection can be reasonably predicted with the

theoretical expressions for the AWGN channel.

In the eigenvalue detector it was seen that the filtering during the decimation process affects

significantly the performance of the eigenvalue detector, by increasing the probabilities of false

alarm. Modeling theoretically this process can reduce substancialy the probabilities of false

alarm, but they would still be higher then expected. Worse, the difference would increase as

the sensitivity of the detector is increased.

For that reason experimental modeling of covariance matrix was used, and it was shown that

it is possible to obtain probabilities of false alarm that are similar to what is expected.

As future work, it would be interesting to repeat the experiments that were done in off line

mode in real time to see if the results are similar. Also it would be interesting to analyze the

probabilities of detection of the energy detector by using theoretical models that take fading

into account.

Another useful work would be to implement more detectors and divulge the code, creating a

spectrum sensing library that could be used by the community.

67

Page 90: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

68 CHAPTER 8. CONCLUSION AND FUTURE WORK

Page 91: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Appendix A

Dial Tone Script

#!/usr/bin/env python

#

# Copyright 2004 ,2005 ,2007 Free Software Foundation , Inc.

#

# This file is part of GNU Radio

#

# GNU Radio is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation; either version 3, or (at your option)

# any later version.

#

# GNU Radio is distributed in the hope that it will be useful ,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with GNU Radio; see the file COPYING. If not , write to

# the Free Software Foundation , Inc., 51 Franklin Street ,

# Boston , MA 02110 -1301 , USA.

#

69

Page 92: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

70 APPENDIX A. DIAL TONE SCRIPT

from gnuradio import gr

from gnuradio import audio

from gnuradio.eng_option import eng_option

from optparse import OptionParser

class my_top_block(gr.top_block ):

def __init__(self):

gr.top_block.__init__(self)

"""

Comand line options

"""

parser = OptionParser(option_class=eng_option)

parser.add_option("-O","--audio -output",type="string",default="",

help="pcm output device name")

parser.add_option("-r","--sample -rate",type="eng_float",

default =48000 ,

help="set sample rate to RATE (48000)")

(options , args) = parser.parse_args ()

if len(args) != 0:

parser.print_help ()

raise SystemExit , 1

sample_rate = int(options.sample_rate)

ampl = 0.1

"""

Create a Sinosoid sources with a frequencies of 350 and 440

The sample rate used to create the sinusoids

is the same as the audio card

Page 93: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

71

"""

src0 = gr.sig_source_f (sample_rate , gr.GR_SIN_WAVE , 350, ampl)

src1 = gr.sig_source_f (sample_rate , gr.GR_SIN_WAVE , 440, ampl)

"""

Creates audio card sink

"""

dst = audio.sink (sample_rate , options.audio_output)

self.connect (src0 , (dst , 0)) #Conects port 0 of source 0 to

#port 0 of the audio card

self.connect (src1 , (dst , 1)) #Conects port 0 of source 1 to

#port 1 of the audio card

if __name__ == ’__main__ ’:

try:

my_top_block (). run() #Starts Runing the flow graph

#and waits for him to finish.

except KeyboardInterrupt:

pass

Page 94: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

72 APPENDIX A. DIAL TONE SCRIPT

Page 95: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Appendix B

Energy detection CDFs using GNU

Radio

73

Page 96: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

74 APPENDIX B. ENERGY DETECTION CDFS USING GNU RADIO

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=100

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure B.1: Empirical CDFs for M=100

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=200

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure B.2: Empirical CDFs for M=200

Page 97: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

75

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=500

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure B.3: Empirical CDFs for M=500

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=1000

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure B.4: Empirical CDFs for M=1000

Page 98: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

76 APPENDIX B. ENERGY DETECTION CDFS USING GNU RADIO

1 2 3 4

x 10−4

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=2000

Exp CDF SNR=−19.2Teo CDF SNR=−19.2Exp CDF SNR=−15.7Teo CDF SNR=−15.7Exp CDF SNR=−12Teo CDF SNR=−12Exp CDF SNR=−10Teo CDF SNR=−10Exp CDF SNR=−8.2Teo CDF SNR=−8.2Exp CDF SNR=−4.19Teo CDF SNR=−4.19Exp CDF SNR=−0.866Teo CDF SNR=−0.866

Figure B.5: Empirical CDFs for M=2000

Page 99: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Appendix C

Energy Detection CDFs using

Offline Processing

77

Page 100: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

78 APPENDIX C. ENERGY DETECTION CDFS USING OFFLINE PROCESSING

0 0.2 0.4 0.6 0.8 1 1.2 1.4

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=100

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure C.1: Empirical CDFs for M=100

0 0.2 0.4 0.6 0.8 1 1.2

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=200

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure C.2: Empirical CDFs for M=200

Page 101: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

79

0 0.2 0.4 0.6 0.8 1 1.2 1.4

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=500

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure C.3: Empirical CDFs for M=500

0 0.2 0.4 0.6 0.8 1 1.2

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=1000

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure C.4: Empirical CDFs for M=1000

Page 102: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

80 APPENDIX C. ENERGY DETECTION CDFS USING OFFLINE PROCESSING

0 0.2 0.4 0.6 0.8 1 1.2

x 10−3

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Threshold

1−P

d

CDF for M=2000

Exp CDF SNR=−18Teo CDF SNR=−18Exp CDF SNR=−12.4Teo CDF SNR=−12.4Exp CDF SNR=−11.3Teo CDF SNR=−11.3Exp CDF SNR=−7.92Teo CDF SNR=−7.92Exp CDF SNR=−5.59Teo CDF SNR=−5.59Exp CDF SNR=−2.46Teo CDF SNR=−2.46Exp CDF SNR=0.837Teo CDF SNR=0.837Exp CDF SNR=4.43Teo CDF SNR=4.43Exp CDF SNR=7.44Teo CDF SNR=7.44

Figure C.5: Empirical CDFs for M=2000

Page 103: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Appendix D

Eigenvalue Threshold Mathematica

Script

ClearAllClearAllClearAll

ng = 8(* number of averages*)ng = 8(* number of averages*)ng = 8(* number of averages*)

kg = 3(*size of matrix*)kg = 3(*size of matrix*)kg = 3(*size of matrix*)

T = 10.13(*Threshold*)T = 10.13(*Threshold*)T = 10.13(*Threshold*)

const = 1(∏kgm=1(ng−m)!∗(kg−m)!

) ;const = 1(∏kgm=1(ng−m)!∗(kg−m)!

) ;const = 1(∏kgm=1(ng−m)!∗(kg−m)!

) ;

N [const];N [const];N [const];

q = ((ng− kg) + i+ j − 1); q = 1;q = ((ng− kg) + i+ j − 1); q = 1;q = ((ng− kg) + i+ j − 1); q = 1;

g1[i , j ,m , n , l ]:=Which[i < n&&j < m,g1[i , j ,m ,n , l ]:=Which[i < n&&j < m,g1[i , j ,m ,n , l ]:=Which[i < n&&j < m,

Gamma[ng− kg + i+ j − 1, 0, l],Gamma[ng− kg + i+ j − 1, 0, l],Gamma[ng− kg + i+ j − 1, 0, l],

i ≥ n&&j ≥ m,i ≥ n&&j ≥ m,i ≥ n&&j ≥ m,

Gamma[ng− kg + i+ j + 1, 0, l],Gamma[ng− kg + i+ j + 1, 0, l],Gamma[ng− kg + i+ j + 1, 0, l],

1 == 1,1 == 1,1 == 1,

Gamma[ng− kg + i+ j, 0, l]]Gamma[ng− kg + i+ j, 0, l]]Gamma[ng− kg + i+ j, 0, l]]

gk[i , j ,m ,n , l ]:=Which[i < n&&j < m,gk[i , j ,m ,n , l ]:=Which[i < n&&j < m,gk[i , j ,m , n , l ]:=Which[i < n&&j < m,

Gamma[ng− kg + i+ j − 1, l],Gamma[ng− kg + i+ j − 1, l],Gamma[ng− kg + i+ j − 1, l],

i ≥ n&&j ≥ m,i ≥ n&&j ≥ m,i ≥ n&&j ≥ m,

Gamma[ng− kg + i+ j + 1, l],Gamma[ng− kg + i+ j + 1, l],Gamma[ng− kg + i+ j + 1, l],

81

Page 104: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

82 APPENDIX D. EIGENVALUE THRESHOLD MATHEMATICA SCRIPT

1 == 1,1 == 1,1 == 1,

Gamma[ng− kg + i+ j, l]]Gamma[ng− kg + i+ j, l]]Gamma[ng− kg + i+ j, l]]

M1[n ,m , l ]:=Table [g1[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]M1[n ,m , l ]:=Table [g1[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]M1[n ,m , l ]:=Table [g1[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]

Mk[n ,m , l ]:=Table [gk[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]Mk[n ,m , l ]:=Table [gk[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]Mk[n ,m , l ]:=Table [gk[i, j, n,m, l], {i, kg− 1}, {j, kg− 1}]

MatrixForm [M1[2, 2, x]]MatrixForm [M1[2, 2, x]]MatrixForm [M1[2, 2, x]]

MatrixForm [Mk[2, 2, x]]MatrixForm [Mk[2, 2, x]]MatrixForm [Mk[2, 2, x]]

f1[l ]:=const ∗∑kg

n=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [M1[n,m, l]]

)f1[l ]:=const ∗

∑kgn=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [M1[n,m, l]]

)f1[l ]:=const ∗

∑kgn=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [M1[n,m, l]]

)f1[0.1]f1[0.1]f1[0.1]

fk[l ]:=const ∗∑kg

n=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [Mk[n,m, l]]

)fk[l ]:=const ∗

∑kgn=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [Mk[n,m, l]]

)fk[l ]:=const ∗

∑kgn=1

(∑kgm=1(−1)n+m ∗ lng−kg+n+m−2 ∗ E−l ∗Det [Mk[n,m, l]]

)fk[0.1]fk[0.1]fk[0.1]

fTapp[t ]:=Which[t ≤ 1,fTapp[t ]:=Which[t ≤ 1,fTapp[t ]:=Which[t ≤ 1,

0,0,0,

t > 1,t > 1,t > 1,

NIntegrate [l ∗ f1[t ∗ l] ∗ fk[l], {l, 0, Infinity}]]NIntegrate [l ∗ f1[t ∗ l] ∗ fk[l], {l, 0, Infinity}]]NIntegrate [l ∗ f1[t ∗ l] ∗ fk[l], {l, 0, Infinity}]]

fTapp[0.05]fTapp[0.05]fTapp[0.05]

NIntegrate [fTapp[x], {x, 0, T}] (*Result of this integration will be 1− Pfa*)NIntegrate [fTapp[x], {x, 0, T}] (*Result of this integration will be 1− Pfa*)NIntegrate [fTapp[x], {x, 0, T}] (*Result of this integration will be 1− Pfa*)

Page 105: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

Bibliography

[1] Pedro Alvarez, Nuno Pratas, Antonio Rodrigues, Neeli Prasad, and Ramjee Prasad. En-

ergy detection and eigenvalue based detection: An experimental study using gnu radio. In

Wireless Personal Multimedia Communications Symposium, 2011. WPMC’11, October

2011.

[2] A. Bejan. Largest eigenvalues and sample covariance matrices. Master’s thesis, Depart-

ment of Statistics, The University of Warwick, 2005.

[3] T.X. Brown. An analysis of unlicensed device operation in licensed broadcast service

bands. In New Frontiers in Dynamic Spectrum Access Networks, 2005. DySPAN 2005.

2005 First IEEE International Symposium on, pages 11 –29, Nov. 2005.

[4] T.X. Brown. An analysis of unlicensed device operation in licensed broadcast service

bands. In New Frontiers in Dynamic Spectrum Access Networks, 2005. DySPAN 2005.

2005 First IEEE International Symposium on, pages 11 –29, Nov. 2005.

[5] J.L. Burbank. Security in cognitive radio networks: The required evolution in approaches

to wireless network security. In Cognitive Radio Oriented Wireless Networks and Com-

munications, 2008. CrownCom 2008. 3rd International Conference on, pages 1 –7, May

2008.

[6] L.S. Cardoso, M. Debbah, P. Bianchi, and J. Najim. Cooperative spectrum sensing

using random matrix theory. In Wireless Pervasive Computing, 2008. ISWPC 2008. 3rd

International Symposium on, pages 334 –338, May 2008.

[7] A.V. Dandawate and G.B. Giannakis. Statistical tests for presence of cyclostationarity.

IEEE Transactions on Signal Processing, 1994.

83

Page 106: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

84 BIBLIOGRAPHY

[8] F. F. Digham, M.-S. Alouini, and M. K. Simon. On the energy detection of unknown

signals over fading channels. Communications, IEEE Transactions on, 55(1):21 –24, Jan.

2007.

[9] F.F. Digham, M.-S. Alouini, and M.K. Simon. On the energy detection of unknown

signals over fading channels. In IEEE International Conference on Communications,

2003.

[10] T.L. Doumi. Spectrum considerations for public safety in the united states. IEEE

Communications Magazine, 2006.

[11] FCC. ET Docket No. 03-322. Notice of Proposed Rule Making and Order, December

2003.

[12] W. Gardner and L. Franks. Characterization of cyclostationary random signal processes.

IEEE Transactions on Information Theory, 1975.

[13] William A. Gardner. Introduction to Random Processes. McMillan, 1st edition edition,

1986.

[14] William A. Gardner, Antonio Napolitano, , and Luigi Paura. Cyclostationarity: Half a

century of research. In Signal Processing, volume 86, page 63969, 2006.

[15] Amir Ghasemi and Elvino S. Sousa. Spectrum sensing in cognitive radio networks: Re-

quirements, challanges and design trade-offs. IEEE Communications Magazine, 2008.

[16] Gene H. Golub and Charls F. Van Loan. Matrix Computations. The Johns Hopkins

University Press, 3th edition edition, 1996.

[17] S. P. Herath, N. Rajatheva, and C. Tellambura. Energy detection of unknown signals

in fading and diversity reception. Communications, IEEE Transactions on, 59(9):2443

–2453, September 2011.

[18] V.I. Kostylev. Energy detection of a signal with random amplitude. In Communications,

2002. ICC 2002. IEEE International Conference on, volume 3, pages 1606 – 1610 vol.3,

2002.

[19] R. Lau et al. Cognitive adaptive radio teams. In 3rd Annual IEEE Communications

Society on Sensor and Ad Hoc Communications and Networks, 2006.

Page 107: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

BIBLIOGRAPHY 85

[20] Jun Ma et al. Signal processing in cognitive radio. In Proceeddings of IEEE, volume 97,

May 2009.

[21] Jun Ma, Guodong Zhao, and Ye Li. Soft combination and detection for cooperative spec-

trum sensing in cognitive radio networks. Wireless Communications, IEEE Transactions

on, 7(11):4502 –4507, November 2008.

[22] Jun Ma, Guodong Zhao, and Ye Li. Soft combination and detection for cooperative spec-

trum sensing in cognitive radio networks. IEEE Transactions wireless communications,

2008.

[23] Valeria Orani. Wavelet Spectrum Sensing and Transmission System (WS-SaT-System)

based on WPDM. PhD thesis, University of Cagliari, 2003.

[24] P. Pawelczak, R. Venkatesha Prasad, L. Xia, and I.G.M.M. Niemegeers. Cognitive radio

emergency networks - requirements and design. In First IEEE International Symposium

on New Frontiers in Dynamic Spectrum Access Networks, 2005.

[25] F. Penna, R. Garello, D. Figlioli, and M.A. Spirito. Exact non-asymptotic threshold for

eigenvalue-based spectrum sensing. In Cognitive Radio Oriented Wireless Networks and

Communications, 2009. CROWNCOM ’09. 4th International Conference on, pages 1 –5,

June 2009.

[26] N. Pratas, N. Marchetti, N.R. Prasad, A. Rodrigues, and R. Prasad. Centralized cooper-

ative spectrum sensing for ad-hoc disaster relief network clusters. In IEEE International

Conference on Communications, 2010.

[27] N. Pratas, N. Marchetti, N.R. Prasad, A. Rodrigues, and R. Prasad. Decentralized co-

operative spectrum sensing for ad-hoc disaster relief network clusters. In IEEE 71stVe-

hicular Technology Conference, 2010.

[28] N. Pratas, F. Meucci, D. Zrno, N.R. Prasad, A. Rodrigues, and R. Prasad. Cogito test-

bed - wireless research evolved. In Cognitive Radio and Advanced Spectrum Management,

2009. CogART 2009. Second International Workshop on, pages 116 –121, May 2009.

[29] John Proakis. Digital Communications. McGraw-Hill, 4th edition edition, 2001.

[30] M. Renzo, L. Imbriglio, F. Graziosi, and F. Santucci. Distributed data fusion over

correlated log-normal sensing and reporting channels: Application to cognitive radio

Page 108: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

86 BIBLIOGRAPHY

networks. Wireless Communications, IEEE Transactions on, 8(12):5813 –5821, December

2009.

[31] Ettus Research. Daughterboards datasheet. http://www.ettus.com/downloads/ettus/

daughterboards.pdf, May 2011.

[32] Ettus Research. Usrp2 datasheet. http://www.ettus.com/downloads/ettus/ds/

usrp2/v5.pdf, May 2011.

[33] Chunhua Sun, Wei Zhang, and K.B. Letaief. Cooperative spectrum sensing for cogni-

tive radios under bandwidth constraints. In Wireless Communications and Networking

Conference, 2007.WCNC 2007. IEEE, pages 1 –5, March 2007.

[34] H. Tang. Some physical layer issues of wide-band cognitive radio systems. In New

Frontiers in Dynamic Spectrum Access Networks, 2005.

[35] Zhi Tian and Georgios B. Giannakis. A wavelet approach to wideband spectrum sensing

for cognitive radios. In Cognitive Radio Oriented Wireless Networks and Communica-

tions, 2006. 1st International Conference on, pages 1 –5, June 2006.

[36] A. M. Tulino and S. Verdu. Random Matrix Theory and Wireless Communications.

Hanover, USA: now Publishers Inc., 2004.

[37] Vesa Turune et al. Implementation of cyclostationary feature detector for cognitive ra-

dios. 4th International Conference on Cognitive Radio Oriented Wireless Networks and

Communications, 2009.

[38] V. Valenta, R. Marsalek, G. Baudoin, M. Villegas, M. Suarez, and F. Robert. Survey on

spectrum utilization in europe: Measurements, analyses and observations. In Cognitive

Radio Oriented Wireless Networks Communications (CROWNCOM), 2010 Proceedings

of the Fifth International Conference on, pages 1 –5, June 2010.

[39] Gnu scientific library. http://www.gnu.org/s/gsl/, May 2011.

[40] Simplified wrapper and interface generator. http://www.swig.org/, May 2011.

[41] Yonghong Zeng and Ying chang Liang. Eigenvalue-based spectrum sensing algorithms for

cognitive radio. Communications, IEEE Transactions on, 57(6):1784 –1793, June 2009.

Page 109: Experimental Study on Spectrum Sensing for Cognitive Radio … · Experimental Study on Spectrum Sensing for Cognitive Radio Networks Pedro Jos e Pinheiro de Almeida Alvarez Dissertation

BIBLIOGRAPHY 87

[42] Yonghong Zeng, Choo Leng Koh, and Ying-Chang Liang;. Maximum eigenvalue detec-

tion: Theory and application. In New Frontiers in Dynamic Spectrum Access Networks,

2008.

[43] Yonghong Zeng and Ying-Chang Liang. Covariance based signal detections for cognitive

radio. In New Frontiers in Dynamic Spectrum Access Networks, 2007.

[44] Yonghong Zeng and Ying-Chang Liang. Maximum-minimum eigenvalue detection for

cognitive radio. In Personal, Indoor and Mobile Radio Communications, 2007. PIMRC

2007. IEEE 18th International Symposium on, pages 1 –5, Sept. 2007.

[45] Yonghong Zeng and Ying-Chang Liang. Spectrum-sensing algorithms for cognitive radio

based on statistical covariances. IEEE Transactions on vehicular technology, 2009.

[46] Q. Zhang, F. W. Hoeksema, A. B. J. Kokkeler, and G. J. M. Smit. Towards cognitive radio

for emergency networks. In Mobile Multimedia: Communication Engineering Perspective.

USA: Nova Publishers, 2006.