FUZZY BASED DECISION FUSION FOR CO-OPERATIVE SPECTRUM SENSING IN COGNITIVE RADIO

Embed Size (px)

DESCRIPTION

This project focuses on co-operative spectrum sensing and decision making using fuzzy logic.

Citation preview

  • FUZZY BASED DECISION FUSION FOR

    CO-OPERATIVE SPECTRUM SENSING IN

    COGNITIVE RADIO

    PROJECT REPORT

    Submitted in partial fulfillment of the

    requirements for the award of the degree of

    Bachelor of Technologyin

    ELECTRONICS AND COMMUNICATION ENGINEERING

    of

    MAHATMA GANDHI UNIVERSITY

    by

    SIJO JOSEPH(201054)

    MITHUN MATHEW(201015)

    NITHIN CLEETUS(201027)

    PAUL JAMES(201029)

    Department of Electronics and Communication EngineeringRajagiri School of Engineering and Technology

    Rajagiri Valley, Kakkanad, Kochi, 682039

    2012-2013

  • Rajagiri Valley, Cochin - 682 039

    DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

    CERTIFICATE

    Certified that this a bonafide report of the project titled FUZZY BASED DECISION FU-

    SION FOR CO-OPERATIVE SPECTRUM SENSING IN COGNITIVE RADIO

    Sijo Joseph (201054) of eighth semester Electronics and Communication Engineering in par-

    tial fulfillment of the requirement for the award of degree of Bachelor of Technology in Electronics

    and Communication Engineering of the Mahatma Gandhi University, Kottayam, during the aca-

    demic year 2012-2013.

    Mr. Jaison Jacob Mr.Jaison Jacob

    Project Guide Head of Department

    Place: Kakkanad

    Date:

  • ACKNOWLEDGEMENTS

    I wish to take this opportunity as our privilege to thank all whose persistent contributions have

    helped me in the fulfillment of this project.

    First and foremost I would like to thank almighty God whose grace was there throughout the

    course of the project.

    I would like to express my deep gratitude to our guide Mr.Jaison Jacob, HOD, Dept. of

    Electronics, RSET for his proper guidance and unstinted support and also for providing us with

    valuable suggestions during the course of this project.

    I would also like to thank my teachers Dr.Jobin K Antony and Mr Rony Antony A.P. for their

    valuable guidance throughout the course of this project.

    Last but not the least I would like to thank for the help and support given by my friends

    without whom this endeavour would not have been a success.

  • ABSTRACT

    With the proliferation of wireless communication technologies, the unlicensed bands available

    for communication purposes are becoming more and more limited. Also, surveys state that the

    licensed bands are under-utilized. Cognitive Radio systems sense the under-utilized parts of the

    spectrum and allocate them for wireless communication to other users, thereby increasing the

    efficient usage of the spectrum. Spectrum sensing refers to the process cared out by the system

    to check whether the primary user is using the spectrum at an instant of time. It is one of the

    most challenging issues in Cognitive Radio Systems.

    This project focuses on co-operative spectrum sensing and decision making using fuzzy logic.

    Co-operative sensing technique is used in order to reduce the effect of fading and shadowing

    in decision making about the presence of the primary user in the spectrum. This is done by

    considering parameters such as SNR and power from multiple nodes before a decision is made.

    To simulate the working of the system, the primary users transmitter, channel and cognitive

    radio terminals receiver section is modeled in Matlab.

    A Rayleigh channel model is used to create a scenario that closely represents fading in urban

    environments which is caused due to high rise buildings. Parameters such as Probability of

    Fault Detection and Probability of Detection are computed to evaluate the performance of the

    system. These parameters are also plotted for single node sensing, OR and AND Rule, to

    compare the results with fuzzy based decision-making. The results indicate that the decision

    obtained through fuzzy logic boasts a high probability of detection and low probability of fault

    detection, when compared with single node decision making. In addition, the accuracy of the

    results and drawbacks of fuzzy based decision making are discussed.

  • List of Figures

    2.1 Block Diagram of Energy Detection Method . . . . . . . . . . . . . . . . . 4

    2.2 Block Diagram of Cyclostationary Method . . . . . . . . . . . . . . . . . . 4

    2.3 Block Diagram of Matched Filter Method . . . . . . . . . . . . . . . . . . 5

    4.1 Block Diagram of Transmiter . . . . . . . . . . . . . . . . . . . . . . . . . 9

    4.2 Block Diagram of Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    4.3 Block Diagram of Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    4.4 Fuzzy Fusion Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    4.5 Membership Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    6.1 Area Under Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    6.2 Zoomed View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    6.3 Generated Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    6.4 Probability Of Fault Detection . . . . . . . . . . . . . . . . . . . . . . . . . 26

    6.5 Probability Of Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    iv

  • List of Tables

    4.1 Fuzzy Rule Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    v

  • Contents

    Acknowledgements ii

    Abstract iii

    List of Figures iv

    List of Tables v

    1 INTRODUCTION 1

    2 LITERATURE SURVEY 2

    2.1 COGNITIVE RADIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2.2 SPECTRUM SENSING . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2.2.1 Energy Detection Method . . . . . . . . . . . . . . . . . . . . . . . 3

    2.2.2 Cyclostationary Method . . . . . . . . . . . . . . . . . . . . . . . . 3

    2.2.3 Matched Filter Method . . . . . . . . . . . . . . . . . . . . . . . . . 4

    2.3 FUZZY LOGIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    3 SPECTRUM SENSING USING FUZZY LOGIC 7

    4 COMMUNICATION SYSTEM MODELLING 8

    4.1 PRIMARY USER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    4.2 CHANNEL MODELLING . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    4.2.1 Additive White Gaussian Noise (AWGN) Channel . . . . . . . . . . 9

    4.2.2 Rayleigh Fading Model . . . . . . . . . . . . . . . . . . . . . . . . . 10

    4.3 COGNITIVE RADIO SECTION . . . . . . . . . . . . . . . . . . . . . . . 11

    4.3.1 Band Pass Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    4.3.2 Energy Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    4.3.3 Demodulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    4.3.4 Fuzzy Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    5 SOFTWARE IMPLEMENTATION 14

    5.1 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    vi

  • 5.2 MATLAB PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    5.3 FUZZY FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    6 STIMULATION AND RESULTS 24

    6.1 INITIAL SCENARIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    6.2 SIMULATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    7 CONCLUSION 28

    REFERENCES 29

  • Chapter 1

    INTRODUCTION

    Recent studies by FCC (Federal Communications Commission) have shown that there is

    scarcity of spectrum available and also underutilisation of licensed spectrum. Cognitive

    radio was developed with an aim to compensate for these problems. Cognitive radio is an

    intelligent transceiver which can detect vacant radio spectrum and communicate through

    that spectrum. Cognitive radio thereby increases the efficiency of spectrum utilisation.

    Spectrum sensing is a key aspect of cognitive radio to detect the presence of Primary

    Users transmission. Our project uses Fuzzy logic to make the spectrum sensing decision.

    Spectrum sensing is done with inputs from neighbouring nodes so as to increase the prob-

    ability of correct decision. Entire communication system has to be modelled in Matlab in

    order to simulate the cognitive radio network. Hence, transmitter, receiver and channel

    modelling are done. Channel modelling is done so as to incorporate channel effects on

    a primary signal. These effects include fading and white noise. In our simulation we

    use Rayleigh fading so as simulate signal propagation in urban area where there is no

    line of sight communication. Transmitter acts as the Primary user, and receiver acts as

    the Cognitive radio. Spectrum sensing is done in the cognitive node by energy detection

    method. Final decision is made by combining other neighbouring nodes inputs in fuzzy

    logic.

    1

  • Chapter 2

    LITERATURE SURVEY

    2.1 COGNITIVE RADIO

    Cognitive Radio smartly senses and adapts with the changing environment by altering its

    transmitting parameters, such as modulation, frequency, frame format etc. The concept

    was first originated by Defense Advance Research Products Agency (DARPA) scientist,

    Dr. Joseph Mitola and the result of that concept is IEEE 802.22, which is a standard

    aimed at using cognitive radio for Wireless Regional Area Network (WRAN) using white

    spaces in the TV frequency spectrum while assuring that no harmful interference is caused

    to the incumbent operation, i.e., digital TV and analog TV broadcasting, and low power

    licensed devices.

    2.2 SPECTRUM SENSING

    A major challenge in cognitive radio is that the secondary users need to detect the

    presence of primary users in a licensed spectrum and quit the frequency band as quickly

    as possible if the corresponding primary radio emerges in order to avoid interference to

    primary users. This technique is called spectrum sensing. Spectrum sensing detects the

    availability of the radio frequency spectrum in a real-time fashion, which is essential and

    vital to cognitive radio. It detects the availability of the spectrum for secondary users

    in the CR network. The effectiveness of spectrum sensing largely determines the overall

    spectrum utilization[4]. A good spectrum sensing algorithm should offer high probability

    of detection at low probability of false alarm for a wide range of signal to noise ratio

    (SNR).

    Spectrum Sensing can be done either as Single node sensing or as Cooperative sensing.

    In single node sensing, only one CR is involved in the entire decision making process.

    Results from neighboring CR are not considered. In cooperative sensing, the CR takes

    2

  • results of the neighboring CR as input to make the final decision[2].

    Cooperative sensing can be Distributed or Centralized. In distributed sensing the deci-

    sions of each CR are shared among themselves and each CR can make use of neighboring

    CRs result to take the final decision. In cooperative sensing, the neighboring nodes

    decision are passed to a center node where it is combined to get a final decision[2].

    Various methods of spectrum sensing:

    1. Energy Detection Method.

    2. Cyclostationary Method.

    3. Matched Filter Method.

    2.2.1 Energy Detection Method

    It is a non-coherent detection method that detects the primary signal based on the

    sensed energy .Due to its simplicity and no requirement on a priori knowledge of primary

    user signal, energy detection (ED) is the most popular sensing technique. In order to

    measure the energy of the received signal the output signal of bandpass filter with band-

    width W is squared and integrated over the observation interval T. Finally the output

    of the integrator is compared with a threshold to detect weather the primary or licensed

    user is present or not. It can also be computed in frequency domain by averaging bins

    of a Fast Fourier Transform. In this the processing gain is proportional to FFT size N

    and the averaging time T. Increase in the size of FFT improves the frequency resolution

    which is helpful in detecting narrowband signals. Also if we reduce the averaging time it

    improves the SNR by reducing the noise power. It estimates the presence of the signal by

    comparing the energy received with a known threshold derived from the statistics of the

    noise. One of the major advantage of energy detection method is that it does not require

    any prior knowledge about the primary users signal[4].

    2.2.2 Cyclostationary Method

    Modulated signals are in general coupled with sine wave carriers, pulse trains,repeating

    spreading, hoping sequences, or cyclic prefixes which result in built -in periodicity. Even

    though the data is a stationary random process, these modulated signals are characterized

    as cyclostationary, since their statistics, mean and autocorrelation, exhibit periodicity.

    This periodicity is typically introduced intentionally in the signal format so that a receiver

    can exploit it for: parameter estimation such as carrier phase, pulse timing, or direction

    of arrival. These features are detected by analyzing a spectral correlation function[4].

    3

  • Figure 2.1: Block Diagram of Energy Detection Method

    Figure 2.2: Block Diagram of Cyclostationary Method

    2.2.3 Matched Filter Method

    A matched filter (MF) is a linear filter designed to maximize the output signal to noise

    ratio for a given input signal. However, a matched filter effectively requires demodulation

    of a primary user signal. This means that cognitive radio has a priori knowledge of primary

    user signal, e.g. modulation type and order, pulse shaping, packet format. Matched filter

    operation is equivalent to correlation in which the unknown signal is convolved with the

    filter whose impulse response is the mirror and time shifted version of a reference signal[4].

    Y [n] =

    k=h [n k]x [k] (2.1)

    Where x is the unknown signal (vector) and is convolved with the h, the impulse

    response of matched filter that is matched to the reference signal for maximizing the

    SNR. Detection by using matched filter is useful only in cases where the information from

    the primary users is known to the cognitive users.

    For spectrum sensing, primarily three methods are proposed in literature: Matched

    filter, Energy Detection and Cyclo-stationary feature detection[3]. Matched filtering is

    optimal but requires detailed knowledge of primary signal. When no such knowledge is

    4

  • Figure 2.3: Block Diagram of Matched Filter Method

    available an Energy Detector is optimal [4]. Hence we go for Energy detection sensing

    method in our project.

    Cooperative spectrum sensing where the decisions of different neighbouring nodes are

    fused to obtain the final decision has been studied in [2]. Cooperative sensing improves

    the probability of detection when compared with single node sensing [2]. All the studies

    mentioned above uses different algorithms to combine the decisions from neighbouring

    nodes.

    2.3 FUZZY LOGIC

    A human has a remarkable capability to perform a wide variety of physical andmental

    tasks without any measurements and any computations.Fuzzy logic is a superset ofconven-

    tional(Boolean) logic that has been extended to handle the concept of partial truthtruth-

    values between completely true and completely false.As its name suggests, itis the

    logic underlying modes of reasoning which are approximate rather than exact.Theidea of

    Fuzzy Logic was conceived by Pr. LOTFI A. ZADEH in the year 1965.

    The purpose of fuzzy logic is to realize sophisticated control systems consideringthat

    many times real problems cannot be efficiently expressed by means of mathematicalmod-

    els. So,fuzzy set theory models the vagueness that exists in realworld problems.According

    to this theory, when A is a fuzzy set and x is a relevant object, the propositionx is a

    member of A is not necessarily true or false, but it may be true or false only tosome

    degree, the degree to which x is actually a member of A. It is common to expressdegrees

    of membership in fuzzy sets by numbers on the closed interval [0,1]. The extremevalues

    in this interval, 0 and 1, then represent, respectively, the total denial or affirmationof the

    membership in the fuzzy set.

    In fuzzy logic, each object x can be labelled by a linguistic term, where a linguisticterm

    is a word such as small, medium, large, etc. so that, x is defined as a linguisticvariable.

    5

  • Each linguistic variable is associated with a term set T(x), which is the set ofnames of

    linguistic values of x. Each element in T(x) is a fuzzy set. To implement decision making

    processes, fuzzy logic makes use of the so called FuzzyLogic Controllers (FLCs). The

    essential part of a FLC is a set of linguistic control rulesbased on expert knowledge in the

    form:

    IF (a set of conditions are satisfied) THEN (a set of consequences can be inferred)

    A general FLC consists of four modules: a fuzzy rule base, a fuzzy inference engineand

    a fuzzification/defuzzification module. A FLC operates by repeating a cycle of fivesteps

    implemented by these four modules. First, measurements are taken of all variablesthat

    represent relevant conditions of the controlled process. Next, these measurements are-

    converted into appropriate fuzzy sets to express measurement uncertainties. This step

    iscalled fuzzification. The fuzzified measurements are then used by the inference engine

    toevaluate control rules stored in the fuzzy rule base. The result of this evaluation is a

    fuzzyset (or several fuzzy sets) defined on the universe of discourse of possible actions.

    Thisfuzzy set is then converted, in the final step of the cycle, into a crisp value (or a vec-

    tor ofvalues). This conversion is called defuzzification. The defuzzified values represent

    actionstaken by the FLC in individual control cycles[1].

    Implementation of fuzzy logic in decision making was studied in [1]. In our project we

    are passing power and SNR as input parameters to fuzzy logic, each with 3 membership

    function. Output parameter is the decision with only 2 parameter. Various performance

    analysis were also done.

    6

  • Chapter 3

    SPECTRUM SENSING USING FUZZY LOGIC

    In this project, we are focusing on spectrum sensing using energy detection method and

    decision making using fuzzy logic. In order to simulate the working of the communication

    system, we modeled a transmitter, a communication channel, and a receiver. The trans-

    mitter acts a primary user and the receiver as the cognitive radio terminal.A Rayleigh

    channel model is used to create a scenario that closely represents fading in urban envi-

    ronments which is caused due to high rise buildings.

    Transmitter section consists of BPSK modulator. The signal produced in the trans-

    mitter is modulated and transmitted across the communication channel where effects of

    white Gaussian noise and Rayleigh fading are added.This Rayleigh faded signal is received

    at the receiver where a band pass filter is used to pass only the frequency band under

    consideration.Band pass filter also aids in noise rejection.

    The cognitive radio node uses energy detection method to find the power of the re-

    ceived signal. In order to incorporate cooperative sensing, other cognitive nodes, i.e., the

    neighboring nodes are defined and thepowers received by them are also computed.These

    powersalong with SNR are taken as parameters for the fuzzy-based decision making. Out-

    put decision Yes or No is defined for all the combination of Power and SNR in Fuzzy rule

    base. Final output decision in Fuzzy is made with this rule base.To compare the results

    of fuzzy-based decision making, decisions from OR Rule, AND Rule and Single Node

    decision are considered. Performance analysis which include probability of detection and

    probability of fault detection for all these rules are plotted and compared.

    7

  • Chapter 4

    COMMUNICATION SYSTEM MODELLING

    4.1 PRIMARY USER

    The primary user acts as the transmitter. For simulation purposes, we have used the

    commonly used type of modulation, BPSK for the transmitted signal. A random bit

    stream of 10 bits is generated every time the program is executed. Each bit persists for

    a time period of 1ns. We have chosen a carrier signal of frequency 900MHz for BPSK

    modulation, as it represents one of the frequencies in the GSM range 890-915MHz.

    The sequence to be transmitted consists of 1s and 0s. 1 represents no phase change

    while 0 represents a phase change, in this modulation scheme. The bit stream is converted

    into bipolar format, ie, +1 for phase change, and -1 for same phase.

    x(t) = stream of 0s and 1s

    d (t) = {+1 for x (t) = 1. (4.1)

    d (t) = {1 for x (t) = 0. (4.2)

    The BPSK modulated signal takes either of the two forms

    s(t) = {Acos(Wt) for x(t) = 1. (4.3)

    s(t) = {Acos(Wt+ pi) = Acos(Wt) for x(t) = 0. (4.4)

    Thus to obtain the modulated waveform, the carrier signal is multiplied with the bipolar

    information signal.

    s(t) = d(t)XAcos(Wt). (4.5)

    8

  • Figure 4.1: Block Diagram of Transmiter

    where A=sqrt(P) and P represents the power of the carrier waveform.

    4.2 CHANNEL MODELLING

    Figure 4.2: Block Diagram of Channel

    4.2.1 Additive White Gaussian Noise (AWGN) Channel

    Additive White Gaussian Noise (AWGN) is common to every communication channels,

    which is the statistically random radio noise characterized by a wide frequency range

    with regards to a signal in the communications channel. Gaussian noise comes from

    many natural sources, such as the thermal vibrations of atoms in conductors, shot noise,

    black body radiation from the earth and other warm objects[5].

    AWGN shows following properties

    The noise is additive, i.e., the received signal equals the transmit signal plus somenoise, where the noise is statistically independent of the signal.

    9

  • The noise is white, i.e., the power spectral density is flat, so the autocorrelation ofthe noise in time domain is zero for any non-zero time offset.

    The noise samples have a Gaussian distribution.

    This model does not account for dispersion, interference, fading, frequency selectivity

    or nonlinearity. Because of interference, multipath, terrain blocking etc., it is not suitable

    model for most terrestrial links.

    AWGN modifies the transmitted signal according to the SNR value. For simulation

    purposes the SNR is randomly generated between -25dB and 10dB

    4.2.2 Rayleigh Fading Model

    Rayleigh fading is the name given to the form of fading that is often experienced in an

    environment where there is a large number of reflections present. According to the as-

    sumption of this model a signal passes through such a transmission medium its amplitude

    will be changed randomly or in other words it will fade with respect to the distribution[5].

    This model is normally viewed as a suitable approach to take when analyzing and predic-

    tion radio wave propagation performance for areas such as cellular communications in a

    well built up urban environment where there are many reflections from buildings, etc.

    Rayleigh fading is a model that can be used to describe the form of fading that occurs

    when multipath propagation exists. In any terrestrial environment a radio signal will

    travel via a number of different paths from the transmitter to the receiver. The most

    obvious path is the direct, or line of sight path. However there will be very many objects

    around the direct path. These objects may serve to reflect, refract, etc. the signal. As a

    result of this, there are many other paths by which the signal may reach the receiver.

    When the signals reach the receiver, the overall signal is a combination of all the signals

    that have reached the receiver via the multitude of different paths that are available. These

    signals will all sum together, the phase of the signal being important. Dependent upon

    the way in which these signals sum together, the signal will vary in strength. If they were

    all in phase with each other they would all add together .However this is not normally

    the case, as some will be in phase and others out of phase, depending upon the various

    path lengths, and therefore some will tend to add to the overall signal, whereas others

    will subtract.

    The Rayleigh fading model can be used to analyse radio signal propagation on a sta-

    tistical basis. It operates best under conditions when there is no dominant signal (e.g.

    10

  • direct line of sight signal), and in many instances cellular telephones being used in a dense

    urban environment fall into this category.

    Cognitive Radio is mainly applicable in urban environment. So chance for dominant

    line of sight between transmitter and receiver is not possible. That is why, we are going

    for Rayleigh fading model.

    y(n) = x(n) r(n) + n(n) (4.6)

    y(n)Received signal x(n)Transmitted signal r(n)Rayleigh channel parameter n(n)AWGN

    noise

    4.3 COGNITIVE RADIO SECTION

    The transmitted signal is received by the cognitive node where the all the computation

    is done. The receiver section consists of a band pass filter, energy detector, fuzzy block

    and a demodulator section.

    Figure 4.3: Block Diagram of Receiver

    4.3.1 Band Pass Filter

    Cognitive radio is concerned only with a band of frequency, i.e., particular frequency

    spectrum. Hence we go for a band pass filter which passes only the spectrum under con-

    sideration. In this project we have considered only one frequency band (GSM frequency

    band). A band pass filter with 3dB points at 800MHz to 1GHz was designed using mat-

    lab. The received signal was passed through this filter and hence only signals in this

    spectrum are used in power computation. Band pass filter also provide noise rejection

    thereby helping in signal demodulation.

    11

  • 4.3.2 Energy Detector

    Spectrum sensing method used in this project is energy detection method. Energy

    Detection method is advantageous in the fact that we do not require any prior knowledge

    about the primary Users signal. In this method, the signal from band pass filter is passed

    to an energy detector. The band pass output is converted in frequency domain coefficients

    using fft function in matlab. Power of this signal is calculated by averaging the square of

    each coefficient over N.

    Y [n] =1

    N

    N0

    X(n)2 (4.7)

    4.3.3 Demodulator

    For demodulation, the carrier waveform is to be recovered from the received signal. For

    recovering the carrier, the received signal is squared, and sent through a band pass filter

    centered about twice the carrier frequency. The carrier frequency signal with phase delay

    caused by the channel is obtained by dividing this signal by 2, using a frequency divider.

    The obtained carrier signal is then multiplied with the received signal. Using an integrate

    and dump circuit along with a bit synchronizer, the demodulated bit stream is obtained.

    This bit stream is compared with the original bit stream to check whether there is any

    error.

    4.3.4 Fuzzy Block

    Final decision on whether or not the spectrum is free is made by using Fuzzy logic. In

    cooperative sensing, we make use of outputs from neighboring CR. Here, input parameters

    passed to fuzzy logic are given as Power, SNR from CR1 and Powers from 2 CRs (CR2 and

    CR3) which are CR1 neighbors. For fuzzification of power and SNR, three membership

    functions are defined for all the parameters. The membership functions represent three

    levels, LOW, MEDIUM and HIGH. These levels are defined based on data analysis signal

    power and SNR, which had been made prior to simulation. However, the output is a

    binary parameter which denotes the presence of the PU by 1 and the absence of the PU

    by 0.

    The fuzzy rule base contains of IF THEN clauses which is designed in such a way that

    the data from the CR terminal which is considered is given more importance than its

    neighbors. For example, if the CR terminal detects high power and high SNR, then the

    output is 1 regardless of the data on power that has been collected from the neighbors[1].

    The rule base is defined for all the possible combination of inputs. With four inputs and

    12

  • Figure 4.4: Fuzzy Fusion Center

    Figure 4.5: Membership Function

    three possible levels for each input, there are 34=81 possible combinations. A part of the

    rule base is shown below.

    Table 4.1: Fuzzy Rule Base

    CR TERMINAL 1 CR TERMINAL 2 CR TERMINAL 3 OUTPUT

    POWER SNR POWER POWER

    LOW LOW LOW LOW NOLOW LOW MEDIUM HIGH NOMEDIUM LOW MEDIUM LOW NOMEDIUM HIGH HIGH HIGH YESHIGH MEDIUM LOW MEDIUM YESHIIGH HIGH HIGH HIGH YES

    13

  • Chapter 5

    SOFTWARE IMPLEMENTATION

    5.1 MATLAB

    MATLAB, short for MATrixLABoratory is a programming package specifically designed

    for quick and easy scientific calculations and I/O. It has literally hundreds of built-in func-

    tions for a wide variety of computations and many toolboxes designed for specific research

    disciplines, including statistics, optimization, data analysis, DSP, communication, fuzzy

    etc.

    5.2 MATLAB PROGRAM

    clc;

    clearall;

    closeall;

    fismat=readfis(main.fis);

    %PU STATUS

    pu=input(Enter status of the PU (1=Present/0=Absent):);

    % SCATTER PLOT

    % Considering a geographic area with random number of CR terminals. Random

    % count is generated by the following function

    count=randi([25 50],1,1);

    % Random x-y co-ordinates are generated for all CR terminals

    X=randi([0 9],1,count)+0.01*randi([0 100],1,count);

    14

  • Y=randi([0 9],1,count)+0.01*randi([0 100],1,count);

    % Scatter Plot showing location of all CR terminals

    scatter(X,Y,100,g);

    % The first CR terminal is selected as the central node and the distances

    % from all otehr terminals to the central node are calculated and stored in

    % an array

    for k=1:count

    distanceunsort(k)=sqrt(((X(1)-X(k))^2)+((Y(1)-Y(k))^2));

    end;

    % The two closest neighbours are selected after sorting the distance array

    distance=sort(distanceunsort);

    for xx=1:3

    forij=1:count

    if ( distance(xx)== distanceunsort(ij))

    x(xx)=X(ij);

    y(xx)=Y(ij);

    end

    end

    end

    % Location of central node and neighbours in the scatter plot are

    % displayed

    for m=2:3

    line([x(1),x(m)],[y(1),y(m)]);

    pause(0.5);

    end;

    % Zoomed view of central node and its neighbours

    figure;

    scatter(x,y,100,g);

    for m=2:3

    line([x(1),x(m)],[y(1),y(m)]);

    pause(1);

    end;

    15

  • % TRANSMITTER - PSK Modulator

    x=randint(1,10); %Random bit stream

    xx=12;

    yy=10;

    b=2*x-1;

    T=0.01e-6; % Bit duration

    Eb=10*T/2; % This will result in unit amplitude waveforms

    fc=9/T; % Carrier frequency

    t=linspace(0,10,1000); % Discrete time sequence between 0 and 10 (1000 samples)

    N=length(t); % Number of samples

    Nsb=N/length(x); % Number of samples per bit

    dd=repmat(x,1,Nsb); % Replicate each bit Nsb times

    bb=repmat(b,1,Nsb);

    dw=dd; % Transpose the rows and columns

    dw=dw(:); % Convert dw to a column vector (colum by column) and convert to a row vector

    bw=bb;

    bw=bw(:); % Data sequence samples

    % Carrier waveform

    w=sqrt(2*Eb/T)*cos(2*pi*fc*t);

    bpsk_w=bw.*w; % PSK Modulated Wave

    % Plots Bit Sequence to be transmitted

    figure;

    subplot(6,1,1);

    plot(t,dw);

    axis([0 yy -2 2])

    title(Bit Sequence to be Transmitted);

    % Plots transmitted signal

    subplot(6,1,2);

    plot(t,bpsk_w,.);

    axis([0 yy -xx xx])

    title(Transmitted Signal (After PSK Modulation));

    % Loop to account for channel modelling for two neighbours

    16

  • for ii=1:3

    % CHANNEL MODELING

    c=rayleighchan(1/1000,100); % Rayleigh Fading Channel Model

    if(pu==1)

    y=filter(c,bpsk_w); % Convolution of transmitted signal with Rayleigh Fading (Rayleigh Faded Signal)

    else

    y=0; % No transmission (Absence of Primary User)

    end;

    % Random SNR generation between -25.00dB and 10.00dB

    snr=randi([-25 9],1,1)+0.01*randi([0 100],1,1);

    % Adding White Gaussian Noise with a defined value for SNR

    q=awgn(y,snr);

    % RECEIVER

    % Band Pass Filter

    ww=fdesign.bandpass(N,F3dB1,F3dB2,2,0.7e9,1.1e9,10e10); % Design BPF by specifying order of filter and 3dB values

    Hd=design(ww,butter); % Butterworth filter

    z=filter(Hd,q); %Convoluted Output

    % Power Detector

    da=fft(z); % Taking FFT of received signal

    v=da.^2; % Squaring all terms

    % Taking average of all terms to obtain Power of received signal

    power(ii)=20*log10(abs(mean(v)));

    % Storing SNR of central node and neighbours

    snnr(ii)=snr;

    % Demodulator

    we=z.*cos(2*pi*fc*t); % Multiplying with carrier

    %Low Pass Butterworth Filter - Integrator

    wqq=fdesign.lowpass(N,Fc,4,1e9,10e10);

    Hd2=design(wqq,butter);

    zqq=filter(Hd2,we); %Convolution

    end;

    17

  • % Plots Received Signal

    subplot(6,1,3);

    plot(t,q);

    title(Recieved Signal);

    axis([0 yy -xx xx])

    % Plots Band Pass Output

    subplot(6,1,4);

    plot(t,z);

    title(Bandpass Output);

    axis([0 yy -xx xx])

    if(evalfis([power(1) snnr(1) power(2) power(3)],fismat)>=0.5)

    %Regenerated Waveform

    subplot(6,1,5)

    plot(t,zqq);

    title(Regenerated Waveform);

    dec=real(zqq)./abs(real(zqq));

    % Demodulated Signal

    subplot(6,1,6)

    plot(t,dec)

    title(Demodulated Signal);

    axis([0 yy -2 2])

    % Obtaining Bit Stream through Sampling

    deccount=1;

    for k=100:100:1000

    array(deccount)=(dec(k)+1)/2;

    deccount=deccount+1;

    end;

    disp(Transmitted Bits : ); disp(x);

    disp(Receieved Bits : ); disp(array);

    18

  • end;

    % FUZZY FILE

    disp(CR1 Power (in dB): ); disp(power(1));

    disp(CR1 SNR (in dB): ); disp(snnr(1));

    disp(CR2 Power (in dB): ); disp(power(2));

    disp(CR3 Power (in dB): ); disp(power(3));

    % Single Node Decision

    if (power(1)>30 &pu==1)

    % sncount=sncount+1;

    end;

    % Fuzzy Decision

    if(evalfis([power(1) snnr(1) power(2) power(3)],fismat)>=0.5)

    disp(PU is Present);

    else

    disp(PU is Absent);

    end;

    5.3 FUZZY FILE

    [System]

    Name=main

    Type=mamdani

    Version=2.0

    NumInputs=4

    NumOutputs=1

    NumRules=81

    AndMethod=min

    OrMethod=max

    ImpMethod=min

    AggMethod=max

    DefuzzMethod=centroid

    19

  • [Input1]

    Name=PowerCR1

    Range=[-200 100]

    NumMFs=3

    MF1=Low:trimf,[-200 -50 5]

    MF2=Medium:trimf,[-30 10 40]

    MF3=High:trimf,[30 50 100]

    [Input2]

    Name=SNRCR1

    Range=[-25 10]

    NumMFs=3

    MF1=Low:trimf,[-38.9 -24.9 -7.4537037037037]

    MF2=Medium:trimf,[-14.8196296296296 -7.31462962962963 0.185370370370368]

    MF3=High:trimf,[-6.98944444444444 8.8655555555556 22.8655555555556]

    [Input3]

    Name=PowerCR2

    Range=[-200 100]

    NumMFs=3

    MF1=Low:trimf,[-200 -50 5]

    MF2=Medium:trimf,[-30 10 40]

    MF3=High:trimf,[30 50 100]

    [Input4]

    Name=PowerCR3

    Range=[-200 100]

    NumMFs=3

    MF1=Low:trimf,[-200 -50 5]

    MF2=Medium:trimf,[-30 10 40]

    MF3=High:trimf,[30 50 100]

    [Output1]

    Name=output1

    Range=[0 1]

    NumMFs=2

    MF1=No:trimf,[0 0.25 0.5]

    MF2=Yes:trimf,[0.5 0.75 1]

    20

  • [Rules]

    1 1 1 1, 1 (1) : 1

    1 1 1 2, 1 (1) : 1

    1 1 1 3, 1 (1) : 1

    1 1 2 1, 1 (1) : 1

    1 1 2 2, 1 (1) : 1

    1 1 2 3, 1 (1) : 1

    1 1 3 1, 1 (1) : 1

    1 1 3 2, 1 (1) : 1

    1 1 3 3, 2 (1) : 1

    1 2 1 1, 1 (1) : 1

    1 2 1 2, 1 (1) : 1

    1 2 1 3, 1 (1) : 1

    1 2 2 1, 1 (1) : 1

    1 2 2 2, 1 (1) : 1

    1 2 2 3, 2 (1) : 1

    1 2 3 1, 1 (1) : 1

    1 2 3 2, 2 (1) : 1

    1 2 3 3, 2 (1) : 1

    1 3 1 1, 1 (1) : 1

    1 3 1 2, 1 (1) : 1

    1 3 1 3, 1 (1) : 1

    1 3 2 1, 1 (1) : 1

    1 3 2 2, 2 (1) : 1

    1 3 2 3, 2 (1) : 1

    1 3 3 1, 1 (1) : 1

    1 3 3 2, 2 (1) : 1

    1 3 3 3, 2 (1) : 1

    2 1 1 1, 1 (1) : 1

    2 1 1 2, 1 (1) : 1

    2 1 1 3, 1 (1) : 1

    2 1 2 1, 1 (1) : 1

    2 1 2 2, 1 (1) : 1

    2 1 2 3, 1 (1) : 1

    2 1 3 1, 1 (1) : 1

    2 1 3 3, 2 (1) : 1

    2 2 1 1, 1 (1) : 1

    21

  • 2 2 1 2, 1 (1) : 1

    2 2 1 3, 1 (1) : 1

    2 2 2 1, 1 (1) : 1

    2 2 2 2, 1 (1) : 1

    2 2 2 3, 2 (1) : 1

    2 2 3 1, 1 (1) : 1

    2 2 3 2, 1 (1) : 1

    2 2 3 3, 2 (1) : 1

    2 3 1 1, 1 (1) : 1

    2 3 1 2, 1 (1) : 1

    2 3 1 3, 2 (1) : 1

    2 3 2 1, 1 (1) : 1

    2 3 2 2, 1 (1) : 1

    2 3 2 3, 2 (1) : 1

    2 3 3 1, 1 (1) : 1

    2 3 3 2, 2 (1) : 1

    2 3 3 3, 2 (1) : 1

    3 1 1 1, 1 (1) : 1

    3 1 1 2, 1 (1) : 1

    3 1 1 3, 2 (1) : 1

    3 1 2 1, 1 (1) : 1

    3 1 2 2, 2 (1) : 1

    3 1 2 3, 2 (1) : 1

    3 1 3 3, 2 (1) : 1

    3 2 1 1, 2 (1) : 1

    3 2 1 2, 2 (1) : 1

    3 2 1 3, 2 (1) : 1

    3 2 2 1, 2 (1) : 1

    3 2 2 2, 2 (1) : 1

    3 2 2 3, 2 (1) : 1

    3 2 3 2, 2 (1) : 1

    3 2 3 3, 2 (1) : 1

    3 3 1 1, 2 (1) : 1

    3 3 1 2, 2 (1) : 1

    3 3 1 3, 2 (1) : 1

    3 3 2 2, 2 (1) : 1

    3 3 2 3, 2 (1) : 1

    3 3 3 1, 2 (1) : 1

    22

  • 3 3 3 3, 2 (1) : 1

    2 1 3 2, 1 (1) : 1

    3 1 3 1, 2 (1) : 1

    3 1 3 2, 2 (1) : 1

    3 2 3 1, 2 (1) : 1

    3 3 3 2, 2 (1) : 1

    3 3 2 1, 2 (1) : 1

    23

  • Chapter 6

    STIMULATION AND RESULTS

    6.1 INITIAL SCENARIO

    A geographical urban area of 10kmsquare considered, and 25-50 CR terminals are po-

    sitioned randomly in the given area. One of the CR terminals is selected randomly and

    the power and SNR of that CR terminal are recorded. The powers received by the neigh-

    bouring two CR terminals which lie nearest to the selected terminal are fetched by the

    selected CR. The four parameters, power and SNR of CR1, power of CR2 and power of

    CR3 are the input parameters for the fuzzy based decision making stage.

    Figure 6.1: Area Under Consideration

    24

  • Figure 6.2: Zoomed View

    6.2 SIMULATION

    At the start of the simulation the status of the spectrum to be analyzed is set, i.e.,

    whether the PU is using the spectrum or not.The Primary User transmits a random bit

    stream generated at the transmitter side.Thebit stream is modulated by carrier wave of

    900Mhz. The transmitted wave is modified by the Rayleigh channel and additive white

    Gaussian noise. It is received and passed through a band pass filter and demodulated.

    Figure 6.3: Generated Waveforms

    (a)Transmitted Bit Sequence (b) BPSK Modulated Signal (c) Recieved Signal

    (d) Band Pass Output (e) Regenerated Waveform (f) Demodulated Signal

    25

  • The selected CR terminal detects the power in specified frequency band used by the

    PU, and notes its SNR value. Similarly the two nearest neighbours detects the power

    in the same band and sends the information to the selected CR. AT the selected CR,

    the fuzzy based decision is made based on the four inputs given. The output obtained

    from the fuzzy decision is compared with the status that was set at the beginning of the

    simulation.

    To compare the performance of the fuzzy based decision making system with other

    systems based on OR- Rule, AND-Rule and single node decision, probability of detection

    and probability of fault detection was plotted.

    False detection refers to the situation in which the spectrum is free (PU is not using

    the spectrum) but the decision made by the system indicates that the spectrum is in use

    by the PU. The probability of fault detection was computed by running the program 100

    times and counting the number of times the PU was falsely detected when it was not

    using the spectrum.

    The probability of fault detection was observed for SNR values between -25 and 10,

    and the fuzzy based system returned the probability of fault detection as 0 in the given

    range of SNRs, which is ideal.

    Figure 6.4: Probability Of Fault Detection

    Successful detection refers to the situation in which the spectrum is being used by

    the PUand the decision made by the system is correct, indicating that the spectrum is

    26

  • in use by the PU. The probability of detection was computed the same way as that of

    probability of false detection, i.e., by running the program 100 times and counting the

    number of times the PU was falsely detected when it was not using the spectrum.

    The probability of detection was observed for SNR values between -25 and 10. The

    plot portrays that the probability of detection for the fuzzy based system is higher than

    other three systems.

    Figure 6.5: Probability Of Detection

    27

  • Chapter 7

    CONCLUSION

    Our project dealt with the use of Fuzzy rule in the decision making process of co-operative

    sensing. From, the simulation results it is evident that fuzzy based decision making

    improves the performance of the spectrum sensing system in the typical range of SNR.

    The probability of false detection is ideally 0, and hence does not impair the efficient usage

    of the CR network. The detection rate is also higher than the other systems based on

    OR-Rule, AND-Rule and single node sensing. However, the system has its disadvantages.

    Due to its wide range of possibilities the computation time for a fuzzy decision is high

    compared to other systems. Furthermore, when the number of inputs to fuzzy system are

    increased, the number of rules to be included in the fuzzy rule base increases exponentially,

    which is a cumbersome task to the system designer. As a future expansion of this project,

    we can include more neighbouring nodes power and SNR in the decision making process.

    This will further increase the probability of detection. Also other weighing parameters

    such as distance can be included so that the inputs from far away nodes will have less

    effect on the decision making process.

    28

  • REFERENCES

    [1] Marja Matinmikko,Tapio Rauma,Miia Mustonen,Iikka Harjula,Heli Sarvanko Aarne

    Mammela Application of Fuzzy Logic To Cognitive Radio ,IEICE Trans

    Commun.,VOL.E92-B,NO.12 December 2009

    [2] T.J. Harrold,P.C. Faris M.A. Beach,Distributed Spectrum Sensing Algorithm For

    Cognitive Radio , Centre for Communications Research, University of Bristol,

    United Kingdom. Email [email protected]

    [3] Danijela Cabric,Shridhar Mubaraq Mishra Robert W. Brodersen Implementation

    Issues in Spectrum Sensing for Cognitive Radios, Berkeley Wireless Research Cen-

    ter, University of California, Berkeley

    [4] Tevfik Yucek Huseyin Arslan A Survey of Spectrum Sensing Algorithms for Cog-

    nitive Radio Applications, IEEE Communicatios Surveys Tutorials, VOL. 11, NO.

    1, First Quarter 2009

    [5] Srinivas Nallagonda,Sanjay Dhar Roy Sumit Kundu Performance of Coop-

    erative Spectrum Sensing in Log-normal Shadowing and Fading under Fusion

    Rules,International Journal of Energy, Information and Communications Vol. 3,

    Issue 3, August, 2012

    29